コード例 #1
0
ファイル: MetaMakerGUI.py プロジェクト: hjanime/metamaker
 def _create_layout(self):
     """
     Creates the GUI layout.
     """
     
     # Options
     
     Label(self.gui, text="No Genomes:").grid(row=0, column=0)
     self.no_genomes = Entry(self.gui)
     self.no_genomes.insert(0, 10)
     self.no_genomes.grid(row=0, column=1)
     
     Label(self.gui, text="Taxa:").grid(row=1,column=0)
     self.taxa = StringVar(self.gui)
     self.taxa.set("Viruses")
     drop = OptionMenu(self.gui, self.taxa, "Viruses", "Bacteria")
     drop.grid(row = 1, column = 1)
     
     Label(self.gui, text="Species Distribution:").grid(row=2,column=0)
     self.distribution = StringVar(self.gui)
     self.distribution.set("Uniform")
     drop = OptionMenu(self.gui, self.distribution, "Uniform", "Exponential")
     drop.grid(row = 2, column = 1)
     
     Label(self.gui, text="Technology:").grid(row=3,column=0)
     self.technology = StringVar(self.gui)
     templates = MetaMaker.get_templates('keys', 'profiles')
     self.technology.set(templates[0])
     drop = OptionMenu(self.gui, self.technology, *templates)
     drop.grid(row = 3, column = 1)
     
     Label(self.gui, text="Output filename:").grid(row=4, column=0)
     self.filename = Entry(self.gui)
     self.filename.insert(0, "MetaMaker_output")
     self.filename.grid(row=4, column=1)
     
     Label(self.gui, text="Key filename:").grid(row=4, column=2)
     self.keyname = Entry(self.gui)
     self.keyname.insert(0, "MetaMaker_output")
     self.keyname.grid(row=4, column=3)
     
     # Start button
     self.start = Button(self.gui, text="Generate", command=self.generate)
     self.start.grid(row=5, column=3)
     
     # Logging console
     self.console = Text(self.gui, height=26, width=100, name="console")
     self.console.grid(row=10, column=0, columnspan=4)
     self.console.insert(END, __doc__)
コード例 #2
0
ファイル: MetaMakerGUI.py プロジェクト: hjanime/metamaker
 def generate(self):
     """
     Check the input and start generating a dataset!
     """
     no_of_genomes = 0
     read_distribution = self.distribution.get()
     try:
         no_of_genomes = int(self.no_genomes.get())
     except:
         self.log.error("Number of genomes must be an integer!")
         return
     
     outfile = self.filename.get()
     if not outfile:
         self.log.error("No filename for output files!")
         return
         
     self.log.info("Running %s genomes" % no_of_genomes)
     
     app = MetaMaker( outfile, no_of_genomes )
     app.set('log', self.__name__)
     app.set('keyfile', self.keyname.get())
     app.set('distribution', read_distribution)
     app.set('template', self.technology.get())
     app.set('taxa', self.taxa.get())
     app.set('template_dir', 'profiles')
     app.start()
     self.gui.after(500, self.update_progress, app)