예제 #1
0
 def ImportFromCvs(self,event,type):
     msg = "Screen solutions and reservoir information will be deleted!\n\n"\
                        "Importing from cvs (comma separated) text file.\n"\
                        "Lines starting with '#' will be ignored.\n"\
                        "Lines starting with '>' will be treated as headings.\n"
     if type == "formulations":
         msg += "The field 'SolutionNr' references the number of the solution in the original screen.\n"\
                "The 'Position' field specifies the well position in the new screen."
     d = wx.MessageBox(msg, "Confirm", wx.YES_NO, self)
     if d == wx.YES:
         dir = self.controller.userData.GetValue("LastDir")
         dlg = wx.FileDialog(
             self, message="Choose cvs file", defaultDir=dir, 
             defaultFile="", style=wx.OPEN | wx.CHANGE_DIR
             )
         # Show the dialog and retrieve the user response. If it is the OK response, 
         # process the data.
         if dlg.ShowModal() == wx.ID_OK:
             self.controller.userData.SetValue("LastDir", os.getcwd())
             # This returns a Python list of files that were selected.
             path = dlg.GetPath()
             if os.access(path, os.F_OK):
                         from util.converter import Converter
                         converter = Converter(path, self.data)
                         if type == "formulations":
                             converter.convert()
                         elif type == "stocks":
                             converter.convertStocks()
                         elif type == "screen":
                             converter.convertSimplexScreen()
                         self.data.UpdateEventListeners(["reagents","screen"],self)
                         self.data.InitReservoirsFromScreen()
                         self.xtal_panel.tray.RefreshWells()
                         self.screen_panel.tray.RefreshWells()
                         self.data.UpdateEventListeners(["front"],self)
예제 #2
0
파일: unittest.py 프로젝트: tschalch/pyTray
 def Run(self):
     results.write("*************\nTesting Converter ... \n")
     results.write("New Screen from scratch ... ")
     name = "Hampton Crystal Screen - Test Conversion"
     noRows = 4
     noCols = 6
     noDrops = 1
     newScreen = {"ScreenName": name, "NoRows": noRows, \
                 "NoCols":noCols, "NoDrops":noDrops}
     contlr = controller.Controller(None)
     data = contlr.NewTray(None,(None,newScreen))
     from util.converter import Converter
     converter = Converter(files + "/hampton_crystal_screen2_25-48.csv", data)
     results.write("New screen before import:\n")
     results.write(data.GetSummary())
     converter.convert()
     results.write("Screen after import:\n")
     results.write(data.GetSummary())
     newFile = os.path.abspath(files + "/CrystalScreenConverted.exp")
     data.Save(newFile)
     # testing import for stock solution only
     results.write("Importing stock solutions only...\n")
     converter = Converter(files + "/simplex_Stocks.csv", data)
     converter.convertStocks()
     results.write("Screen after import:\n")
     results.write(data.GetSummary())
     newFile = os.path.abspath(files + "/CrystalScreenStocksConverted.exp")
     data.Save(newFile)
     # testing for screen solutions from simplex output
     results.write("Importing simplex screen solutions only...\n")
     converter = Converter(files + "/simplex_screen.csv", data)
     converter.convertSimplexScreen()
     results.write("Screen after import:\n")
     results.write(data.GetSummary())
     newFile = os.path.abspath(files + "/CrystalScreenSimplexConverted.exp")
     data.Save(newFile)
     # removing unused reagents
     results.write("Removing unused reagents...\n")
     data.RemoveUnusedReagents()
     results.write(data.GetSummary())
     data.Close()
     self.datafile = newFile
     #data = contlr.GetTrayData(None,newFile)
     frame = self.StartGui()