diff --git a/ChangeLog b/ChangeLog index fcb720b03..112080880 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-02-15 Benny Malengier + * src/DateEdit.py: example use of help + * src/GrampsDisplay.py: internationalization of help system + * src/Editors/_EditPrimary.py: define_help_button link to webpage + * src/Editors/_EditSecondary.py: define_help_button link to webpage + * src/Editors/_EditReference.py: define_help_button link to webpage + * src/Editors/_EditFamily.py: remove empty line + 2008-02-14 Douglas S. Blank * src/DataViews/RelationView.py (RelationshipView.write_parents): added Sibling/Children add buttons; rearranged display; diff --git a/src/DateEdit.py b/src/DateEdit.py index fadd022cc..951e7a4ec 100644 --- a/src/DateEdit.py +++ b/src/DateEdit.py @@ -38,7 +38,7 @@ unambiguously built using UI controls such as menus and spin buttons. # Python modules # #------------------------------------------------------------------------- -from gettext import gettext as _ +from TransUtils import sgettext as _ #------------------------------------------------------------------------- # @@ -94,6 +94,8 @@ CAL_TO_MONTHS_NAMES = { Date.CAL_PERSIAN : DateHandler.displayer.persian, Date.CAL_ISLAMIC : DateHandler.displayer.islamic } +WIKI_HELP_PAGE = 'Gramps_3.0_Wiki_Manual_-_Entering_and_Editing_Data:_Detailed' +WIKI_HELP_SEC = _('manual|Editing_Dates') #------------------------------------------------------------------------- # # DateEdit @@ -259,7 +261,8 @@ class DateEditorDialog(ManagedWindow.ManagedWindow): while True: response = self.window.run() if response == gtk.RESPONSE_HELP: - GrampsDisplay.help('adv-dates') + GrampsDisplay.help('adv-dates', webpage=WIKI_HELP_PAGE, + section=WIKI_HELP_SEC) elif response == gtk.RESPONSE_DELETE_EVENT: break else: diff --git a/src/Editors/_EditFamily.py b/src/Editors/_EditFamily.py index a9af8f2a0..a385cd08d 100644 --- a/src/Editors/_EditFamily.py +++ b/src/Editors/_EditFamily.py @@ -234,7 +234,6 @@ class ChildEmbedList(EmbeddedList): def share_button_clicked(self, obj): # it only makes sense to skip those who are already in the family - skip_list = [self.family.get_father_handle(), \ self.family.get_mother_handle()] + \ [x.ref for x in self.family.get_child_ref_list() ] diff --git a/src/Editors/_EditPrimary.py b/src/Editors/_EditPrimary.py index e909fe368..158f51416 100644 --- a/src/Editors/_EditPrimary.py +++ b/src/Editors/_EditPrimary.py @@ -128,8 +128,9 @@ class EditPrimary(ManagedWindow.ManagedWindow): def define_cancel_button(self, button): button.connect('clicked', self.close) - def define_help_button(self, button, tag): - button.connect('clicked', lambda x: GrampsDisplay.help(tag)) + def define_help_button(self, button, tag, webpage='', section=''): + button.connect('clicked', lambda x: GrampsDisplay.help(tag, webpage, + section)) def _do_close(self, *obj): for key in self.signal_keys: diff --git a/src/Editors/_EditReference.py b/src/Editors/_EditReference.py index 08521e667..309dbcce3 100644 --- a/src/Editors/_EditReference.py +++ b/src/Editors/_EditReference.py @@ -181,9 +181,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, webpage='', section=''): import GrampsDisplay - button.connect('clicked', lambda x: GrampsDisplay.help(tag)) + button.connect('clicked', lambda x: GrampsDisplay.help(tag, webpage, + section)) button.set_sensitive(True) def _cleanup_on_exit(self): diff --git a/src/Editors/_EditSecondary.py b/src/Editors/_EditSecondary.py index a71490cdd..34c4e1522 100644 --- a/src/Editors/_EditSecondary.py +++ b/src/Editors/_EditSecondary.py @@ -113,8 +113,9 @@ class EditSecondary(ManagedWindow.ManagedWindow): def define_cancel_button(self,button): button.connect('clicked',self.close) - def define_help_button(self,button,tag): - button.connect('clicked', lambda x: GrampsDisplay.help(tag)) + def define_help_button(self, button, tag, webpage='', section=''): + button.connect('clicked', lambda x: GrampsDisplay.help(tag, webpage, + section)) def close(self,*obj): for key in self.signal_keys: diff --git a/src/GrampsDisplay.py b/src/GrampsDisplay.py index 4d20ef912..eab5f8292 100644 --- a/src/GrampsDisplay.py +++ b/src/GrampsDisplay.py @@ -21,6 +21,39 @@ # $Id$ import const +import locale +import os + +#list of manuals on wiki, map locale code to wiki extension, add language codes +#completely, or first part, so pt_BR if Brazilian portugeze wiki manual, and +#nl for Dutch (nl_BE, nl_NL language code) +MANUALS = { + 'nl' : '/nl', +} + +#first, determine language code, so nl_BE --> wiki /nl +LANG = locale.getlocale()[0] +if not LANG: + LANG = 'C' +#support environment overrule: +try: + if not os.environ['LANGUAGE'] or \ + os.environ['LANGUAGE'].split(':')[0] == LANG: + pass + else: + LANG = os.environ['LANGUAGE'].split(':')[0] +except: + pass +EXTENSION = '' +try: + EXTENSION = MANUALS[LANG] +except KeyError: + pass +try: + if not EXTENSION : + EXTENSION = MANUALS[LANG.split('_')[0]] +except KeyError: + pass def help(target, webpage='', section=''): """ @@ -34,12 +67,15 @@ def help(target, webpage='', section=''): # url(const.URL_MANUAL+'en/') # 3.0 Beta, direct to the wiki 3.0 Manual + + + if not webpage: - link = const.URL_WIKISTRING + const.URL_MANUAL_PAGE + link = const.URL_WIKISTRING + const.URL_MANUAL_PAGE + EXTENSION else: - link = const.URL_WIKISTRING + webpage + link = const.URL_WIKISTRING + webpage + EXTENSION if section: - link + '#' + section + link = link + '#' + section url(link) def url(link):