From ca105fb73ad0935f9919381fe42f8b1acb509ca3 Mon Sep 17 00:00:00 2001 From: Paul Franklin Date: Thu, 8 Dec 2016 14:28:42 -0800 Subject: [PATCH] 9795: remember the last location of windows [partial: the editrefs] --- gramps/gen/config.py | 14 -------------- gramps/gui/editors/editchildref.py | 12 +++++------- gramps/gui/editors/editeventref.py | 4 ++-- gramps/gui/editors/editmediaref.py | 6 +++--- gramps/gui/editors/editpersonref.py | 18 ++++++++---------- gramps/gui/editors/editplaceref.py | 5 +++-- gramps/gui/editors/editreference.py | 2 +- gramps/gui/editors/editreporef.py | 3 +-- gramps/gui/editors/editsecondary.py | 5 +++++ 9 files changed, 28 insertions(+), 41 deletions(-) diff --git a/gramps/gen/config.py b/gramps/gen/config.py index 77ace7d9a..4f7b2e395 100644 --- a/gramps/gen/config.py +++ b/gramps/gen/config.py @@ -192,15 +192,11 @@ register('interface.address-height', 450) register('interface.address-width', 650) register('interface.attribute-height', 350) register('interface.attribute-width', 600) -register('interface.child-ref-height', 450) -register('interface.child-ref-width', 600) register('interface.dont-ask', False) register('interface.view-categories', ["Dashboard", "People", "Relationships", "Families", "Ancestry", "Events", "Places", "Geography", "Sources", "Citations", "Repositories", "Media", "Notes"]) -register('interface.event-ref-height', 450) -register('interface.event-ref-width', 600) register('interface.filter', False) register('interface.fullscreen', False) register('interface.grampletbar-close', False) @@ -216,8 +212,6 @@ register('interface.main-window-horiz-position', 15) register('interface.main-window-vert-position', 10) register('interface.main-window-width', 775) register('interface.mapservice', 'OpenStreetMap') -register('interface.media-ref-height', 450) -register('interface.media-ref-width', 600) register('interface.name-height', 350) register('interface.name-width', 600) register('interface.open-with-default-viewer', False) @@ -227,20 +221,12 @@ register('interface.pedview-show-marriage', False) register('interface.pedview-tree-size', 5) register('interface.pedview-tree-direction', 2) register('interface.pedview-show-unknown-people', False) -register('interface.person-ref-height', 350) -register('interface.person-ref-width', 600) register('interface.place-name-height', 100) register('interface.place-name-width', 450) -register('interface.place-ref-height', 450) -register('interface.place-ref-width', 600) register('interface.relcalc-height', 400) register('interface.relcalc-width', 600) -register('interface.repo-ref-height', 450) -register('interface.repo-ref-width', 600) register('interface.sidebar-text', True) register('interface.size-checked', False) -register('interface.source-ref-height', 450) -register('interface.source-ref-width', 600) register('interface.statusbar', 1) register('interface.toolbar-on', True) register('interface.url-height', 150) diff --git a/gramps/gui/editors/editchildref.py b/gramps/gui/editors/editchildref.py index 9ffe07a2f..2fe248884 100644 --- a/gramps/gui/editors/editchildref.py +++ b/gramps/gui/editors/editchildref.py @@ -21,8 +21,7 @@ # """ -The EditChildRef module provides the EditChildRef class. This provides a -mechanism for the user to edit address information. +The EditChildRef module provides the EditChildRef class. """ #------------------------------------------------------------------------- @@ -78,28 +77,27 @@ _RIGHT_BUTTON = 3 #------------------------------------------------------------------------- class EditChildRef(EditSecondary): """ - Displays a dialog that allows the user to edit an address. + Displays a dialog that allows the user to edit a child reference. """ + def __init__(self, name, dbstate, uistate, track, childref, callback): """ Displays the dialog box. - parent - The class that called the ChildRef editor. - addr - The address that is to be edited + childref - The child reference that is to be edited """ self.name = name EditSecondary.__init__(self, dbstate, uistate, track, childref, callback) def _local_init(self): - self.width_key = 'interface.child-ref-width' - self.height_key = 'interface.child-ref-height' self.top = Glade() self.set_window(self.top.toplevel, self.top.get_object("title"), self.name, _('Child Reference Editor')) + self.setup_configs('interface.child-ref', 600, 450) self.ok_button = self.top.get_object('ok') self.edit_button = self.top.get_object('edit') diff --git a/gramps/gui/editors/editeventref.py b/gramps/gui/editors/editeventref.py index b06bb31dd..2b678debc 100644 --- a/gramps/gui/editors/editeventref.py +++ b/gramps/gui/editors/editeventref.py @@ -69,13 +69,13 @@ class EditEventRef(EditReference): self._init_event() def _local_init(self): - self.width_key = 'interface.event-ref-width' - self.height_key = 'interface.event-ref-height' self.top = Glade() self.set_window(self.top.toplevel, self.top.get_object('eer_title'), _('Event Reference Editor')) + self.setup_configs('interface.event-ref', 600, 450) + self.define_warn_box(self.top.get_object("eer_warning")) self.define_expander(self.top.get_object("eer_expander")) self.share_btn = self.top.get_object('share_place') diff --git a/gramps/gui/editors/editmediaref.py b/gramps/gui/editors/editmediaref.py index e82623bc6..25f7970c4 100644 --- a/gramps/gui/editors/editmediaref.py +++ b/gramps/gui/editors/editmediaref.py @@ -86,13 +86,13 @@ class EditMediaRef(EditReference): self._update_addmedia) def _local_init(self): - self.width_key = 'interface.media-ref-width' - self.height_key = 'interface.media-ref-height' - self.top = Glade() + self.top = Glade() self.set_window(self.top.toplevel, self.top.get_object('title'), _('Media Reference Editor')) + self.setup_configs('interface.media-ref', 600, 450) + self.define_warn_box(self.top.get_object("warn_box")) self.top.get_object("label427").set_text(_("Y coordinate|Y")) self.top.get_object("label428").set_text(_("Y coordinate|Y")) diff --git a/gramps/gui/editors/editpersonref.py b/gramps/gui/editors/editpersonref.py index 58859d72e..a3d9f6ded 100644 --- a/gramps/gui/editors/editpersonref.py +++ b/gramps/gui/editors/editpersonref.py @@ -21,8 +21,7 @@ # """ -The EditPersonRef module provides the EditPersonRef class. This provides a -mechanism for the user to edit address information. +The EditPersonRef module provides the EditPersonRef class. """ #------------------------------------------------------------------------- @@ -77,24 +76,23 @@ class EditPersonRef(EditSecondary): Displays a dialog that allows the user to edit a person reference. """ - def __init__(self, dbstate, uistate, track, addr, callback): + def __init__(self, dbstate, uistate, track, personref, callback): """ Displays the dialog box. - parent - The class that called the PersonRef editor. - addr - The address that is to be edited + personref - The person reference that is to be edited """ - EditSecondary.__init__(self, dbstate, uistate, track, addr, callback) + EditSecondary.__init__(self, dbstate, uistate, track, + personref, callback) def _local_init(self): - self.width_key = 'interface.person-ref-width' - self.height_key = 'interface.person-ref-height' self.top = Glade() - self.set_window(self.top.toplevel, self.top.get_object("title"), _('Person Reference Editor')) + self.setup_configs('interface.person-ref', 600, 350) + self.person_label = self.top.get_object('person') #allow for drop: @@ -226,7 +224,7 @@ class EditPersonRef(EditSecondary): def save(self,*obj): """ Called when the OK button is pressed. Gets data from the - form and updates the Address data structure. + form and updates the data structure. """ if self.obj.ref: diff --git a/gramps/gui/editors/editplaceref.py b/gramps/gui/editors/editplaceref.py index 9592f648a..1adda4ed6 100644 --- a/gramps/gui/editors/editplaceref.py +++ b/gramps/gui/editors/editplaceref.py @@ -53,10 +53,11 @@ class EditPlaceRef(EditReference): update) def _local_init(self): - self.width_key = 'interface.place-ref-width' - self.height_key = 'interface.place-ref-height' + self.top = Glade() self.set_window(self.top.toplevel, None, _('Place Reference Editor')) + self.setup_configs('interface.place-ref', 600, 450) + self.define_warn_box(self.top.get_object("warning")) self.define_expander(self.top.get_object("expander")) #self.place_name_label = self.top.get_object('place_name_label') diff --git a/gramps/gui/editors/editreference.py b/gramps/gui/editors/editreference.py index 5282d1f8c..2529a91ae 100644 --- a/gramps/gui/editors/editreference.py +++ b/gramps/gui/editors/editreference.py @@ -29,7 +29,7 @@ from gi.repository import Gtk #------------------------------------------------------------------------- # -# gramps modules +# Gramps modules # #------------------------------------------------------------------------- from gramps.gen.const import GRAMPS_LOCALE as glocale diff --git a/gramps/gui/editors/editreporef.py b/gramps/gui/editors/editreporef.py index c1d86996b..688a5408f 100644 --- a/gramps/gui/editors/editreporef.py +++ b/gramps/gui/editors/editreporef.py @@ -53,13 +53,12 @@ class EditRepoRef(EditReference): source_ref, update) def _local_init(self): - self.width_key = 'interface.repo-ref-width' - self.height_key = 'interface.repo-ref-height' self.top = Glade() self.set_window(self.top.toplevel, self.top.get_object('repo_title'), _('Repository Reference Editor')) + self.setup_configs('interface.repo-ref', 600, 450) self.define_warn_box(self.top.get_object("warn_box")) self.define_expander(self.top.get_object("src_expander")) diff --git a/gramps/gui/editors/editsecondary.py b/gramps/gui/editors/editsecondary.py index 7874c0543..7c7064090 100644 --- a/gramps/gui/editors/editsecondary.py +++ b/gramps/gui/editors/editsecondary.py @@ -19,6 +19,11 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # +#------------------------------------------------------------------------- +# +# Gramps modules +# +#------------------------------------------------------------------------- from ..managedwindow import ManagedWindow from ..display import display_help from gramps.gen.config import config