Example #1
0
 def attempt_db_connect(self):
     try:
         print "attempting to connect", self.config_info
         db = MySQLdb.connect(
             self.config_info["database_server"],
             self.config_info["database_user"],
             self.config_info["database_password"],
             self.config_info["database_name"],
         )
         db.close()
     except:
         db_dialog = DatabaseInfoDialog(
             self,
             self.config_info["database_server"],
             self.config_info["database_name"],
             self.config_info["database_user"],
         )
         response = db_dialog.run()
         if response == Gtk.ResponseType.OK:
             self.config_info["database_server"] = db_dialog.info["db_server"]
             self.config_info["database_user"] = db_dialog.info["db_user"]
             self.config_info["database_password"] = db_dialog.info["db_password"]
             self.config_info["database_name"] = db_dialog.info["db_name"]
         db_dialog.destroy()
         self.attempt_db_connect()
     else:
         utils.write_to_config_file(self.config_info)
Example #2
0
 def attempt_db_connect(self):
     try:
         print 'attempting to connect', self.config_info
         db = MySQLdb.connect(self.config_info['database_server'],
                              self.config_info['database_user'],
                              self.config_info['database_password'],
                              self.config_info['database_name'])
         db.close()
     except:
         db_dialog = DatabaseInfoDialog(self,
                                        self.config_info['database_server'],
                                        self.config_info['database_name'],
                                        self.config_info['database_user'])
         response = db_dialog.run()
         if response == Gtk.ResponseType.OK:
             self.config_info['database_server'] = db_dialog.info[
                 'db_server']
             self.config_info['database_user'] = db_dialog.info['db_user']
             self.config_info['database_password'] = db_dialog.info[
                 'db_password']
             self.config_info['database_name'] = db_dialog.info['db_name']
         db_dialog.destroy()
         self.attempt_db_connect()
     else:
         utils.write_to_config_file(self.config_info)
Example #3
0
def check_protein_db(count):
    results = get_db().query('SELECT count(*) from gene')
    new_count = results[0][0]
    print new_count
    if int(new_count) != int(count):
        update_protein_db()
        config = utils.get_config()
        config["count"] = new_count
        utils.write_to_config_file(config)
Example #4
0
def check_protein_db(count):
    results = get_db().query('SELECT count(*) from gene')
    new_count = results[0][0]
    print new_count
    if int(new_count) != int(count):
        update_protein_db()
        config = utils.get_config()
        config["count"] = new_count
        utils.write_to_config_file(config)
Example #5
0
    def on_folder_clicked(self, button, data):
        name = data[0]
        entry = data[1]
        read = data[2]
        dialog = Gtk.FileChooserDialog("Please choose a folder for %s" % read, self,
            Gtk.FileChooserAction.CREATE_FOLDER,
            (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
             Gtk.STOCK_OPEN, Gtk.ResponseType.OK))
        response = dialog.run()
        if response == Gtk.ResponseType.OK:
            print "File selected: " + dialog.get_filename()
            self.config_info[name] = dialog.get_filename()
            entry.set_text(self.config_info[name])
            print name, self.config_info[name]
            utils.write_to_config_file(self.config_info)

        dialog.destroy()
Example #6
0
    def on_folder_clicked(self, button, data):
        name = data[0]
        entry = data[1]
        read = data[2]
        dialog = Gtk.FileChooserDialog("Please choose a folder for %s" % read, self,
                                       Gtk.FileChooserAction.CREATE_FOLDER,
                                       (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
                                        Gtk.STOCK_OPEN, Gtk.ResponseType.OK))
        response = dialog.run()
        if response == Gtk.ResponseType.OK:
            print "File selected: " + dialog.get_filename()
            self.config_info[name] = dialog.get_filename()
            entry.set_text(self.config_info[name])
            print name, self.config_info[name]
            utils.write_to_config_file(self.config_info)

        dialog.destroy()
Example #7
0
 def on_entry_changed(self, entry, name):
     self.config_info[name] = entry.get_text()
     utils.write_to_config_file(self.config_info)
Example #8
0
 def on_entry_changed(self, entry, name):
     self.config_info[name] = entry.get_text()
     utils.write_to_config_file(self.config_info)
Example #9
0
 def on_pref_clicked(self, data):
     dialog = PreferencesDialog(self, self.config_info)
     response = dialog.run()
     if response == Gtk.ResponseType.APPLY:
         utils.write_to_config_file(self.config_info)
     dialog.destroy()
Example #10
0
 def on_pref_clicked(self, data):
     dialog = PreferencesDialog(self, self.config_info)
     response = dialog.run()
     if response == Gtk.ResponseType.APPLY:
         utils.write_to_config_file(self.config_info)
     dialog.destroy()