From b43d2c8eef88b48f2db6f118805a3f621a0a13d3 Mon Sep 17 00:00:00 2001 From: lucaszhao19 Date: Fri, 17 Jul 2020 21:30:55 +0630 Subject: Fixed ShortcutColumn --- DockWidgets/DockWidgetShortcutColumn.py | 39 ++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 6 deletions(-) (limited to 'DockWidgets/DockWidgetShortcutColumn.py') diff --git a/DockWidgets/DockWidgetShortcutColumn.py b/DockWidgets/DockWidgetShortcutColumn.py index af81441..fc5c34f 100644 --- a/DockWidgets/DockWidgetShortcutColumn.py +++ b/DockWidgets/DockWidgetShortcutColumn.py @@ -34,12 +34,13 @@ class DockWidgetShortcutColumn(QDockWidget,ui_dialog): print("input_params_list ", self.input_dict) self.l1.setText(self.obj.variables['HKey']['name']+":") + self.l2.setText(self.obj.variables['LKey']['name']+":") + print(self.obj.compounds) for i in self.obj.compounds: self.cb1.addItem(str(i)) self.cb2.addItem(str(i)) - self.l2.setText(self.obj.variables['LKey']['name']+":") self.l3.setText(self.obj.variables['HKey_x_pc']['name']+":") self.le3.setText(str(self.obj.variables['HKey_x_pc']['value'])) @@ -84,14 +85,40 @@ class DockWidgetShortcutColumn(QDockWidget,ui_dialog): except Exception as e: print(e) - @staticmethod def show_result(lst): - #DockWidget1.flag = True for i in lst: - i.resultsCategory(i.name) - #i.show() + try: + i.results_category(i.name) + except AttributeError: + pass # result data tab def results_category(self,name): - pass \ No newline at end of file + flag = True + try: + print("Under result category name ", name) + result=self.container.result + obj = self.container.fetch_object(name) + self.tableWidget.setRowCount(0) + variKeys = obj.result_parameters + print(variKeys) + for i, val in enumerate(variKeys): + propertyname = name + '.' + val + print(i,val, propertyname) + if propertyname in result[0]: + ind = result[0].index(propertyname) + resultval = str(result[-1][ind]) + obj.variables[val]['value']= result[-1][ind] + print("######Resultsfetch####",val,resultval) + rowPosition = self.tableWidget.rowCount() + self.tableWidget.insertRow(rowPosition) + self.tableWidget.setItem(rowPosition , 0, QTableWidgetItem(obj.variables[val]['name'])) + self.tableWidget.setItem(rowPosition , 1, QTableWidgetItem(resultval)) + self.tableWidget.setItem(rowPosition , 2, QTableWidgetItem(obj.variables[val]['unit'])) + self.tableWidget.resizeColumnsToContents() + + print(obj.variables) + + except Exception as e: + print(e) \ No newline at end of file -- cgit From 788b7f4bbb7aa51839c0836b1ab163fa831ce8fc Mon Sep 17 00:00:00 2001 From: lucaszhao19 Date: Thu, 30 Jul 2020 21:19:00 +0630 Subject: Fixed populating the wrong simulation results --- DockWidgets/DockWidgetShortcutColumn.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'DockWidgets/DockWidgetShortcutColumn.py') diff --git a/DockWidgets/DockWidgetShortcutColumn.py b/DockWidgets/DockWidgetShortcutColumn.py index fc5c34f..f3a12b7 100644 --- a/DockWidgets/DockWidgetShortcutColumn.py +++ b/DockWidgets/DockWidgetShortcutColumn.py @@ -92,7 +92,10 @@ class DockWidgetShortcutColumn(QDockWidget,ui_dialog): i.results_category(i.name) except AttributeError: pass - + + def clear_results(self): + self.tableWidget.setRowCount(0) + # result data tab def results_category(self,name): flag = True -- cgit From 7a6921b773cf8879cc29c8eb6c0f6ca2a1da961e Mon Sep 17 00:00:00 2001 From: lucaszhao19 Date: Mon, 3 Aug 2020 20:45:29 +0630 Subject: Add Thermo Package for ShortcutColumn --- DockWidgets/DockWidgetShortcutColumn.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'DockWidgets/DockWidgetShortcutColumn.py') diff --git a/DockWidgets/DockWidgetShortcutColumn.py b/DockWidgets/DockWidgetShortcutColumn.py index f3a12b7..409c051 100644 --- a/DockWidgets/DockWidgetShortcutColumn.py +++ b/DockWidgets/DockWidgetShortcutColumn.py @@ -63,7 +63,13 @@ class DockWidgetShortcutColumn(QDockWidget,ui_dialog): self.l8.setText(self.obj.variables['RR']['name']+":") self.le8.setText(str(self.obj.variables['RR']['value'])) - self.input_dict = [self.cb1, self.cb2, self.le3, self.le4, self.cb5, self.le6, self.le7, self.le8] + self.l9.setText("Thermo Package :") + + self.lines = [line.rstrip('\n') for line in open('thermopackage.txt')] + for j in self.lines: + self.cb6.addItem(str(j)) + + self.input_dict = [self.cb1, self.cb2, self.le3, self.le4, self.cb5, self.le6, self.le7, self.le8, self.cb6] except Exception as e: print(e) @@ -76,7 +82,8 @@ class DockWidgetShortcutColumn(QDockWidget,ui_dialog): self.dict=[] print("param.input_dict ", self.input_dict) self.dict = [self.input_dict[0].currentText(),self.input_dict[1].currentText(),float(self.input_dict[2].text()), float(self.input_dict[3].text()), - self.input_dict[4].currentText(), float(self.input_dict[5].text()), float(self.input_dict[6].text()), float(self.input_dict[7].text())] + self.input_dict[4].currentText(), float(self.input_dict[5].text()), float(self.input_dict[6].text()), float(self.input_dict[7].text()), + self.input_dict[8].currentText()] print("param ", self.dict) self.obj.param_setter(self.dict) -- cgit From 37a360da5346302eb881071f7db2fe7159f8e643 Mon Sep 17 00:00:00 2001 From: lucaszhao19 Date: Wed, 5 Aug 2020 21:07:37 +0630 Subject: Remove unnecessary codes from all dock widgets --- DockWidgets/DockWidgetShortcutColumn.py | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'DockWidgets/DockWidgetShortcutColumn.py') diff --git a/DockWidgets/DockWidgetShortcutColumn.py b/DockWidgets/DockWidgetShortcutColumn.py index 409c051..2b7dfae 100644 --- a/DockWidgets/DockWidgetShortcutColumn.py +++ b/DockWidgets/DockWidgetShortcutColumn.py @@ -2,10 +2,7 @@ from PyQt5.QtCore import * from PyQt5.QtWidgets import * from PyQt5.QtGui import * from PyQt5.uic import loadUiType -import pandas as pd -from functools import partial from ComponentSelector import * -from collections import defaultdict from Graphics import * ui_dialog,_ = loadUiType('DockWidgets/DockWidgetShortcutColumn.ui') @@ -20,7 +17,6 @@ class DockWidgetShortcutColumn(QDockWidget,ui_dialog): self.obj=obj self.type = comptype self.input_dict = [] - print("constructor ", self.input_dict) self.input_params_list() self.btn.clicked.connect(self.param) self.dict = [] @@ -30,9 +26,7 @@ class DockWidgetShortcutColumn(QDockWidget,ui_dialog): # input data tab def input_params_list(self): - try: - print("input_params_list ", self.input_dict) - + try: self.l1.setText(self.obj.variables['HKey']['name']+":") self.l2.setText(self.obj.variables['LKey']['name']+":") @@ -41,7 +35,6 @@ class DockWidgetShortcutColumn(QDockWidget,ui_dialog): self.cb1.addItem(str(i)) self.cb2.addItem(str(i)) - self.l3.setText(self.obj.variables['HKey_x_pc']['name']+":") self.le3.setText(str(self.obj.variables['HKey_x_pc']['value'])) self.u3.setText(self.obj.variables['HKey_x_pc']['unit']) @@ -80,12 +73,9 @@ class DockWidgetShortcutColumn(QDockWidget,ui_dialog): def param(self): try: self.dict=[] - print("param.input_dict ", self.input_dict) self.dict = [self.input_dict[0].currentText(),self.input_dict[1].currentText(),float(self.input_dict[2].text()), float(self.input_dict[3].text()), self.input_dict[4].currentText(), float(self.input_dict[5].text()), float(self.input_dict[6].text()), float(self.input_dict[7].text()), - self.input_dict[8].currentText()] - - print("param ", self.dict) + self.input_dict[8].currentText()] self.obj.param_setter(self.dict) self.hide() @@ -127,8 +117,5 @@ class DockWidgetShortcutColumn(QDockWidget,ui_dialog): self.tableWidget.setItem(rowPosition , 1, QTableWidgetItem(resultval)) self.tableWidget.setItem(rowPosition , 2, QTableWidgetItem(obj.variables[val]['unit'])) self.tableWidget.resizeColumnsToContents() - - print(obj.variables) - except Exception as e: print(e) \ No newline at end of file -- cgit