2005-03-16 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
* src/ScratchPad.py (ScratchPad): improved the generation of tooltip information for most object types. svn: r4192
This commit is contained in:
parent
dea172a726
commit
78e8029352
@ -1,3 +1,7 @@
|
|||||||
|
2005-03-16 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
|
||||||
|
* src/ScratchPad.py (ScratchPad): improved the generation of
|
||||||
|
tooltip information for most object types.
|
||||||
|
|
||||||
2005-03-16 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
|
2005-03-16 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
|
||||||
* src/EditPerson.py (EditPerson.ev_drag_data_received): Fixed
|
* src/EditPerson.py (EditPerson.ev_drag_data_received): Fixed
|
||||||
drag and drop of events.
|
drag and drop of events.
|
||||||
|
@ -398,63 +398,116 @@ class ScratchPadWindow:
|
|||||||
self.otree.select_row(0)
|
self.otree.select_row(0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def generate_event_tooltip(self,event):
|
||||||
|
global escape
|
||||||
|
|
||||||
|
s = "<big><b>%s</b></big>\n\n"\
|
||||||
|
"\t<b>%s:</b>\t%s\n"\
|
||||||
|
"\t<b>%s:</b>\t%s\n"\
|
||||||
|
"\t<b>%s:</b>\t%s\n"\
|
||||||
|
"\t<b>%s:</b>\t%s\n"\
|
||||||
|
"\t<b>%s:</b>\t%s\n" % (
|
||||||
|
_("Event"),
|
||||||
|
_("Type"),escape(const.display_pevent(event.get_name())),
|
||||||
|
_("Date"),escape(event.get_date()),
|
||||||
|
_("Place"),escape(place_title(self.db,event)),
|
||||||
|
_("Cause"),escape(event.get_cause()),
|
||||||
|
_("Description"), escape(event.get_description()))
|
||||||
|
|
||||||
|
if len(event.get_source_references()) > 0:
|
||||||
|
psrc_ref = event.get_source_references()[0]
|
||||||
|
psrc_id = psrc_ref.get_base_handle()
|
||||||
|
psrc = self.db.get_source_from_handle(psrc_id)
|
||||||
|
|
||||||
|
s += "\n<big><b>%s</b></big>\n\n"\
|
||||||
|
"\t<b>%s:</b>\t%s\n" % (
|
||||||
|
_("Primary source"),
|
||||||
|
_("Name"),
|
||||||
|
escape(short(psrc.get_title())))
|
||||||
|
|
||||||
|
return s
|
||||||
|
|
||||||
def generate_addr_tooltip(self,addr):
|
def generate_addr_tooltip(self,addr):
|
||||||
global escape
|
global escape
|
||||||
return "<big><b>%s</b></big>\n"\
|
s = "<big><b>%s</b></big>\n\n"\
|
||||||
"<b>%s:</b>\t%s\n"\
|
"\t<b>%s:</b>\t%s\n"\
|
||||||
"<b>%s:</b>\n"\
|
"\t<b>%s:</b>\n"\
|
||||||
"\t%s\n"\
|
"\t\t%s\n"\
|
||||||
"\t%s\n"\
|
"\t\t%s\n"\
|
||||||
"\t%s\n"\
|
"\t\t%s\n"\
|
||||||
"\t%s" % (_("Address"),
|
"\t\t%s\n"\
|
||||||
_("Date"),
|
"\t\t%s\n"\
|
||||||
escape(addr.get_date()),
|
"\t<b>%s:</b>\t%s\n" % (
|
||||||
|
_("Address"),
|
||||||
|
_("Date"), escape(addr.get_date()),
|
||||||
_("Location"),
|
_("Location"),
|
||||||
escape(addr.get_street()),
|
escape(addr.get_street()),
|
||||||
escape(addr.get_city()),
|
escape(addr.get_city()),
|
||||||
escape(addr.get_state()),
|
escape(addr.get_state()),
|
||||||
escape(addr.get_country()))
|
escape(addr.get_country()),
|
||||||
|
escape(addr.get_postal_code()),
|
||||||
|
_("Telephone"), escape(addr.get_phone()))
|
||||||
|
|
||||||
|
if len(addr.get_source_references()) > 0:
|
||||||
|
psrc_ref = addr.get_source_references()[0]
|
||||||
|
psrc_id = psrc_ref.get_base_handle()
|
||||||
|
psrc = self.db.get_source_from_handle(psrc_id)
|
||||||
|
s += "\n<big><b>%s</b></big>\n\n"\
|
||||||
|
"\t<b>%s:</b>\t%s\n" % (
|
||||||
|
_("Sources"),
|
||||||
|
_("Name"),escape(short(psrc.get_title())))
|
||||||
|
|
||||||
|
return s
|
||||||
|
|
||||||
def generate_event_tooltip(self,event):
|
|
||||||
global escape
|
|
||||||
return "<big><b>%s</b></big>\n"\
|
|
||||||
"<b>%s:</b>\t%s\n"\
|
|
||||||
"<b>%s:</b>\t%s\n" % (_("Event"),
|
|
||||||
_("Name"),
|
|
||||||
escape(const.display_pevent(event.get_name())),
|
|
||||||
_("Description"),
|
|
||||||
escape(event.get_description()))
|
|
||||||
|
|
||||||
def generate_url_tooltip(self,url):
|
def generate_url_tooltip(self,url):
|
||||||
global escape
|
global escape
|
||||||
return "<big><b>%s</b></big>\n"\
|
return "<big><b>%s</b></big>\n\n"\
|
||||||
"<b>%s:</b>\t%s\n"\
|
"\t<b>%s:</b>\t%s\n"\
|
||||||
"<b>%s:</b>\t%s" % (_("Url"),
|
"\t<b>%s:</b>\t%s" % (_("Url"),
|
||||||
_("Path"),
|
_("Path"),
|
||||||
escape(url.get_path()),
|
escape(url.get_path()),
|
||||||
_("Description"),
|
_("Description"),
|
||||||
escape(url.get_description()))
|
escape(url.get_description()))
|
||||||
|
|
||||||
def generate_pattr_tooltip(self,pattr):
|
def generate_pattr_tooltip(self,attr):
|
||||||
global escape
|
global escape
|
||||||
return "<big><b>%s</b></big>\n"\
|
s = "<big><b>%s</b></big>\n\n"\
|
||||||
"<b>%s:</b>\t%s\n"\
|
"\t<b>%s:</b>\t%s\n"\
|
||||||
"<b>%s:</b>\t%s" % (_("Attribute"),
|
"\t<b>%s:</b>\t%s" % (_("Attribute"),
|
||||||
_("Type"),
|
_("Type"),
|
||||||
escape(const.display_pattr(pattr.get_type())),
|
escape(const.display_pattr(attr.get_type())),
|
||||||
_("Value"),
|
_("Value"),
|
||||||
escape(pattr.get_value()))
|
escape(attr.get_value()))
|
||||||
|
|
||||||
|
if len(attr.get_source_references()) > 0:
|
||||||
|
psrc_ref = attr.get_source_references()[0]
|
||||||
|
psrc_id = psrc_ref.get_base_handle()
|
||||||
|
psrc = self.db.get_source_from_handle(psrc_id)
|
||||||
|
s += "\n<big><b>%s</b></big>\n\n"\
|
||||||
|
"\t<b>%s:</b>\t%s\n" % (
|
||||||
|
_("Sources"),
|
||||||
|
_("Name"),escape(short(psrc.get_title())))
|
||||||
|
|
||||||
|
return s
|
||||||
|
|
||||||
|
|
||||||
def generate_srcref_tooltip(self,srcref):
|
def generate_srcref_tooltip(self,srcref):
|
||||||
global escape
|
global escape
|
||||||
base = self.db.get_source_from_handle(srcref.get_base_handle())
|
base = self.db.get_source_from_handle(srcref.get_base_handle())
|
||||||
return "<big><b>%s</b></big>\n"\
|
s = "<big><b>%s</b></big>\n\n"\
|
||||||
"<b>%s:</b>\t%s\n"\
|
"\t<b>%s:</b>\t%s\n"\
|
||||||
"<b>%s:</b>\t%s" % (_("SourceRef"),
|
"\t<b>%s:</b>\t%s\n"\
|
||||||
_("Title"),
|
"\t<b>%s:</b>\t%s\n"\
|
||||||
escape(base.get_title()),
|
"\t<b>%s:</b>\t%s" % (
|
||||||
_("Text"),
|
_("SourceRef"),
|
||||||
escape(srcref.get_text()))
|
_("Title"),escape(base.get_title()),
|
||||||
|
_("Page"), escape(srcref.get_page()),
|
||||||
|
_("Text"), escape(srcref.get_text()),
|
||||||
|
_("Comment"), escape(srcref.get_comments()))
|
||||||
|
|
||||||
|
return s
|
||||||
|
|
||||||
def generate_text_tooltip(self,text):
|
def generate_text_tooltip(self,text):
|
||||||
global escape
|
global escape
|
||||||
@ -462,6 +515,19 @@ class ScratchPadWindow:
|
|||||||
"%s" % (_("Text"),
|
"%s" % (_("Text"),
|
||||||
escape(text))
|
escape(text))
|
||||||
|
|
||||||
|
def short(val,size=60):
|
||||||
|
if len(val) > size:
|
||||||
|
return "%s..." % val[0:size]
|
||||||
|
else:
|
||||||
|
return val
|
||||||
|
|
||||||
|
def place_title(db,event):
|
||||||
|
pid = event.get_place_handle()
|
||||||
|
if pid:
|
||||||
|
return db.get_place_from_handle(pid).get_title()
|
||||||
|
else:
|
||||||
|
return u''
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user