From 2588cc35d4d4af361f844b9653d3834e62a1ac6b Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Mon, 24 Mar 2003 03:51:07 +0000 Subject: [PATCH] Source improvements svn: r1389 --- src/AutoComp.py | 1 - src/EditSource.py | 2 +- src/Sources.py | 63 +++++++++++-- src/const.py | 2 +- src/const.py.in | 2 +- src/gramps.glade | 2 +- src/po/template.po | 60 ++++++++----- src/srcsel.glade | 219 +++++++++++++++++++++++++-------------------- 8 files changed, 214 insertions(+), 137 deletions(-) diff --git a/src/AutoComp.py b/src/AutoComp.py index d55d602eb..2d89d2d7d 100644 --- a/src/AutoComp.py +++ b/src/AutoComp.py @@ -156,7 +156,6 @@ class AutoCombo(AutoCompBase): """ self.inb = 1 - print text if self.vals[0] == "": self.entry.set_popdown_strings([self.entry.entry.get_text()]) else: diff --git a/src/EditSource.py b/src/EditSource.py index 4cdcf899a..f0eee4da4 100644 --- a/src/EditSource.py +++ b/src/EditSource.py @@ -88,7 +88,7 @@ class EditSource: if self.source.getId() == "": - self.top_window.get_widget("add_photo").set_sensitive(0) + self.top_window.get_widget("edit_photo").set_sensitive(0) self.top_window.get_widget("delete_photo").set_sensitive(0) def close(self,obj): diff --git a/src/Sources.py b/src/Sources.py index 5bb77fb75..331187a03 100644 --- a/src/Sources.py +++ b/src/Sources.py @@ -67,6 +67,8 @@ class SourceSelector: }) self.slist = self.top.get_widget("slist") + self.edit = self.top.get_widget('edit') + self.delete = self.top.get_widget('delete') self.selection = self.slist.get_selection() self.model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING) self.slist.set_model(self.model) @@ -82,9 +84,22 @@ class SourceSelector: column.set_min_width(title[2]) self.slist.append_column (column) + self.selection.connect('changed',self.selection_changed) + + self.delete.set_sensitive(gtk.FALSE) + self.edit.set_sensitive(gtk.FALSE) self.redraw() self.sourcesel.show() + def selection_changed(self,obj): + (store,iter) = self.selection.get_selected() + if iter: + self.delete.set_sensitive(gtk.TRUE) + self.edit.set_sensitive(gtk.TRUE) + else: + self.delete.set_sensitive(gtk.FALSE) + self.edit.set_sensitive(gtk.FALSE) + def redraw(self): self.model.clear() for s in self.list: @@ -220,15 +235,22 @@ class SourceEditor: self.showSource.signal_autoconnect({ "on_sourceok_clicked" : self.on_sourceok_clicked, "on_source_changed" : self.on_source_changed, + "on_add_src_clicked" : self.add_src_clicked, "destroy_passed_object" : Utils.destroy_passed_object }) self.source_field = self.get_widget("sourceList") self.title_menu = self.get_widget("source_title") self.title_menu.set_data("o",self) self.conf_menu = self.get_widget("conf") + self.ok = self.get_widget("ok") Utils.build_confidence_menu(self.conf_menu) self.conf_menu.set_history(srcref.getConfidence()) + self.list = [] + + self.title_menu.list.select_item(0) + self.title_menu.list.remove_items(self.title_menu.list.get_selection()) + self.author_field = self.get_widget("sauthor") self.pub_field = self.get_widget("spubinfo") @@ -236,14 +258,23 @@ class SourceEditor: self.active_source = self.source_ref.getBase() else: self.active_source = None + self.draw() + self.set_button() self.sourceDisplay.show() + def set_button(self): + if self.active_source: + self.ok.set_sensitive(1) + else: + self.ok.set_sensitive(0) + def get_widget(self,name): """returns the widget associated with the specified name""" return self.showSource.get_widget(name) - def draw(self): + def draw(self,sel = None): + self.title_menu.list.remove_items(self.list) if self.source_ref: self.get_widget("spage").set_text(self.source_ref.getPage()) date = self.source_ref.getDate() @@ -267,7 +298,8 @@ class SourceEditor: values = self.db.getSourceMap().values() sel_child = None - list = [] + self.list = [] + self.active_source = sel for src in values: l = gtk.Label("%s [%s]" % (src.getTitle(),src.getId())) l.show() @@ -276,16 +308,17 @@ class SourceEditor: c.add(l) c.set_data("s",src) c.show() - list.append(c) + self.list.append(c) if self.active_source == src: sel_child = c - self.title_menu.list.append_items(list) + self.title_menu.list.append_items(self.list) if sel_child: self.title_menu.list.select_child(sel_child) def on_sourceok_clicked(self,obj): + if self.active_source != self.source_ref.getBase(): self.source_ref.setBase(self.active_source) @@ -314,11 +347,23 @@ class SourceEditor: Utils.destroy_passed_object(obj) def on_source_changed(self,obj): - self.active_source = obj.list.get_selection()[0].get_data("s") + sel = obj.list.get_selection() + if sel: + self.active_source = sel[0].get_data("s") + + if self.active_source: + self.author_field.set_text(self.active_source.getAuthor()) + self.pub_field.set_text(self.active_source.getPubInfo()) + self.set_button() - if self.active_source: - self.author_field.set_text(self.active_source.getAuthor()) - self.pub_field.set_text(self.active_source.getPubInfo()) - + def update_display(self,source): + self.db.addSource(source) + self.draw(source) +# self.update(0) + + def add_src_clicked(self,obj): + import EditSource + import RelLib + EditSource.EditSource(RelLib.Source(),self.db, self.update_display) diff --git a/src/const.py b/src/const.py index a67bdc864..0e7f379d6 100644 --- a/src/const.py +++ b/src/const.py @@ -133,7 +133,7 @@ translators = u'Radek Malcic - Czech\n' \ # Constants # #------------------------------------------------------------------------- -picWidth = 275.0 +picWidth = 200.0 thumbScale = 96.0 xmlFile = "data.gramps" zodbFile = "gramps.zodb" diff --git a/src/const.py.in b/src/const.py.in index 666fde596..fe35bd6a2 100644 --- a/src/const.py.in +++ b/src/const.py.in @@ -133,7 +133,7 @@ translators = u'Radek Malcic - Czech\n' \ # Constants # #------------------------------------------------------------------------- -picWidth = 275.0 +picWidth = 200.0 thumbScale = 96.0 xmlFile = "data.gramps" zodbFile = "gramps.zodb" diff --git a/src/gramps.glade b/src/gramps.glade index d23996863..df36a321e 100644 --- a/src/gramps.glade +++ b/src/gramps.glade @@ -4805,7 +4805,7 @@ - + True True _Edit... diff --git a/src/po/template.po b/src/po/template.po index b3a797604..5417b5b0b 100644 --- a/src/po/template.po +++ b/src/po/template.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: GRAMPS VERSION\n" -"POT-Creation-Date: Sun Mar 23 08:23:05 2003\n" +"POT-Creation-Date: Sun Mar 23 20:30:36 2003\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -32,7 +32,7 @@ msgstr "" #: AddSpouse.py:85 ChooseParents.py:55 FamilyView.py:138 ImageSelect.py:824 #: MediaView.py:59 PlaceView.py:48 SelectChild.py:105 SourceView.py:54 -#: Sources.py:75 Sources.py:145 Witness.py:54 gramps_main.py:93 +#: Sources.py:77 Sources.py:160 Witness.py:54 gramps_main.py:93 #: plugins/RelCalc.py:326 msgid "ID" msgstr "" @@ -927,7 +927,7 @@ msgstr "" msgid "The GRAMPS ID that you chose for this relationship is already being used." msgstr "" -#: MediaView.py:59 SourceView.py:54 Sources.py:75 Sources.py:145 +#: MediaView.py:59 SourceView.py:54 Sources.py:77 Sources.py:160 #: plugins/TimeLine.py:347 msgid "Title" msgstr "" @@ -1392,7 +1392,7 @@ msgstr "" msgid "Source Reference Selection" msgstr "" -#: Sources.py:218 +#: Sources.py:233 msgid "Source Information" msgstr "" @@ -1666,23 +1666,23 @@ msgstr "" msgid "Other" msgstr "" -#: const.py:167 srcsel.glade:493 +#: const.py:167 srcsel.glade:418 msgid "Very Low" msgstr "" -#: const.py:168 plugins/Merge.py:107 srcsel.glade:501 +#: const.py:168 plugins/Merge.py:107 srcsel.glade:426 msgid "Low" msgstr "" -#: const.py:169 srcsel.glade:509 +#: const.py:169 srcsel.glade:434 msgid "Normal" msgstr "" -#: const.py:170 plugins/Merge.py:115 srcsel.glade:517 +#: const.py:170 plugins/Merge.py:115 srcsel.glade:442 msgid "High" msgstr "" -#: const.py:171 srcsel.glade:525 +#: const.py:171 srcsel.glade:450 msgid "Very High" msgstr "" @@ -1927,7 +1927,7 @@ msgid "_Event type:" msgstr "" #: dialog.glade:148 dialog.glade:1866 edit_person.glade:304 -#: edit_person.glade:4046 srcsel.glade:190 +#: edit_person.glade:4046 srcsel.glade:166 msgid "_Date:" msgstr "" @@ -1970,7 +1970,7 @@ msgstr "" #: gramps.glade:3906 gramps.glade:4795 imagesel.glade:981 imagesel.glade:1763 #: marriage.glade:746 marriage.glade:1140 marriage.glade:1327 places.glade:899 #: places.glade:1100 places.glade:1251 places.glade:1537 rule.glade:340 -#: rule.glade:804 srcsel.glade:810 styles.glade:138 +#: rule.glade:804 srcsel.glade:831 styles.glade:138 msgid "_Add..." msgstr "" @@ -1980,7 +1980,7 @@ msgstr "" #: edit_person.glade:3820 gramps.glade:4811 imagesel.glade:997 #: imagesel.glade:1779 marriage.glade:762 marriage.glade:1156 #: marriage.glade:1343 places.glade:915 places.glade:1115 places.glade:1267 -#: places.glade:1553 rule.glade:358 rule.glade:823 srcsel.glade:826 +#: places.glade:1553 rule.glade:358 rule.glade:823 srcsel.glade:847 #: styles.glade:150 msgid "_Edit..." msgstr "" @@ -1991,7 +1991,7 @@ msgstr "" #: gramps.glade:4831 imagesel.glade:1015 imagesel.glade:1797 #: marriage.glade:779 marriage.glade:1173 marriage.glade:1360 places.glade:931 #: places.glade:1131 places.glade:1283 places.glade:1639 rule.glade:376 -#: rule.glade:858 srcsel.glade:843 styles.glade:162 +#: rule.glade:858 srcsel.glade:864 styles.glade:162 msgid "_Delete" msgstr "" @@ -2083,7 +2083,7 @@ msgid "T_ype:" msgstr "" #: dialog.glade:2962 edit_person.glade:229 gramps.glade:4520 -#: imagesel.glade:235 imagesel.glade:1434 places.glade:119 srcsel.glade:320 +#: imagesel.glade:235 imagesel.glade:1434 places.glade:119 srcsel.glade:296 msgid "_Title:" msgstr "" @@ -3319,7 +3319,7 @@ msgstr "" msgid "Status:" msgstr "" -#: plugins.glade:255 srcsel.glade:296 +#: plugins.glade:255 srcsel.glade:272 msgid "Author:" msgstr "" @@ -5677,30 +5677,42 @@ msgid "_Confidence:" msgstr "" #: srcsel.glade:138 -msgid "Source details" -msgstr "" - -#: srcsel.glade:162 msgid "_Volume/Film/Page:" msgstr "" -#: srcsel.glade:218 +#: srcsel.glade:194 msgid "Te_xt:" msgstr "" -#: srcsel.glade:245 +#: srcsel.glade:221 msgid "Co_mments:" msgstr "" -#: srcsel.glade:272 +#: srcsel.glade:248 msgid "Publication information:" msgstr "" -#: srcsel.glade:459 +#: srcsel.glade:333 +msgid "Selects an existing source from the Source View" +msgstr "" + +#: srcsel.glade:388 +msgid "Creates a new source" +msgstr "" + +#: srcsel.glade:390 +msgid "_New..." +msgstr "" + +#: srcsel.glade:632 msgid "Source selection" msgstr "" -#: srcsel.glade:783 +#: srcsel.glade:656 +msgid "Source details" +msgstr "" + +#: srcsel.glade:804 msgid "Double click will edit the selected source" msgstr "" diff --git a/src/srcsel.glade b/src/srcsel.glade index bd7514f9f..948b677ca 100644 --- a/src/srcsel.glade +++ b/src/srcsel.glade @@ -8,8 +8,8 @@ GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE - True - 450 + False + 550 True False gramps.png @@ -40,7 +40,7 @@ - + True True True @@ -99,7 +99,7 @@ 12 True 11 - 3 + 4 False 6 12 @@ -132,30 +132,6 @@ - - - True - <b>Source details</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 0 - 3 - 5 - 6 - fill - - - - True @@ -342,54 +318,6 @@ - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 3 - 0 - - - 2 - 3 - 2 - 3 - fill - - - - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 3 - 0 - - - 2 - 3 - 3 - 4 - fill - - - - True @@ -402,6 +330,7 @@ True + Selects an existing source from the Source View True True False @@ -454,24 +383,20 @@ - + True - <b>Source selection</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 + Creates a new source + True + _New... + True + GTK_RELIEF_NORMAL + - 0 - 3 - 0 - 1 + 3 + 4 + 1 + 2 fill @@ -531,7 +456,7 @@ 2 - 3 + 4 6 7 fill @@ -553,7 +478,7 @@ 2 - 3 + 4 7 8 @@ -574,7 +499,7 @@ 2 - 3 + 4 8 9 @@ -609,7 +534,7 @@ 2 - 3 + 4 9 10 fill @@ -645,13 +570,109 @@ 2 - 3 + 4 10 11 fill fill + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 3 + 0 + + + 2 + 4 + 2 + 3 + fill + + + + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 3 + 0 + + + 2 + 4 + 3 + 4 + fill + + + + + + + True + <b>Source selection</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + 0 + 4 + 0 + 1 + fill + + + + + + + True + <b>Source details</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + 0 + 4 + 5 + 6 + fill + + + 0 @@ -803,7 +824,7 @@ 6 - + True True True @@ -820,7 +841,7 @@ - + True True _Edit... @@ -836,7 +857,7 @@ - + True True True