Refactoring. ManagedWindow now controls window sizing

svn: r11905
This commit is contained in:
Gary Burton 2009-02-07 22:54:16 +00:00
parent 326ecebad4
commit 4530bd5cb9
23 changed files with 87 additions and 132 deletions

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
# 2009 Gary Burton
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -63,8 +64,6 @@ class EditAddress(EditSecondary):
Displays a dialog that allows the user to edit an address.
"""
WIDTH_KEY = Config.ADDRESS_WIDTH
HEIGHT_KEY = Config.ADDRESS_HEIGHT
def __init__(self, dbstate, uistate, track, addr, callback):
"""
@ -76,6 +75,8 @@ class EditAddress(EditSecondary):
EditSecondary.__init__(self, dbstate, uistate, track, addr, callback)
def _local_init(self):
self.width_key = Config.ADDRESS_WIDTH
self.height_key = Config.ADDRESS_HEIGHT
self.top = glade.XML(const.GLADE_FILE, "addr_edit","gramps")
self.set_window(self.top.get_widget("addr_edit"),
self.top.get_widget("title"),

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
# 2009 Gary Burton
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -63,9 +64,6 @@ class EditAttribute(EditSecondary):
Displays a dialog that allows the user to edit an attribute.
"""
WIDTH_KEY = Config.ATTRIBUTE_WIDTH
HEIGHT_KEY = Config.ATTRIBUTE_HEIGHT
def __init__(self, state, uistate, track, attrib, title, data_list, callback):
"""
Displays the dialog box.
@ -79,6 +77,8 @@ class EditAttribute(EditSecondary):
EditSecondary.__init__(self, state, uistate, track, attrib, callback)
def _local_init(self):
self.width_key = Config.ATTRIBUTE_WIDTH
self.height_key = Config.ATTRIBUTE_HEIGHT
self.top = glade.XML(const.GLADE_FILE, "attr_edit","gramps")
self.set_window(self.top.get_widget("attr_edit"),
self.top.get_widget('title'),

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
# 2009 Gary Burton
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -95,6 +96,9 @@ class EditEvent(EditPrimary):
self.dbstate.db.get_family_event_types()
def _local_init(self):
self.width_key = Config.EVENT_WIDTH
self.height_key = Config.EVENT_HEIGHT
self.top = glade.XML(const.GLADE_FILE, "event_edit","gramps")
self.set_window(self.top.get_widget("event_edit"), None,
self.get_menu_title())
@ -103,10 +107,6 @@ class EditEvent(EditPrimary):
self.share_btn = self.top.get_widget('select_place')
self.add_del_btn = self.top.get_widget('add_del_place')
width = Config.get(Config.EVENT_WIDTH)
height = Config.get(Config.EVENT_HEIGHT)
self.window.resize(width, height)
def _connect_signals(self):
self.top.get_widget('button111').connect('clicked', self.close)
self.top.get_widget('button126').connect('clicked', self.help_clicked)
@ -186,10 +186,6 @@ class EditEvent(EditPrimary):
def _cleanup_on_exit(self):
self.backref_tab.close()
(width, height) = self.window.get_size()
Config.set(Config.EVENT_WIDTH, width)
Config.set(Config.EVENT_HEIGHT, height)
Config.sync()
def build_menu_names(self, event):
return (_('Edit Event'), self.get_menu_title())

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
# 2009 Gary Burton
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -65,15 +66,14 @@ from ObjectEntries import PlaceEntry
#-------------------------------------------------------------------------
class EditEventRef(EditReference):
WIDTH_KEY = Config.EVENT_REF_WIDTH
HEIGHT_KEY = Config.EVENT_REF_HEIGHT
def __init__(self, state, uistate, track, event, event_ref, update):
EditReference.__init__(self, state, uistate, track, event, event_ref,
update)
self._init_event()
def _local_init(self):
self.width_key = Config.EVENT_REF_WIDTH
self.height_key = Config.EVENT_REF_HEIGHT
self.top = glade.XML(const.GLADE_FILE, "event_eref_edit","gramps")
self.set_window(self.top.get_widget('event_eref_edit'),

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
# 2009 Gary Burton
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -510,6 +511,8 @@ class EditFamily(EditPrimary):
return (_('Edit Family'), self.get_menu_title())
def build_interface(self):
self.width_key = Config.FAMILY_WIDTH
self.height_key = Config.FAMILY_HEIGHT
self.top = glade.XML(const.GLADE_FILE, "family_editor", "gramps")
@ -521,10 +524,6 @@ class EditFamily(EditPrimary):
# FIXME: remove if we can use show()
self.window.show_all = self.window.show
# restore window size
width = Config.get(Config.FAMILY_WIDTH)
height = Config.get(Config.FAMILY_HEIGHT)
self.window.set_default_size(width, height)
self.fbirth = self.top.get_widget('fbirth')
self.fdeath = self.top.get_widget('fdeath')
@ -1028,12 +1027,6 @@ class EditFamily(EditPrimary):
self._do_close()
def _cleanup_on_exit(self):
(width, height) = self.window.get_size()
Config.set(Config.FAMILY_WIDTH, width)
Config.set(Config.FAMILY_HEIGHT, height)
Config.sync()
def no_name(self):
"""
Default surname guess.

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
# 2009 Gary Burton
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -131,9 +132,6 @@ class EditLdsOrd(EditSecondary):
Displays a dialog that allows the user to edit an attribute.
"""
WIDTH_KEY = Config.LDS_WIDTH
HEIGHT_KEY = Config.LDS_HEIGHT
def __init__(self, state, uistate, track, attrib, callback):
"""
Displays the dialog box.
@ -146,6 +144,8 @@ class EditLdsOrd(EditSecondary):
EditSecondary.__init__(self, state, uistate, track, attrib, callback)
def _local_init(self):
self.width_key = Config.LDS_WIDTH
self.height_key = Config.LDS_HEIGHT
self.top = glade.XML(const.GLADE_FILE, "lds_person_edit","gramps")
self.set_window(self.top.get_widget("lds_person_edit"),
self.top.get_widget('title'),

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
# 2009 Gary Burton
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -46,14 +47,13 @@ from gettext import gettext as _
#-------------------------------------------------------------------------
class EditLocation(EditSecondary):
WIDTH_KEY = Config.LOCATION_WIDTH
HEIGHT_KEY = Config.LOCATION_HEIGHT
def __init__(self,dbstate,uistate,track,location,callback):
EditSecondary.__init__(self, dbstate, uistate, track,
location, callback)
def _local_init(self):
self.width_key = Config.LOCATION_WIDTH
self.height_key = Config.LOCATION_HEIGHT
self.top = glade.XML(const.GLADE_FILE, "loc_edit","gramps")
self.set_window(self.top.get_widget("loc_edit"), None,
_('Location Editor'))

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
# 2009 Gary Burton
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -88,14 +89,13 @@ class EditMedia(EditPrimary):
def _local_init(self):
assert(self.obj)
self.width_key = Config.MEDIA_WIDTH
self.height_key = Config.MEDIA_HEIGHT
self.glade = glade.XML(const.GLADE_FILE,
"change_global","gramps")
self.set_window(self.glade.get_widget('change_global'),
None, self.get_menu_title())
width = Config.get(Config.MEDIA_WIDTH)
height = Config.get(Config.MEDIA_HEIGHT)
self.window.resize(width, height)
def _connect_signals(self):
self.define_cancel_button(self.glade.get_widget('button91'))
@ -277,10 +277,6 @@ class EditMedia(EditPrimary):
def _cleanup_on_exit(self):
self.backref_list.close()
(width, height) = self.window.get_size()
Config.set(Config.MEDIA_WIDTH, width)
Config.set(Config.MEDIA_HEIGHT, height)
Config.sync()
def data_has_changed(self):
"""

View File

@ -2,7 +2,8 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
# Copyright (C) 2008-2009 Stephane Charette <stephanecharette@gmail.com>
# 2008-2009 Stephane Charette <stephanecharette@gmail.com>
# 2009 Gary Burton
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -61,9 +62,6 @@ from AddMedia import AddMediaObject
#-------------------------------------------------------------------------
class EditMediaRef(EditReference):
WIDTH_KEY = Config.MEDIA_REF_WIDTH
HEIGHT_KEY = Config.MEDIA_REF_HEIGHT
def __init__(self, state, uistate, track, media, media_ref, update):
EditReference.__init__(self, state, uistate, track, media,
media_ref, update)
@ -73,7 +71,8 @@ class EditMediaRef(EditReference):
self._update_addmedia)
def _local_init(self):
self.width_key = Config.MEDIA_REF_WIDTH
self.height_key = Config.MEDIA_REF_HEIGHT
self.top = glade.XML(const.GLADE_FILE,
"change_description","gramps")

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
# 2009 Gary Burton
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -100,15 +101,14 @@ class GeneralNameTab(GrampsTab):
#-------------------------------------------------------------------------
class EditName(EditSecondary):
WIDTH_KEY = Config.NAME_WIDTH
HEIGHT_KEY = Config.NAME_HEIGHT
def __init__(self, dbstate, uistate, track, name, callback):
EditSecondary.__init__(self, dbstate, uistate,
track, name, callback)
def _local_init(self):
self.width_key = Config.NAME_WIDTH
self.height_key = Config.NAME_HEIGHT
self.top = glade.XML(const.GLADE_FILE, "name_edit","gramps")
self.set_window(self.top.get_widget("name_edit"),

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
# 2009 Gary Burton
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -163,13 +164,12 @@ class EditNote(EditPrimary):
and overridden here.
"""
self.width_key = Config.NOTE_WIDTH
self.height_key = Config.NOTE_HEIGHT
self.top = glade.XML(GLADE_FILE, "edit_note", "gramps")
win = self.top.get_widget("edit_note")
self.set_window(win, None, self.get_menu_title())
width = Config.get(Config.NOTE_WIDTH)
height = Config.get(Config.NOTE_HEIGHT)
self.window.set_default_size(width, height)
vboxnote = self.top.get_widget('vbox131')
notebook = self.top.get_widget('note_notebook')
@ -361,12 +361,6 @@ class EditNote(EditPrimary):
self.callback(self.obj.get_handle())
self.close()
def _cleanup_on_exit(self):
(width, height) = self.window.get_size()
Config.set(Config.NOTE_WIDTH, width)
Config.set(Config.NOTE_HEIGHT, height)
Config.sync()
class DeleteNoteQuery:
def __init__(self, dbstate, uistate, note, the_lists):
self.note = note

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
# 2009 Gary Burton
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -127,6 +128,8 @@ class EditPerson(EditPrimary):
This is called by the base class of EditPrimary, and overridden here.
"""
self.width_key = Config.PERSON_WIDTH
self.height_key = Config.PERSON_HEIGHT
self.pname = self.obj.get_primary_name()
self.should_guess_gender = (not self.obj.get_gramps_id() and
self.obj.get_gender () ==
@ -138,9 +141,6 @@ class EditPerson(EditPrimary):
self.set_window(self.top.get_widget("edit_person"), None,
self.get_menu_title())
width = Config.get(Config.PERSON_WIDTH)
height = Config.get(Config.PERSON_HEIGHT)
self.window.set_default_size(width, height)
self.obj_photo = self.top.get_widget("personPix")
self.eventbox = self.top.get_widget("eventbox1")
@ -849,9 +849,6 @@ class EditPerson(EditPrimary):
return child_ref_list
def _cleanup_on_exit(self):
(width, height) = self.window.get_size()
Config.set(Config.PERSON_WIDTH, width)
Config.set(Config.PERSON_HEIGHT, height)
Config.set(Config.PREFIX_SUFFIX, self.prefix_suffix.active_key)
Config.set(Config.PATRO_TITLE, self.patro_title.active_key)
Config.sync()

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
# 2009 Gary Burton
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -63,9 +64,6 @@ class EditPersonRef(EditSecondary):
Displays a dialog that allows the user to edit an address.
"""
WIDTH_KEY = Config.PERSON_REF_WIDTH
HEIGHT_KEY = Config.PERSON_REF_HEIGHT
def __init__(self, dbstate, uistate, track, addr, callback):
"""
Displays the dialog box.
@ -76,6 +74,8 @@ class EditPersonRef(EditSecondary):
EditSecondary.__init__(self, dbstate, uistate, track, addr, callback)
def _local_init(self):
self.width_key = Config.PERSON_REF_WIDTH
self.height_key = Config.PERSON_REF_HEIGHT
self.top = glade.XML(const.GLADE_FILE, "pref_edit","gramps")
self.set_window(self.top.get_widget("pref_edit"),
self.top.get_widget("title"),

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
# 2009 Gary Burton
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -113,13 +114,12 @@ class EditPlace(EditPrimary):
return gen.lib.Place()
def _local_init(self):
self.width_key = Config.PLACE_WIDTH
self.height_key = Config.PLACE_HEIGHT
self.top = glade.XML(const.GLADE_FILE, "place_editor","gramps")
self.set_window(self.top.get_widget("place_editor"), None,
self.get_menu_title())
width = Config.get(Config.PLACE_WIDTH)
height = Config.get(Config.PLACE_HEIGHT)
self.window.resize(width, height)
tblmloc = self.top.get_widget('table19')
notebook = self.top.get_widget('notebook3')
#recreate start page as GrampsTab
@ -257,10 +257,6 @@ class EditPlace(EditPrimary):
def _cleanup_on_exit(self):
self.backref_list.close()
(width, height) = self.window.get_size()
Config.set(Config.PLACE_WIDTH, width)
Config.set(Config.PLACE_HEIGHT, height)
Config.sync()
def save(self, *obj):
self.ok_button.set_sensitive(False)

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
# 2009 Gary Burton
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -60,7 +61,7 @@ class EditPrimary(ManagedWindow.ManagedWindow):
ManagedWindow.ManagedWindow.__init__(self, uistate, track, obj)
self._local_init()
self._set_size()
self._create_tabbed_pages()
self._setup_fields()
self._connect_signals()
@ -153,6 +154,7 @@ class EditPrimary(ManagedWindow.ManagedWindow):
for key in self.signal_keys:
self.db.disconnect(key)
self._cleanup_on_exit()
self._save_size()
ManagedWindow.ManagedWindow.close(self)
def close(self, *obj):
@ -285,4 +287,4 @@ class EditPrimary(ManagedWindow.ManagedWindow):
if self.get_from_gramps_id(idval):
return (True, idval)
return (False, 0)

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
# 2009 Gary Burton
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -86,9 +87,6 @@ class RefTab(GrampsTab):
#-------------------------------------------------------------------------
class EditReference(ManagedWindow.ManagedWindow):
WIDTH_KEY = None
HEIGHT_KEY = None
def __init__(self, state, uistate, track, source, source_ref, update):
self.db = state.db
self.dbstate = state
@ -110,12 +108,6 @@ class EditReference(ManagedWindow.ManagedWindow):
self.show()
self._post_init()
def _set_size(self):
if self.WIDTH_KEY:
width = Config.get(self.WIDTH_KEY)
height = Config.get(self.HEIGHT_KEY)
self.window.resize(width, height)
def _local_init(self):
"""
Derived class should do any pre-window initalization in this task.
@ -212,10 +204,3 @@ class EditReference(ManagedWindow.ManagedWindow):
self.db.disconnect(key)
self._save_size()
ManagedWindow.ManagedWindow.close(self)
def _save_size(self):
if self.HEIGHT_KEY:
(width, height) = self.window.get_size()
Config.set(self.WIDTH_KEY, width)
Config.set(self.HEIGHT_KEY, height)
Config.sync()

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
# 2009 Gary Burton
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -55,15 +56,14 @@ from _EditReference import RefTab, EditReference
#-------------------------------------------------------------------------
class EditRepoRef(EditReference):
WIDTH_KEY = Config.REPO_REF_WIDTH
HEIGHT_KEY = Config.REPO_REF_HEIGHT
def __init__(self, state, uistate, track, source, source_ref, update):
EditReference.__init__(self, state, uistate, track, source,
source_ref, update)
def _local_init(self):
self.width_key = Config.REPO_REF_WIDTH
self.height_key = Config.REPO_REF_HEIGHT
self.top = glade.XML(const.GLADE_FILE, "repository_ref_edit","gramps")

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
# 2009 Gary Burton
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -72,15 +73,13 @@ class EditRepository(EditPrimary):
return title
def _local_init(self):
self.width_key = Config.REPO_WIDTH
self.height_key = Config.REPO_HEIGHT
self.glade = glade.XML(const.GLADE_FILE, "repository_editor","gramps")
self.set_window(self.glade.get_widget("repository_editor"), None,
self.get_menu_title())
width = Config.get(Config.REPO_WIDTH)
height = Config.get(Config.REPO_HEIGHT)
self.window.resize(width, height)
def build_menu_names(self, source):
return (_('Edit Repository'), self.get_menu_title())
@ -176,10 +175,6 @@ class EditRepository(EditPrimary):
def _cleanup_on_exit(self):
self.backref_tab.close()
(width, height) = self.window.get_size()
Config.set(Config.REPO_WIDTH, width)
Config.set(Config.REPO_HEIGHT, height)
Config.sync()
class DelRepositoryQuery:
def __init__(self, dbstate, uistate, repository, sources):

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
# 2009 Gary Burton
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -26,9 +27,6 @@ import Config
class EditSecondary(ManagedWindow.ManagedWindow):
WIDTH_KEY = None
HEIGHT_KEY = None
def __init__(self, state, uistate, track, obj, callback=None):
"""Create an edit window. Associates a person with the window."""
@ -50,12 +48,6 @@ class EditSecondary(ManagedWindow.ManagedWindow):
self.show()
self._post_init()
def _set_size(self):
if self.WIDTH_KEY:
width = Config.get(self.WIDTH_KEY)
height = Config.get(self.HEIGHT_KEY)
self.window.resize(width, height)
def _local_init(self):
"""
Derived class should do any pre-window initalization in this task.
@ -134,10 +126,3 @@ class EditSecondary(ManagedWindow.ManagedWindow):
self._cleanup_on_exit()
self._save_size()
ManagedWindow.ManagedWindow.close(self)
def _save_size(self):
if self.HEIGHT_KEY:
(width, height) = self.window.get_size()
Config.set(self.WIDTH_KEY, width)
Config.set(self.HEIGHT_KEY, height)
Config.sync()

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
# 2009 Gary Burton
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -78,15 +79,13 @@ class EditSource(EditPrimary):
return title
def _local_init(self):
self.width_key = Config.SOURCE_WIDTH
self.height_key = Config.SOURCE_HEIGHT
assert(self.obj)
self.glade = glade.XML(const.GLADE_FILE, "source_editor","gramps")
self.set_window(self.glade.get_widget("source_editor"), None,
self.get_menu_title())
width = Config.get(Config.SOURCE_WIDTH)
height = Config.get(Config.SOURCE_HEIGHT)
self.window.resize(width, height)
def _connect_signals(self):
self.define_ok_button(self.glade.get_widget('ok'),self.save)
@ -193,10 +192,6 @@ class EditSource(EditPrimary):
def _cleanup_on_exit(self):
self.backref_tab.close()
(width, height) = self.window.get_size()
Config.set(Config.SOURCE_WIDTH, width)
Config.set(Config.SOURCE_HEIGHT, height)
Config.sync()
class DelSrcQuery:
def __init__(self, dbstate, uistate, source, the_lists):

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
# 2009 Gary Burton
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -56,15 +57,14 @@ from _EditReference import RefTab, EditReference
#-------------------------------------------------------------------------
class EditSourceRef(EditReference):
WIDTH_KEY = Config.SOURCE_REF_WIDTH
HEIGHT_KEY = Config.SOURCE_REF_HEIGHT
def __init__(self, state, uistate, track, source, source_ref, update):
EditReference.__init__(self, state, uistate, track, source,
source_ref, update)
def _local_init(self):
self.width_key = Config.EVENT_REF_WIDTH
self.height_key = Config.EVENT_REF_HEIGHT
self.top = glade.XML(const.GLADE_FILE, "source_ref_edit","gramps")

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
# 2009 Gary Burton
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -51,15 +52,14 @@ from widgets import MonitoredEntry, PrivacyButton, MonitoredDataType
#-------------------------------------------------------------------------
class EditUrl(EditSecondary):
WIDTH_KEY = Config.URL_WIDTH
HEIGHT_KEY = Config.URL_HEIGHT
def __init__(self, dbstate, uistate, track, name, url, callback):
EditSecondary.__init__(self, dbstate, uistate, track,
url, callback)
def _local_init(self):
self.width_key = Config.URL_WIDTH
self.height_key = Config.URL_HEIGHT
self.top = glade.XML(const.GLADE_FILE, "url_edit", "gramps")
self.jump = self.top.get_widget('jump')

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
# 2009 Gary Burton
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -47,6 +48,7 @@ from gtk import glade
#-------------------------------------------------------------------------
import const
import Errors
import Config
#-------------------------------------------------------------------------
#
@ -292,7 +294,6 @@ class ManagedWindow:
menu, keeping track of child windows, closing them on close/delete
event, and presenting itself when selected or attempted to create again.
"""
def __init__(self, uistate, track, obj):
"""
Create child windows and add itself to menu, if not there already.
@ -331,6 +332,8 @@ class ManagedWindow:
menu_label, submenu_label = self.build_menu_names(obj)
self._gladeobj = None
self.isWindow = None
self.width_key = None
self.height_key = None
if uistate.gwm.get_item_from_id(window_key):
uistate.gwm.get_item_from_id(window_key).present()
@ -478,6 +481,24 @@ class ManagedWindow:
"ManagedWindow: self.window does not exist!"
self.window.present()
def _set_size(self):
"""
Set the dimensions of the window
"""
if self.width_key is not None:
width = Config.get(self.width_key)
height = Config.get(self.height_key)
self.window.resize(width, height)
def _save_size(self):
"""
Save the dimensions of the window to the config file
"""
if self.width_key is not None:
(width, height) = self.window.get_size()
Config.set(self.width_key, width)
Config.set(self.height_key, height)
Config.sync()
#-------------------------------------------------------------------------
#
# Helper functions