Changeset 15 for conseil.py

Show
Ignore:
Timestamp:
07/05/06 11:26:25 (3 years ago)
Author:
ploum
Message:

#10 Cannot delete a bookmark

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • conseil.py

    r14 r15  
    3232                        "on_window1_destroy" : gtk.main_quit, 
    3333                        "on_bookmarks_row_activated": self.bookmarkClicked, 
    34                         "on_addBookmark_clicked" : self.addBookmark_clicked } 
     34                        "on_addBookmark_clicked" : self.addBookmark_clicked, 
     35                        "on_bookmarks_button_press_event" : self.bookmarks_button_press  } 
    3536                self.wTree.signal_autoconnect(dic) 
    3637                #Wich BTS are we using ? 
     
    8889                return listing 
    8990 
     91 
     92        def bookmarks_button_press(self,widget, event) : 
     93                #middle click, we open the bug 
     94                if event.button == 2 : 
     95                        #self.bookmarkClicked() 
     96                        print "TODO : open the bug on middle click" 
     97                #right click menu 
     98                elif event.button == 3 : 
     99                        # callback for delete right click menu 
     100                        def del_callback(menuitem) : 
     101                                model = widget.get_model() 
     102                                zetuple = widget.get_selection().get_selected() 
     103                                model.remove(zetuple[1]) 
     104                                #TODO : do not forget to also remove the bookmarks from 
     105                                #the stored bookmarks. (sync with storage) 
     106                        #callback for rename TODO 
     107                        def ren_callback(menuitem) : 
     108                                print "TODO rename function" 
     109                        #définition du right click menu 
     110                        # TODO : use a widget as the MenuItem 
     111                        delete = gtk.MenuItem("delete") 
     112                        delete.connect("activate", del_callback) 
     113                        delete.show() 
     114                        rename = gtk.MenuItem("rename") 
     115                        rename.connect("activate", ren_callback) 
     116                        rename.show() 
     117                        menu = gtk.Menu() 
     118                        menu.append(delete) 
     119                        menu.append(rename) 
     120                        menu.popup(None, None, None, event.button, event.time) 
     121 
    90122         
    91123        def bookmarkClicked(widget, path, view_column,user_param1): 
     
    116148        def addBookmark(self,title,searchMethod, args) : 
    117149                self.bookmarks.insert_before(None, [title, searchMethod, args]) 
     150                # TODO : do not forget to also add the bookmark in the store ! 
    118151         
    119152         
     
    139172                #First, we ask for the result as it can takes some times                         
    140173                tree=self.__treeInit__() 
    141                 handler = tree.connect("row-activated", self.__row_clicked, tree.get_selection()) 
     174                tree.connect("row-activated", self.__row_clicked, tree.get_selection()) 
    142175                if search_type == 3 : 
    143176                        array= args.split("\n",1)