diff --git a/gramps/gui/managedwindow.py b/gramps/gui/managedwindow.py index a5b842f2e..2b9cfca88 100644 --- a/gramps/gui/managedwindow.py +++ b/gramps/gui/managedwindow.py @@ -336,7 +336,7 @@ class ManagedWindow: from .managedwindow import ManagedWindow class SomeWindowClass(ManagedWindow): - def __init__(self, uistate, dbstate, track, modal): + def __init__(self, uistate, track, obj, modal): window_id = self # Or e.g. window_id = person.handle ManagedWindow.__init__(self, uistate, @@ -354,10 +354,11 @@ class ManagedWindow: :param track: {list of parent windows, [] if the main GRAMPS window is the parent} :param obj: The object that is used to id the managed window, - The inheriting object needs a method build_menu_names(self, obj) + The inheriting object needs a method + build_menu_names(self, obj) which works on this obj and creates menu labels for use in the Gramps Window Menu. - If self.submenu_label ='' then leaf, otherwise branch + If self.submenu_label ='' then leaf, else branch :param modal: True/False, if True, this window is made modal (always on top, and always has focus). Any child windows are also automatically made modal by moving @@ -425,8 +426,10 @@ class ManagedWindow: """ Set the window that is managed. - :param window: if isWindow=False window must be a Gtk.Window() object, otherwise None - :param title: a label widget in which to write the title, None if not needed + :param window: if isWindow=False window must be a Gtk.Window() object + (or a subclass such as Gtk.Dialog), otherwise None + :param title: a label widget in which to write the title, + else None if not needed :param text: text to use as title of window and in title param :param msg: if not None, use msg as title of window instead of text :param isWindow: {if isWindow than self is the window diff --git a/gramps/gui/plug/_windows.py b/gramps/gui/plug/_windows.py index 22b4d269b..ed6bba62a 100644 --- a/gramps/gui/plug/_windows.py +++ b/gramps/gui/plug/_windows.py @@ -883,7 +883,7 @@ class ToolManagedWindowBase(ManagedWindow): def pre_run(self): from ..utils import ProgressMeter self.progress = ProgressMeter(self.get_title(), - parent=self.uistate.window) + parent=self.window) def run(self): raise NotImplementedError("tool needs to define a run() method") diff --git a/gramps/plugins/tool/changenames.glade b/gramps/plugins/tool/changenames.glade index e89e42fa5..6a12129ab 100644 --- a/gramps/plugins/tool/changenames.glade +++ b/gramps/plugins/tool/changenames.glade @@ -5,8 +5,6 @@ False False - 500 - 450 diff --git a/gramps/plugins/tool/changenames.py b/gramps/plugins/tool/changenames.py index 8c0b65590..e22cd7fe2 100644 --- a/gramps/plugins/tool/changenames.py +++ b/gramps/plugins/tool/changenames.py @@ -186,6 +186,7 @@ class ChangeNames(tool.BatchTool, ManagedWindow): self.list = self.top.get_object("list") self.set_window(window,self.top.get_object('title'),self.label) + self.setup_configs('interface.changenames', 500, 450) self.model = Gtk.ListStore(GObject.TYPE_BOOLEAN, GObject.TYPE_STRING, GObject.TYPE_STRING) diff --git a/gramps/plugins/tool/changetypes.py b/gramps/plugins/tool/changetypes.py index 5aa20c54c..bf13bf0f0 100644 --- a/gramps/plugins/tool/changetypes.py +++ b/gramps/plugins/tool/changetypes.py @@ -94,6 +94,7 @@ class ChangeTypes(tool.BatchTool, ManagedWindow): window = self.glade.toplevel self.set_window(window,self.glade.get_object('title'),self.title) + self.setup_configs('interface.changetypes', 640, 260) self.glade.connect_signals({ "on_close_clicked" : self.close, diff --git a/gramps/plugins/tool/dumpgenderstats.py b/gramps/plugins/tool/dumpgenderstats.py index 1be4712d8..fd0dc5844 100644 --- a/gramps/plugins/tool/dumpgenderstats.py +++ b/gramps/plugins/tool/dumpgenderstats.py @@ -68,16 +68,16 @@ class DumpGenderStats(tool.Tool, ManagedWindow): treeview = Gtk.TreeView() model = ListModel(treeview, titles) - for entry in stats_list: + for entry in sorted(stats_list): model.add(entry, entry[0]) - window = Gtk.Window() - window.set_default_size(400, 300) + window = Gtk.Window() # TODO there needs to be a way to "close" it s = Gtk.ScrolledWindow() s.add(treeview) window.add(s) window.show_all() self.set_window(window, None, self.label) + self.setup_configs('interface.dumpgenderstats', 400, 300) self.show() else: diff --git a/gramps/plugins/tool/eventcmp.glade b/gramps/plugins/tool/eventcmp.glade index f047665bd..f0320b0ac 100644 --- a/gramps/plugins/tool/eventcmp.glade +++ b/gramps/plugins/tool/eventcmp.glade @@ -4,8 +4,6 @@ False - 500 - 400 dialog @@ -139,7 +137,6 @@ False - 400 dialog diff --git a/gramps/plugins/tool/eventcmp.py b/gramps/plugins/tool/eventcmp.py index 052a49c23..23666941a 100644 --- a/gramps/plugins/tool/eventcmp.py +++ b/gramps/plugins/tool/eventcmp.py @@ -138,6 +138,7 @@ class EventComparison(tool.Tool,ManagedWindow): self.label = _('Event comparison filter selection') self.set_window(window,self.filterDialog.get_object('title'), self.label) + self.setup_configs('interface.eventcomparison', 640, 220) self.on_filters_changed('Person') uistate.connect('filters-changed', self.on_filters_changed) @@ -193,7 +194,7 @@ class EventComparison(tool.Tool,ManagedWindow): WarningDialog(_("No matches were found"), parent=self.window) else: - DisplayChart(self.dbstate,self.uistate,plist,self.track) + EventComparisonResults(self.dbstate, self.uistate, plist, self.track) #------------------------------------------------------------------------- # @@ -217,7 +218,7 @@ def fix(line): # # #------------------------------------------------------------------------- -class DisplayChart(ManagedWindow): +class EventComparisonResults(ManagedWindow): def __init__(self,dbstate,uistate,people_list,track): self.dbstate = dbstate self.uistate = uistate @@ -241,6 +242,7 @@ class DisplayChart(ManagedWindow): window = self.topDialog.toplevel self.set_window(window, self.topDialog.get_object('title'), _('Event Comparison Results')) + self.setup_configs('interface.eventcomparisonresults', 750, 400) self.eventlist = self.topDialog.get_object('treeview') self.sort = Sort(self.db) @@ -307,7 +309,7 @@ class DisplayChart(ManagedWindow): def build_row_data(self): self.progress_bar = ProgressMeter( - _('Comparing Events'), '', parent=self.window) + _('Comparing Events'), '', parent=self.uistate.window) self.progress_bar.set_pass(_('Building data'),len(self.my_list)) for individual_id in self.my_list: individual = self.db.get_person_from_handle(individual_id) diff --git a/gramps/plugins/tool/finddupes.glade b/gramps/plugins/tool/finddupes.glade index 0b836f604..5aae1108e 100644 --- a/gramps/plugins/tool/finddupes.glade +++ b/gramps/plugins/tool/finddupes.glade @@ -10,7 +10,6 @@ False - 350 dialog diff --git a/gramps/plugins/tool/finddupes.py b/gramps/plugins/tool/finddupes.py index 1cd529bd7..b1ae4d811 100644 --- a/gramps/plugins/tool/finddupes.py +++ b/gramps/plugins/tool/finddupes.py @@ -84,7 +84,7 @@ def is_initial(name): # The Actual tool. # #------------------------------------------------------------------------- -class Merge(tool.Tool,ManagedWindow): +class DuplicatePeopleTool(tool.Tool, ManagedWindow): def __init__(self, dbstate, user, options_class, name, callback=None): uistate = user.uistate @@ -124,6 +124,7 @@ class Merge(tool.Tool,ManagedWindow): window = top.toplevel self.set_window(window, top.get_object('title'), _('Find Possible Duplicate People')) + self.setup_configs('interface.duplicatepeopletool', 350, 220) top.connect_signals({ "on_do_merge_clicked" : self.__dummy, @@ -178,8 +179,9 @@ class Merge(tool.Tool,ManagedWindow): parent=self.window) else: try: - ShowMatches(self.dbstate,self.uistate,self.track, - self.list,self.map,self.update) + DuplicatePeopleToolMatches(self.dbstate, self.uistate, + self.track, self.list, self.map, + self.update) except WindowActiveError: pass @@ -533,7 +535,7 @@ class Merge(tool.Tool,ManagedWindow): pass -class ShowMatches(ManagedWindow): +class DuplicatePeopleToolMatches(ManagedWindow): def __init__(self, dbstate, uistate, track, the_list, the_map, callback): ManagedWindow.__init__(self,uistate,track,self.__class__) @@ -551,6 +553,7 @@ class ShowMatches(ManagedWindow): window = top.toplevel self.set_window(window, top.get_object('title'), _('Potential Merges')) + self.setup_configs('interface.duplicatepeopletoolmatches', 500, 350) self.mlist = top.get_object("mlist") top.connect_signals({ @@ -665,7 +668,7 @@ def get_surnames(name): # # #------------------------------------------------------------------------ -class MergeOptions(tool.ToolOptions): +class DuplicatePeopleToolOptions(tool.ToolOptions): """ Defines options and provides handling interface. """ diff --git a/gramps/plugins/tool/mergecitations.glade b/gramps/plugins/tool/mergecitations.glade index 074c56fcc..170422ffb 100644 --- a/gramps/plugins/tool/mergecitations.glade +++ b/gramps/plugins/tool/mergecitations.glade @@ -10,7 +10,6 @@ False - 350 dialog diff --git a/gramps/plugins/tool/mergecitations.py b/gramps/plugins/tool/mergecitations.py index e30ca094b..f3567a4b0 100644 --- a/gramps/plugins/tool/mergecitations.py +++ b/gramps/plugins/tool/mergecitations.py @@ -131,7 +131,8 @@ class MergeCitations(tool.BatchTool,ManagedWindow): # _('Merge citations')) self.set_window(window, top.get_object('title2'), _("Notes, media objects and data-items of matching " - "citations will be combined.")) + "citations will be combined.")) + self.setup_configs('interface.mergecitations', 700, 230) top.connect_signals({ "on_merge_ok_clicked" : self.on_merge_ok_clicked, @@ -182,7 +183,7 @@ class MergeCitations(tool.BatchTool,ManagedWindow): self.options.handler.save_options() self.progress = ProgressMeter(_('Checking Sources'), '', - parent=self.user.uistate.window) + parent=self.window) self.progress.set_pass(_('Looking for citation fields'), self.db.get_number_of_citations()) @@ -234,7 +235,7 @@ class MergeCitations(tool.BatchTool,ManagedWindow): ngettext("{number_of} citation merged", "{number_of} citations merged", num_merges ).format(number_of=num_merges), - parent=self.user.uistate.window) + parent=self.window) self.close(obj) #------------------------------------------------------------------------ diff --git a/gramps/plugins/tool/notrelated.glade b/gramps/plugins/tool/notrelated.glade index a8b5d75a8..ed8302f5d 100644 --- a/gramps/plugins/tool/notrelated.glade +++ b/gramps/plugins/tool/notrelated.glade @@ -4,8 +4,6 @@ False - 450 - 400 dialog diff --git a/gramps/plugins/tool/notrelated.py b/gramps/plugins/tool/notrelated.py index 97a66435a..a60eb1353 100644 --- a/gramps/plugins/tool/notrelated.py +++ b/gramps/plugins/tool/notrelated.py @@ -93,6 +93,7 @@ class NotRelated(tool.ActivePersonTool, ManagedWindow) : window = topDialog.toplevel title = topDialog.get_object("title") self.set_window(window, title, self.title) + self.setup_configs('interface.notrelated', 450, 400) self.tagcombo = topDialog.get_object("tagcombo") tagmodel = Gtk.ListStore(str) @@ -108,7 +109,7 @@ class NotRelated(tool.ActivePersonTool, ManagedWindow) : # start the progress indicator self.progress = ProgressMeter(self.title, _('Starting'), - parent=self.window) + parent=self.uistate.window) # setup the columns self.model = Gtk.TreeStore( diff --git a/gramps/plugins/tool/ownereditor.glade b/gramps/plugins/tool/ownereditor.glade index d177926c4..7a4c3ce06 100644 --- a/gramps/plugins/tool/ownereditor.glade +++ b/gramps/plugins/tool/ownereditor.glade @@ -35,7 +35,6 @@ False center - 500 diff --git a/gramps/plugins/tool/ownereditor.py b/gramps/plugins/tool/ownereditor.py index e554fcfff..90fab537d 100644 --- a/gramps/plugins/tool/ownereditor.py +++ b/gramps/plugins/tool/ownereditor.py @@ -100,6 +100,7 @@ class OwnerEditor(tool.Tool, ManagedWindow): self.set_window(window, topDialog.get_object("title"), _("Database Owner Editor")) + self.setup_configs('interface.ownereditor', 500, 400) # move help button to the left side action_area = topDialog.get_object("action_area") diff --git a/gramps/plugins/tool/removeunused.glade b/gramps/plugins/tool/removeunused.glade index 43068844a..8de6d2531 100644 --- a/gramps/plugins/tool/removeunused.glade +++ b/gramps/plugins/tool/removeunused.glade @@ -4,8 +4,6 @@ False - 500 - 300 dialog diff --git a/gramps/plugins/tool/removeunused.py b/gramps/plugins/tool/removeunused.py index b41e0437b..c5b63c47f 100644 --- a/gramps/plugins/tool/removeunused.py +++ b/gramps/plugins/tool/removeunused.py @@ -130,6 +130,7 @@ class RemoveUnused(tool.Tool, ManagedWindow, UpdateCallback): self.top = Glade() window = self.top.toplevel self.set_window(window, self.top.get_object('title'), self.title) + self.setup_configs('interface.removeunused', 400, 520) self.events_box = self.top.get_object('events_box') self.sources_box = self.top.get_object('sources_box') diff --git a/gramps/plugins/tool/tools.gpr.py b/gramps/plugins/tool/tools.gpr.py index 6ee145eeb..8b3484503 100644 --- a/gramps/plugins/tool/tools.gpr.py +++ b/gramps/plugins/tool/tools.gpr.py @@ -157,8 +157,8 @@ fname = 'finddupes.py', authors = ["Donald N. Allingham"], authors_email = ["don@gramps-project.org"], category = TOOL_DBPROC, -toolclass = 'Merge', -optionclass = 'MergeOptions', +toolclass = 'DuplicatePeopleTool', +optionclass = 'DuplicatePeopleToolOptions', tool_modes = [TOOL_MODE_GUI] )