2006-04-28 Alex Roitman <shura@gramps-project.org>

* src/ScratchPad.py (ScratchPadWindow.__init__): Allow only one
	instance; translate label; remove unneeded event handlers.
	* src/ViewManager.py (ViewManager.scratchpad): Catch exception.



svn: r6485
This commit is contained in:
Alex Roitman 2006-04-28 16:56:19 +00:00
parent edaf5fd8ae
commit 04448c2de3
3 changed files with 12 additions and 9 deletions

View File

@ -1,3 +1,8 @@
2006-04-28 Alex Roitman <shura@gramps-project.org>
* src/ScratchPad.py (ScratchPadWindow.__init__): Allow only one
instance; translate label; remove unneeded event handlers.
* src/ViewManager.py (ViewManager.scratchpad): Catch exception.
2006-04-27 Alex Roitman <shura@gramps-project.org> 2006-04-27 Alex Roitman <shura@gramps-project.org>
* src/ViewManager.py (ViewManager.build_plugin_menu): Use unique * src/ViewManager.py (ViewManager.build_plugin_menu): Use unique
command-line name for action menu. command-line name for action menu.

View File

@ -928,7 +928,7 @@ class ScratchPadWindow(ManagedWindow.ManagedWindow):
def __init__(self, dbstate, uistate): def __init__(self, dbstate, uistate):
"""Initializes the ScratchPad class, and displays the window""" """Initializes the ScratchPad class, and displays the window"""
ManagedWindow.ManagedWindow.__init__(self, uistate, [], self) ManagedWindow.ManagedWindow.__init__(self,uistate,[],self.__class__)
self.db = dbstate.db self.db = dbstate.db
self.database_changed(self.db) self.database_changed(self.db)
@ -962,11 +962,9 @@ class ScratchPadWindow(ManagedWindow.ManagedWindow):
self.object_list.set_model(ScratchPadWindow.otree) self.object_list.set_model(ScratchPadWindow.otree)
self.top.signal_autoconnect({ self.top.signal_autoconnect({
"on_close_scratchpad" : self.on_close_scratchpad, "on_close_scratchpad" : self.close,
"on_clear_clicked": self.on_clear_clicked, "on_clear_clicked": self.on_clear_clicked,
"on_help_clicked": self.on_help_clicked, "on_help_clicked": self.on_help_clicked,
"on_objectlist_delete_event": self.close,
"on_scratch_pad_delete_event": self.close,
}) })
self.clear_all_btn.connect_object('clicked', gtk.ListStore.clear, self.clear_all_btn.connect_object('clicked', gtk.ListStore.clear,
@ -976,7 +974,7 @@ class ScratchPadWindow(ManagedWindow.ManagedWindow):
self.show() self.show()
def build_menu_names(self,obj): def build_menu_names(self,obj):
return ('ScratchPad',None) return (_('ScratchPad'),None)
def database_changed(self,database): def database_changed(self,database):
self.db = database self.db = database
@ -998,9 +996,6 @@ class ScratchPadWindow(ManagedWindow.ManagedWindow):
"""Display the relevant portion of GRAMPS manual""" """Display the relevant portion of GRAMPS manual"""
GrampsDisplay.help('tools-util-scratch-pad') GrampsDisplay.help('tools-util-scratch-pad')
def on_close_scratchpad(self,obj):
self.close()
def on_clear_clicked(self,obj): def on_clear_clicked(self,obj):
"""Deletes the selected object from the object list""" """Deletes the selected object from the object list"""
selection = self.object_list.get_selection() selection = self.object_list.get_selection()

View File

@ -958,7 +958,10 @@ class ViewManager:
def scratchpad(self, obj): def scratchpad(self, obj):
import ScratchPad import ScratchPad
ScratchPad.ScratchPadWindow(self.state, self.uistate) try:
ScratchPad.ScratchPadWindow(self.state, self.uistate)
except Errors.WindowActiveError:
pass
def undo(self, obj): def undo(self, obj):
self.state.db.undo() self.state.db.undo()