Skip to content

Commit

Permalink
Help issues for bug 9042 (#738)
Browse files Browse the repository at this point in the history
* Media Manager: add help button and remove '...'

Issue #9042

* Edit/Preferences: add Help button

Issue #9042

* Style Editor, Document Styles dialog: add help buttons

Issue #9042

* Fix Select Person dialog Help button URL

Issue #9042

* Fix Select Repository dialog Help button URL

Issue #9042

* Relationship Calculator: Add help button

Issue #9042

* Reorder Relationships dialog; add Help button

Issue #9042

* Generate Book Dialog; Fix Help URL

Issue #9042

* Manage Book dialog; add help button

Issue #9042

* Fix Detached Gramplets Help button URL when 'help_url' not in .gpr

Issue #9042

* Fix help URLs when they contain illegal characters and to match wiki
section targetID algorithm

Issue #9042
  • Loading branch information
prculley authored Dec 20, 2018
1 parent 03b151b commit 44180b4
Show file tree
Hide file tree
Showing 57 changed files with 206 additions and 85 deletions.
11 changes: 10 additions & 1 deletion gramps/gui/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
#-------------------------------------------------------------------------
from gramps.gen.config import config
from gramps.gen.const import GRAMPS_LOCALE as glocale
from gramps.gen.const import HOME_DIR, URL_WIKISTRING
from gramps.gen.const import HOME_DIR, URL_WIKISTRING, URL_MANUAL_PAGE
from gramps.gen.datehandler import get_date_formats
from gramps.gen.display.name import displayer as _nd
from gramps.gen.display.name import NameDisplayError
Expand All @@ -64,6 +64,7 @@
from .widgets import MarkupLabel, BasicLabel
from .dialog import ErrorDialog, QuestionDialog2, OkDialog
from .editors.editplaceformat import EditPlaceFormat
from .display import display_help
from .glade import Glade
from gramps.gen.plug.utils import available_updates
from .plug import PluginWindows
Expand Down Expand Up @@ -91,6 +92,9 @@
COL_FMT = 2
COL_EXPL = 3

WIKI_HELP_PAGE = URL_MANUAL_PAGE + "_-_Settings"
WIKI_HELP_SEC = _('Preferences')

#-------------------------------------------------------------------------
#
#
Expand Down Expand Up @@ -204,6 +208,8 @@ def __setup_pages(self, configure_page_funcs):
self.panel.append_page(widget, MarkupLabel(labeltitle))

def done(self, obj, value):
if value == Gtk.ResponseType.HELP:
return
if self.__on_close:
self.__on_close()
self.close()
Expand Down Expand Up @@ -523,6 +529,9 @@ def __init__(self, uistate, dbstate):
ConfigureDialog.__init__(self, uistate, dbstate, page_funcs,
GrampsPreferences, config,
on_close=update_constants)
help_btn = self.window.add_button(_('_Help'), Gtk.ResponseType.HELP)
help_btn.connect(
'clicked', lambda x: display_help(WIKI_HELP_PAGE, WIKI_HELP_SEC))
self.setup_configs('interface.grampspreferences', 700, 450)

def add_researcher_panel(self, configdialog):
Expand Down
5 changes: 3 additions & 2 deletions gramps/gui/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import os
import webbrowser
import sys
from urllib.parse import quote
#------------------------------------------------------------------------
#
# Gramps modules
Expand Down Expand Up @@ -65,9 +66,9 @@ def display_help(webpage='', section=''):
if not webpage:
link = URL_WIKISTRING + URL_MANUAL_PAGE + EXTENSION
else:
link = URL_WIKISTRING + webpage + EXTENSION
link = URL_WIKISTRING + quote(webpage) + EXTENSION
if section:
link = link + '#' + section
link += '#' + quote(section.replace(' ', '_')).replace('%', '.')
display_url(link)

def display_url(link, uistate=None):
Expand Down
17 changes: 17 additions & 0 deletions gramps/gui/glade/book.glade
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,23 @@
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button14">
<property name="label" translatable="yes">_Help</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<signal name="clicked" handler="on_book_help_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
<property name="secondary">True</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
Expand Down
32 changes: 32 additions & 0 deletions gramps/gui/glade/styleeditor.glade
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,22 @@
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="help_btn">
<property name="label">gtk-help</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_help_btn_style_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
<property name="secondary">True</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
Expand Down Expand Up @@ -1751,6 +1767,22 @@
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="help_btn_styles">
<property name="label">gtk-help</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_help_btn_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
<property name="secondary">True</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
Expand Down
12 changes: 12 additions & 0 deletions gramps/gui/plug/report/_bookdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
_ = glocale.translation.gettext
from ...listmodel import ListModel
from gramps.gen.errors import FilterError, ReportError
from gramps.gen.const import URL_MANUAL_PAGE
from ...display import display_help
from ...pluginmanager import GuiPluginManager
from ...dialog import WarningDialog, ErrorDialog, QuestionDialog2
from gramps.gen.plug.menu import PersonOption, FamilyOption
Expand All @@ -85,6 +87,10 @@

_RETURN = Gdk.keyval_from_name("Return")
_KP_ENTER = Gdk.keyval_from_name("KP_Enter")
WIKI_HELP_PAGE = URL_MANUAL_PAGE + "_-_Reports_-_part_3"
WIKI_HELP_SEC = _('Books')
GENERATE_WIKI_HELP_SEC = _('Generate_Book_dialog')

#------------------------------------------------------------------------
#
# Private Functions
Expand Down Expand Up @@ -173,6 +179,7 @@ def __init__(self, booklist, nodelete=False, dosave=False, parent=None):
"on_booklist_ok_clicked" : self.on_booklist_ok_clicked,
"on_booklist_delete_clicked" : self.on_booklist_delete_clicked,
"on_book_ok_clicked" : self.do_nothing,
"on_book_help_clicked" : self.do_nothing,
"destroy_passed_object" : self.do_nothing,
"on_setup_clicked" : self.do_nothing,
"on_down_clicked" : self.do_nothing,
Expand Down Expand Up @@ -342,6 +349,8 @@ def __init__(self, dbstate, uistate):
"on_save_clicked" : self.on_save_clicked,
"on_open_clicked" : self.on_open_clicked,
"on_edit_clicked" : self.on_edit_clicked,
"on_book_help_clicked" : lambda x: display_help(WIKI_HELP_PAGE,
WIKI_HELP_SEC),
"on_book_ok_clicked" : self.on_book_ok_clicked,
"destroy_passed_object" : self.on_close_clicked,

Expand Down Expand Up @@ -978,6 +987,9 @@ def make_doc_menu(self, active=None):
whether the document requires table support, etc."""
self.format_menu = _BookFormatComboBox(active)

def on_help_clicked(self, *obj):
display_help(WIKI_HELP_PAGE, GENERATE_WIKI_HELP_SEC)

def make_document(self):
"""Create a document of the type requested by the user."""
user = User(uistate=self.uistate)
Expand Down
10 changes: 10 additions & 0 deletions gramps/gui/plug/report/_styleeditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@
from ...managedwindow import ManagedWindow
from ...glade import Glade
from ...dialog import ErrorDialog
from ...display import display_help
from gramps.gen.const import URL_MANUAL_PAGE

WIKI_HELP_PAGE = URL_MANUAL_PAGE + "_-_Settings"

#------------------------------------------------------------------------
#
Expand Down Expand Up @@ -100,8 +104,11 @@ def __init__(self, stylesheetlist, uistate, track, callback=None):
"on_button_press" : self.on_button_press,
"on_edit_clicked" : self.on_edit_clicked,
"on_cancel_clicked" : self.__cancel,
"on_help_btn_clicked" : lambda x: display_help(
WIKI_HELP_PAGE, _('manual|Document_Styles_dialog')),
"on_cancel_style_clicked" : dummy_callback,
"on_save_style_clicked" : dummy_callback,
"on_help_btn_style_clicked" : dummy_callback,
})

self.list = ListModel(self.top.get_object("list"),
Expand Down Expand Up @@ -230,12 +237,15 @@ def __init__(self, name, style, parent):
self.top.connect_signals({
"on_save_style_clicked" : self.on_save_style_clicked,
"on_cancel_style_clicked" : self.__cancel,
"on_help_btn_style_clicked" : lambda x: display_help(
WIKI_HELP_PAGE, _('manual|Style_editor_dialog')),
"on_cancel_clicked" : dummy_callback,
"on_ok_clicked" : dummy_callback,
"on_add_clicked" : dummy_callback,
"on_delete_clicked" : dummy_callback,
"on_button_press" : dummy_callback,
"on_edit_clicked" : dummy_callback,
"on_help_btn_clicked" : dummy_callback,
})

self.pname = self.top.get_object('pname')
Expand Down
2 changes: 1 addition & 1 deletion gramps/gui/selectors/selectperson.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def __init__(self, dbstate, uistate, track=[], title=None, filter=None,
elif title == _("Select Child"):
self.WIKI_HELP_SEC = _('manual|Select_Child_selector')
else:
self.WIKI_HELP_SEC = _('manual|Person_Reference_Editor')
self.WIKI_HELP_SEC = _('manual|Select_Person_selector')

BaseSelector.__init__(self, dbstate, uistate, track, filter,
skip, show_search_bar, default)
Expand Down
2 changes: 1 addition & 1 deletion gramps/gui/selectors/selectrepository.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ def get_from_handle_func(self):
return self.db.get_repository_from_handle

WIKI_HELP_PAGE = URL_MANUAL_SECT2
WIKI_HELP_SEC = _('manual|Repositories')
WIKI_HELP_SEC = _('manual|Select_Repository_selector')
2 changes: 2 additions & 0 deletions gramps/gui/widgets/grampletpane.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,8 @@ def __init__(self, pane, dbstate, uistate, title, **kwargs):
self.gstate = kwargs.get("state", "maximized")
self.data = kwargs.get("data", [])
self.help_url = kwargs.get("help_url", WIKI_HELP_PAGE)
if self.help_url == 'None':
self.help_url = None # to fix up the config file vers of None
##########
self.use_markup = False
self.pui = None # user code
Expand Down
15 changes: 14 additions & 1 deletion gramps/gui/widgets/reorderfam.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,23 @@
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.sgettext
from gramps.gen.db import DbTxn
from gramps.gen.const import URL_MANUAL_PAGE
from ..listmodel import ListModel
from ..display import display_help
from ..managedwindow import ManagedWindow
from ..glade import Glade
from gramps.gen.display.name import displayer as name_displayer

#-------------------------------------------------------------------------
#
# Constants
#
#-------------------------------------------------------------------------

WIKI_HELP_PAGE = URL_MANUAL_PAGE + "_-_Categories"
WIKI_HELP_SEC = _('manual|Reorder_Relationships_dialog')


#-------------------------------------------------------------------------
#
# Reorder class
Expand Down Expand Up @@ -93,7 +105,8 @@ def __init__(self, state, uistate, track, handle):

xml.get_object('ok').connect('clicked', self.ok_clicked)
xml.get_object('cancel').connect('clicked', self.cancel_clicked)

xml.get_object('help').connect(
'clicked', lambda x: display_help(WIKI_HELP_PAGE, WIKI_HELP_SEC))
fup = xml.get_object('fup')
fup.connect('clicked', self.fup_clicked)
fup.set_sensitive(fenable)
Expand Down
6 changes: 5 additions & 1 deletion gramps/plugins/tool/mediamanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
#
#-------------------------------------------------------------------------
WIKI_HELP_PAGE = '%s_-_Tools' % URL_MANUAL_PAGE
WIKI_HELP_SEC = _('manual|Media_Manager...')
WIKI_HELP_SEC = _('manual|Media_Manager')

#-------------------------------------------------------------------------
#
Expand All @@ -88,6 +88,10 @@ def __init__(self, dbstate, user, options_class, name, callback=None):
self.set_window(self.assistant, None, _('Media Manager'))
self.setup_configs('interface.mediaman', 780, 600)

help_btn = Gtk.Button.new_with_label(_('Help'))
help_btn.connect('clicked', self.on_help_clicked)
self.assistant.add_action_widget(help_btn)

self.assistant.connect('close', self.do_close)
self.assistant.connect('cancel', self.do_close)
self.assistant.connect('apply', self.run)
Expand Down
16 changes: 15 additions & 1 deletion gramps/plugins/tool/relcalc.glade
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<interface>
<requires lib="gtk+" version="3.10"/>
<object class="GtkDialog" id="relcalc">
<property name="visible">False</property>
<property name="can_focus">False</property>
<property name="type_hint">dialog</property>
<signal name="delete-event" handler="on_delete_event" swapped="no"/>
Expand Down Expand Up @@ -34,6 +33,21 @@
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="help_btn">
<property name="label">gtk-help</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
<property name="secondary">True</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
Expand Down
7 changes: 7 additions & 0 deletions gramps/plugins/tool/relcalc.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
from gramps.gui.views.treemodels import PeopleBaseModel, PersonTreeModel
from gramps.plugins.lib.libpersonview import BasePersonView
from gramps.gen.relationship import get_relationship_calculator
from gramps.gen.const import URL_MANUAL_PAGE
from gramps.gui.display import display_help

from gramps.gui.dialog import ErrorDialog
from gramps.gui.plug import tool
Expand All @@ -61,6 +63,8 @@
#-------------------------------------------------------------------------

column_names = [column[0] for column in BasePersonView.COLUMNS]
WIKI_HELP_PAGE = URL_MANUAL_PAGE + "_-_Tools"
WIKI_HELP_SEC = _('Relationship Calculator')

#-------------------------------------------------------------------------
#
Expand Down Expand Up @@ -144,6 +148,9 @@ def __init__(self, dbstate, user, options_class, name, callback=None):
self.changedkey = self.sel.connect('changed',self.on_apply_clicked)
self.closebtn = self.glade.get_object("button5")
self.closebtn.connect('clicked', self.close)
help_btn = self.glade.get_object("help_btn")
help_btn.connect('clicked', lambda x: display_help(WIKI_HELP_PAGE,
WIKI_HELP_SEC))

if not self.person:
self.window.hide()
Expand Down
6 changes: 3 additions & 3 deletions po/ar.po
Original file line number Diff line number Diff line change
Expand Up @@ -13638,7 +13638,7 @@ msgstr "محرر الموقع"
#: ../gramps/gui/editors/editmedia.py:68
#, fuzzy
msgid "manual|New_Media_dialog"
msgstr "manual|Media_Manager..."
msgstr "manual|Media_Manager"

#: ../gramps/gui/editors/editmedia.py:99
#: ../gramps/gui/editors/editmediaref.py:409
Expand Down Expand Up @@ -32221,8 +32221,8 @@ msgid "Looking for possible loop for each person"
msgstr "بحث عن {number_of} من الأشخاص"

#: ../gramps/plugins/tool/mediamanager.py:68
msgid "manual|Media_Manager..."
msgstr "manual|Media_Manager..."
msgid "manual|Media_Manager"
msgstr "manual|Media_Manager"

#: ../gramps/plugins/tool/mediamanager.py:88
#: ../gramps/plugins/tool/mediamanager.py:114
Expand Down
4 changes: 2 additions & 2 deletions po/bg.po
Original file line number Diff line number Diff line change
Expand Up @@ -33269,8 +33269,8 @@ msgid "Looking for possible loop for each person"
msgstr "Търсене за %d лице"

#: ../gramps/plugins/tool/mediamanager.py:68
msgid "manual|Media_Manager..."
msgstr ""
msgid "manual|Media_Manager"
msgstr "Управление_на_медиите"

#: ../gramps/plugins/tool/mediamanager.py:88
#: ../gramps/plugins/tool/mediamanager.py:114
Expand Down
4 changes: 2 additions & 2 deletions po/br.po
Original file line number Diff line number Diff line change
Expand Up @@ -32756,8 +32756,8 @@ msgid "Looking for possible loop for each person"
msgstr "O klask restroù roadennoù"

#: ../gramps/plugins/tool/mediamanager.py:68
msgid "manual|Media_Manager..."
msgstr ""
msgid "manual|Media_Manager"
msgstr "Ardoer_molladoù"

#: ../gramps/plugins/tool/mediamanager.py:88
#: ../gramps/plugins/tool/mediamanager.py:114
Expand Down
Loading

0 comments on commit 44180b4

Please sign in to comment.