예제 #1
0
파일: SimpleTable.py 프로젝트: TradeUp/Demo
 def chooseFile(self):
     fileName = QFileDialog.getOpenFileName(self, dir="/home/dylan/mock_algo/", filter="*.algo")
     if fileName == '': return
     #add some method to send file name to backend here!!
     print fileName 
     """ADD FUNCTION HERE...LET IT RETURN TRUE IF VALID FILE"""
     parser = Parser(None) # don't need a path to recipe
     recipe = None
     
     try:
         recipe = parser.parse_recipe(str(fileName[0]))
     except:
         msgBox = QMessageBox(QMessageBox.Icon.Critical, "Error", "");
         msgBox.setText("Unable to open file.")
         msgBox.exec_()
         return
     
     if recipe:
         self.table.addRecipe(recipe.name,)