Bug 2888 - minor edits and cleanup

svn: r12529
This commit is contained in:
Gerald Britton 2009-05-15 18:12:10 +00:00
parent 110557c3c7
commit 21e96b0616
21 changed files with 64 additions and 72 deletions

View File

@ -32,6 +32,7 @@ the create/deletion of dialog windows.
#
#-------------------------------------------------------------------------
from cStringIO import StringIO
import os
#-------------------------------------------------------------------------
#
@ -67,6 +68,7 @@ DISABLED = -1
#-----------------------------------------------------------------------
def get_object(self,value):
raise DeprecationWarning, "ManagedWindow.get_object: shouldn't get here"
if self.get_name() == value:
return self
elif hasattr(self,'get_children'):
@ -424,16 +426,14 @@ class ManagedWindow:
def define_glade(self, top_module, glade_file=None):
if glade_file is None:
raise TypeError, "ManagedWindow.define_glade: no glade file"
glade_file = const.GLADE_FILE
builder = gtk.Builder()
builder.add_from_file(glade_file)
self._gladeobj = builder.get_object(top_module)
self._gladeobj.get_object = get_object
self._gladeobj = Glade(glade_file, "", top_module)
return self._gladeobj
def get_widget(self, name):
assert(self._gladeobj)
object = get_object(self._gladeobj,name)
object = self._gladeobj.get_child_object(name)
if object is not None:
return object
raise ValueError, (

View File

@ -61,7 +61,6 @@ except:
#
#-------------------------------------------------------------------------
paper_sizes = []
_GLADE_FILE = "papermenu.glade"
#-------------------------------------------------------------------------
#

View File

@ -55,13 +55,6 @@ import ListModel
import ManagedWindow
from glade import Glade
#------------------------------------------------------------------------
#
# Constants
#
#------------------------------------------------------------------------
_GLADE_FILE = "styleeditor.glade"
#------------------------------------------------------------------------
#
# StyleList class

View File

@ -80,16 +80,12 @@ class Glade(gtk.Builder):
"""
gtk.Builder.__init__(self)
if isinstance(toplevel, gtk.Container): # if we have a Gtk object
self.__toplevel = toplevel # just remember it
return # and we're done
filename_given = filename is not None
dirname_given = dirname is not None
# if filename not given, use module name to derive it
if not filename:
if not filename_given:
filename = sys._getframe(1).f_code.co_filename
filename = os.path.basename(filename)
filename = filename.rpartition('.')[0] + '.glade'
@ -97,7 +93,7 @@ class Glade(gtk.Builder):
# if dirname not given, use current directory
if not dirname:
if not dirname_given:
dirname = sys._getframe(1).f_code.co_filename
dirname = os.path.dirname(dirname)
@ -210,6 +206,8 @@ class Glade(gtk.Builder):
if isinstance(toplevel, basestring):
toplevel = self.get_object(toplevel)
# Simple Breadth-First Search
queue = [toplevel]
while queue:
obj = queue.pop(0)

View File

@ -534,7 +534,7 @@ Title: A title used to refer to the person, such as 'Dr.' or 'Rev.'</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Abandon changes and close window</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="destroy_passed_object" object="editPerson"/>
<signal name="clicked" handler="destroy_passed_object" object="editperson"/>
</object>
<packing>
<property name="expand">False</property>
@ -552,7 +552,7 @@ Title: A title used to refer to the person, such as 'Dr.' or 'Rev.'</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Accept changes and close window</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_apply_person_clicked" object="editPerson"/>
<signal name="clicked" handler="on_apply_person_clicked" object="editperson"/>
</object>
<packing>
<property name="expand">False</property>

View File

@ -178,7 +178,7 @@
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="destroy_passed_object" object="merge_places"/>
<signal name="clicked" handler="destroy_passed_object" object="mergeplace"/>
</object>
<packing>
<property name="expand">False</property>
@ -194,7 +194,7 @@
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_merge_places_clicked" object="merge_places"/>
<signal name="clicked" handler="on_merge_places_clicked" object="mergeplace"/>
</object>
<packing>
<property name="expand">False</property>
@ -367,7 +367,7 @@
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="destroy_passed_object" object="merge"/>
<signal name="clicked" handler="destroy_passed_object" object="mergedata"/>
</object>
<packing>
<property name="expand">False</property>
@ -384,7 +384,7 @@
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<signal name="clicked" handler="on_next_clicked" object="merge"/>
<signal name="clicked" handler="on_next_clicked" object="mergedata"/>
</object>
<packing>
<property name="expand">False</property>
@ -400,7 +400,7 @@
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<signal name="clicked" handler="on_merge_clicked" object="merge"/>
<signal name="clicked" handler="on_merge_clicked" object="mergedata"/>
</object>
<packing>
<property name="expand">False</property>

View File

@ -233,12 +233,18 @@ class PackageWriter:
sys.getfilesystemencoding())
if os.path.isfile(newfile):
self.copy_file(newfile, 'burn:///%s/%s' % (base, obase))
fs_top = gtk.FileSelection("%s - GRAMPS" % _("Select file"))
fs_top.hide_fileop_buttons()
fs_top.ok_button.connect('clicked', fs_ok_clicked)
fs_top.cancel_button.connect('clicked', fs_close_window)
fs_top.run()
fs_top = gtk.FileChooserDialog("%s - GRAMPS" % _("Select file"),
buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
gtk.STOCK_OK, gtk.RESPONSE_OK)
)
response = fs_top.run()
if response == gtk.RESPONSE_OK:
fs_ok_clicked(fs_top)
elif response == gtk.RESPONSE_CANCEL:
fs_close_window(fs_top)
fs_top.destroy()
#----------------------------------------------------------

View File

@ -170,12 +170,18 @@ class PackageWriter:
sys.getfilesystemencoding())
if os.path.isfile(name):
archive.add(name)
fs_top = gtk.FileChooserDialog("%s - GRAMPS" % _("Select file"),
buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
gtk.STOCK_OK, gtk.RESPONSE_OK)
)
s
response = fs_top.run()
if response == gtk.RESPONSE_OK:
fs_ok_clicked(fs_top)
elif response == gtk.RESPONSE_CANCEL:
fs_close_window(fs_top)
fs_top = gtk.FileSelection("%s - GRAMPS" % _("Select file"))
fs_top.hide_fileop_buttons()
fs_top.ok_button.connect('clicked',fs_ok_clicked)
fs_top.cancel_button.connect('clicked',fs_close_window)
fs_top.run()
fs_top.destroy()
#---------------------------------------------------------------
@ -242,4 +248,4 @@ plugin = ExportPlugin(name = _('GRAM_PS package (portable XML)'),
export_function = writeData,
extension = "gpkg",
config = _config )
pmgr.register_plugin(plugin)
pmgr.register_plugin(plugin)

View File

@ -238,7 +238,7 @@
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="destroy_passed_object" object="gedcomExport"/>
<signal name="clicked" handler="destroy_passed_object" object="exportcsv"/>
</object>
<packing>
<property name="expand">False</property>
@ -254,7 +254,7 @@
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_ok_clicked" object="gedcomExport"/>
<signal name="clicked" handler="on_ok_clicked" object="exportcsv"/>
</object>
<packing>
<property name="expand">False</property>

View File

@ -130,7 +130,7 @@
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="destroy_passed_object" object="gedcomExport"/>
<signal name="clicked" handler="destroy_passed_object" object="exportftree"/>
</object>
<packing>
<property name="expand">False</property>
@ -146,7 +146,7 @@
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_ok_clicked" object="gedcomExport"/>
<signal name="clicked" handler="on_ok_clicked" object="exportftree"/>
</object>
<packing>
<property name="expand">False</property>

View File

@ -260,7 +260,7 @@
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_ok_clicked" object="gedcomExport"/>
<signal name="clicked" handler="on_ok_clicked" object="exportgeneweb"/>
</object>
<packing>
<property name="expand">False</property>

View File

@ -98,7 +98,7 @@
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="destroy_passed_object" object="gedcomExport"/>
<signal name="clicked" handler="destroy_passed_object" object="exportvcalendar"/>
</object>
<packing>
<property name="expand">False</property>
@ -114,7 +114,7 @@
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_ok_clicked" object="gedcomExport"/>
<signal name="clicked" handler="on_ok_clicked" object="exportvcalendar"/>
</object>
<packing>
<property name="expand">False</property>

View File

@ -96,7 +96,7 @@
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="destroy_passed_object" object="gedcomExport"/>
<signal name="clicked" handler="destroy_passed_object" object="exportvcard"/>
</object>
<packing>
<property name="expand">False</property>

View File

@ -48,14 +48,7 @@ from glade import Glade
#-------------------------------------------------------------------------
#
# Constants
#
#-------------------------------------------------------------------------
_GLADE_FILE = "changetype.glade"
#-------------------------------------------------------------------------
#
#
# ChangeTypes class
#
#-------------------------------------------------------------------------
class ChangeTypes(Tool.BatchTool, ManagedWindow.ManagedWindow):

View File

@ -66,13 +66,6 @@ from QuestionDialog import OkDialog, MissingMediaDialog
from BasicUtils import name_displayer as _nd
from glade import Glade
#-------------------------------------------------------------------------
#
# Constants
#
#-------------------------------------------------------------------------
_GLADE_FILE = "summary.glade"
#-------------------------------------------------------------------------
#
# Low Level repair
@ -543,11 +536,15 @@ class CheckIntegrity:
else:
self.bad_photo.append(ObjectId)
fs_top = gtk.FileSelection("%s - GRAMPS" % _("Select file"))
fs_top.hide_fileop_buttons()
fs_top.ok_button.connect('clicked',fs_ok_clicked)
fs_top.cancel_button.connect('clicked',fs_close_window)
fs_top.run()
fs_top = gtk.FileChooserDialog("%s - GRAMPS" % _("Select file"),
buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
gtk.STOCK_OK, gtk.RESPONSE_OK)
)
response = fs_top.run()
if response == gtk.RESPONSE_OK:
fs_ok_clicked(fs_top)
elif response == gtk.RESPONSE_CANCEL:
fs_close_window(fs_top)
fs_top.destroy()
#-------------------------------------------------------------------------

View File

@ -66,7 +66,6 @@ from glade import Glade
#-------------------------------------------------------------------------
WIKI_HELP_PAGE = '%s_-_Tools' % const.URL_MANUAL_PAGE
WIKI_HELP_SEC = _('manual|Compare_Individual_Events...')
_GLADE_FILE = "eventcmp.glade"
#------------------------------------------------------------------------
#

View File

@ -65,7 +65,6 @@ _val2label = {
WIKI_HELP_PAGE = '%s_-_Tools' % const.URL_MANUAL_PAGE
WIKI_HELP_SEC = _('manual|Find_Possible_Duplicate_People...')
_GLADE_FILE = "merge.glade"
#-------------------------------------------------------------------------
#

View File

@ -120,7 +120,7 @@
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_close_clicked" object="top"/>
<signal name="clicked" handler="on_close_clicked" object="changetypes"/>
</object>
<packing>
<property name="expand">False</property>
@ -136,7 +136,7 @@
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_apply_clicked" object="top"/>
<signal name="clicked" handler="on_apply_clicked" object="changetypes"/>
</object>
<packing>
<property name="expand">False</property>

View File

@ -64,7 +64,7 @@
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="destroy_passed_object" object="summary"/>
<signal name="clicked" handler="destroy_passed_object" object="check"/>
</object>
<packing>
<property name="expand">False</property>

View File

@ -86,7 +86,7 @@
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_write_table" object="view"/>
<signal name="clicked" handler="on_write_table" object="eventcmp"/>
</object>
<packing>
<property name="expand">False</property>

View File

@ -1,3 +1,4 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
@ -44,6 +45,7 @@ from gtk.glade import set_custom_handler
def get_custom_handler(glade, function_name, widget_name,
str1, str2, int1, int2):
raise DeprecationWarning, "get_custom_handler: shouldn't get here"
if function_name == 'ValidatableMaskedEntry':
return ValidatableMaskedEntry()
if function_name == 'StyledTextEditor':