2006-04-27 Alex Roitman <shura@gramps-project.org>
* src/PluginUtils/_PluginStatus.py: Fix wm. * src/PluginUtils/_Plugins.py: Fix Reload tool. The re-building of the menus still needs to be fixed. * src/plugins/Leak.py: Fix wm. * src/docgen/LPRDoc.py: Import Errors module before it is called. * src/plugins/DumpGenderStats.py: Fix wm. svn: r6468
This commit is contained in:
parent
2ccd918953
commit
0f6e4ff82a
@ -1,3 +1,11 @@
|
|||||||
|
2006-04-27 Alex Roitman <shura@gramps-project.org>
|
||||||
|
* src/PluginUtils/_PluginStatus.py: Fix wm.
|
||||||
|
* src/PluginUtils/_Plugins.py: Fix Reload tool. The re-building of
|
||||||
|
the menus still needs to be fixed.
|
||||||
|
* src/plugins/Leak.py: Fix wm.
|
||||||
|
* src/docgen/LPRDoc.py: Import Errors module before it is called.
|
||||||
|
* src/plugins/DumpGenderStats.py: Fix wm.
|
||||||
|
|
||||||
2006-04-27 Don Allingham <don@gramps-project.org>
|
2006-04-27 Don Allingham <don@gramps-project.org>
|
||||||
* src/DisplayModels.py: flush cache on row update
|
* src/DisplayModels.py: flush cache on row update
|
||||||
* src/DisplayTabs.py: check of event==None when determining default type
|
* src/DisplayTabs.py: check of event==None when determining default type
|
||||||
|
@ -55,15 +55,14 @@ class PluginStatus(ManagedWindow.ManagedWindow):
|
|||||||
def __init__(self, state, uistate, track=[]):
|
def __init__(self, state, uistate, track=[]):
|
||||||
|
|
||||||
self.title = _("Plugin Status")
|
self.title = _("Plugin Status")
|
||||||
ManagedWindow.ManagedWindow.__init__(self, uistate, track, self)
|
ManagedWindow.ManagedWindow.__init__(self,uistate,track,self.__class__)
|
||||||
|
|
||||||
self.set_window(gtk.Dialog("",uistate.window,
|
self.set_window(gtk.Dialog("",uistate.window,
|
||||||
gtk.DIALOG_DESTROY_WITH_PARENT,
|
gtk.DIALOG_DESTROY_WITH_PARENT,
|
||||||
(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)),
|
(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)),
|
||||||
None, self.title)
|
None, self.title)
|
||||||
self.window.set_size_request(600,400)
|
self.window.set_size_request(600,400)
|
||||||
self.window.connect('delete-event',self.close_window)
|
self.window.connect('response', self.close)
|
||||||
self.window.connect('response', self.close_window)
|
|
||||||
|
|
||||||
scrolled_window = gtk.ScrolledWindow()
|
scrolled_window = gtk.ScrolledWindow()
|
||||||
self.list = gtk.TreeView()
|
self.list = gtk.TreeView()
|
||||||
@ -106,9 +105,6 @@ class PluginStatus(ManagedWindow.ManagedWindow):
|
|||||||
'<span weight="bold" color="#267726">%s</span>' % _("OK"),
|
'<span weight="bold" color="#267726">%s</span>' % _("OK"),
|
||||||
i[0], descr, None])
|
i[0], descr, None])
|
||||||
|
|
||||||
def close_window(self, *obj):
|
|
||||||
self.close()
|
|
||||||
|
|
||||||
def button_press(self, obj, event):
|
def button_press(self, obj, event):
|
||||||
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
|
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
|
||||||
model, node = self.selection.get_selected()
|
model, node = self.selection.get_selected()
|
||||||
@ -138,8 +134,7 @@ class PluginTrace(ManagedWindow.ManagedWindow):
|
|||||||
(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)),
|
(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)),
|
||||||
None, title)
|
None, title)
|
||||||
self.window.set_size_request(600,400)
|
self.window.set_size_request(600,400)
|
||||||
self.window.connect('delete-event',self.close_window)
|
self.window.connect('response', self.close)
|
||||||
self.window.connect('response', self.close_window)
|
|
||||||
|
|
||||||
scrolled_window = gtk.ScrolledWindow()
|
scrolled_window = gtk.ScrolledWindow()
|
||||||
scrolled_window.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
|
scrolled_window.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
|
||||||
@ -153,6 +148,3 @@ class PluginTrace(ManagedWindow.ManagedWindow):
|
|||||||
|
|
||||||
def build_menu_names(self,obj):
|
def build_menu_names(self,obj):
|
||||||
return (self.name, None)
|
return (self.name, None)
|
||||||
|
|
||||||
def close_window(self, *obj):
|
|
||||||
self.close()
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
#
|
#
|
||||||
# Copyright (C) 2000-2005 Donald N. Allingham
|
# Copyright (C) 2000-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
|
||||||
@ -60,6 +60,7 @@ import Errors
|
|||||||
import _Report
|
import _Report
|
||||||
import _Tool
|
import _Tool
|
||||||
import _PluginMgr
|
import _PluginMgr
|
||||||
|
import _PluginStatus
|
||||||
import GrampsDisplay
|
import GrampsDisplay
|
||||||
import ManagedWindow
|
import ManagedWindow
|
||||||
|
|
||||||
@ -379,8 +380,8 @@ def by_menu_name(a,b):
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class Reload(_Tool.Tool):
|
class Reload(_Tool.Tool):
|
||||||
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)
|
_Tool.Tool.__init__(self,dbstate,options_class,name)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Treated as a callback, causes all plugins to get reloaded.
|
Treated as a callback, causes all plugins to get reloaded.
|
||||||
@ -393,12 +394,12 @@ class Reload(_Tool.Tool):
|
|||||||
_PluginMgr.failmsg_list = []
|
_PluginMgr.failmsg_list = []
|
||||||
|
|
||||||
# attempt to reload all plugins that have succeeded in the past
|
# attempt to reload all plugins that have succeeded in the past
|
||||||
for plugin in _PluginMgr._success_list:
|
for plugin in _PluginMgr.success_list:
|
||||||
filename = os.path.basename(plugin.__file__)
|
filename = plugin[0]
|
||||||
filename = filename.replace('pyc','py')
|
filename = filename.replace('pyc','py')
|
||||||
filename = filename.replace('pyo','py')
|
filename = filename.replace('pyo','py')
|
||||||
try:
|
try:
|
||||||
reload(plugin)
|
reload(plugin[1])
|
||||||
except:
|
except:
|
||||||
_PluginMgr.failmsg_list.append((filename,sys.exc_info()))
|
_PluginMgr.failmsg_list.append((filename,sys.exc_info()))
|
||||||
|
|
||||||
@ -440,7 +441,7 @@ class Reload(_Tool.Tool):
|
|||||||
# Looks like a bug in Python.
|
# Looks like a bug in Python.
|
||||||
a = __import__(plugin)
|
a = __import__(plugin)
|
||||||
reload(a)
|
reload(a)
|
||||||
_PluginMgr._success_list.append(a)
|
_PluginMgr.success_list.append((filename,a))
|
||||||
except:
|
except:
|
||||||
_PluginMgr.failmsg_list.append((filename,sys.exc_info()))
|
_PluginMgr.failmsg_list.append((filename,sys.exc_info()))
|
||||||
|
|
||||||
@ -457,21 +458,25 @@ class Reload(_Tool.Tool):
|
|||||||
plugin = match.groups()[0]
|
plugin = match.groups()[0]
|
||||||
try:
|
try:
|
||||||
a = __import__(plugin)
|
a = __import__(plugin)
|
||||||
if a not in _PluginMgr._success_list:
|
if a not in [plugin[1]
|
||||||
_PluginMgr._success_list.append(a)
|
for plugin in _PluginMgr.success_list]:
|
||||||
|
_PluginMgr.success_list.append((filename,a))
|
||||||
except:
|
except:
|
||||||
_PluginMgr.failmsg_list.append((filename,sys.exc_info()))
|
_PluginMgr.failmsg_list.append((filename,sys.exc_info()))
|
||||||
|
|
||||||
if Config.get(Config.POP_PLUGIN_STATUS) and len(_PluginMgr.failmsg_list):
|
if Config.get(Config.POP_PLUGIN_STATUS) \
|
||||||
PluginStatus()
|
and len(_PluginMgr.failmsg_list):
|
||||||
else:
|
try:
|
||||||
global status_up
|
_PluginStatus.PluginStatus(dbstate,uistate)
|
||||||
if status_up:
|
except Errors.WindowActiveError:
|
||||||
status_up.close(None)
|
old_win = uistate.gwm.get_item_from_id(
|
||||||
status_up = None
|
_PluginStatus.PluginStatus)
|
||||||
|
old_win.close()
|
||||||
|
_PluginStatus.PluginStatus(dbstate,uistate)
|
||||||
|
|
||||||
# Re-generate tool and report menus
|
# Re-generate tool and report menus
|
||||||
parent.build_plugin_menus(rebuild=True)
|
# FIXME: This needs to be fixed!
|
||||||
|
# build_plugin_menus(rebuild=True)
|
||||||
|
|
||||||
class ReloadOptions(_Tool.ToolOptions):
|
class ReloadOptions(_Tool.ToolOptions):
|
||||||
"""
|
"""
|
||||||
|
@ -42,7 +42,7 @@ from gettext import gettext as _
|
|||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
import gtk.gdk
|
import gtk.gdk
|
||||||
|
import Errors
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import gnomeprint, gnomeprint.ui
|
import gnomeprint, gnomeprint.ui
|
||||||
@ -60,8 +60,6 @@ else:
|
|||||||
print " or wait for the next gnome-python release."
|
print " or wait for the next gnome-python release."
|
||||||
### end FIXME ###
|
### end FIXME ###
|
||||||
|
|
||||||
import Errors
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# gramps modules
|
# gramps modules
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
#
|
#
|
||||||
# Copyright (C) 2000-2005 Martin Hawlisch, Donald N. Allingham
|
# Copyright (C) 2000-2006 Martin Hawlisch, 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
|
||||||
@ -37,10 +37,9 @@ _GENDER = [ _(u'female'), _(u'male'), _(u'unknown') ]
|
|||||||
class DumpGenderStats(Tool.Tool, ManagedWindow.ManagedWindow):
|
class DumpGenderStats(Tool.Tool, ManagedWindow.ManagedWindow):
|
||||||
|
|
||||||
def __init__(self, dbstate, uistate, options_class, name, callback=None):
|
def __init__(self, dbstate, uistate, options_class, name, callback=None):
|
||||||
|
self.label = _("Gender Statistics tool")
|
||||||
Tool.Tool.__init__(self, dbstate, options_class, name)
|
Tool.Tool.__init__(self, dbstate, options_class, name)
|
||||||
|
ManagedWindow.ManagedWindow.__init__(self,uistate,[],self.__class__)
|
||||||
ManagedWindow.ManagedWindow.__init__(self, uistate, [], self)
|
|
||||||
|
|
||||||
stats_list = []
|
stats_list = []
|
||||||
|
|
||||||
@ -63,12 +62,14 @@ class DumpGenderStats(Tool.Tool, ManagedWindow.ManagedWindow):
|
|||||||
for entry in stats_list:
|
for entry in stats_list:
|
||||||
model.add(entry,entry[0])
|
model.add(entry,entry[0])
|
||||||
|
|
||||||
self.window = gtk.Window()
|
window = gtk.Window()
|
||||||
self.window.set_default_size(400,300)
|
window.set_default_size(400,300)
|
||||||
s = gtk.ScrolledWindow()
|
s = gtk.ScrolledWindow()
|
||||||
s.add(treeview)
|
s.add(treeview)
|
||||||
self.window.add(s)
|
window.add(s)
|
||||||
self.window.show_all()
|
window.show_all()
|
||||||
|
self.set_window(window,None,self.label)
|
||||||
|
self.show()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print "\t%s\t%s\t%s\t%s\t%s\n" % (
|
print "\t%s\t%s\t%s\t%s\t%s\n" % (
|
||||||
@ -76,6 +77,9 @@ class DumpGenderStats(Tool.Tool, ManagedWindow.ManagedWindow):
|
|||||||
for entry in stats_list:
|
for entry in stats_list:
|
||||||
print "\t%s\t%s\t%s\t%s\t%s" % entry
|
print "\t%s\t%s\t%s\t%s\t%s" % entry
|
||||||
|
|
||||||
|
def build_menu_names(self,obj):
|
||||||
|
return (self.label,None)
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
@ -49,66 +49,39 @@ import gc
|
|||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
import Utils
|
import Utils
|
||||||
from PluginUtils import Tool, register_tool
|
from PluginUtils import Tool, register_tool
|
||||||
|
import ManagedWindow
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Actual tool
|
# Actual tool
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class Leak(Tool.Tool):
|
class Leak(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 = _('Uncollected Objects Tool')
|
||||||
|
|
||||||
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__),"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")
|
||||||
|
|
||||||
self.top = self.glade.get_widget("top")
|
window = self.glade.get_widget("top")
|
||||||
self.top.set_icon(self.parent.topWindow.get_icon())
|
|
||||||
self.eval = self.glade.get_widget("eval")
|
self.eval = self.glade.get_widget("eval")
|
||||||
self.ebuf = self.eval.get_buffer()
|
self.ebuf = self.eval.get_buffer()
|
||||||
gc.set_debug(gc.DEBUG_UNCOLLECTABLE|gc.DEBUG_OBJECTS|gc.DEBUG_SAVEALL)
|
gc.set_debug(gc.DEBUG_UNCOLLECTABLE|gc.DEBUG_OBJECTS|gc.DEBUG_SAVEALL)
|
||||||
|
|
||||||
self.title = _('Uncollected Objects Tool')
|
self.set_window(window,self.glade.get_widget('title'),self.title)
|
||||||
Utils.set_titles(self.top,
|
|
||||||
self.glade.get_widget('title'),
|
|
||||||
self.title)
|
|
||||||
|
|
||||||
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,
|
||||||
"on_close_clicked" : self.close_clicked,
|
|
||||||
})
|
})
|
||||||
self.display()
|
self.display()
|
||||||
|
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(self.title)
|
|
||||||
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()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user