Commit e0d58da2 authored by ulc0011's avatar ulc0011

ENH: Data for GUI applications as optional input argument, otherwise by...

ENH: Data for GUI applications as optional input argument, otherwise by run_path, fixed axes switching in heatmap_2.py
parent 6d9a16ae
......@@ -7,7 +7,7 @@ pp = pprint.PrettyPrinter(indent=4)
class IndicSelectWindow(QtWidgets.QDialog):
def __init__(self, table = "overall", parent=None):
def __init__(self, table = "overall", ownData = None, parent=None):
super(IndicSelectWindow, self).__init__(parent=parent)
self.resize(500, 400)
self.mainLayout = QtWidgets.QVBoxLayout(self)
......@@ -31,11 +31,16 @@ class IndicSelectWindow(QtWidgets.QDialog):
self.myStyleSheet_2 = "border: 2px solid black; border-radius: 0px; background-color: rgb(255,255,255); max-width: {}px; max-height: {}px;".format(self.cell_max_width,self.cell_max_height_2)
self.myStyleSheet_3 = "border: 2px solid black; border-radius: 0px; background-color: rgb(255,255,255); max-height:{}px;".format(self.cell_max_height_2)
if not ownData:
self.data = run_path("get_data_for_gui.py")
else:
self.data = ownData
def createTable(self):
if self.tabtype == "overall":
self.data = run_path("get_data_for_gui.py")
#self.data = run_path("get_data_for_gui.py")
self.table_contents = self.data["overall_vals"]
self.inner_labels = []
......@@ -125,7 +130,7 @@ class IndicSelectWindow(QtWidgets.QDialog):
self.mainLayout.addWidget(self.scrollArea)
elif self.tabtype == "regions":
self.data = run_path("get_data_for_gui.py")
#self.data = run_path("get_data_for_gui.py")
self.table_data = self.data["average_program_start_table_data"]
#K = list(self.table_data.keys())
......@@ -328,7 +333,7 @@ class IndicSelectWindow(QtWidgets.QDialog):
elif self.tabtype == "onereg":
self.data = run_path("get_data_for_gui.py")
#self.data = run_path("get_data_for_gui.py")
self.table_data = self.data["dynamic_savings_tables"]
self.table_contents = [self.table_data[0]['average_program_start']["table_data"],self.table_data[0]['average_program_start']["total_dyn_savings"]]
......
......@@ -16,7 +16,7 @@ pp = pprint.PrettyPrinter(indent=4)
class Window(QtWidgets.QDialog):
def __init__(self, parent=None):
def __init__(self, ownData = None, parent=None):
super(Window, self).__init__(parent)
# a figure instance to plot on
......@@ -47,7 +47,11 @@ class Window(QtWidgets.QDialog):
self.mult.setAlignment(QtCore.Qt.AlignCenter)
# data loading, we can have more than one y_data! TODO
self.d = run_path("get_data_for_gui.py")
if not ownData:
self.d = run_path("get_data_for_gui.py")
else:
self.d = ownData
self.data = self.d["plot_summary_data"]
#self.data = self.d["nested_regions_report_data"][0]["plot_data"]
......@@ -103,6 +107,11 @@ class Window(QtWidgets.QDialog):
self.plot()
'''if not ownData:
print("Surprise")
else:
print("No surprise")'''
def chooseReg(self, dataLabel):
if dataLabel == "Overall summary":
self.data = self.d["plot_summary_data"]
......@@ -135,7 +144,7 @@ class Window(QtWidgets.QDialog):
def change_sw(self):
self.sw = not self.sw
self.plot()
pp.pprint(self.d["nested_regions_report_data"])
#pp.pprint(self.d["nested_regions_report_data"])
def plot(self):
......@@ -212,7 +221,7 @@ class Window(QtWidgets.QDialog):
if __name__ == '__main__':
app = QtWidgets.QApplication(sys.argv)
main = Window()
main = Window(1)
main.show()
sys.exit(app.exec_())
\ No newline at end of file
......@@ -24,10 +24,13 @@ cm = mpc.ListedColormap(C/255.0)
class Window(QtWidgets.QDialog):
def __init__(self, parent=None):
def __init__(self, ownData = None, parent=None):
super(Window, self).__init__(parent)
# data loading, we can have more than one y_data! TODO
self.d = run_path("get_data_for_gui.py")
if not ownData:
self.d = run_path("get_data_for_gui.py")
else:
self.d = ownData
self.D = self.d["plot_summary_data"]
self.sw = False
......@@ -118,6 +121,7 @@ class Window(QtWidgets.QDialog):
def change_sw(self):
self.sw = not self.sw
self.draw_heatmap()
#self.figure.set_size_inches(self.figheight,self.figwidth, forward = True)
def onclick(self,event):
......
......@@ -15,8 +15,12 @@ import pprint
ppr = pprint.PrettyPrinter(indent=4)
def browse_dir(path):
d = run_path("get_data_for_gui.py")
def browse_dir(path, ownData = None):
if not ownData:
d = run_path("get_data_for_gui.py")
else:
d = ownData
D = d["all_nested_funcs_dic"]
chs_regs = list(D.keys())
ppr.pprint(chs_regs)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment