* src/ListModel.py: keep track of data index

* src/EventEdit.py: use new label scheme for tabs that uses an
icon to indicate used tabs


svn: r4410
This commit is contained in:
Don Allingham 2005-04-24 03:39:07 +00:00
parent 6656af3e3a
commit 5a620927b6
5 changed files with 268 additions and 89 deletions

View File

@ -1,4 +1,7 @@
2005-04-23 Don Allingham <don@gramps-project.org> 2005-04-23 Don Allingham <don@gramps-project.org>
* src/ListModel.py: keep track of data index
* src/EventEdit.py: use new label scheme for tabs that uses an
icon to indicate used tabs
* src/AddrEdit.py: use new label scheme for tabs that uses an * src/AddrEdit.py: use new label scheme for tabs that uses an
icon to indicate used tabs icon to indicate used tabs
* src/AttrEdit.py: use new label scheme for tabs that uses an * src/AttrEdit.py: use new label scheme for tabs that uses an

View File

@ -307,21 +307,39 @@ class EditPerson:
self.on_event_update_clicked) self.on_event_update_clicked)
# attribute display # attribute display
atitles = [(_('Attribute'),-1,150),(_('Value'),-1,150)] atitles = [
(_('Attribute'),-1,200),
(_('Value'),-1,350),
(_(':Source'),-1,50),
(_(':Note'),-1,50),
]
self.atree = ListModel.ListModel(self.attr_list,atitles, self.atree = ListModel.ListModel(self.attr_list,atitles,
self.on_attr_select_row, self.on_attr_select_row,
self.on_update_attr_clicked) self.on_update_attr_clicked)
# address display # address display
ptitles = [(_('Date'),-1,150),(_('Address'),-1,150)] ptitles = [
(_('Date'),-1,175),
(_('Address'),-1,150),
(_('City'),-1,100),
(_('State/Province'),-1,75),
(_('Country'),-1,100),
(_(':Source'),-1,50),
(_(':Note'),-1,50),
]
self.ptree = ListModel.ListModel(self.addr_list, ptitles, self.ptree = ListModel.ListModel(self.addr_list, ptitles,
self.on_addr_select_row, self.on_addr_select_row,
self.on_update_addr_clicked) self.on_update_addr_clicked)
# name display # name display
ntitles = [(_('Family Name'),-1,250),(_('Prefix'),-1,50), ntitles = [
(_('Given Name'),-1,200),(_('Suffix'),-1,50), (_('Family Name'),-1,225),
(_('Type'),-1,100)] (_('Prefix'),-1,50),
(_('Given Name'),-1,200),
(_('Suffix'),-1,50),
(_('Type'),-1,100),
(_(':Source'),-1,50), (_(':Note'),-1,50),
]
self.ntree = ListModel.ListModel(self.name_list,ntitles, self.ntree = ListModel.ListModel(self.name_list,ntitles,
self.on_name_select_row) self.on_name_select_row)
self.ntree.tree.connect('event',self.aka_double_click) self.ntree.tree.connect('event',self.aka_double_click)
@ -969,10 +987,12 @@ class EditPerson:
self.ntree.clear() self.ntree.clear()
self.nmap = {} self.nmap = {}
for name in self.nlist: for name in self.nlist:
has_note = name.get_note()
has_source = len(name.get_source_references())> 0
node = self.ntree.add([ node = self.ntree.add([
name.get_surname(),name.get_surname_prefix(), name.get_surname(),name.get_surname_prefix(),
name.get_first_name(), name.get_suffix(), name.get_first_name(), name.get_suffix(),
_(name.get_type())],name) _(name.get_type()),has_source,has_note],name)
self.nmap[str(name)] = node self.nmap[str(name)] = node
if self.nlist: if self.nlist:
self.ntree.select_row(0) self.ntree.select_row(0)
@ -1002,9 +1022,14 @@ class EditPerson:
self.ptree.clear() self.ptree.clear()
self.pmap = {} self.pmap = {}
for addr in self.plist: for addr in self.plist:
has_note = addr.get_note()
has_source = len(addr.get_source_references())> 0
location = "%s %s %s %s" % (addr.get_street(),addr.get_city(), location = "%s %s %s %s" % (addr.get_street(),addr.get_city(),
addr.get_state(),addr.get_country()) addr.get_state(),addr.get_country())
node = self.ptree.add([addr.get_date(),location],addr) node = self.ptree.add([addr.get_date(),addr.get_street(),
addr.get_city(),addr_get_state(),
addr_get_country(),has_source,has_note],
addr)
self.pmap[str(addr)] = node self.pmap[str(addr)] = node
if self.plist: if self.plist:
self.ptree.select_row(0) self.ptree.select_row(0)
@ -1017,7 +1042,12 @@ class EditPerson:
self.atree.clear() self.atree.clear()
self.amap = {} self.amap = {}
for attr in self.alist: for attr in self.alist:
node = self.atree.add([const.display_pattr(attr.get_type()),attr.get_value()],attr) has_note = attr.get_note()
has_source = len(attr.get_source_references())> 0
node = self.atree.add([
const.display_pattr(attr.get_type()), attr.get_value(),
has_source, has_note,
],attr)
self.amap[str(attr)] = node self.amap[str(attr)] = node
if self.alist: if self.alist:
self.atree.select_row(0) self.atree.select_row(0)

View File

@ -144,14 +144,15 @@ class EventEditor:
self.event_menu = self.top.get_widget("personal_events") self.event_menu = self.top.get_widget("personal_events")
self.priv = self.top.get_widget("priv") self.priv = self.top.get_widget("priv")
self.priv.set_sensitive(not noedit) self.priv.set_sensitive(not noedit)
self.sources_label = self.top.get_widget("sourcesEvent") self.sources_label = self.top.get_widget("sources_tab")
self.notes_label = self.top.get_widget("notesEvent") self.notes_label = self.top.get_widget("note_tab")
self.general_label = self.top.get_widget("general_tab")
self.gallery_label = self.top.get_widget("gallery_tab")
self.witnesses_label = self.top.get_widget("witness_tab")
self.flowed = self.top.get_widget("eventflowed") self.flowed = self.top.get_widget("eventflowed")
self.flowed.set_sensitive(not noedit) self.flowed.set_sensitive(not noedit)
self.preform = self.top.get_widget("eventpreform") self.preform = self.top.get_widget("eventpreform")
self.preform.set_sensitive(not noedit) self.preform.set_sensitive(not noedit)
self.gallery_label = self.top.get_widget("galleryEvent")
self.witnesses_label = self.top.get_widget("witnessesEvent")
self.ok = self.top.get_widget('ok') self.ok = self.top.get_widget('ok')
self.ok.set_sensitive(not noedit) self.ok.set_sensitive(not noedit)
@ -219,7 +220,6 @@ class EventEditor:
self.date_field, self.date_field,
self.top.get_widget("date_stat"), self.top.get_widget("date_stat"),
self.window) self.window)
if not event: if not event:
event = RelLib.Event() event = RelLib.Event()
self.icon_list = self.top.get_widget("iconlist") self.icon_list = self.top.get_widget("iconlist")

View File

@ -34,11 +34,13 @@ class ListModel:
event_func=None,mode=gtk.SELECTION_SINGLE): event_func=None,mode=gtk.SELECTION_SINGLE):
self.tree = tree self.tree = tree
self.mylist = [] self.mylist = []
self.data_index = 0
for l in dlist: for l in dlist:
if l[0] and l[0][0] == ':': if l[0] and l[0][0] == ':':
self.mylist.append(TYPE_BOOLEAN) self.mylist.append(TYPE_BOOLEAN)
else: else:
self.mylist.append(TYPE_STRING) self.mylist.append(TYPE_STRING)
self.data_index += 1
self.mylist.append(TYPE_PYOBJECT) self.mylist.append(TYPE_PYOBJECT)
self.tree.set_rules_hint(True) self.tree.set_rules_hint(True)
@ -46,7 +48,6 @@ class ListModel:
self.selection = None self.selection = None
self.mode = mode self.mode = mode
self.new_model() self.new_model()
self.data_index = l
self.count = 0 self.count = 0
self.cid = None self.cid = None
self.cids = [] self.cids = []

View File

@ -27416,22 +27416,51 @@ Very High</property>
</child> </child>
<child> <child>
<widget class="GtkLabel" id="label271"> <widget class="GtkHBox" id="general_tab">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;General&lt;/b&gt;</property> <property name="homogeneous">False</property>
<property name="use_underline">False</property> <property name="spacing">0</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_CENTER</property> <child>
<property name="wrap">False</property> <widget class="GtkImage" id="image2583">
<property name="selectable">False</property> <property name="icon_size">4</property>
<property name="xalign">0.5</property> <property name="icon_name">gtk-file</property>
<property name="yalign">0.5</property> <property name="xalign">0.5</property>
<property name="xpad">0</property> <property name="yalign">0.5</property>
<property name="ypad">0</property> <property name="xpad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> <property name="ypad">0</property>
<property name="width_chars">-1</property> </widget>
<property name="single_line_mode">False</property> <packing>
<property name="angle">0</property> <property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label271">
<property name="visible">True</property>
<property name="label" translatable="yes">General</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget> </widget>
<packing> <packing>
<property name="type">tab</property> <property name="type">tab</property>
@ -27601,22 +27630,51 @@ Very High</property>
</child> </child>
<child> <child>
<widget class="GtkLabel" id="sourcesEvent"> <widget class="GtkHBox" id="sources_tab">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">Sources</property> <property name="homogeneous">False</property>
<property name="use_underline">False</property> <property name="spacing">0</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property> <child>
<property name="wrap">False</property> <widget class="GtkImage" id="image2584">
<property name="selectable">False</property> <property name="icon_size">4</property>
<property name="xalign">0.5</property> <property name="icon_name">gtk-file</property>
<property name="yalign">0.5</property> <property name="xalign">0.5</property>
<property name="xpad">0</property> <property name="yalign">0.5</property>
<property name="ypad">0</property> <property name="xpad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> <property name="ypad">0</property>
<property name="width_chars">-1</property> </widget>
<property name="single_line_mode">False</property> <packing>
<property name="angle">0</property> <property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="sourcesEvent">
<property name="visible">True</property>
<property name="label" translatable="yes">Sources</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget> </widget>
<packing> <packing>
<property name="type">tab</property> <property name="type">tab</property>
@ -27766,22 +27824,51 @@ Very High</property>
</child> </child>
<child> <child>
<widget class="GtkLabel" id="notesEvent"> <widget class="GtkHBox" id="note_tab">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">Note</property> <property name="homogeneous">False</property>
<property name="use_underline">False</property> <property name="spacing">0</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property> <child>
<property name="wrap">False</property> <widget class="GtkImage" id="image2585">
<property name="selectable">False</property> <property name="icon_size">4</property>
<property name="xalign">0.5</property> <property name="icon_name">gtk-file</property>
<property name="yalign">0.5</property> <property name="xalign">0.5</property>
<property name="xpad">0</property> <property name="yalign">0.5</property>
<property name="ypad">0</property> <property name="xpad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> <property name="ypad">0</property>
<property name="width_chars">-1</property> </widget>
<property name="single_line_mode">False</property> <packing>
<property name="angle">0</property> <property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="notesEvent">
<property name="visible">True</property>
<property name="label" translatable="yes">Note</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget> </widget>
<packing> <packing>
<property name="type">tab</property> <property name="type">tab</property>
@ -27952,22 +28039,51 @@ Very High</property>
</child> </child>
<child> <child>
<widget class="GtkLabel" id="witnessesEvent"> <widget class="GtkHBox" id="witness_tab">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">Witnesses</property> <property name="homogeneous">False</property>
<property name="use_underline">False</property> <property name="spacing">0</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property> <child>
<property name="wrap">False</property> <widget class="GtkImage" id="image2586">
<property name="selectable">False</property> <property name="icon_size">4</property>
<property name="xalign">0.5</property> <property name="icon_name">gtk-file</property>
<property name="yalign">0.5</property> <property name="xalign">0.5</property>
<property name="xpad">0</property> <property name="yalign">0.5</property>
<property name="ypad">0</property> <property name="xpad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> <property name="ypad">0</property>
<property name="width_chars">-1</property> </widget>
<property name="single_line_mode">False</property> <packing>
<property name="angle">0</property> <property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="witnessesEvent">
<property name="visible">True</property>
<property name="label" translatable="yes">Witnesses</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget> </widget>
<packing> <packing>
<property name="type">tab</property> <property name="type">tab</property>
@ -28167,22 +28283,51 @@ Very High</property>
</child> </child>
<child> <child>
<widget class="GtkLabel" id="galleryEvent"> <widget class="GtkHBox" id="gallery_tab">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">Gallery</property> <property name="homogeneous">False</property>
<property name="use_underline">False</property> <property name="spacing">0</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property> <child>
<property name="wrap">False</property> <widget class="GtkImage" id="image2587">
<property name="selectable">False</property> <property name="icon_size">4</property>
<property name="xalign">0.5</property> <property name="icon_name">gtk-file</property>
<property name="yalign">0.5</property> <property name="xalign">0.5</property>
<property name="xpad">0</property> <property name="yalign">0.5</property>
<property name="ypad">0</property> <property name="xpad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> <property name="ypad">0</property>
<property name="width_chars">-1</property> </widget>
<property name="single_line_mode">False</property> <packing>
<property name="angle">0</property> <property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="galleryEvent">
<property name="visible">True</property>
<property name="label" translatable="yes">Gallery</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget> </widget>
<packing> <packing>
<property name="type">tab</property> <property name="type">tab</property>