clean some window management bugs
svn: r8888
This commit is contained in:
		@@ -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> 
 | 
			
		||||
	* src/Editors/_EditPerson.py: intendation error
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -108,7 +108,8 @@ class NoteTab(EmbeddedList):
 | 
			
		||||
        if self.notetype :
 | 
			
		||||
            note.set_type(self.notetype)
 | 
			
		||||
        try:
 | 
			
		||||
            EditNote(self.dbstate, self.uistate, [], note, self.add_callback,
 | 
			
		||||
            EditNote(self.dbstate, self.uistate, self.track, 
 | 
			
		||||
                            note, self.add_callback,
 | 
			
		||||
                            self.callertitle, extratype = [self.notetype])
 | 
			
		||||
        except Errors.WindowActiveError:
 | 
			
		||||
            pass
 | 
			
		||||
@@ -123,7 +124,7 @@ class NoteTab(EmbeddedList):
 | 
			
		||||
        if handle:
 | 
			
		||||
            note = self.dbstate.db.get_note_from_handle(handle)
 | 
			
		||||
            try:
 | 
			
		||||
                EditNote(self.dbstate, self.uistate, [], note,
 | 
			
		||||
                EditNote(self.dbstate, self.uistate, self.track, note,
 | 
			
		||||
                        self.edit_callback, self.callertitle,
 | 
			
		||||
                        extratype = [self.notetype] )
 | 
			
		||||
            except Errors.WindowActiveError:
 | 
			
		||||
 
 | 
			
		||||
@@ -133,6 +133,17 @@ class EditMediaRef(EditReference):
 | 
			
		||||
        else:
 | 
			
		||||
            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):
 | 
			
		||||
        if event.button==1 and event.type == gtk.gdk._2BUTTON_PRESS:
 | 
			
		||||
            self.view_media(obj)
 | 
			
		||||
 
 | 
			
		||||
@@ -274,6 +274,13 @@ class EditNote(EditPrimary):
 | 
			
		||||
        else:
 | 
			
		||||
            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):
 | 
			
		||||
        """Handle shortcuts in the TextView."""
 | 
			
		||||
        return textview.get_buffer().on_key_press_event(textview, event)
 | 
			
		||||
 
 | 
			
		||||
@@ -118,7 +118,8 @@ class EditReference(ManagedWindow.ManagedWindow):
 | 
			
		||||
        pass
 | 
			
		||||
 | 
			
		||||
    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()
 | 
			
		||||
        else:
 | 
			
		||||
            return id(self)
 | 
			
		||||
 
 | 
			
		||||
@@ -187,13 +187,18 @@ class GrampsWindowManager:
 | 
			
		||||
        # if the item is identifiable then we need to remember
 | 
			
		||||
        # its id so that in the future we recall this window
 | 
			
		||||
        # 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:
 | 
			
		||||
            self.id2item[item.window_id] = item
 | 
			
		||||
 | 
			
		||||
        # Make sure we have a track
 | 
			
		||||
        parent_item = self.get_item_from_track(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
 | 
			
		||||
        if item.submenu_label:
 | 
			
		||||
@@ -316,6 +321,8 @@ class ManagedWindow:
 | 
			
		||||
        @param obj      The object that is used to id the managed window, 
 | 
			
		||||
                            The inheriting object needs a method build_menu_names(self,obj)
 | 
			
		||||
                            which works on this obj and creates menu labels
 | 
			
		||||
                            for use in the Gramps Window Menu.
 | 
			
		||||
                            If self.submenu_label ='' then leaf, otherwise branch
 | 
			
		||||
         
 | 
			
		||||
                
 | 
			
		||||
        """
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user