mg-pso-gui 0.2.81__py3-none-any.whl → 0.2.82__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mg-pso-gui
3
- Version: 0.2.81
3
+ Version: 0.2.82
4
4
  Summary: GUI for MG-PSO
5
5
  Author: Robert Cordingly
6
6
  Author-email: <rcording@uw.ed>
@@ -1,10 +1,11 @@
1
1
  mgpsogui/__init__.py,sha256=q7AfBjeJABnFtbsZnsObpUwaXKPDVYtz46G6MKXLF74,42
2
2
  mgpsogui/mgpsogui.py,sha256=NIZmyNcbwC8EgSwf1ubdMUSJscrIEgoD4jLYziqHQ-k,148
3
3
  mgpsogui/start.yaml,sha256=ZjCVLb-MLqAxrGRm9kA7_SDpa-45EuKIELNQ2QqCAiU,4713
4
- mgpsogui/gui/HomePage.py,sha256=QG5xjdmpuVsM1vPjQ_OwESxc7mFmQgPIv611FEVX6-4,22713
4
+ mgpsogui/gui/HomePage.py,sha256=_hN2gWEDRB5Ik1q71zfIlEwkRbn7IQYirSyRLMXZp9o,22862
5
5
  mgpsogui/gui/OptionManager.py,sha256=OczLGSmS9MfE2HgpPNw0OFbl2AdNQ_70pxQUKIDWAnU,21707
6
6
  mgpsogui/gui/OptionManager_backup.py,sha256=TCWfPnHL2foN5id47jsi267lamRG6yGU6y_M29eOOJk,18530
7
7
  mgpsogui/gui/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ mgpsogui/gui/General/NoticeWindow.py,sha256=qwGpJphtZ7t204UfQwVria4KGX_huBBTX92GUIyIxvM,1775
8
9
  mgpsogui/gui/General/ParameterView.py,sha256=gTpsXQomHgWxdHhiMxjOk171PeefXqdpVQefH88PE_c,6384
9
10
  mgpsogui/gui/General/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
11
  mgpsogui/gui/PlatformTab/PlatformTab.py,sha256=XVaXjNoH1MBI-587CWigLIT3LGT00yzEAEnXNkzCLrk,10947
@@ -21,6 +22,8 @@ mgpsogui/gui/SetupTab/ListEditor.py,sha256=nin7Pl8z7d_yfKoAxM-yVS34uhj-LnprJ2mNR
21
22
  mgpsogui/gui/SetupTab/ListParametersView.py,sha256=mkGaC5cXhEOy5oD0MbTyK9z7VGZp019oK2Y8Ay-n05Q,7460
22
23
  mgpsogui/gui/SetupTab/OverrideParameterMetrics.py,sha256=rBfaSitYDOajbHvyi2TfoXAHYlz1cCt028UVpIJ_Dc0,3369
23
24
  mgpsogui/gui/SetupTab/OverrideParameterWindow.py,sha256=UpZDxTaFxee0BeviUYXeiIlMNYNy00qz3zlMlM5VcXE,1291
25
+ mgpsogui/gui/SetupTab/SamplingListView.py,sha256=DhZBAhDcrqZn1XioCs1gTe_v-8W10C0UfPm0fLAbeXM,5260
26
+ mgpsogui/gui/SetupTab/SamplingNameListWindow.py,sha256=QzVu8mSpFGy3mUlLonk94k5thDNdJzw2d3qmEq89RAQ,2866
24
27
  mgpsogui/gui/SetupTab/SetupTab.py,sha256=3V8LYvg5ulTll1hhguB_XpSoOR-w72vHh_Z3gw3nCxc,2758
25
28
  mgpsogui/gui/SetupTab/StepView.py,sha256=M_7gj3TqszMs0pVBnGmZZDr96NWZg5mfKyX1Ne1MIrc,9018
26
29
  mgpsogui/gui/SetupTab/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -69,8 +72,8 @@ mgpsogui/util/recosu/utils/trace_writer.py,sha256=V9BJlOjCbNYGoXGEk3CF5wjifBxvar
69
72
  mgpsogui/util/recosu/utils/utils.py,sha256=QB8vftq3142ekG0ORjz0ZBHU5YknXbR0oTsrxrPAsF0,3951
70
73
  mgpsogui/util/recosu/utils/plot/__init__.py,sha256=h1KjM7_tNDv351pcwt8A6Ibb1jhwWyx5Gbu-zj-sI3Q,71
71
74
  mgpsogui/util/recosu/utils/plot/cost_steps.py,sha256=1Ce11AJyweWkmvjXPxEygzS-h8yVLmQEDLS53yjPLqQ,3779
72
- mg_pso_gui-0.2.81.dist-info/METADATA,sha256=7xfhpC5JYLsITsQu8bYzPciufN0Z-3FVGPQOVVm0zU8,9455
73
- mg_pso_gui-0.2.81.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
74
- mg_pso_gui-0.2.81.dist-info/entry_points.txt,sha256=jg82VOFjR1XDGrchs1wJSCqKYE4Ozv12aBcCSp--koA,117
75
- mg_pso_gui-0.2.81.dist-info/top_level.txt,sha256=y7JuS9xJN5YdxUsQ3PSVjN8MzQAnR146bP3ZN3PYWdE,9
76
- mg_pso_gui-0.2.81.dist-info/RECORD,,
75
+ mg_pso_gui-0.2.82.dist-info/METADATA,sha256=-FF_qD0fWmm4mNWmwNqi7sr9sATnipSmnaHy4S7t2Xc,9455
76
+ mg_pso_gui-0.2.82.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
77
+ mg_pso_gui-0.2.82.dist-info/entry_points.txt,sha256=jg82VOFjR1XDGrchs1wJSCqKYE4Ozv12aBcCSp--koA,117
78
+ mg_pso_gui-0.2.82.dist-info/top_level.txt,sha256=y7JuS9xJN5YdxUsQ3PSVjN8MzQAnR146bP3ZN3PYWdE,9
79
+ mg_pso_gui-0.2.82.dist-info/RECORD,,
@@ -0,0 +1,53 @@
1
+ from typing import Union, Tuple, Optional
2
+
3
+ from customtkinter import CTkLabel
4
+ from customtkinter import CTkButton
5
+ from customtkinter import CTkEntry
6
+ from customtkinter import CTkInputDialog
7
+ from customtkinter import CTkTextbox
8
+
9
+ class NoticeWindow(CTkInputDialog):
10
+ """
11
+ Dialog with extra window, message, entry widget, cancel and ok button.
12
+ For detailed information check out the documentation.
13
+ """
14
+
15
+ def __init__(self, *args,
16
+ message: None,
17
+ **kwargs):
18
+ super().__init__(*args, **kwargs)
19
+
20
+ self.geometry("400x800")
21
+
22
+ self.message = message
23
+
24
+ def _create_widgets(self):
25
+
26
+ self.grid_columnconfigure(0, weight=1)
27
+ self.rowconfigure(0, weight=1)
28
+
29
+ self.textbox = CTkTextbox(self, state="disabled")
30
+ self.textbox.grid(row=0, column=0, padx=(20, 20), pady=(20, 20), sticky="nsew")
31
+ self.textbox.insert("0.0", self.message)
32
+
33
+ self._ok_button = CTkButton(master=self,
34
+ width=100,
35
+ border_width=0,
36
+ fg_color=self._button_fg_color,
37
+ hover_color=self._button_hover_color,
38
+ text_color=self._button_text_color,
39
+ text='OK',
40
+ command=self._ok_event)
41
+ self._ok_button.grid(row=1, column=0, columnspan=1, padx=(20, 10), pady=(0, 20), sticky="ew")
42
+
43
+ def _ok_event(self, event=None):
44
+ self.grab_release()
45
+ self.destroy()
46
+
47
+ def _on_closing(self):
48
+ self.grab_release()
49
+ self.destroy()
50
+
51
+ def _cancel_event(self):
52
+ self.grab_release()
53
+ self.destroy()
mgpsogui/gui/HomePage.py CHANGED
@@ -30,6 +30,8 @@ import time
30
30
 
31
31
  from queue import Empty
32
32
 
33
+ from General.NoticeWindow import NoticeWindow as NW
34
+
33
35
  from ..util import PSORunner
34
36
  from ..util import GraphGenerator
35
37
  from ..util.CTkToolTip import CTkToolTip as ctt
@@ -208,6 +210,8 @@ class App(customtkinter.CTk):
208
210
  self.refresh_step_view(0)
209
211
  self.after(1000, self.running_loop)
210
212
 
213
+ NW(title="Welcome!", message="Welcome to COSU Manager!", option_manager=self.option_manager)
214
+
211
215
  def update_graph(self, value):
212
216
  self.vis_sidebar.refresh()
213
217
  GraphGenerator.generate_graphs(self)
@@ -0,0 +1,127 @@
1
+ from customtkinter import CTkScrollableFrame
2
+ from customtkinter import CTkFrame
3
+ from customtkinter import CTkLabel
4
+ from customtkinter import CTkButton
5
+ from customtkinter import CTkEntry
6
+ import tkinter as tk
7
+ import subprocess
8
+ import platform
9
+ import os
10
+
11
+ global option_manager
12
+
13
+ class SamplingListView(CTkScrollableFrame):
14
+ def __init__(self, *args,
15
+ option_manager: None,
16
+ step_index: 0,
17
+ bound_index: 0,
18
+ **kwargs):
19
+ super().__init__(*args, **kwargs)
20
+
21
+ self.option_manager = option_manager
22
+ self.step_index = step_index
23
+ self.bounds_index = bound_index
24
+ self.key_values = []
25
+ self.visual_name = tk.StringVar()
26
+ self.visual_name.set("name")
27
+
28
+
29
+ self.name = self.option_manager.get_steps()[self.step_index]["parameter_objects"][bound_index]["name"].get()
30
+ self.default = self.option_manager.get_steps()[self.step_index]["parameter_objects"][bound_index]["default_value"].get()
31
+ try:
32
+ if self.name != "" and self.default != "":
33
+
34
+ self.visual_name.set(self.name.rsplit('/', 1)[0] + '/')
35
+ self.names = self.name.split('/')
36
+ self.rows = self.names[-1].split(';')
37
+ self.defaults = self.default.replace("[", "").replace("]", "").replace("(", "").replace(")", "").replace(" ", "").split(",")
38
+
39
+ print("rows", self.rows)
40
+ print("defaults", self.defaults)
41
+ index = 0
42
+
43
+ for name in self.rows:
44
+ obj = {"name": tk.StringVar(), "value": tk.StringVar()}
45
+ obj['name'].set(name)
46
+ obj['value'].set(self.defaults[index])
47
+ self.key_values.append(obj)
48
+ index += 1
49
+ except Exception as e:
50
+ print(e)
51
+
52
+ if (len(self.key_values) == 0):
53
+ self.add_key()
54
+
55
+ self.edit_mode = False
56
+
57
+ self.render()
58
+
59
+ def clear(self):
60
+ self.containerFrame.destroy()
61
+
62
+ def toggle_edit_mode(self):
63
+ self.clear()
64
+ self.edit_mode = not self.edit_mode
65
+ self.render()
66
+
67
+ def add_key(self, key="0000", value="0"):
68
+ obj = {"name": tk.StringVar(), "value": tk.StringVar()}
69
+ obj['name'].set(key)
70
+ obj['value'].set(value)
71
+ self.key_values.append(obj)
72
+
73
+ def remove_key(self, index):
74
+ self.key_values.pop(index)
75
+
76
+ def render(self):
77
+ row = 0
78
+ index = 0
79
+
80
+ self.containerFrame = CTkFrame(self)
81
+ self.containerFrame.grid(row=0, column=0, padx=(5, 5), pady=(5, 5), sticky="nsew")
82
+ self.containerFrame.grid_columnconfigure((0, 1), weight=1)
83
+
84
+
85
+ CTkLabel(self.containerFrame, text="Row:").grid(row=row, column=0, columnspan=1, padx=5, pady=5, sticky="")
86
+ CTkLabel(self.containerFrame, text="Default:").grid(row=row, column=1, columnspan=1, padx=5, pady=5, sticky="")
87
+ row += 1
88
+
89
+ for key_value_pair in self.key_values:
90
+ CTkEntry(self.containerFrame, textvariable=self.key_values[index]["name"]).grid(row=row, column=0, padx=(5, 5), pady=(5, 5), sticky="ew")
91
+
92
+ if self.edit_mode:
93
+ return_func = lambda index=index: (self.clear(), self.remove_key(index), self.render())
94
+ CTkButton(self.containerFrame, text="Remove", command=return_func).grid(row=row, column=1, padx=(5, 5), pady=(5, 5), sticky="ew")
95
+ else:
96
+ bb = CTkEntry(self.containerFrame)
97
+ bb.grid(row=row, column=1, padx=(5, 5), pady=(5, 5), sticky="ew")
98
+ bb.configure(textvariable=self.key_values[index]["value"])
99
+ row += 1
100
+ index += 1
101
+
102
+ if self.edit_mode:
103
+ CTkButton(self.containerFrame, text="Exit", command=self.toggle_edit_mode).grid(row=row, column=0, padx=(5, 5), pady=(5, 5), sticky="ew")
104
+ else:
105
+ CTkButton(self.containerFrame, text="Edit", command=self.toggle_edit_mode).grid(row=row, column=0, padx=(5, 5), pady=(5, 5), sticky="ew")
106
+
107
+ add_key_func = lambda: (self.clear(), self.add_key(), self.render())
108
+ CTkButton(self.containerFrame, text="Add", command=add_key_func).grid(row=row, column=1, padx=(5, 5), pady=(5, 5), sticky="ew")
109
+
110
+ row += 1
111
+
112
+ def push_to_option_manager(self):
113
+ visual_name = self.visual_name.get()
114
+ default_values = "["
115
+ first = True
116
+ for key_value_pair in self.key_values:
117
+ if first:
118
+ visual_name += key_value_pair['name'].get()
119
+ first = False
120
+ else:
121
+ visual_name += ";" + key_value_pair['name'].get()
122
+ default_values += key_value_pair['value'].get() + ","
123
+
124
+ default_values = default_values[:-1] + "]"
125
+
126
+ self.option_manager.get_steps()[self.step_index]["parameter_objects"][self.bounds_index]["name"].set(visual_name)
127
+ self.option_manager.get_steps()[self.step_index]["parameter_objects"][self.bounds_index]["default_value"].set(default_values)
@@ -0,0 +1,74 @@
1
+ from typing import Union, Tuple, Optional
2
+
3
+ from customtkinter import CTkLabel
4
+ from customtkinter import CTkButton
5
+ from customtkinter import CTkEntry
6
+ from customtkinter import CTkInputDialog
7
+ from .SamplingListView import SamplingListView as SamplingListView
8
+
9
+ class SamplingNameListWindow(CTkInputDialog):
10
+ """
11
+ Dialog with extra window, message, entry widget, cancel and ok button.
12
+ For detailed information check out the documentation.
13
+ """
14
+
15
+ def __init__(self, *args,
16
+ step_index: 0,
17
+ bound_index: 0,
18
+ option_manager: None,
19
+ **kwargs):
20
+ super().__init__(*args, **kwargs)
21
+
22
+ self.geometry("400x800")
23
+
24
+ self.step_index = step_index
25
+ self.bound_index = bound_index
26
+ self.option_manager = option_manager
27
+ self.bounds = None
28
+
29
+ def _create_widgets(self):
30
+
31
+ self.grid_columnconfigure((0, 1), weight=1)
32
+ self.rowconfigure(0, weight=1)
33
+
34
+ self.bounds = SamplingListView(
35
+ self, step_index=self.step_index, bound_index=self.bound_index, option_manager=self.option_manager)
36
+ self.bounds.grid(row=0, column=0, columnspan=2, padx=(10, 10),
37
+ pady=(10, 10), sticky="nsew")
38
+ self.bounds.grid_columnconfigure(0, weight=1)
39
+
40
+ self._ok_button = CTkButton(master=self,
41
+ width=100,
42
+ border_width=0,
43
+ fg_color=self._button_fg_color,
44
+ hover_color=self._button_hover_color,
45
+ text_color=self._button_text_color,
46
+ text='Save',
47
+ command=self._ok_event)
48
+ self._ok_button.grid(row=2, column=0, columnspan=1, padx=(20, 10), pady=(0, 20), sticky="ew")
49
+
50
+ self._cancel_button = CTkButton(master=self,
51
+ width=100,
52
+ border_width=0,
53
+ fg_color=self._button_fg_color,
54
+ hover_color=self._button_hover_color,
55
+ text_color=self._button_text_color,
56
+ text='Cancel',
57
+ command=self._cancel_event)
58
+ self._cancel_button.grid(row=2, column=1, columnspan=1, padx=(10, 20), pady=(0, 20), sticky="ew")
59
+
60
+ def _ok_event(self, event=None):
61
+ # Save values in bounds editor...
62
+
63
+ self.bounds.push_to_option_manager()
64
+
65
+ self.grab_release()
66
+ self.destroy()
67
+
68
+ def _on_closing(self):
69
+ self.grab_release()
70
+ self.destroy()
71
+
72
+ def _cancel_event(self):
73
+ self.grab_release()
74
+ self.destroy()