示例#1
0
    def run(self):
        self.gladefile = gladeFile().filename
        #self.wTree = gtk.glade.XML(self.gladefile, "whatsNewDialog")
        self.wTree = gtk.Builder()
        self.wTree.add_objects_from_file(self.gladefile, ["whatsNewDialog"])
        self.dlg = self.wTree.get_object("whatsNewDialog")
        self.textView = self.wTree.get_object('whatsNewDialogTextView')
        buffer = gtk.TextBuffer()
        self.textView.set_buffer(buffer)

        try:
            from bzrlib.branch import Branch
            my_branch = Branch.open(
                os.path.join(os.path.dirname(__file__), '../..'))
            rev_ids = my_branch.revision_history()
            rev_ids.reverse()
            repo = my_branch.repository
            for rev_id in rev_ids:
                revision = repo.get_revision(rev_id)
                buffer.insert_at_cursor('revision ')
                buffer.insert_at_cursor(
                    str(my_branch.revision_id_to_revno(rev_id)))
                buffer.insert_at_cursor(' :: ')
                buffer.insert_at_cursor(revision.message)
                buffer.insert_at_cursor('\n\n')
        except:
            pass

        self.result = self.dlg.run()
        self.dlg.destroy()
示例#2
0
    def run(self):
        """This function will show the addPhageDialog"""
        #load the dialog from the glade file
        self.gladefile = gladeFile().filename
        #self.wTree = gtk.glade.XML(self.gladefile, "AddPhageDialog")
        self.wTree = gtk.Builder()
        self.wTree.add_objects_from_file(self.gladefile, ["AddPhageDialog"])
        #Get the actual dialog widget
        self.dlg = self.wTree.get_object("AddPhageDialog")
        #Get all of the Entry Widgets and set their text
        self.enName = self.wTree.get_object("AddPhage_EnterName")
        self.allowRefSeqsCheckBox = self.wTree.get_object(
            "allowRefSeqsCheckBox")

        #run the dialog and store the response
        self.result = self.dlg.run()
        #get the value of the entry fields
        self.phage.name = self.enName.get_text()
        #we are done with the dialog, destroy it
        self.dlg.destroy()
        if self.result == gtk.RESPONSE_CANCEL: return None
        self.logger.log('destroying AddPhageDialog')
        #return the result and the phage
        return (self.result, self.phage,
                self.allowRefSeqsCheckBox.get_active())
示例#3
0
  def run(self):
    self.gladefile = gladeFile().filename
    #self.wTree = gtk.glade.XML(self.gladefile, "whatsNewDialog")
    self.wTree = gtk.Builder()
    self.wTree.add_objects_from_file(self.gladefile, ["whatsNewDialog"])
    self.dlg = self.wTree.get_object("whatsNewDialog")
    self.textView = self.wTree.get_object('whatsNewDialogTextView')
    buffer = gtk.TextBuffer()
    self.textView.set_buffer(buffer)
    
    try:
      from bzrlib.branch import Branch
      my_branch = Branch.open(os.path.join(os.path.dirname(__file__), '../..'))
      rev_ids = my_branch.revision_history()
      rev_ids.reverse()
      repo = my_branch.repository
      for rev_id in rev_ids:
        revision=repo.get_revision(rev_id)
        buffer.insert_at_cursor('revision ')
        buffer.insert_at_cursor(str(my_branch.revision_id_to_revno(rev_id)))
        buffer.insert_at_cursor(' :: ')
        buffer.insert_at_cursor(revision.message)
        buffer.insert_at_cursor('\n\n')
    except:
      pass

    self.result = self.dlg.run()
    self.dlg.destroy()
示例#4
0
 def __init__(self):
     self.gladefile = gladeFile().filename
     import gconf
     self.client = gconf.client_get_default()
     self.client.add_dir('/apps/phamerator', gconf.CLIENT_PRELOAD_NONE)
     hideDialog = self.client.get_bool(
         '/apps/phamerator/hide_BLAST_warning_dialog')
示例#5
0
 def __init__(self, dbname):
   print 'open database setup dialog'
   self.gladefile = gladeFile().filename
   #self.wTree = gtk.glade.XML(self.gladefile, "databaseSetupWarningDialog")
   self.wTree = gtk.Builder()
   self.wTree.add_objects_from_file(self.gladefile, ["databaseSetupWarningDialog"])
   self.dbname = self.wTree.get_object("databaseSetupWarningDbname")
   self.dbname.set_text(dbname)
示例#6
0
 def __init__(self, name):
   print 'creating saveDialog'
   #Dialog.__init__(self)
   self.gladefile = gladeFile().filename
   self.wTree = gtk.Builder()
   self.wTree.add_objects_from_file(self.gladefile, [name])
   self.current_folder = os.path.join(os.environ['HOME'], 'Desktop')
   if name is not None: self.wTree.get_object(name).set_current_folder(self.current_folder)
示例#7
0
 def run(self):
   self.gladefile = gladeFile().filename
   self.wTree = gtk.Builder()
   self.wTree.add_objects_from_file(self.gladefile, ["newDatabaseAvailableDialog"])
   self.dlg = self.wTree.get_object("newDatabaseAvailableDialog")
   self.result = self.dlg.run()
   self.dlg.destroy()
   return self.result
示例#8
0
 def __init__(self, pM):
   SaveDialog.__init__(self, "batchFileSaveAsDialog")
   self.gladefile = gladeFile().filename
   dic = {"on_appendDateCheckButton_toggled" : self.on_appendDateCheckButton_toggled}
   self.wTree.connect_signals(dic)
   self.chooser = self.wTree.get_object("batchFileSaveAsDialog")
   #self.chooser.set_current_name('pham####')
   self.pM = pM
示例#9
0
  def __init__(self,showPopUp=True,filePath=None):
    self.gladefile = gladeFile().filename
    self.wTree = gtk.Builder()
    dic = {"on_specifyButton_activate" : self.on_specifyButton_activate,"on_downloadSpecificPathButton_activate":self.on_downloadSpecificPathButton_activate, "on_okbutton_activate":self.on_okbutton_activate}

    self.wTree.add_objects_from_file(self.gladefile, ["blastDownloadDialog"])
    self.wTree.connect_signals(dic)
    self.dlg = self.wTree.get_object("blastDownloadDialog")
示例#10
0
 def run(self):
   self.gladefile = gladeFile().filename
   #self.wTree = gtk.glade.XML(self.gladefile, "OpenGenBankFileDialog")
   self.wTree = gtk.Builder()
   self.wTree.add_objects_from_file(self.gladefile, ["OpenGenBankFileDialog"])
   self.dlg = self.wTree.get_object("OpenGenBankFileDialog")
   self.result = self.dlg.run()
   self.dlg.hide()
   return self.result
示例#11
0
 def run(self):
   self.gladefile = gladeFile().filename
   self.wTree = gtk.Builder()
   self.wTree.add_objects_from_file(self.gladefile, ["blastCustomLocationDialog"])
   self.dlg = self.wTree.get_object("blastCustomLocationDialog")
   self.dlg.set_current_folder(os.environ['HOME'])
   self.result = self.dlg.run()
   self.dlg.hide()
   return self.result
示例#12
0
 def __init__(self, name):
     print 'creating saveDialog'
     #Dialog.__init__(self)
     self.gladefile = gladeFile().filename
     self.wTree = gtk.Builder()
     self.wTree.add_objects_from_file(self.gladefile, [name])
     self.current_folder = os.path.join(os.environ['HOME'], 'Desktop')
     if name is not None:
         self.wTree.get_object(name).set_current_folder(self.current_folder)
示例#13
0
 def run(self):
     self.gladefile = gladeFile().filename
     self.wTree = gtk.Builder()
     self.wTree.add_objects_from_file(self.gladefile,
                                      ["newDatabaseAvailableDialog"])
     self.dlg = self.wTree.get_object("newDatabaseAvailableDialog")
     self.result = self.dlg.run()
     self.dlg.destroy()
     return self.result
示例#14
0
 def run(self):
   self.gladefile = gladeFile().filename
   #self.wTree = gtk.glade.XML(self.gladefile, "InvalidConfigurationDialog")
   #self.dlg = self.wTree.get_object("InvalidConfigurationDialog")
   self.wTree = gtk.Builder()
   self.wTree.add_objects_from_file(self.gladefile, ["InvalidConfigurationDialog"])
   self.dlg = self.wTree.get_object("InvalidConfigurationDialog")
   self.result = self.dlg.run()
   self.dlg.destroy()
示例#15
0
 def __init__(self, dbname):
     print 'open database setup dialog'
     self.gladefile = gladeFile().filename
     #self.wTree = gtk.glade.XML(self.gladefile, "databaseSetupWarningDialog")
     self.wTree = gtk.Builder()
     self.wTree.add_objects_from_file(self.gladefile,
                                      ["databaseSetupWarningDialog"])
     self.dbname = self.wTree.get_object("databaseSetupWarningDbname")
     self.dbname.set_text(dbname)
示例#16
0
 def run(self):
     self.gladefile = gladeFile().filename
     #self.wTree = gtk.glade.XML(self.gladefile, "OpenGenBankFileDialog")
     self.wTree = gtk.Builder()
     self.wTree.add_objects_from_file(self.gladefile,
                                      ["OpenGenBankFileDialog"])
     self.dlg = self.wTree.get_object("OpenGenBankFileDialog")
     self.result = self.dlg.run()
     self.dlg.hide()
     return self.result
示例#17
0
 def run(self):
     self.gladefile = gladeFile().filename
     #self.wTree = gtk.glade.XML(self.gladefile, "InvalidConfigurationDialog")
     #self.dlg = self.wTree.get_object("InvalidConfigurationDialog")
     self.wTree = gtk.Builder()
     self.wTree.add_objects_from_file(self.gladefile,
                                      ["InvalidConfigurationDialog"])
     self.dlg = self.wTree.get_object("InvalidConfigurationDialog")
     self.result = self.dlg.run()
     self.dlg.destroy()
示例#18
0
  def __init__(self, error):
    print error
    errno, errmsg = error
    self.gladefile = gladeFile().filename
    #self.wTree = gtk.glade.XML(self.gladefile, "databaseConnectionErrorDialog")
    self.wTree = gtk.Builder()
    self.wTree.add_objects_from_file(self.gladefile, ["databaseConnectionErrorDialog"])

    label = self.wTree.get_object("databaseConnectionErrorLabel")
    label.set_text('%s: %s' % (errno, errmsg))
示例#19
0
 def run(self):
     self.gladefile = gladeFile().filename
     self.wTree = gtk.Builder()
     self.wTree.add_objects_from_file(self.gladefile,
                                      ["blastCustomLocationDialog"])
     self.dlg = self.wTree.get_object("blastCustomLocationDialog")
     self.dlg.set_current_folder(os.environ['HOME'])
     self.result = self.dlg.run()
     self.dlg.hide()
     return self.result
示例#20
0
 def run(self):
   self.gladefile = gladeFile().filename
   #self.wTree = gtk.glade.XML(self.gladefile, "openBlastFolderDialog")
   self.wTree = gtk.Builder()
   self.wTree.add_objects_from_file(self.gladefile, ["openBlastFolderDialog"])
   self.dlg = self.wTree.get_object("openBlastFolderDialog")
   self.dlg.set_current_folder(os.environ['HOME'])
   self.result = self.dlg.run()
   self.dlg.hide()
   return self.result
示例#21
0
    def __init__(self, error):
        print error
        errno, errmsg = error
        self.gladefile = gladeFile().filename
        #self.wTree = gtk.glade.XML(self.gladefile, "databaseConnectionErrorDialog")
        self.wTree = gtk.Builder()
        self.wTree.add_objects_from_file(self.gladefile,
                                         ["databaseConnectionErrorDialog"])

        label = self.wTree.get_object("databaseConnectionErrorLabel")
        label.set_text('%s: %s' % (errno, errmsg))
示例#22
0
 def __init__(self, pM):
     SaveDialog.__init__(self, "batchFileSaveAsDialog")
     self.gladefile = gladeFile().filename
     dic = {
         "on_appendDateCheckButton_toggled":
         self.on_appendDateCheckButton_toggled
     }
     self.wTree.connect_signals(dic)
     self.chooser = self.wTree.get_object("batchFileSaveAsDialog")
     #self.chooser.set_current_name('pham####')
     self.pM = pM
示例#23
0
 def __init__(self, name=None):
   #setup the glade file
   self.gladefile = gladeFile().filename
   self.client = gconf.client_get_default()
   self.conf = config.PhameratorConfiguration()
   self.current_folder = self.conf.get('/apps/phamerator/default_folder')
   if not self.current_folder: self.current_folder = os.path.join(os.environ['HOME'], 'Desktop')
   #self.wTree = gtk.glade.XML(self.gladefile, name)
   self.wTree = gtk.Builder()
   self.wTree.add_objects_from_file(self.gladefile, [name])
   if name is not None: self.wTree.get_object(name).set_current_folder(self.current_folder)
示例#24
0
 def run(self):
     self.gladefile = gladeFile().filename
     #self.wTree = gtk.glade.XML(self.gladefile, "openBlastFolderDialog")
     self.wTree = gtk.Builder()
     self.wTree.add_objects_from_file(self.gladefile,
                                      ["openBlastFolderDialog"])
     self.dlg = self.wTree.get_object("openBlastFolderDialog")
     self.dlg.set_current_folder(os.environ['HOME'])
     self.result = self.dlg.run()
     self.dlg.hide()
     return self.result
示例#25
0
 def run(self):
   self.gladefile = gladeFile().filename
   #self.wTree = gtk.glade.XML(self.gladefile, "ErrorAddingPhageDialog")
   self.wTree = gtk.Builder()
   self.wTree.add_objects_from_file(self.gladefile, ["ErrorAddingPhageDialog"])
   self.dlg = self.wTree.get_object("ErrorAddingPhageDialog")
   errTextView = self.wTree.get_object("errorAddingPhageTextView") # errorAddingPhageTextView
   errText = gtk.TextBuffer(table=None)
   errText.set_text(self.msg)
   errTextView.set_buffer(errText)
   self.result = self.dlg.run()
   self.dlg.destroy()
   return self.result
示例#26
0
 def run(self):
     self.gladefile = gladeFile().filename
     #self.wTree = gtk.glade.XML(self.gladefile, "addDatabaseDialog")
     self.wTree = gtk.Builder()
     self.wTree.add_objects_from_file(self.gladefile, ["addDatabaseDialog"])
     self.dlg = self.wTree.get_object("addDatabaseDialog")
     self.result = self.dlg.run()
     text = self.wTree.get_object("addDatabaseEntry").get_text()
     self.dlg.destroy()
     if not self.result:
         return None
     else:
         return text
示例#27
0
 def run(self):
   self.gladefile = gladeFile().filename
   #self.wTree = gtk.glade.XML(self.gladefile, "addDatabaseDialog")
   self.wTree = gtk.Builder()
   self.wTree.add_objects_from_file(self.gladefile, ["addDatabaseDialog"])
   self.dlg = self.wTree.get_object("addDatabaseDialog")
   self.result = self.dlg.run()
   text = self.wTree.get_object("addDatabaseEntry").get_text()
   self.dlg.destroy()
   if not self.result:
     return None
   else:
     return text
示例#28
0
 def __init__(self, name=None):
     #setup the glade file
     self.gladefile = gladeFile().filename
     self.client = gconf.client_get_default()
     self.conf = config.PhameratorConfiguration()
     self.current_folder = self.conf.get('/apps/phamerator/default_folder')
     if not self.current_folder:
         self.current_folder = os.path.join(os.environ['HOME'], 'Desktop')
     #self.wTree = gtk.glade.XML(self.gladefile, name)
     self.wTree = gtk.Builder()
     self.wTree.add_objects_from_file(self.gladefile, [name])
     if name is not None:
         self.wTree.get_object(name).set_current_folder(self.current_folder)
示例#29
0
    def __init__(self, showPopUp=True, filePath=None):
        self.gladefile = gladeFile().filename
        self.wTree = gtk.Builder()
        dic = {
            "on_specifyButton_activate": self.on_specifyButton_activate,
            "on_downloadSpecificPathButton_activate":
            self.on_downloadSpecificPathButton_activate,
            "on_okbutton_activate": self.on_okbutton_activate
        }

        self.wTree.add_objects_from_file(self.gladefile,
                                         ["blastDownloadDialog"])
        self.wTree.connect_signals(dic)
        self.dlg = self.wTree.get_object("blastDownloadDialog")
示例#30
0
 def run(self):
     self.gladefile = gladeFile().filename
     #self.wTree = gtk.glade.XML(self.gladefile, "ErrorAddingPhageDialog")
     self.wTree = gtk.Builder()
     self.wTree.add_objects_from_file(self.gladefile,
                                      ["ErrorAddingPhageDialog"])
     self.dlg = self.wTree.get_object("ErrorAddingPhageDialog")
     errTextView = self.wTree.get_object(
         "errorAddingPhageTextView")  # errorAddingPhageTextView
     errText = gtk.TextBuffer(table=None)
     errText.set_text(self.msg)
     errTextView.set_buffer(errText)
     self.result = self.dlg.run()
     self.dlg.destroy()
     return self.result
示例#31
0
  def run(self):
    self.gladefile = gladeFile().filename
    #self.wTree = gtk.glade.XML(self.gladefile, "AboutDialog")
    self.wTree = gtk.Builder()
    self.wTree.add_objects_from_file(self.gladefile, ["AboutDialog"])
    self.dlg = self.wTree.get_object("AboutDialog")

    try:
      from bzrlib.branch import Branch
      my_branch = Branch.open(os.path.join(os.path.dirname(__file__), '../..'))
      version = my_branch.last_revision_info()[0]
      self.dlg.set_comments('you are using a development version')
    except:
      self.dlg.set_comments('')
      version = open(os.path.join(os.path.dirname(__file__), '../..', 'README.txt')).readlines()[0].split(' ')[-1]

    self.dlg.set_version('%s' % version)
    self.result = self.dlg.run()
    self.dlg.destroy()
示例#32
0
    def run(self):
        self.gladefile = gladeFile().filename
        #self.wTree = gtk.glade.XML(self.gladefile, "AboutDialog")
        self.wTree = gtk.Builder()
        self.wTree.add_objects_from_file(self.gladefile, ["AboutDialog"])
        self.dlg = self.wTree.get_object("AboutDialog")

        try:
            from bzrlib.branch import Branch
            my_branch = Branch.open(
                os.path.join(os.path.dirname(__file__), '../..'))
            version = my_branch.last_revision_info()[0]
            self.dlg.set_comments('you are using a development version')
        except:
            self.dlg.set_comments('')
            version = open(
                os.path.join(os.path.dirname(__file__), '../..',
                             'README.txt')).readlines()[0].split(' ')[-1]

        self.dlg.set_version('%s' % version)
        self.result = self.dlg.run()
        self.dlg.destroy()
示例#33
0
    def run(self):
        self.gladefile = gladeFile().filename
        #self.wTree = gtk.glade.XML(self.gladefile, "dbStatsDialog")
        self.wTree = gtk.Builder()
        self.wTree.add_objects_from_file(self.gladefile, ["dbStatsDialog"])

        self.show_number_of_genes()
        self.show_number_of_genomes()
        self.show_number_of_phamilies()
        self.show_genome_length_min()
        self.show_genome_length_max()
        self.show_genome_length_mean()
        self.show_gene_length_min()
        self.show_gene_length_max()
        self.show_gene_length_mean()
        self.show_phamily_size_min()
        self.show_phamily_size_max()
        self.show_phamily_size_mean()

        self.dlg = self.wTree.get_object("dbStatsDialog")
        self.result = self.dlg.run()
        self.dlg.destroy()
示例#34
0
  def run(self):
    self.gladefile = gladeFile().filename
    #self.wTree = gtk.glade.XML(self.gladefile, "dbStatsDialog")
    self.wTree = gtk.Builder()
    self.wTree.add_objects_from_file(self.gladefile, ["dbStatsDialog"])

    self.show_number_of_genes()
    self.show_number_of_genomes()
    self.show_number_of_phamilies()
    self.show_genome_length_min()
    self.show_genome_length_max()
    self.show_genome_length_mean()
    self.show_gene_length_min()
    self.show_gene_length_max()
    self.show_gene_length_mean()
    self.show_phamily_size_min()
    self.show_phamily_size_max()
    self.show_phamily_size_mean()

    self.dlg = self.wTree.get_object("dbStatsDialog")
    self.result = self.dlg.run()
    self.dlg.destroy()
示例#35
0
 def run(self):
   """This function will show the addPhageDialog"""  
   #load the dialog from the glade file    
   self.gladefile = gladeFile().filename
   #self.wTree = gtk.glade.XML(self.gladefile, "AddPhageDialog")
   self.wTree = gtk.Builder()
   self.wTree.add_objects_from_file(self.gladefile, ["AddPhageDialog"])
   #Get the actual dialog widget
   self.dlg = self.wTree.get_object("AddPhageDialog")
   #Get all of the Entry Widgets and set their text
   self.enName = self.wTree.get_object("AddPhage_EnterName")
   self.allowRefSeqsCheckBox = self.wTree.get_object("allowRefSeqsCheckBox")
 
   #run the dialog and store the response
   self.result = self.dlg.run()
   #get the value of the entry fields
   self.phage.name = self.enName.get_text()
   #we are done with the dialog, destroy it
   self.dlg.destroy()
   if self.result == gtk.RESPONSE_CANCEL: return None
   self.logger.log('destroying AddPhageDialog')
   #return the result and the phage
   return (self.result,self.phage,self.allowRefSeqsCheckBox.get_active())
示例#36
0
 def __init__(self, results):
     self.gi_list = results
     self.gladefile = gladeFile().filename
     self.active = None
示例#37
0
 def __init__(self):
   self.gladefile = gladeFile().filename
   import gconf
   self.client = gconf.client_get_default()
   self.client.add_dir('/apps/phamerator', gconf.CLIENT_PRELOAD_NONE)
   hideDialog = self.client.get_bool('/apps/phamerator/hide_BLAST_warning_dialog')
示例#38
0
 def __init__(self, results):
   self.gi_list = results
   self.gladefile = gladeFile().filename
   self.active = None
示例#39
0
  def __init__(self,pManager):
    self.PManager = pManager
    self.gladefile = gladeFile().filename
    #self.wTree = gtk.glade.XML(self.gladefile, "preferencesDialog")
    self.wTree = gtk.Builder()
    self.wTree.add_objects_from_file(self.gladefile, ["preferencesDialog"])
    dic = {"preferencesChangedSignalHandler" : self.preferencesChangedSignalHandler,
           "radioChangedSignalHandler":self.radioChangedSignalHandler,
           "on_preferencesServerComboBox_changed": self.on_preferencesServerComboBox_changed,
           "on_preferencesDatabaseComboBox_changed": self.on_preferencesDatabaseComboBox_changed,
           "on_updateDatabaseButton_clicked": self.on_updateDatabaseButton_clicked,
           "on_addServerButton_clicked": self.on_addServerButton_clicked,
           "on_removeServerButton_clicked": self.on_removeServerButton_clicked,
           "on_addDatabaseButton_clicked": self.on_addDatabaseButton_clicked,
           "on_removeDatabaseButton_clicked": self.on_removeDatabaseButton_clicked,
           }
    self.dlg = self.wTree.get_object("preferencesDialog")
    spinner = self.wTree.get_object("preferencesDialogSpinner")
    spinner.start()
    conf = config.PhameratorConfiguration()
    if conf.get('/apps/phamerator/pham_circle_color_scheme') == 'alignmentType':
      self.wTree.get_object("alignmentTypeRadioButton").set_active(True)
      self.wTree.get_object("phamColorRadioButton").set_active(False)
    if conf.get('/apps/phamerator/pham_circle_color_scheme') == 'phamColor':
      self.wTree.get_object("alignmentTypeRadioButton").set_active(False)
      self.wTree.get_object("phamColorRadioButton").set_active(True)
    adj = self.wTree.get_object("transparency_slider").get_adjustment()
    adj.configure(conf.get_float('/apps/phamerator/transparency_adjustment'), 0.0, 100.0, 1.0, 10.0, 0)
    cfg = ConfigParser.RawConfigParser()
    cfg.read(os.path.join(os.environ['HOME'], '.phamerator', 'phamerator.conf'))
    if cfg.get('Phamerator','draw_blast_alignments') == 'False':
      self.wTree.get_object("eValuesCheckBox").set_sensitive(False)
      self.wTree.get_object("blastAlignmentCheckBox").set_sensitive(False)
    #self.wTree.signal_autoconnect(dic)
    self.wTree.connect_signals(dic)
    try:
      self.database = cfg.get('Phamerator','defaultDatabase')
      print "self.database = " + self.database
    except: self.database = 'SEA'
    try: self.remote_server = cfg.get('Phamerator','defaultServer')
    except:
      pass
      self.remote_server = 'http://localhost'


    comboBoxes = [('server', 'preferencesServerComboBox'), ('database', 'preferencesDatabaseComboBox')]
    for box in comboBoxes:
      boxType, boxName = box[0], box[1]
      cbe = self.wTree.get_object(boxName)
      listStore = gtk.ListStore(str)
      cbe.set_model(listStore)
      
      cell = gtk.CellRendererText()
      cbe.pack_start(cell, True)
      cbe.add_attribute(cell, "text", 0)
      
      #cbe.set_text_column(0)
      if boxType == 'server':
        others = cfg.get('Phamerator','otherServers')
      elif boxType == 'database':
        others = cfg.get('Phamerator','otherDatabases')
      otherList = others.split(',')
      otherListNew = []
      for n,o in enumerate(otherList):
        if o != "":
          otherListNew.append(o.strip())
      otherListNew.sort()
      for o in otherListNew:
        print o
        listStore.append(row=(o,))
      if boxType == 'server' and self.remote_server:
        print 'POPULATING SERVER COMBOX BOX with %s' % self.remote_server
        #listStore.prepend(row=(self.remote_server,))
        cbe.prepend_text(self.remote_server)
      elif boxType == 'database':
        cbe.prepend_text(self.database)
      cbe.set_active(0)
示例#40
0
    def __init__(self, pManager):
        self.PManager = pManager
        self.gladefile = gladeFile().filename
        #self.wTree = gtk.glade.XML(self.gladefile, "preferencesDialog")
        self.wTree = gtk.Builder()
        self.wTree.add_objects_from_file(self.gladefile, ["preferencesDialog"])
        dic = {
            "preferencesChangedSignalHandler":
            self.preferencesChangedSignalHandler,
            "radioChangedSignalHandler":
            self.radioChangedSignalHandler,
            "on_preferencesServerComboBox_changed":
            self.on_preferencesServerComboBox_changed,
            "on_preferencesDatabaseComboBox_changed":
            self.on_preferencesDatabaseComboBox_changed,
            "on_updateDatabaseButton_clicked":
            self.on_updateDatabaseButton_clicked,
            "on_addServerButton_clicked":
            self.on_addServerButton_clicked,
            "on_removeServerButton_clicked":
            self.on_removeServerButton_clicked,
            "on_addDatabaseButton_clicked":
            self.on_addDatabaseButton_clicked,
            "on_removeDatabaseButton_clicked":
            self.on_removeDatabaseButton_clicked,
        }
        self.dlg = self.wTree.get_object("preferencesDialog")
        spinner = self.wTree.get_object("preferencesDialogSpinner")
        spinner.start()
        conf = config.PhameratorConfiguration()
        if conf.get('/apps/phamerator/pham_circle_color_scheme'
                    ) == 'alignmentType':
            self.wTree.get_object("alignmentTypeRadioButton").set_active(True)
            self.wTree.get_object("phamColorRadioButton").set_active(False)
        if conf.get(
                '/apps/phamerator/pham_circle_color_scheme') == 'phamColor':
            self.wTree.get_object("alignmentTypeRadioButton").set_active(False)
            self.wTree.get_object("phamColorRadioButton").set_active(True)
        adj = self.wTree.get_object("transparency_slider").get_adjustment()
        adj.configure(
            conf.get_float('/apps/phamerator/transparency_adjustment'), 0.0,
            100.0, 1.0, 10.0, 0)
        cfg = ConfigParser.RawConfigParser()
        cfg.read(
            os.path.join(os.environ['HOME'], '.phamerator', 'phamerator.conf'))
        if cfg.get('Phamerator', 'draw_blast_alignments') == 'False':
            self.wTree.get_object("eValuesCheckBox").set_sensitive(False)
            self.wTree.get_object("blastAlignmentCheckBox").set_sensitive(
                False)
        #self.wTree.signal_autoconnect(dic)
        self.wTree.connect_signals(dic)
        try:
            self.database = cfg.get('Phamerator', 'defaultDatabase')
            print "self.database = " + self.database
        except:
            self.database = 'SEA'
        try:
            self.remote_server = cfg.get('Phamerator', 'defaultServer')
        except:
            pass
            self.remote_server = 'http://localhost'

        comboBoxes = [('server', 'preferencesServerComboBox'),
                      ('database', 'preferencesDatabaseComboBox')]
        for box in comboBoxes:
            boxType, boxName = box[0], box[1]
            cbe = self.wTree.get_object(boxName)
            listStore = gtk.ListStore(str)
            cbe.set_model(listStore)

            cell = gtk.CellRendererText()
            cbe.pack_start(cell, True)
            cbe.add_attribute(cell, "text", 0)

            #cbe.set_text_column(0)
            if boxType == 'server':
                others = cfg.get('Phamerator', 'otherServers')
            elif boxType == 'database':
                others = cfg.get('Phamerator', 'otherDatabases')
            otherList = others.split(',')
            otherListNew = []
            for n, o in enumerate(otherList):
                if o != "":
                    otherListNew.append(o.strip())
            otherListNew.sort()
            for o in otherListNew:
                print o
                listStore.append(row=(o, ))
            if boxType == 'server' and self.remote_server:
                print 'POPULATING SERVER COMBOX BOX with %s' % self.remote_server
                #listStore.prepend(row=(self.remote_server,))
                cbe.prepend_text(self.remote_server)
            elif boxType == 'database':
                cbe.prepend_text(self.database)
            cbe.set_active(0)