* src/plugins/Leak.py: Typo.

* src/plugins/Eval.py: Convert to ManagedWindow.


svn: r6583
This commit is contained in:
Alex Roitman 2006-05-08 18:21:11 +00:00
parent bd789f227b
commit 971bfecf66
3 changed files with 17 additions and 41 deletions

View File

@ -1,4 +1,6 @@
2006-05-08 Alex Roitman <shura@gramps-project.org> 2006-05-08 Alex Roitman <shura@gramps-project.org>
* src/plugins/Leak.py: Typo.
* src/plugins/Eval.py: Convert to ManagedWindow.
* src/GrampsDb/_GrampsBSDDB.py (gramps_upgrade_9): Add callname to * src/GrampsDb/_GrampsBSDDB.py (gramps_upgrade_9): Add callname to
names during upgrade. names during upgrade.
* src/GrampsDb/_ReadXML.py (start_childref): Typo. * src/GrampsDb/_ReadXML.py (start_childref): Typo.

View File

@ -1,7 +1,7 @@
# #
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2003-2005 Donald N. Allingham # Copyright (C) 2003-2006 Donald N. Allingham
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -46,70 +46,44 @@ import gtk.glade
# GRAMPS modules # GRAMPS modules
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
import Utils
from PluginUtils import Tool, register_tool from PluginUtils import Tool, register_tool
import ManagedWindow
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# Actual tool # Actual tool
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class Eval(Tool.Tool): class Eval(Tool.Tool,ManagedWindow.ManagedWindow):
def __init__(self,db,person,options_class,name,callback=None,parent=None): def __init__(self,dbstate, uistate, options_class, name, callback=None):
Tool.Tool.__init__(self,db,person,options_class,name) self.title = _("Python evaluation window")
self.parent = parent Tool.Tool.__init__(self,dbstate, options_class, name)
if self.parent.child_windows.has_key(self.__class__): ManagedWindow.ManagedWindow.__init__(self,uistate,[],self.__class__)
self.parent.child_windows[self.__class__].present(None)
return
self.win_key = self.__class__
glade_file = "%s/%s" % (os.path.dirname(__file__),"eval.glade") glade_file = "%s/%s" % (os.path.dirname(__file__),"eval.glade")
self.glade = gtk.glade.XML(glade_file,"top","gramps") self.glade = gtk.glade.XML(glade_file,"top","gramps")
self.top = self.glade.get_widget("top") window = self.glade.get_widget("top")
self.top.set_icon(self.parent.topWindow.get_icon())
self.dbuf = self.glade.get_widget("display").get_buffer() self.dbuf = self.glade.get_widget("display").get_buffer()
self.ebuf = self.glade.get_widget("eval").get_buffer() self.ebuf = self.glade.get_widget("eval").get_buffer()
self.error = self.glade.get_widget("error").get_buffer() self.error = self.glade.get_widget("error").get_buffer()
self.glade.signal_autoconnect({ self.glade.signal_autoconnect({
"on_apply_clicked" : self.apply_clicked, "on_apply_clicked" : self.apply_clicked,
"on_close_clicked" : self.close_clicked, "on_close_clicked" : self.close,
"on_delete_event" : self.on_delete_event,
"on_clear_clicked" : self.clear_clicked, "on_clear_clicked" : self.clear_clicked,
}) })
Utils.set_titles(self.top,self.glade.get_widget('title'), self.set_window(window,self.glade.get_widget('title'),self.title)
_("Python evaluation window")) self.show()
self.add_itself_to_menu() def build_menu_names(self,obj):
self.top.show() return (self.title,None)
def on_delete_event(self,obj,b):
self.remove_itself_from_menu()
def close_clicked(self,obj):
self.remove_itself_from_menu()
self.top.destroy()
def add_itself_to_menu(self):
self.parent.child_windows[self.win_key] = self
self.parent_menu_item = gtk.MenuItem(_('Python evaluation window'))
self.parent_menu_item.connect("activate",self.present)
self.parent_menu_item.show()
self.parent.winsmenu.append(self.parent_menu_item)
def remove_itself_from_menu(self):
del self.parent.child_windows[self.win_key]
self.parent_menu_item.destroy()
def present(self,obj):
self.top.present()
def apply_clicked(self,obj): def apply_clicked(self,obj):
text = unicode(self.ebuf.get_text(self.ebuf.get_start_iter(), text = unicode(self.ebuf.get_text(self.ebuf.get_start_iter(),
self.ebuf.get_end_iter(),False)) self.ebuf.get_end_iter(),False))
outtext = cStringIO.StringIO() outtext = cStringIO.StringIO()
errtext = cStringIO.StringIO() errtext = cStringIO.StringIO()

View File

@ -122,7 +122,7 @@ class LeakOptions(Tool.ToolOptions):
if __debug__: if __debug__:
register_tool( register_tool(
name = 'eval', name = 'leak',
category = Tool.TOOL_DEBUG, category = Tool.TOOL_DEBUG,
tool_class = Leak, tool_class = Leak,
options_class = LeakOptions, options_class = LeakOptions,