From 8a45d47e094031d0730d907e938c34848cf61b4c Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Thu, 2 Feb 2006 22:48:21 +0000 Subject: [PATCH] * src/DdTargets.py: add support for data items in sources * src/EventEdit.py: use DisplayTabs * src/gramps.glade: New EventEditor with display tabs * src/DisplayTabs.py: specify data _DND_TYPE, don't enable d-n-d if _DND_TYPE not defined svn: r5868 --- ChangeLog | 5 + src/DdTargets.py | 1 + src/DisplayTabs.py | 4 +- src/EventEdit.py | 97 +-- src/gramps.glade | 1396 +++++++------------------------------------- 5 files changed, 264 insertions(+), 1239 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5c214dbe0..9fdac7ca3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,9 @@ 2006-02-02 Don Allingham + * src/DdTargets.py: add support for data items in sources + * src/EventEdit.py: use DisplayTabs + * src/gramps.glade: New EventEditor with display tabs + * src/DisplayTabs.py: specify data _DND_TYPE, don't enable d-n-d if + _DND_TYPE not defined * src/DisplayState.py: add standard function for using WATCH cursor * src/PageView.py: enable watch cursor when it is necessary to rebuild a page. diff --git a/src/DdTargets.py b/src/DdTargets.py index 80855c8b7..661ee8e4c 100644 --- a/src/DdTargets.py +++ b/src/DdTargets.py @@ -105,6 +105,7 @@ class _DdTargets(object): self.SOURCEREF = _DdType(self,'srcref') self.NAME = _DdType(self,'name') self.MEDIAOBJ = _DdType(self,'mediaobj') + self.DATA = _DdType(self,'data_tuple') self.PERSON_LINK = _DdType(self,'person-link') self.PERSON_LINK_LIST = _DdType(self,'person-link-list') diff --git a/src/DisplayTabs.py b/src/DisplayTabs.py index c0901ba9b..e113faf78 100644 --- a/src/DisplayTabs.py +++ b/src/DisplayTabs.py @@ -284,7 +284,8 @@ class EmbeddedList(ButtonTab): self.columns = [] self.build_columns() - self._set_dnd() + if self._DND_TYPE: + self._set_dnd() # build the initial data self.rebuild() @@ -668,6 +669,7 @@ class SourceBackRefList(EmbeddedList): #------------------------------------------------------------------------- class DataEmbedList(EmbeddedList): + _DND_TYPE = DdTargets.DATA _column_names = [ (_('Key'),0,150), (_('Value'),1,250), diff --git a/src/EventEdit.py b/src/EventEdit.py index 5bdb495c8..74f2d43ee 100644 --- a/src/EventEdit.py +++ b/src/EventEdit.py @@ -51,14 +51,13 @@ import AutoComp import RelLib import Date from DateHandler import parser as _dp, displayer as _dd -import ImageSelect import DateEdit -import Spell import GrampsDisplay import DisplayState from QuestionDialog import WarningDialog, ErrorDialog from WindowUtils import GladeIf +from DisplayTabs import * #------------------------------------------------------------------------- # @@ -117,12 +116,6 @@ class EventEditor(DisplayState.ManagedWindow): if self.already_exist: return - # build list for menu - ## values = sets.Set(elist) -## values.union(self.get_event_names()) -## self.elist = list(values) - ##self.elist.sort() - for key in self.db.get_place_handles(): title = self.db.get_place_from_handle(key).get_title() self.pmap[title] = key @@ -148,27 +141,13 @@ class EventEditor(DisplayState.ManagedWindow): self.place_field.set_editable(not noedit) self.cause_field = self.top.get_widget("eventCause") self.cause_field.set_editable(not noedit) - self.slist = self.top.get_widget("slist") - self.wlist = self.top.get_widget("wlist") self.date_field = self.top.get_widget("eventDate") self.date_field.set_editable(not noedit) self.descr_field = self.top.get_widget("event_description") self.descr_field.set_editable(not noedit) - self.note_field = self.top.get_widget("eventNote") - self.note_field.set_editable(not noedit) - self.spell = Spell.Spell(self.note_field) self.event_menu = self.top.get_widget("personal_events") self.priv = self.top.get_widget("priv") self.priv.set_sensitive(not noedit) - self.sources_label = self.top.get_widget("sources_tab") - 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.set_sensitive(not noedit) - self.preform = self.top.get_widget("eventpreform") - self.preform.set_sensitive(not noedit) self.ok = self.top.get_widget('ok') self.ok.set_sensitive(not noedit) @@ -177,26 +156,6 @@ class EventEditor(DisplayState.ManagedWindow): self.event_menu.set_sensitive(False) self.date_field.grab_focus() - add_src = self.top.get_widget('add_src') - add_src.set_sensitive(not noedit) - del_src = self.top.get_widget('del_src') - del_src.set_sensitive(not noedit) - - self.sourcetab = Sources.SourceTab(self.dbstate, self.uistate, self.track, - self.srcreflist, self, self.top, self.window, self.slist, - add_src, self.top.get_widget('edit_src'), del_src, - self.db.readonly) - - add_witness = self.top.get_widget('add_witness') - add_witness.set_sensitive(not noedit) - edit_witness = self.top.get_widget('edit_witness') - del_witness = self.top.get_widget('del_witness') - del_witness.set_sensitive(not noedit) - -# self.witnesstab = Witness.WitnessTab( -# self.witnesslist, self, self.top, self.window, self.wlist, -# add_witness, edit_witness, del_witness) - if event: defval = event.get_type()[0] else: @@ -221,16 +180,6 @@ class EventEditor(DisplayState.ManagedWindow): self.descr_field.set_text(event.get_description()) self.priv.set_active(event.get_privacy()) - self.note_field.get_buffer().set_text(event.get_note()) - if event.get_note(): - self.note_field.get_buffer().set_text(event.get_note()) - Utils.bold_label(self.notes_label) - if event.get_note_format() == 1: - self.preform.set_active(1) - else: - self.flowed.set_active(1) - if event.get_media_list(): - Utils.bold_label(self.gallery_label) else: event = RelLib.Event() date_stat = self.top.get_widget("date_stat") @@ -240,29 +189,41 @@ class EventEditor(DisplayState.ManagedWindow): date_stat, self.window) -# self.icon_list = self.top.get_widget("iconlist") -# self.gallery = ImageSelect.Gallery(event, self.db.commit_event, -# self.path, self.icon_list, -# self.db,self,self.window) - - self.gladeif.connect('event_edit','delete_event',self.on_delete_event) self.gladeif.connect('button111','clicked',self.close) self.gladeif.connect('ok','clicked',self.on_event_edit_ok_clicked) self.gladeif.connect('button126','clicked',self.on_help_clicked) - self.gladeif.connect('notebook','switch_page',self.on_switch_page) -# self.gladeif.connect('add_obj','clicked',self.gallery.on_add_media_clicked) -# self.gladeif.connect('sel_obj','clicked',self.gallery.on_select_media_clicked) -# self.gladeif.connect('button172','clicked',self.gallery.on_edit_media_clicked) -# self.gladeif.connect('del_obj','clicked',self.gallery.on_delete_media_clicked) - self.top.get_widget('del_obj').set_sensitive(not noedit) - self.top.get_widget('sel_obj').set_sensitive(not noedit) - self.top.get_widget('add_obj').set_sensitive(not noedit) - - Utils.bold_label(self.general_label) + self._create_tabbed_pages() self.show() + def _add_page(self,page): + self.notebook.insert_page(page) + self.notebook.set_tab_label(page,page.get_tab_widget()) + return page + + def _create_tabbed_pages(self): + """ + Creates the notebook tabs and inserts them into the main + window. + + """ + vbox = self.top.get_widget('vbox') + self.notebook = gtk.Notebook() + + self.srcref_list = self._add_page(SourceEmbedList( + self.dbstate,self.uistate, self.track, + self.event.source_list)) + self.note_tab = self._add_page(NoteTab( + self.dbstate, self.uistate, self.track, + self.event.get_note_object())) + self.gallery_tab = self._add_page(GalleryTab( + self.dbstate, self.uistate, self.track, + self.event.get_media_list())) + + self.notebook.show_all() + vbox.pack_start(self.notebook,True) + def build_menu_names(self,event): if event: if event.get_type()[0] == RelLib.Event.CUSTOM: diff --git a/src/gramps.glade b/src/gramps.glade index e085a52b7..5466b242d 100644 --- a/src/gramps.glade +++ b/src/gramps.glade @@ -13017,6 +13017,7 @@ Very High GTK_WIN_POS_NONE False 600 + 450 True False gramps.png @@ -13096,7 +13097,7 @@ Very High - + True False 0 @@ -13127,1258 +13128,313 @@ Very High - + + 12 True - True - True - False - GTK_POS_TOP - False - False - + 4 + 6 + False + 6 + 12 - - 12 + True - 6 - 3 - False - 6 - 12 - - - - True - _Event type: - True - False - GTK_JUSTIFY_CENTER - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 0 - 1 - fill - - - - - - - True - _Date: - True - False - GTK_JUSTIFY_CENTER - False - False - 0 - 0.5 - 0 - 0 - eventDate - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - - - - 0 - 1 - 1 - 2 - fill - - - - - - - True - De_scription: - True - False - GTK_JUSTIFY_CENTER - False - False - 0 - 0.5 - 0 - 0 - event_description - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - - - - 0 - 1 - 4 - 5 - fill - - - - - - - True - _Place: - True - False - GTK_JUSTIFY_CENTER - False - False - 0 - 0.5 - 0 - 3 - eventPlace - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - - - - 0 - 1 - 2 - 3 - fill - - - - - - - True - _Cause: - True - False - GTK_JUSTIFY_CENTER - False - False - 0 - 0.5 - 0 - 0 - eventCause - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - - - - 0 - 1 - 3 - 4 - fill - - - - - - - True - True - True - True - 0 - - True - * - False - - - 1 - 2 - 1 - 2 - - - - - - - True - True - True - True - 0 - - True - * - False - - - 1 - 3 - 4 - 5 - - - - - - - True - True - True - True - 0 - - True - * - False - - - 1 - 3 - 3 - 4 - - - - - - - True - True - True - True - 0 - - True - * - False - - - 1 - 3 - 2 - 3 - - - - - - - True - True - _Private record - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 1 - 3 - 5 - 6 - fill - - - - - - - True - False - True - True - - - 1 - 3 - 0 - 1 - fill - fill - - - - - - True - True - GTK_RELIEF_NONE - True - - - - True - 0.5 - 0.5 - 0 - 0 - - - - - 2 - 3 - 1 - 2 - fill - fill - - + _Event type: + True + False + GTK_JUSTIFY_CENTER + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 - False - True + 0 + 1 + 0 + 1 + fill + - + True - False - 0 - - - - gtk-file - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - True - True - - - - - - True - General - False - True - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - + _Place: + True + False + GTK_JUSTIFY_CENTER + False + False + 0 + 0.5 + 0 + 3 + eventPlace + PANGO_ELLIPSIZE_NONE + -1 + False + 0 - tab + 0 + 1 + 2 + 3 + fill + - + True - False - 0 - - - - 6 - True - False - 6 - - - - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - False - True - False - False - False - - - - - 0 - True - True - - - - - - True - False - 6 - - - - True - True - GTK_RELIEF_NORMAL - True - - - - True - gtk-add - 4 - 0.5 - 0.5 - 0 - 0 - - - - - 0 - False - False - - - - - - True - True - GTK_RELIEF_NORMAL - True - - - - True - edit_sm.png - 0.5 - 0.5 - 0 - 0 - - - - - 0 - False - False - - - - - - True - True - GTK_RELIEF_NORMAL - True - - - - True - gtk-remove - 4 - 0.5 - 0.5 - 0 - 0 - - - - - 0 - False - False - - - - - - - - - 0 - False - True - - - - - 0 - True - True - - - - - - True - GTK_BUTTONBOX_SPREAD - 30 - - - 0 - False - True - - + _Cause: + True + False + GTK_JUSTIFY_CENTER + False + False + 0 + 0.5 + 0 + 0 + eventCause + PANGO_ELLIPSIZE_NONE + -1 + False + 0 - False - True + 0 + 1 + 3 + 4 + fill + - + True - False - 0 - - - - gtk-file - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - True - True - - - - - - True - Sources - False - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - + True + True + True + 0 + + True + * + False - tab + 1 + 3 + 3 + 4 + - + True - False - 0 - - - - 6 - 400 - 200 - 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 - - - - - - 0 - True - False - - - - - - 12 - True - 2 - 3 - False - 12 - 24 - - - - True - <b>Format</b> - True - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 3 - 0 - 1 - fill - - - - - - - True - Multiple spaces, tabs, and single line breaks are replaced with single spaces. Two consecutive line breaks mark a new paragraph. - True - _Flowed - True - GTK_RELIEF_NORMAL - True - True - False - True - - - 1 - 2 - 1 - 2 - - - - - - - - True - Formatting is preserved, except for the leading whitespace. Multiple spaces, tabs, and all line breaks are respected. - True - _Preformatted - True - GTK_RELIEF_NORMAL - True - False - False - True - eventflowed - - - 2 - 3 - 1 - 2 - - - - - - - 0 - True - True - - + False + True + True - False - True + 1 + 3 + 0 + 1 + fill + fill - + True - False - 0 - - - - gtk-file - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - True - True - - - - - - True - Note - False - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - + _Date: + True + False + GTK_JUSTIFY_CENTER + False + False + 0 + 0.5 + 0 + 0 + eventDate + PANGO_ELLIPSIZE_NONE + -1 + False + 0 - tab + 3 + 4 + 0 + 1 + fill + - + True - False - 0 - - - - 6 - True - False - 6 - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - False - True - False - False - False - - - - - 0 - True - True - - - - - - True - False - 6 - - - - True - True - GTK_RELIEF_NORMAL - True - - - - True - gtk-add - 4 - 0.5 - 0.5 - 0 - 0 - - - - - 0 - False - False - - - - - - True - True - GTK_RELIEF_NORMAL - True - - - - True - edit_sm.png - 0.5 - 0.5 - 0 - 0 - - - - - 0 - False - False - - - - - - True - True - GTK_RELIEF_NORMAL - True - - - - True - gtk-remove - 4 - 0.5 - 0.5 - 0 - 0 - - - - - 0 - False - False - - - - - - - - - 0 - False - True - - - - - 0 - True - True - - - - - - True - GTK_BUTTONBOX_SPREAD - 0 - - - 0 - False - True - - + True + True + True + 0 + + True + * + False - False - True + 4 + 5 + 0 + 1 + - + True - False - 0 + True + GTK_RELIEF_NONE + True - - gtk-file - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - True - True - - - - - + True - Witnesses - False - False - GTK_JUSTIFY_LEFT - False - False 0.5 0.5 0 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - 0 - False - False - - tab + 5 + 6 + 0 + 1 + fill + - + True - False - 0 - - - - 6 - True - False - 6 - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - GTK_SELECTION_SINGLE - GTK_ORIENTATION_VERTICAL - False - - - - - 0 - True - True - - - - - - True - False - 6 - - - - True - Add a new media object to the database and place it in this gallery - True - GTK_RELIEF_NORMAL - True - - - - - True - gtk-add - 4 - 0.5 - 0.5 - 0 - 0 - - - - - 0 - False - False - - - - - - True - Select an existing media object from the database and place it in this gallery - True - GTK_RELIEF_NORMAL - True - - - - - True - gtk-index - 4 - 0.5 - 0.5 - 0 - 0 - - - - - 0 - False - False - - - - - - True - Edit the properties of the selected object - True - GTK_RELIEF_NORMAL - True - - - - - True - edit_sm.png - 0.5 - 0.5 - 0 - 0 - - - - - 0 - False - False - - - - - - True - Remove selected object from this gallery only - True - GTK_RELIEF_NORMAL - True - - - - - True - gtk-remove - 4 - 0.5 - 0.5 - 0 - 0 - - - - - 0 - False - False - - - - - 0 - False - True - - - - - 0 - True - True - - - - - - True - GTK_BUTTONBOX_SPREAD - 30 - - - 0 - False - True - - + De_scription: + True + False + GTK_JUSTIFY_CENTER + False + False + 0 + 0.5 + 0 + 0 + event_description + PANGO_ELLIPSIZE_NONE + -1 + False + 0 - False - True + 0 + 1 + 1 + 2 + fill + - + True - False - 0 - - - - gtk-file - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - True - True - - - - - - True - Gallery - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - + True + True + True + 0 + + True + * + False - tab + 1 + 6 + 1 + 2 + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 6 + 2 + 3 + + + + + + + True + True + _Private record + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 4 + 5 + 3 + 4 + fill + 0 - True - True + False + False