Fix dialogs for 'Help' button closes the dialog, and non-functional 'Help' (#727)

* Fix Family Tree manager for 'Help' button closes dialog

Fixes #10589

* Fix selectors for 'Help' button closes dialog

Fixes #10589

* Fix 'Generate Book' dialog for 'Help' button closes dialog

Fixes #10589

* Fix TestcaseGenerator for 'Help' button closes dialog

Fixes #10589

* Fix Selectors to enable the 'Help' buttons to actually work

Fixes #10589
This commit is contained in:
Paul Culley 2018-11-27 15:30:06 -06:00 committed by Sam Manzi
parent b32e9d812e
commit 4c7b24ba30
14 changed files with 60 additions and 49 deletions

View File

@ -65,6 +65,7 @@
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">False</property> <property name="fill">False</property>
<property name="position">2</property> <property name="position">2</property>
<property name="secondary">True</property>
</packing> </packing>
</child> </child>
</object> </object>
@ -161,7 +162,6 @@
<action-widgets> <action-widgets>
<action-widget response="-6">cancelbutton1</action-widget> <action-widget response="-6">cancelbutton1</action-widget>
<action-widget response="-5">okbutton1</action-widget> <action-widget response="-5">okbutton1</action-widget>
<action-widget response="-11">help</action-widget>
</action-widgets> </action-widgets>
</object> </object>
</interface> </interface>

View File

@ -159,6 +159,7 @@
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">False</property> <property name="fill">False</property>
<property name="position">2</property> <property name="position">2</property>
<property name="secondary">True</property>
</packing> </packing>
</child> </child>
</object> </object>
@ -375,7 +376,6 @@
<action-widgets> <action-widgets>
<action-widget response="-7">cancel_btn</action-widget> <action-widget response="-7">cancel_btn</action-widget>
<action-widget response="-5">connect_btn</action-widget> <action-widget response="-5">connect_btn</action-widget>
<action-widget response="-11">help_btn</action-widget>
</action-widgets> </action-widgets>
</object> </object>
</interface> </interface>

View File

@ -929,7 +929,10 @@ class BookDialog(DocReportDialog):
'book', self.title, track=track) 'book', self.title, track=track)
self.options.options_dict['bookname'] = self.book.get_name() self.options.options_dict['bookname'] = self.book.get_name()
response = self.window.run() while True:
response = self.window.run()
if response != Gtk.ResponseType.HELP:
break
if response == Gtk.ResponseType.OK: if response == Gtk.ResponseType.OK:
handler = self.options.handler handler = self.options.handler
if self.book.get_paper_name() != handler.get_paper_name(): if self.book.get_paper_name() != handler.get_paper_name():

View File

@ -36,6 +36,8 @@ from ..managedwindow import ManagedWindow
from ..filters import SearchBar from ..filters import SearchBar
from ..glade import Glade from ..glade import Glade
from ..widgets.interactivesearchbox import InteractiveSearchBox from ..widgets.interactivesearchbox import InteractiveSearchBox
from ..display import display_help
from gramps.gen.const import URL_MANUAL_PAGE
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -86,6 +88,9 @@ class BaseSelector(ManagedWindow):
self.tree.set_headers_clickable(True) self.tree.set_headers_clickable(True)
self.tree.connect('row-activated', self._on_row_activated) self.tree.connect('row-activated', self._on_row_activated)
self.tree.grab_focus() self.tree.grab_focus()
self.define_help_button(
self.glade.get_object('help'), self.WIKI_HELP_PAGE,
self.WIKI_HELP_SEC)
# connect to signal for custom interactive-search # connect to signal for custom interactive-search
self.searchbox = InteractiveSearchBox(self.tree) self.searchbox = InteractiveSearchBox(self.tree)
@ -358,3 +363,7 @@ class BaseSelector(ManagedWindow):
def close(self, *obj): def close(self, *obj):
ManagedWindow.close(self) ManagedWindow.close(self)
self._cleanup_on_exit() self._cleanup_on_exit()
def define_help_button(self, button, webpage='', section=''):
""" Setup to deal with help button """
button.connect('clicked', lambda x: display_help(webpage, section))

View File

@ -39,7 +39,6 @@ from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.sgettext _ = glocale.translation.sgettext
from ..views.treemodels import CitationTreeModel from ..views.treemodels import CitationTreeModel
from .baseselector import BaseSelector from .baseselector import BaseSelector
from ..display import display_help
from gramps.gen.const import URL_MANUAL_SECT2 from gramps.gen.const import URL_MANUAL_SECT2
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -47,8 +46,6 @@ from gramps.gen.const import URL_MANUAL_SECT2
# Constants # Constants
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
WIKI_HELP_PAGE = URL_MANUAL_SECT2
WIKI_HELP_SEC = _('manual|Select_Source_or_Citation_selector')
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -84,3 +81,6 @@ class SelectCitation(BaseSelector):
return self.db.get_source_from_handle(handle) return self.db.get_source_from_handle(handle)
else: else:
return self.db.get_citation_from_handle(handle) return self.db.get_citation_from_handle(handle)
WIKI_HELP_PAGE = URL_MANUAL_SECT2
WIKI_HELP_SEC = _('manual|Select_Source_or_Citation_selector')

View File

@ -34,7 +34,6 @@ from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.sgettext _ = glocale.translation.sgettext
from ..views.treemodels import EventModel from ..views.treemodels import EventModel
from .baseselector import BaseSelector from .baseselector import BaseSelector
from ..display import display_help
from gramps.gen.const import URL_MANUAL_SECT1 from gramps.gen.const import URL_MANUAL_SECT1
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -42,8 +41,6 @@ from gramps.gen.const import URL_MANUAL_SECT1
# Constants # Constants
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
WIKI_HELP_PAGE = URL_MANUAL_SECT1
WIKI_HELP_SEC = _('manual|Select_Event_selector')
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -77,3 +74,6 @@ class SelectEvent(BaseSelector):
def get_from_handle_func(self): def get_from_handle_func(self):
return self.db.get_event_from_handle return self.db.get_event_from_handle
WIKI_HELP_PAGE = URL_MANUAL_SECT1
WIKI_HELP_SEC = _('manual|Select_Event_selector')

View File

@ -34,7 +34,6 @@ from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.sgettext _ = glocale.translation.sgettext
from ..views.treemodels import FamilyModel from ..views.treemodels import FamilyModel
from .baseselector import BaseSelector from .baseselector import BaseSelector
from ..display import display_help
from gramps.gen.const import URL_MANUAL_PAGE from gramps.gen.const import URL_MANUAL_PAGE
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -42,8 +41,6 @@ from gramps.gen.const import URL_MANUAL_PAGE
# Constants # Constants
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
WIKI_HELP_PAGE = '%s_-_Categories' % URL_MANUAL_PAGE
WIKI_HELP_SEC = _('manual|Select_Family_selector')
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -74,3 +71,6 @@ class SelectFamily(BaseSelector):
def get_from_handle_func(self): def get_from_handle_func(self):
return self.db.get_family_from_handle return self.db.get_family_from_handle
WIKI_HELP_PAGE = '%s_-_Categories' % URL_MANUAL_PAGE
WIKI_HELP_SEC = _('manual|Select_Family_selector')

View File

@ -37,7 +37,6 @@ from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.sgettext _ = glocale.translation.sgettext
from ..views.treemodels import NoteModel from ..views.treemodels import NoteModel
from .baseselector import BaseSelector from .baseselector import BaseSelector
from ..display import display_help
from gramps.gen.const import URL_MANUAL_SECT1 from gramps.gen.const import URL_MANUAL_SECT1
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -45,8 +44,6 @@ from gramps.gen.const import URL_MANUAL_SECT1
# Constants # Constants
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
WIKI_HELP_PAGE = URL_MANUAL_SECT1
WIKI_HELP_SEC = _('manual|Select_Note_selector')
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -80,3 +77,6 @@ class SelectNote(BaseSelector):
def get_from_handle_func(self): def get_from_handle_func(self):
return self.db.get_note_from_handle return self.db.get_note_from_handle
WIKI_HELP_PAGE = URL_MANUAL_SECT1
WIKI_HELP_SEC = _('manual|Select_Note_selector')

View File

@ -48,7 +48,6 @@ from gramps.gen.utils.file import media_path_full
from gramps.gen.utils.thumbnails import get_thumbnail_image from gramps.gen.utils.thumbnails import get_thumbnail_image
from ..views.treemodels import MediaModel from ..views.treemodels import MediaModel
from .baseselector import BaseSelector from .baseselector import BaseSelector
from ..display import display_help
from gramps.gen.const import URL_MANUAL_SECT1 from gramps.gen.const import URL_MANUAL_SECT1
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -56,8 +55,6 @@ from gramps.gen.const import URL_MANUAL_SECT1
# Constants # Constants
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
WIKI_HELP_PAGE = URL_MANUAL_SECT1
WIKI_HELP_SEC = _('manual|Select_Media_Object_selector')
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -106,3 +103,6 @@ class SelectObject(BaseSelector):
pix = get_thumbnail_image(media_path_full(self.db, obj.get_path())) pix = get_thumbnail_image(media_path_full(self.db, obj.get_path()))
self.preview.set_from_pixbuf(pix) self.preview.set_from_pixbuf(pix)
gc.collect() gc.collect()
WIKI_HELP_PAGE = URL_MANUAL_SECT1
WIKI_HELP_SEC = _('manual|Select_Media_Object_selector')

View File

@ -36,7 +36,6 @@ from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.sgettext _ = glocale.translation.sgettext
from ..views.treemodels import PeopleBaseModel, PersonTreeModel from ..views.treemodels import PeopleBaseModel, PersonTreeModel
from .baseselector import BaseSelector from .baseselector import BaseSelector
from ..display import display_help
from gramps.gen.const import URL_MANUAL_SECT1 from gramps.gen.const import URL_MANUAL_SECT1
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -45,17 +44,6 @@ from gramps.gen.const import URL_MANUAL_SECT1
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# This dialog changes depending on the string pass for the title.
# https://gramps-project.org/wiki/index.php?title=Gramps_4.2_Wiki_Manual_-_Entering_and_editing_data:_detailed_-_part_1#Select_Child_selector
# https://gramps-project.org/wiki/index.php?title=Gramps_4.2_Wiki_Manual_-_Entering_and_editing_data:_detailed_-_part_1#Select_Father_selector
# https://gramps-project.org/wiki/index.php?title=Gramps_4.2_Wiki_Manual_-_Entering_and_editing_data:_detailed_-_part_1#Select_Mother_selector
WIKI_HELP_PAGE = URL_MANUAL_SECT1
WIKI_HELP_SEC = _('manual|Select_Child_selector')
WIKI_HELP_PAGE2 = URL_MANUAL_SECT1
WIKI_HELP_SEC2 = _('manual|Select_Father_selector')
WIKI_HELP_PAGE3 = URL_MANUAL_SECT1
WIKI_HELP_SEC3 = _('manual|Select_Mother_selector')
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -71,6 +59,15 @@ class SelectPerson(BaseSelector):
# instead of the default defined for get_window_title() # instead of the default defined for get_window_title()
if title is not None: if title is not None:
self.title = title self.title = title
self.WIKI_HELP_PAGE = URL_MANUAL_SECT1
if title == _("Select Father"):
self.WIKI_HELP_SEC = _('manual|Select_Father_selector')
elif title == _("Select Mother"):
self.WIKI_HELP_SEC = _('manual|Select_Mother_selector')
elif title == _("Select Child"):
self.WIKI_HELP_SEC = _('manual|Select_Child_selector')
else:
self.WIKI_HELP_SEC = _('manual|Person_Reference_Editor')
BaseSelector.__init__(self, dbstate, uistate, track, filter, BaseSelector.__init__(self, dbstate, uistate, track, filter,
skip, show_search_bar, default) skip, show_search_bar, default)

View File

@ -35,7 +35,6 @@ from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.sgettext _ = glocale.translation.sgettext
from ..views.treemodels.placemodel import PlaceTreeModel from ..views.treemodels.placemodel import PlaceTreeModel
from .baseselector import BaseSelector from .baseselector import BaseSelector
from ..display import display_help
from gramps.gen.const import URL_MANUAL_SECT2 from gramps.gen.const import URL_MANUAL_SECT2
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -43,8 +42,6 @@ from gramps.gen.const import URL_MANUAL_SECT2
# Constants # Constants
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
WIKI_HELP_PAGE = URL_MANUAL_SECT2
WIKI_HELP_SEC = _('manual|Select_Place_selector')
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -76,3 +73,6 @@ class SelectPlace(BaseSelector):
def get_from_handle_func(self): def get_from_handle_func(self):
return self.db.get_place_from_handle return self.db.get_place_from_handle
WIKI_HELP_PAGE = URL_MANUAL_SECT2
WIKI_HELP_SEC = _('manual|Select_Place_selector')

View File

@ -34,7 +34,6 @@ from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.sgettext _ = glocale.translation.sgettext
from ..views.treemodels import RepositoryModel from ..views.treemodels import RepositoryModel
from .baseselector import BaseSelector from .baseselector import BaseSelector
from ..display import display_help
from gramps.gen.const import URL_MANUAL_SECT2 from gramps.gen.const import URL_MANUAL_SECT2
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -42,8 +41,6 @@ from gramps.gen.const import URL_MANUAL_SECT2
# Constants # Constants
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
WIKI_HELP_PAGE = URL_MANUAL_SECT2
WIKI_HELP_SEC = _('manual|Repositories')
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -73,3 +70,6 @@ class SelectRepository(BaseSelector):
def get_from_handle_func(self): def get_from_handle_func(self):
return self.db.get_repository_from_handle return self.db.get_repository_from_handle
WIKI_HELP_PAGE = URL_MANUAL_SECT2
WIKI_HELP_SEC = _('manual|Repositories')

View File

@ -34,16 +34,13 @@ from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.sgettext _ = glocale.translation.sgettext
from ..views.treemodels import SourceModel from ..views.treemodels import SourceModel
from .baseselector import BaseSelector from .baseselector import BaseSelector
from ..display import display_help from gramps.gen.const import URL_MANUAL_SECT2
from gramps.gen.const import URL_MANUAL_PAGE
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# Constants # Constants
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# WIKI_HELP_PAGE = '%s_-_xxx' % URL_MANUAL_PAGE # FIXME
# WIKI_HELP_SEC = _('manual|xxxx') # FIXME
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -74,3 +71,6 @@ class SelectSource(BaseSelector):
def get_from_handle_func(self): def get_from_handle_func(self):
return self.db.get_source_from_handle return self.db.get_source_from_handle
WIKI_HELP_PAGE = URL_MANUAL_SECT2
WIKI_HELP_SEC = _('manual|Select_Source_selector')

View File

@ -329,7 +329,13 @@ class TestcaseGenerator(tool.BatchTool):
self.top.add_button(_('_Help'), Gtk.ResponseType.HELP) self.top.add_button(_('_Help'), Gtk.ResponseType.HELP)
self.top.show_all() self.top.show_all()
response = self.top.run() while True:
response = self.top.run()
if response == Gtk.ResponseType.HELP:
display_help(webpage=WIKI_HELP_PAGE,
section=WIKI_HELP_SEC)
else:
break
self.options_dict['lowlevel'] = int( self.options_dict['lowlevel'] = int(
self.check_lowlevel.get_active()) self.check_lowlevel.get_active())
self.options_dict['bugs'] = int( self.options_dict['bugs'] = int(
@ -348,14 +354,10 @@ class TestcaseGenerator(tool.BatchTool):
self.entry_count.get_text()) self.entry_count.get_text())
self.top.destroy() self.top.destroy()
if response == Gtk.ResponseType.HELP: if response == Gtk.ResponseType.OK:
display_help(webpage=WIKI_HELP_PAGE, self.run_tool(cli=False)
section=WIKI_HELP_SEC) # Save options
else: self.options.handler.save_options()
if response == Gtk.ResponseType.OK:
self.run_tool(cli=False)
# Save options
self.options.handler.save_options()
def on_dummy_data_clicked(self, obj): def on_dummy_data_clicked(self, obj):
self.label.set_sensitive(obj.get_active()) self.label.set_sensitive(obj.get_active())