Changeset 35 for conseil.py

Show
Ignore:
Timestamp:
07/10/06 16:22:28 (2 years ago)
Author:
ploum
Message:

You can now import a bookmark file

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • conseil.py

    r33 r35  
    3737                        "on_bookmarks_row_activated": self.bookmarkClicked, 
    3838                        "on_addBookmark_clicked" : self.addBookmark_clicked, 
    39                         "on_bookmarks_button_press_event" : self.bookmarks_button_press  } 
     39                        "on_bookmarks_button_press_event" : self.bookmarks_button_press, 
     40                        "on_quitter1_activate": gtk.main_quit, 
     41                        "on_importer_activate" : self.import_bookmarks   } 
    4042                self.wTree.signal_autoconnect(dic) 
    4143                #Wich BTS are we using ? 
     
    6365        def __edited_callback(self, cellrenderertext, path, new_text) : 
    6466                self.bookmarks.rename(path,new_text) 
     67         
     68        def import_bookmarks(self,a) : 
     69                def callback(dial,zeid,bmarks): 
     70                        if zeid == -5 : 
     71                                if bmarks.import_file(dial.get_filename()) == 0 : 
     72                                        print "Not valid Conseil XML file" 
     73                                dial.destroy() 
     74                        else : 
     75                                dial.destroy() 
     76                dialog = gtk.FileChooserDialog() 
     77                cancel_button = dialog.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL) 
     78                ok_button = dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK) 
     79                ok_button.grab_default() 
     80                dialog.connect("response", callback, self.bookmarks) 
     81                dialog.show() 
    6582 
    6683        # This function initialize an empty result tree