예제 #1
0
    def __init__(self, parent, icon):

        FileChooserDialog.__init__(self, _("Choose the buildscript"),
                                   parent, FILE_CHOOSER_ACTION_OPEN,
                                   (STOCK_OPEN, RESPONSE_ACCEPT,
                                    STOCK_CANCEL, RESPONSE_REJECT))
        self.set_icon(pixbuf_new_from_file(icon))
예제 #2
0
 def __on_add(self, button, tree_view):
     file_chooser = FileChooserDialog('Add Plugin Path', None, FILE_CHOOSER_ACTION_SELECT_FOLDER,
                 (STOCK_CANCEL, RESPONSE_CANCEL, STOCK_OPEN, RESPONSE_OK) )
     result = file_chooser.run()
     model = tree_view.get_model()
     if result == RESPONSE_OK:
         row = (file_chooser.get_filename(),)
         model.append(row)
         
     file_chooser.destroy()
 def on_report_button_clicked(self, *args):
     fcd = FileChooserDialog("Choose report file and location",
                             None,
                             FILE_CHOOSER_ACTION_SAVE,
                             (STOCK_CANCEL, RESPONSE_CANCEL,
                                 STOCK_SAVE, RESPONSE_OK))
     fcd.set_modal(True)
     result = fcd.run()
     file_path = fcd.get_filename()
     fcd.destroy()
     if result == RESPONSE_OK and file_path != None:
         self.generate_balance_report(file_path)
 def file_selection_module_contents(self, msg="choose file"):
     fcd = FileChooserDialog(
         msg,
         None,
         FILE_CHOOSER_ACTION_OPEN,
         (STOCK_CANCEL, RESPONSE_CANCEL, STOCK_OPEN, RESPONSE_OK) )
     fcd.set_modal(True)
     result = fcd.run()
     file_path = fcd.get_filename()
     fcd.destroy()
     if result == RESPONSE_OK and file_path != None:
         return get_module_for_file_path(file_path)
     return None
예제 #5
0
 def save_dialog(self, msg):
     fcd = FileChooserDialog(
         msg,
         None,
         FILE_CHOOSER_ACTION_SAVE,
         (STOCK_CANCEL, RESPONSE_CANCEL, STOCK_SAVE, RESPONSE_OK) )
     fcd.set_modal(True)
     result = fcd.run()
     file_path = fcd.get_filename()
     fcd.destroy()
     if result == RESPONSE_OK and file_path != None:
         return file_path
     else:
         return None
예제 #6
0
def file_selection_path(msg="choose file",
                        selection_code=FILE_CHOOSER_ACTION_OPEN):
    fcd = FileChooserDialog(
        msg,
        None,
        selection_code,
        (STOCK_CANCEL, RESPONSE_CANCEL, STOCK_OPEN, RESPONSE_OK) )
    fcd.set_modal(True)
    result = fcd.run()
    file_path = fcd.get_filename()
    fcd.destroy()
    if result == RESPONSE_OK:
        return file_path
    return None
예제 #7
0
 def on_selectdb_button_clicked(self, *args):
     """Browse for the location of a new BoKeep transaction database."""
     
     fcd = FileChooserDialog(
         "Where should the database be?",
         self.bokeep_config_dialog,
         FILE_CHOOSER_ACTION_SAVE,
         (STOCK_CANCEL, RESPONSE_CANCEL, STOCK_SAVE, RESPONSE_OK) )
     fcd.set_modal(True)
     result = fcd.run()
     db_path = fcd.get_filename()
     fcd.destroy()
     if result == RESPONSE_OK and db_path != None:
         self.db_path_label.set_text(db_path)
         db_access_method = self.__get_db_access_method()
         self.__update_db_path(db_path, db_access_method)
         self.set_sensitivities()
예제 #8
0
 def run(self):
     res = FileChooserDialog.run(self)
     if res == RESPONSE_ACCEPT:
         return self.get_filename()
예제 #9
0
    def __OpenDB_dialog(self):
        dialog = FileChooserDialog(_("Select the database to use"), None,
                                   gtk.FILE_CHOOSER_ACTION_OPEN,
                                   (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                                    gtk.STOCK_OPEN, gtk.RESPONSE_OK))
        dialog.set_default_response(gtk.RESPONSE_OK)

        # sqlite files
        dialogFilter = gtk.FileFilter()
        dialogFilter.set_name("SQLite database")
        dialogFilter.add_pattern("*.sqlite")
        dialog.add_filter(dialogFilter)
        # Priorities export file
        dialogFilter = gtk.FileFilter()
        dialogFilter.set_name(_("Priorities export file"))
        dialogFilter.add_pattern("*.priorities")
        dialog.add_filter(dialogFilter)
        # All files
        dialogFilter = gtk.FileFilter()
        dialogFilter.set_name("All files")
        dialogFilter.add_pattern("*")
        dialog.add_filter(dialogFilter)

        response = dialog.run()
        if response == gtk.RESPONSE_OK:
            response = dialog.get_filename()

            # Export file
            if response[-11:] == ".priorities":
                self.controller.Connect(":memory:")
                if not self.controller.Import(response):
                    print _("Exception importing database")
                    dialog.destroy()
                    return False

            # Database
            else:
                self.controller.Connect(response)

            dialog.destroy()
            return True

        else:
            dialog.destroy()
            return False