* src/plugins/Eval.py: Window management. Replaces eval.py.
* src/plugins/eval.py: Remove from CVS. * src/plugins/eval.glade: Define event handler. * src/plugins/Leak.py: Window management. Replaces leak.py. * src/plugins/leak.py: Remove from CVS. * src/plugins/leak.glade: Define event handler. svn: r3155
This commit is contained in:
parent
739729de97
commit
a211dd41d1
@ -21,6 +21,13 @@
|
|||||||
* src/plugins/Verify.py: Window management.
|
* src/plugins/Verify.py: Window management.
|
||||||
* src/plugins/verify.glade: Define event handler.
|
* src/plugins/verify.glade: Define event handler.
|
||||||
|
|
||||||
|
* src/plugins/Eval.py: Window management. Replaces eval.py.
|
||||||
|
* src/plugins/eval.py: Remove from CVS.
|
||||||
|
* src/plugins/eval.glade: Define event handler.
|
||||||
|
* src/plugins/Leak.py: Window management. Replaces leak.py.
|
||||||
|
* src/plugins/leak.py: Remove from CVS.
|
||||||
|
* src/plugins/leak.glade: Define event handler.
|
||||||
|
|
||||||
2004-05-09 Don Allingham <donaldallingham@users.sourceforge.net>
|
2004-05-09 Don Allingham <donaldallingham@users.sourceforge.net>
|
||||||
* src/DbPrompter.py: added a .grdb if not specified.
|
* src/DbPrompter.py: added a .grdb if not specified.
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
#
|
#
|
||||||
# Copyright (C) 2003 Donald N. Allingham
|
# Copyright (C) 2003-2004 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
|
||||||
@ -36,7 +36,10 @@ from gettext import gettext as _
|
|||||||
|
|
||||||
class EvalWindow:
|
class EvalWindow:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self,parent):
|
||||||
|
self.parent = parent
|
||||||
|
self.win_key = self
|
||||||
|
|
||||||
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")
|
||||||
|
|
||||||
@ -48,12 +51,37 @@ class EvalWindow:
|
|||||||
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_clicked,
|
||||||
|
"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'),
|
Utils.set_titles(self.top,self.glade.get_widget('title'),
|
||||||
_("Python Evaluation Window"))
|
_("Python Evaluation Window"))
|
||||||
|
|
||||||
|
self.add_itself_to_menu()
|
||||||
|
self.top.show()
|
||||||
|
|
||||||
|
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(),gtk.FALSE))
|
self.ebuf.get_end_iter(),gtk.FALSE))
|
||||||
@ -73,10 +101,6 @@ class EvalWindow:
|
|||||||
self.ebuf.set_text("")
|
self.ebuf.set_text("")
|
||||||
self.error.set_text("")
|
self.error.set_text("")
|
||||||
|
|
||||||
def close_clicked(self,obj):
|
|
||||||
self.top.destroy()
|
|
||||||
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
@ -84,8 +108,8 @@ class EvalWindow:
|
|||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
from Plugins import register_tool
|
from Plugins import register_tool
|
||||||
|
|
||||||
def runtool(database,person,callback):
|
def runtool(database,person,callback,parent):
|
||||||
EvalWindow()
|
EvalWindow(parent)
|
||||||
|
|
||||||
register_tool(
|
register_tool(
|
||||||
runtool,
|
runtool,
|
||||||
@ -93,4 +117,3 @@ register_tool(
|
|||||||
category=_("Debug"),
|
category=_("Debug"),
|
||||||
description=_("Provides a window that can evaluate python code")
|
description=_("Provides a window that can evaluate python code")
|
||||||
)
|
)
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
#
|
#
|
||||||
# Copyright (C) 2003 Donald N. Allingham
|
# Copyright (C) 2003-2004 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
|
||||||
@ -18,9 +18,12 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# $Id$
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Provides a python evaluation window
|
Show uncollected objects in a window.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import gtk
|
import gtk
|
||||||
import gtk.glade
|
import gtk.glade
|
||||||
@ -29,9 +32,12 @@ import string
|
|||||||
|
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
class EvalWindow:
|
class Leak:
|
||||||
|
|
||||||
|
def __init__(self,parent):
|
||||||
|
self.parent = parent
|
||||||
|
self.win_key = self
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
glade_file = "%s/%s" % (os.path.dirname(__file__),"leak.glade")
|
glade_file = "%s/%s" % (os.path.dirname(__file__),"leak.glade")
|
||||||
self.glade = gtk.glade.XML(glade_file,"top","gramps")
|
self.glade = gtk.glade.XML(glade_file,"top","gramps")
|
||||||
|
|
||||||
@ -42,27 +48,48 @@ class EvalWindow:
|
|||||||
|
|
||||||
self.glade.signal_autoconnect({
|
self.glade.signal_autoconnect({
|
||||||
"on_apply_clicked" : self.apply_clicked,
|
"on_apply_clicked" : self.apply_clicked,
|
||||||
|
"on_delete_event" : self.on_delete_event,
|
||||||
"on_close_clicked" : self.close_clicked,
|
"on_close_clicked" : self.close_clicked,
|
||||||
})
|
})
|
||||||
self.display()
|
self.display()
|
||||||
|
|
||||||
|
self.add_itself_to_menu()
|
||||||
|
self.top.show()
|
||||||
|
|
||||||
|
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(_('Uncollected objects'))
|
||||||
|
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 display(self):
|
def display(self):
|
||||||
gc.collect()
|
gc.collect()
|
||||||
mylist = []
|
mylist = []
|
||||||
if len(gc.garbage):
|
if len(gc.garbage):
|
||||||
for each in gc.garbage:
|
for each in gc.garbage:
|
||||||
mylist.append(str(each))
|
mylist.append(str(each))
|
||||||
self.ebuf.set_text("Uncollected objects:\n\n" + string.join(mylist,'\n\n'))
|
self.ebuf.set_text(_("Uncollected objects:\n\n") + string.join(mylist,'\n\n'))
|
||||||
else:
|
else:
|
||||||
self.ebuf.set_text("No uncollected objects\n" + str(gc.get_debug()))
|
self.ebuf.set_text(_("No uncollected objects\n") + str(gc.get_debug()))
|
||||||
|
|
||||||
def apply_clicked(self,obj):
|
def apply_clicked(self,obj):
|
||||||
self.display()
|
self.display()
|
||||||
|
|
||||||
def close_clicked(self,obj):
|
|
||||||
self.top.destroy()
|
|
||||||
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
@ -70,8 +97,8 @@ class EvalWindow:
|
|||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
from Plugins import register_tool
|
from Plugins import register_tool
|
||||||
|
|
||||||
def runtool(database,person,callback):
|
def runtool(database,person,callback,parent=None):
|
||||||
EvalWindow()
|
Leak(parent)
|
||||||
|
|
||||||
register_tool(
|
register_tool(
|
||||||
runtool,
|
runtool,
|
||||||
@ -79,4 +106,3 @@ register_tool(
|
|||||||
category=_("Debug"),
|
category=_("Debug"),
|
||||||
description=_("Provide a window listing all uncollected objects"),
|
description=_("Provide a window listing all uncollected objects"),
|
||||||
)
|
)
|
||||||
|
|
@ -14,6 +14,12 @@
|
|||||||
<property name="default_height">500</property>
|
<property name="default_height">500</property>
|
||||||
<property name="resizable">True</property>
|
<property name="resizable">True</property>
|
||||||
<property name="destroy_with_parent">False</property>
|
<property name="destroy_with_parent">False</property>
|
||||||
|
<property name="decorated">True</property>
|
||||||
|
<property name="skip_taskbar_hint">False</property>
|
||||||
|
<property name="skip_pager_hint">False</property>
|
||||||
|
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
|
||||||
|
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||||
|
<signal name="delete_event" handler="on_delete_event" last_modification_time="Tue, 11 May 2004 01:57:33 GMT"/>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkVBox" id="vbox1">
|
<widget class="GtkVBox" id="vbox1">
|
||||||
@ -67,6 +73,8 @@
|
|||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="editable">True</property>
|
<property name="editable">True</property>
|
||||||
|
<property name="overwrite">False</property>
|
||||||
|
<property name="accepts_tab">True</property>
|
||||||
<property name="justification">GTK_JUSTIFY_LEFT</property>
|
<property name="justification">GTK_JUSTIFY_LEFT</property>
|
||||||
<property name="wrap_mode">GTK_WRAP_NONE</property>
|
<property name="wrap_mode">GTK_WRAP_NONE</property>
|
||||||
<property name="cursor_visible">True</property>
|
<property name="cursor_visible">True</property>
|
||||||
@ -102,6 +110,8 @@
|
|||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="editable">False</property>
|
<property name="editable">False</property>
|
||||||
|
<property name="overwrite">False</property>
|
||||||
|
<property name="accepts_tab">True</property>
|
||||||
<property name="justification">GTK_JUSTIFY_LEFT</property>
|
<property name="justification">GTK_JUSTIFY_LEFT</property>
|
||||||
<property name="wrap_mode">GTK_WRAP_NONE</property>
|
<property name="wrap_mode">GTK_WRAP_NONE</property>
|
||||||
<property name="cursor_visible">True</property>
|
<property name="cursor_visible">True</property>
|
||||||
@ -186,6 +196,8 @@
|
|||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="editable">False</property>
|
<property name="editable">False</property>
|
||||||
|
<property name="overwrite">False</property>
|
||||||
|
<property name="accepts_tab">True</property>
|
||||||
<property name="justification">GTK_JUSTIFY_LEFT</property>
|
<property name="justification">GTK_JUSTIFY_LEFT</property>
|
||||||
<property name="wrap_mode">GTK_WRAP_NONE</property>
|
<property name="wrap_mode">GTK_WRAP_NONE</property>
|
||||||
<property name="cursor_visible">True</property>
|
<property name="cursor_visible">True</property>
|
||||||
@ -254,6 +266,7 @@
|
|||||||
<property name="label">gtk-clear</property>
|
<property name="label">gtk-clear</property>
|
||||||
<property name="use_stock">True</property>
|
<property name="use_stock">True</property>
|
||||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||||
|
<property name="focus_on_click">True</property>
|
||||||
<signal name="clicked" handler="on_clear_clicked" last_modification_time="Sun, 11 May 2003 21:01:15 GMT"/>
|
<signal name="clicked" handler="on_clear_clicked" last_modification_time="Sun, 11 May 2003 21:01:15 GMT"/>
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
@ -266,6 +279,7 @@
|
|||||||
<property name="label">gtk-execute</property>
|
<property name="label">gtk-execute</property>
|
||||||
<property name="use_stock">True</property>
|
<property name="use_stock">True</property>
|
||||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||||
|
<property name="focus_on_click">True</property>
|
||||||
<signal name="clicked" handler="on_apply_clicked" last_modification_time="Sun, 11 May 2003 21:01:26 GMT"/>
|
<signal name="clicked" handler="on_apply_clicked" last_modification_time="Sun, 11 May 2003 21:01:26 GMT"/>
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
@ -278,6 +292,7 @@
|
|||||||
<property name="label">gtk-close</property>
|
<property name="label">gtk-close</property>
|
||||||
<property name="use_stock">True</property>
|
<property name="use_stock">True</property>
|
||||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||||
|
<property name="focus_on_click">True</property>
|
||||||
<signal name="clicked" handler="on_close_clicked" last_modification_time="Sun, 11 May 2003 21:01:38 GMT"/>
|
<signal name="clicked" handler="on_close_clicked" last_modification_time="Sun, 11 May 2003 21:01:38 GMT"/>
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
|
@ -14,6 +14,12 @@
|
|||||||
<property name="default_height">500</property>
|
<property name="default_height">500</property>
|
||||||
<property name="resizable">True</property>
|
<property name="resizable">True</property>
|
||||||
<property name="destroy_with_parent">False</property>
|
<property name="destroy_with_parent">False</property>
|
||||||
|
<property name="decorated">True</property>
|
||||||
|
<property name="skip_taskbar_hint">False</property>
|
||||||
|
<property name="skip_pager_hint">False</property>
|
||||||
|
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
|
||||||
|
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||||
|
<signal name="delete_event" handler="on_delete_event" last_modification_time="Tue, 11 May 2004 02:16:52 GMT"/>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkVBox" id="vbox1">
|
<widget class="GtkVBox" id="vbox1">
|
||||||
@ -67,6 +73,8 @@
|
|||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="editable">True</property>
|
<property name="editable">True</property>
|
||||||
|
<property name="overwrite">False</property>
|
||||||
|
<property name="accepts_tab">True</property>
|
||||||
<property name="justification">GTK_JUSTIFY_LEFT</property>
|
<property name="justification">GTK_JUSTIFY_LEFT</property>
|
||||||
<property name="wrap_mode">GTK_WRAP_NONE</property>
|
<property name="wrap_mode">GTK_WRAP_NONE</property>
|
||||||
<property name="cursor_visible">True</property>
|
<property name="cursor_visible">True</property>
|
||||||
@ -134,6 +142,7 @@
|
|||||||
<property name="label">gtk-refresh</property>
|
<property name="label">gtk-refresh</property>
|
||||||
<property name="use_stock">True</property>
|
<property name="use_stock">True</property>
|
||||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||||
|
<property name="focus_on_click">True</property>
|
||||||
<signal name="clicked" handler="on_apply_clicked" last_modification_time="Sun, 11 May 2003 21:01:26 GMT"/>
|
<signal name="clicked" handler="on_apply_clicked" last_modification_time="Sun, 11 May 2003 21:01:26 GMT"/>
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
@ -146,6 +155,7 @@
|
|||||||
<property name="label">gtk-close</property>
|
<property name="label">gtk-close</property>
|
||||||
<property name="use_stock">True</property>
|
<property name="use_stock">True</property>
|
||||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||||
|
<property name="focus_on_click">True</property>
|
||||||
<signal name="clicked" handler="on_close_clicked" last_modification_time="Sun, 11 May 2003 21:01:38 GMT"/>
|
<signal name="clicked" handler="on_close_clicked" last_modification_time="Sun, 11 May 2003 21:01:38 GMT"/>
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
|
Loading…
Reference in New Issue
Block a user