diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index fde180f81..e1dcaba74 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -5,6 +5,11 @@ (on_sourceok_clicked): Properly parse date for sourceref (closes # 1031156). + * src/gramps.glade: Add LED button widgets to the sourceref editor. + * src/Sources.py (SourceEditor.__init__): Use DateEdit to support + LED functionality; (SourceEditor.on_sourceok_clicked): Set date using + date object, instead of parsing text. + 2004-09-19 Alex Roitman * src/Date.py (is_equal): Add method -- needed to compare dates for being identical, since __cmp__ only compares the sorting value diff --git a/gramps2/src/Sources.py b/gramps2/src/Sources.py index 4a961031a..960936912 100644 --- a/gramps2/src/Sources.py +++ b/gramps2/src/Sources.py @@ -20,6 +20,13 @@ # $Id$ +#------------------------------------------------------------------------- +# +# Python modules +# +#------------------------------------------------------------------------- +from gettext import gettext as _ + #------------------------------------------------------------------------- # # GTK/Gnome modules @@ -38,8 +45,9 @@ import gnome import const import Utils import RelLib +import Date +import DateEdit import DateHandler -from gettext import gettext as _ #------------------------------------------------------------------------- # @@ -335,13 +343,23 @@ class SourceEditor: self.author_field = self.get_widget("sauthor") self.pub_field = self.get_widget("spubinfo") + self.dd = DateHandler.create_display() + + self.date_entry_field = self.get_widget("sdate") + if self.source_ref: self.active_source = self.db.get_source_from_handle(self.source_ref.get_base_handle()) + self.date_obj = self.source_ref.get_date() + self.date_entry_field.set_text(self.dd.display(self.date_obj)) else: + self.date_obj = Date.Date() self.active_source = None - self.dd = DateHandler.create_display() - self.dp = DateHandler.create_parser() + date_stat = self.get_widget("date_stat") + self.date_check = DateEdit.DateEdit(self.date_obj, + self.date_entry_field, + date_stat, + self.sourceDisplay) self.draw(self.active_source) self.set_button() @@ -411,9 +429,6 @@ class SourceEditor: if self.source_ref: spage = self.get_widget("spage") spage.get_buffer().set_text(self.source_ref.get_page()) - date = self.source_ref.get_date() - if date: - self.get_widget("sdate").set_text(self.dd.display(date)) text = self.get_widget("stext") text.get_buffer().set_text(self.source_ref.get_text()) @@ -461,7 +476,6 @@ class SourceEditor: if self.active_source != self.db.get_source_from_handle(self.source_ref.get_base_handle()): self.source_ref.set_base_handle(self.active_source.get_handle()) - date = unicode(self.get_widget("sdate").get_text()) conf = self.get_widget("conf").get_menu().get_active().get_data('a') buf = self.get_widget("scomment").get_buffer() @@ -477,7 +491,7 @@ class SourceEditor: buf.get_end_iter(),gtk.FALSE)) self.source_ref.set_page(page) - self.source_ref.get_date().copy(self.dp.parse(date)) + self.source_ref.set_date(self.date_obj) self.source_ref.set_text(text) self.source_ref.set_comments(comments) self.source_ref.set_confidence_level(conf) diff --git a/gramps2/src/gramps.glade b/gramps2/src/gramps.glade index d3117bd42..f94f63f3a 100644 --- a/gramps2/src/gramps.glade +++ b/gramps2/src/gramps.glade @@ -19569,7 +19569,7 @@ Other 12 True 11 - 4 + 5 False 6 12 @@ -19849,186 +19849,6 @@ Other - - - True - Creates a new source - True - _New... - True - GTK_RELIEF_NORMAL - True - - - - 3 - 4 - 1 - 2 - fill - - - - - - - True - True - 0 - - - - True - - - - True - Very Low - True - - - - - - True - Low - True - - - - - - True - Normal - True - - - - - - True - High - True - - - - - - True - Very High - True - - - - - - - 2 - 4 - 6 - 7 - fill - - - - - - - True - True - True - True - 0 - - True - * - False - - - 2 - 4 - 8 - 9 - - - - - - - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - True - GTK_JUSTIFY_LEFT - GTK_WRAP_WORD - True - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - 2 - 4 - 9 - 10 - fill - fill - - - - - - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - True - GTK_JUSTIFY_LEFT - GTK_WRAP_WORD - True - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - 2 - 4 - 10 - 11 - fill - fill - - - True @@ -20125,6 +19945,27 @@ Other + + + True + True + True + True + 0 + + True + * + False + + + 2 + 4 + 8 + 9 + + + + True @@ -20156,13 +19997,199 @@ Other 2 - 4 + 5 7 8 fill fill + + + + True + True + 0 + + + + True + + + + True + Very Low + True + + + + + + True + Low + True + + + + + + True + Normal + True + + + + + + True + High + True + + + + + + True + Very High + True + + + + + + + 2 + 5 + 6 + 7 + fill + + + + + + + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + True + False + True + GTK_JUSTIFY_LEFT + GTK_WRAP_WORD + True + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + 2 + 5 + 9 + 10 + fill + fill + + + + + + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + True + False + True + GTK_JUSTIFY_LEFT + GTK_WRAP_WORD + True + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + 2 + 5 + 10 + 11 + fill + fill + + + + + + True + Creates a new source + True + _New... + True + GTK_RELIEF_NORMAL + True + + + + 3 + 5 + 1 + 2 + fill + + + + + + + True + True + GTK_RELIEF_NONE + True + + + + True + 0.5 + 0.5 + 0 + 0 + + + + + 4 + 5 + 8 + 9 + fill + fill + + 0