summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ComponentSelector.py18
-rw-r--r--Graphics.py14
-rw-r--r--Undo.datbin3191 -> 0 bytes
-rw-r--r--mainApp.py9
4 files changed, 22 insertions, 19 deletions
diff --git a/ComponentSelector.py b/ComponentSelector.py
index 80c88d8..c5ba6f5 100644
--- a/ComponentSelector.py
+++ b/ComponentSelector.py
@@ -43,9 +43,8 @@ class ComponentSelector(QDialog,ui_dialog):
self.completer.setCaseSensitivity(Qt.CaseInsensitive)
self.completer.setModel(self.model)
- #QCompleter completes the text written in lineedit
- self.lineEdit.setCompleter(self.completer)
-
+ # QCompleter completes the text written in lineedit
+ self.lineEdit.setCompleter(self.completer)
self.compoundSelectButton.clicked.connect(self.compound_selection)
self.compoundSelectButton.setAutoDefault(False)
self.pushButton.clicked.connect(self.accept)
@@ -87,15 +86,20 @@ class ComponentSelector(QDialog,ui_dialog):
self.temp_comp= component.replace(removing_attrib,'')
return(self.temp_comp)
- def compound_selection(self):
- self.comp = self.lineEdit.text() #gets entered text
+ def compound_selection(self, *args):
+ if len(args) == 2:
+ self.comp = args[1] #helpful when loading saved data
+ else:
+ self.comp = self.lineEdit.text() #gets entered text
if self.comp in self.lines: #matches with the db
+ if self.comp not in compound_selected:
+ compound_selected.append(self.comp) # appending compound in the list
self.obj=self.get_object(self.comp) #obj will store the key of the dictionary
#and thus store the instance of the class to which the component belongs
self.removing_attrib='(' + self.obj.name + ')' #getting the attribute that is to be removed
self.comp=self.get_original_name(self.comp,self.removing_attrib)
#getting only air, water etc from air chemsep etc
- compound_selected.append(self.comp) #appending that in the list
+
self.prop_list=self.obj.get_comp_prop(self.comp) #getting prop of the comp
#obj is the required class object
@@ -120,7 +124,7 @@ class ComponentSelector(QDialog,ui_dialog):
@staticmethod
def set_compounds(compounds):
- #compound_selected = compounds
+ # compound_selected = compounds
for i in compounds:
compound_selected.append(i)
diff --git a/Graphics.py b/Graphics.py
index 16ef1a7..f6b17b5 100644
--- a/Graphics.py
+++ b/Graphics.py
@@ -30,25 +30,18 @@ class Graphics(QDialog, QtWidgets.QGraphicsItem):
self.graphicsView = graphicsView
self.pos = None
self.unit_operations = unit_operations
-
+
def get_scene(self):
return self.scene
- def get_component_selector(self):
- return ComponentSelector(self)
-
def create_node_item(self,unit_operation, container):
return NodeItem(unit_operation, container, self.graphicsView)
def load_canvas(self, obj, container):
stm = ['MaterialStream','EngStm']
- compounds = obj[-1]
- obj.pop()
- ComponentSelector.set_compounds(compounds)
-
for i in obj:
- if(i in self.unit_operations):
- pass
+ if i in self.unit_operations:
+ pass
else:
self.unit_operations.append(i)
print(self.unit_operations)
@@ -56,7 +49,6 @@ class Graphics(QDialog, QtWidgets.QGraphicsItem):
new_box.setPos(i.pos.toPoint().x(), i.pos.toPoint().y())
self.scene.addItem(new_box)
-
for i in obj:
if i.type == "MaterialStream":
print(eval(i.type))
diff --git a/Undo.dat b/Undo.dat
index 914294e..e69de29 100644
--- a/Undo.dat
+++ b/Undo.dat
Binary files differ
diff --git a/mainApp.py b/mainApp.py
index 91059a8..ea64132 100644
--- a/mainApp.py
+++ b/mainApp.py
@@ -331,10 +331,17 @@ class MainApp(QMainWindow,ui):
with open(file_name, 'rb') as f:
obj = pickle.load(f)
print(obj)
+ compound_selected = obj[-1]
+ obj.pop()
+ print(compound_selected)
+ self.comp.set_compounds(compound_selected)
+ for i in compound_selected:
+ self.comp.compound_selection(self.comp, i)
self.container.graphics.load_canvas(obj, self.container)
+
except Exception as e:
- pass
+ print(e)
def main():