clean some window management bugs
svn: r8888
This commit is contained in:
parent
fb5541f635
commit
4a2e1058b0
@ -1,3 +1,10 @@
|
|||||||
|
2007-08-29 Benny Malengier <bm@cage.ugent.be>
|
||||||
|
* src/Editors/_EditNote.py : ManagedWindow error, bad naming in menu
|
||||||
|
* src/Editors/_EditMediaRef.py : Bad naming in menu
|
||||||
|
* src/DisplayTabs/_NoteTab.py : ManagedWindow error, bad track
|
||||||
|
* src/Editors/_EditReference.py: Always give an id to ManagedWindow
|
||||||
|
* src/ManagedWindow.py : Add comment and better error message
|
||||||
|
|
||||||
2007-08-29 Benny Malengier <bm@cage.ugent.be>
|
2007-08-29 Benny Malengier <bm@cage.ugent.be>
|
||||||
* src/Editors/_EditPerson.py: intendation error
|
* src/Editors/_EditPerson.py: intendation error
|
||||||
|
|
||||||
|
@ -108,8 +108,9 @@ class NoteTab(EmbeddedList):
|
|||||||
if self.notetype :
|
if self.notetype :
|
||||||
note.set_type(self.notetype)
|
note.set_type(self.notetype)
|
||||||
try:
|
try:
|
||||||
EditNote(self.dbstate, self.uistate, [], note, self.add_callback,
|
EditNote(self.dbstate, self.uistate, self.track,
|
||||||
self.callertitle, extratype = [self.notetype])
|
note, self.add_callback,
|
||||||
|
self.callertitle, extratype = [self.notetype])
|
||||||
except Errors.WindowActiveError:
|
except Errors.WindowActiveError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -123,7 +124,7 @@ class NoteTab(EmbeddedList):
|
|||||||
if handle:
|
if handle:
|
||||||
note = self.dbstate.db.get_note_from_handle(handle)
|
note = self.dbstate.db.get_note_from_handle(handle)
|
||||||
try:
|
try:
|
||||||
EditNote(self.dbstate, self.uistate, [], note,
|
EditNote(self.dbstate, self.uistate, self.track, note,
|
||||||
self.edit_callback, self.callertitle,
|
self.edit_callback, self.callertitle,
|
||||||
extratype = [self.notetype] )
|
extratype = [self.notetype] )
|
||||||
except Errors.WindowActiveError:
|
except Errors.WindowActiveError:
|
||||||
|
@ -132,7 +132,18 @@ class EditMediaRef(EditReference):
|
|||||||
self.top.get_widget("type").set_text(mt)
|
self.top.get_widget("type").set_text(mt)
|
||||||
else:
|
else:
|
||||||
self.top.get_widget("type").set_text("")
|
self.top.get_widget("type").set_text("")
|
||||||
|
|
||||||
|
def build_menu_names(self, person):
|
||||||
|
"""
|
||||||
|
Provides the information needed by the base class to define the
|
||||||
|
window management menu entries.
|
||||||
|
"""
|
||||||
|
if self.source:
|
||||||
|
submenu_label = _('Media: %s') % self.source.get_gramps_id()
|
||||||
|
else:
|
||||||
|
submenu_label = _('New Media')
|
||||||
|
return (_('Media Reference Editor'),submenu_label)
|
||||||
|
|
||||||
def button_press_event(self, obj, event):
|
def button_press_event(self, obj, event):
|
||||||
if event.button==1 and event.type == gtk.gdk._2BUTTON_PRESS:
|
if event.button==1 and event.type == gtk.gdk._2BUTTON_PRESS:
|
||||||
self.view_media(obj)
|
self.view_media(obj)
|
||||||
|
@ -273,6 +273,13 @@ class EditNote(EditPrimary):
|
|||||||
log.debug("Initial Note: %s" % buffer.get_text())
|
log.debug("Initial Note: %s" % buffer.get_text())
|
||||||
else:
|
else:
|
||||||
self.empty = True
|
self.empty = True
|
||||||
|
|
||||||
|
def build_menu_names(self, person):
|
||||||
|
"""
|
||||||
|
Provides the information needed by the base class to define the
|
||||||
|
window management menu entries.
|
||||||
|
"""
|
||||||
|
return (_('Edit Note'), self.get_menu_title())
|
||||||
|
|
||||||
def on_textview_key_press_event(self, textview, event):
|
def on_textview_key_press_event(self, textview, event):
|
||||||
"""Handle shortcuts in the TextView."""
|
"""Handle shortcuts in the TextView."""
|
||||||
|
@ -118,7 +118,8 @@ class EditReference(ManagedWindow.ManagedWindow):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def build_window_key(self,sourceref):
|
def build_window_key(self,sourceref):
|
||||||
if self.source:
|
#the window key for managedwindow identification. No need to return None
|
||||||
|
if self.source and self.source.get_handle():
|
||||||
return self.source.get_handle()
|
return self.source.get_handle()
|
||||||
else:
|
else:
|
||||||
return id(self)
|
return id(self)
|
||||||
|
@ -187,13 +187,18 @@ class GrampsWindowManager:
|
|||||||
# if the item is identifiable then we need to remember
|
# if the item is identifiable then we need to remember
|
||||||
# its id so that in the future we recall this window
|
# its id so that in the future we recall this window
|
||||||
# instead of spawning a new one
|
# instead of spawning a new one
|
||||||
|
# So people can make as many windows of type item.window_id = None
|
||||||
|
# Use this for add dialogs, where users may add as many values
|
||||||
|
# simultaneously as they want.
|
||||||
|
# Actually, we should do this away, as requiring at least id(obj)
|
||||||
|
# is not a big requirement ?
|
||||||
if item.window_id:
|
if item.window_id:
|
||||||
self.id2item[item.window_id] = item
|
self.id2item[item.window_id] = item
|
||||||
|
|
||||||
# Make sure we have a track
|
# Make sure we have a track
|
||||||
parent_item = self.get_item_from_track(track)
|
parent_item = self.get_item_from_track(track)
|
||||||
assert type(parent_item) == list or track == [], \
|
assert type(parent_item) == list or track == [], \
|
||||||
"Gwm: add_item: Incorrect track."
|
"Gwm: add_item: Incorrect track - Is parent not a leaf?"
|
||||||
|
|
||||||
# Prepare a new item, depending on whether it is branch or leaf
|
# Prepare a new item, depending on whether it is branch or leaf
|
||||||
if item.submenu_label:
|
if item.submenu_label:
|
||||||
@ -316,6 +321,8 @@ class ManagedWindow:
|
|||||||
@param obj The object that is used to id the managed window,
|
@param obj The object that is used to id the managed window,
|
||||||
The inheriting object needs a method build_menu_names(self,obj)
|
The inheriting object needs a method build_menu_names(self,obj)
|
||||||
which works on this obj and creates menu labels
|
which works on this obj and creates menu labels
|
||||||
|
for use in the Gramps Window Menu.
|
||||||
|
If self.submenu_label ='' then leaf, otherwise branch
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user