Source improvements

svn: r1389
This commit is contained in:
Don Allingham 2003-03-24 03:51:07 +00:00
parent 11349e589b
commit 2588cc35d4
8 changed files with 214 additions and 137 deletions

View File

@ -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:

View File

@ -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):

View File

@ -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,14 +235,21 @@ 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()
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)

View File

@ -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"

View File

@ -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"

View File

@ -4805,7 +4805,7 @@
</child>
<child>
<widget class="GtkButton" id="button156">
<widget class="GtkButton" id="edit_photo">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Edit...</property>

View File

@ -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 <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\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 "<b>Source details</b>"
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 "<b>Source selection</b>"
msgstr ""
#: srcsel.glade:783
#: srcsel.glade:656
msgid "<b>Source details</b>"
msgstr ""
#: srcsel.glade:804
msgid "Double click will edit the selected source"
msgstr ""

View File

@ -8,8 +8,8 @@
<property name="title" translatable="yes"></property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">True</property>
<property name="default_width">450</property>
<property name="modal">False</property>
<property name="default_width">550</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="icon">gramps.png</property>
@ -40,7 +40,7 @@
</child>
<child>
<widget class="GtkButton" id="button94">
<widget class="GtkButton" id="ok">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
@ -99,7 +99,7 @@
<property name="border_width">12</property>
<property name="visible">True</property>
<property name="n_rows">11</property>
<property name="n_columns">3</property>
<property name="n_columns">4</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
@ -132,30 +132,6 @@
</packing>
</child>
<child>
<widget class="GtkLabel" id="label254">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Source details&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">3</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label180">
<property name="visible">True</property>
@ -342,54 +318,6 @@
</packing>
</child>
<child>
<widget class="GtkLabel" id="sauthor">
<property name="visible">True</property>
<property name="label" translatable="yes"></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</property>
<property name="yalign">0.5</property>
<property name="xpad">3</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="spubinfo">
<property name="visible">True</property>
<property name="label" translatable="yes"></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</property>
<property name="yalign">0.5</property>
<property name="xpad">3</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkCombo" id="source_title">
<property name="visible">True</property>
@ -402,6 +330,7 @@
<child internal-child="entry">
<widget class="GtkEntry" id="source">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Selects an existing source from the Source View</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="editable">False</property>
@ -454,24 +383,20 @@
</child>
<child>
<widget class="GtkLabel" id="label255">
<widget class="GtkButton" id="button143">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Source selection&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="tooltip" translatable="yes">Creates a new source</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_New...</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<signal name="clicked" handler="on_add_src_clicked" last_modification_time="Sun, 23 Mar 2003 23:22:04 GMT"/>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">3</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -531,7 +456,7 @@
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="x_options">fill</property>
@ -553,7 +478,7 @@
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
<property name="y_options"></property>
@ -574,7 +499,7 @@
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">8</property>
<property name="bottom_attach">9</property>
<property name="y_options"></property>
@ -609,7 +534,7 @@
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">9</property>
<property name="bottom_attach">10</property>
<property name="x_options">fill</property>
@ -645,13 +570,109 @@
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">10</property>
<property name="bottom_attach">11</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="sauthor">
<property name="visible">True</property>
<property name="label" translatable="yes"></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</property>
<property name="yalign">0.5</property>
<property name="xpad">3</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">4</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="spubinfo">
<property name="visible">True</property>
<property name="label" translatable="yes"></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</property>
<property name="yalign">0.5</property>
<property name="xpad">3</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">4</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label255">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Source selection&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">4</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label254">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Source details&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">4</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
@ -803,7 +824,7 @@
<property name="spacing">6</property>
<child>
<widget class="GtkButton" id="button139">
<widget class="GtkButton" id="add">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
@ -820,7 +841,7 @@
</child>
<child>
<widget class="GtkButton" id="button142">
<widget class="GtkButton" id="edit">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Edit...</property>
@ -836,7 +857,7 @@
</child>
<child>
<widget class="GtkButton" id="button141">
<widget class="GtkButton" id="delete">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>