Logo Search packages:      
Sourcecode: catfish version File versions  Download package

def catfish::catfish::on_menu_save (   self,
  menu 
)
Show a save dialog and possibly write the results to a file.

Definition at line 837 of file catfish.py.

                                :
        """Show a save dialog and possibly write the results to a file."""

        filename = self.get_save_dialog(self.window_search)
        if os.path.exists(filename):
            if not self.get_yesno_dialog(('The file %s already exists. Do you '
             + 'want to overwrite it?') % filename, self.window_search):
                filename = None
        if filename <> None:
            try:
                save = open(filename, 'w')
                listmodel = self.treeview_files.get_model()
                for item in range(len(listmodel)):
                    treeiter = listmodel.iter_nth_child(None, item)
                    name, path = self.get_selected_filename(self.treeview_files, treeiter)
                    save.write(os.path.join(name, path) + os.linesep)
                save.close()
            except Exception, msg:
                if self.options.debug: print 'Debug:', msg
                self.get_error_dialog('The file %s could not be saved.'
                 % filename, self.window_search)

catfish()
gtk.main()

Generated by  Doxygen 1.6.0   Back to index