From 0d778ae0757f91e53abc9cf3a04c3b9df1ecdcf6 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Mon, 19 Mar 2007 04:19:49 +0000 Subject: [PATCH] 2007-03-18 Don Allingham * src/ViewManager.py: use tooltips for buttons when text disabled (bug 959) * src/Editors/_EditSourceRef.py: fix help button (bug 960), delete the cancel on the comment tab. * src/Editors/_EditReference.py: make sure help button is sensitive if used. * src/GrampsDbUtils/_GedcomParse.py: check for UTF16 BOM * src/ArgHandler.py: use STOCK_NEW for create of db (bug 947) * src/DbLoader.py: use STOCK_NEW for create of db (bug 947) svn: r8304 --- ChangeLog | 9 +++++++++ src/ArgHandler.py | 2 +- src/DbLoader.py | 2 +- src/Editors/_EditReference.py | 3 ++- src/Editors/_EditSourceRef.py | 9 +-------- src/GrampsDbUtils/_GedcomParse.py | 5 +++++ src/ViewManager.py | 6 ++++++ 7 files changed, 25 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8c9567edd..65a851301 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2007-03-18 Don Allingham + * src/ViewManager.py: use tooltips for buttons when text disabled (bug 959) + * src/Editors/_EditSourceRef.py: fix help button (bug 960), delete the cancel + on the comment tab. + * src/Editors/_EditReference.py: make sure help button is sensitive if used. + * src/GrampsDbUtils/_GedcomParse.py: check for UTF16 BOM + * src/ArgHandler.py: use STOCK_NEW for create of db (bug 947) + * src/DbLoader.py: use STOCK_NEW for create of db (bug 947) + 2007-03-17 Zsolt Foldvari * src/Editors/_EditPlace.py: better tooltip for coordinates; fix position of those tooltip. diff --git a/src/ArgHandler.py b/src/ArgHandler.py index f8f646f09..faaee95d0 100644 --- a/src/ArgHandler.py +++ b/src/ArgHandler.py @@ -722,7 +722,7 @@ class NewNativeDbPrompter: gtk.FILE_CHOOSER_ACTION_SAVE, (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, - gtk.STOCK_OPEN, + gtk.STOCK_NEW, gtk.RESPONSE_OK)) self.state.db.close() diff --git a/src/DbLoader.py b/src/DbLoader.py index f04c1d92f..b767c741d 100644 --- a/src/DbLoader.py +++ b/src/DbLoader.py @@ -142,7 +142,7 @@ class DbLoader: self.uistate.window, gtk.FILE_CHOOSER_ACTION_SAVE, (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, - gtk.STOCK_OPEN, gtk.RESPONSE_OK)) + gtk.STOCK_NEW, gtk.RESPONSE_OK)) # Always add automatic (macth all files) filter add_all_files_filter(choose) diff --git a/src/Editors/_EditReference.py b/src/Editors/_EditReference.py index 59506a513..7f3086995 100644 --- a/src/Editors/_EditReference.py +++ b/src/Editors/_EditReference.py @@ -134,9 +134,10 @@ class EditReference(ManagedWindow.ManagedWindow): self._cleanup_on_exit() self.close(obj) - def define_help_button(self,button,tag): + def define_help_button(self, button, tag): import GrampsDisplay button.connect('clicked', lambda x: GrampsDisplay.help(tag)) + button.set_sensitive(True) def _cleanup_on_exit(self): pass diff --git a/src/Editors/_EditSourceRef.py b/src/Editors/_EditSourceRef.py index 404051b18..ddb026a19 100644 --- a/src/Editors/_EditSourceRef.py +++ b/src/Editors/_EditSourceRef.py @@ -72,15 +72,8 @@ class EditSourceRef(EditReference): def _connect_signals(self): self.define_ok_button(self.top.get_widget('ok'),self.ok_clicked) self.define_cancel_button(self.top.get_widget('cancel')) + self.define_help_button(self.top.get_widget("help"), 'adv-si') - def _cleanup_on_exit(self): - # FIXME: the second call was causing the problem, as it was - # re-setting the whole sref to its original state. - # that problem is fixed, but _cleanup_on_exit SHOULD NOT be run - # in close(), because close() is called on OK. - # Until this is fixed, notes, text and comments are not saved!!! - self.comment_tab.cancel() - def _setup_fields(self): self.ref_privacy = PrivacyButton( self.top.get_widget('privacy'), self.source_ref, self.db.readonly) diff --git a/src/GrampsDbUtils/_GedcomParse.py b/src/GrampsDbUtils/_GedcomParse.py index 06244d653..4a070b6b6 100644 --- a/src/GrampsDbUtils/_GedcomParse.py +++ b/src/GrampsDbUtils/_GedcomParse.py @@ -143,6 +143,9 @@ ADDR3_RE = re.compile('(.+)([\n\r]+)(.+)\s*,(.+)') TRUNC_MSG = _("Your GEDCOM file is corrupted. " "It appears to have been truncated.") +BAD_UTF16 = _("Your GEDCOM file is corrupted. " + "The file appears to be encoded using the UTF16 " + "character set, but is missing the BOM marker.") #------------------------------------------------------------------------- # @@ -255,6 +258,8 @@ class StageOne: self.enc = "UTF16" self.ifile.seek(0) self.reader = codecs.EncodedFile(self.ifile, 'utf8', 'utf16') + elif line[0] == "\x00" or line[1] == "\x00": + raise Errors.GedcomError(BAD_UTF16) else: self.ifile.seek(0) self.reader = self.ifile diff --git a/src/ViewManager.py b/src/ViewManager.py index e074b1276..b1ffa421e 100644 --- a/src/ViewManager.py +++ b/src/ViewManager.py @@ -205,6 +205,7 @@ class ViewManager: self.active_page = None self.views = [] self.pages = [] + self.tips = gtk.Tooltips() self._key = None self.file_loaded = False self._build_main_window() @@ -747,6 +748,10 @@ class ViewManager: self.prev_nav = PageView.NAVIGATION_NONE use_text = Config.get(Config.SIDEBAR_TEXT) + if use_text: + self.tips.disable() + else: + self.tips.enable() index = 0 for page_def in self.views: @@ -776,6 +781,7 @@ class ViewManager: # create the button and add it to the sidebar button = gtk.ToggleButton() + self.tips.set_tip(button, page_title) hbox = gtk.HBox() hbox.show() image = gtk.Image()