mg-pso-gui 0.1.223__py3-none-any.whl → 0.1.225__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mg_pso_gui-0.1.223.dist-info → mg_pso_gui-0.1.225.dist-info}/METADATA +1 -1
- {mg_pso_gui-0.1.223.dist-info → mg_pso_gui-0.1.225.dist-info}/RECORD +8 -6
- mgpsogui/gui/SetupTab/CustomFunctionEditorWindow.py +74 -0
- mgpsogui/gui/SetupTab/CustomFunctionMetrics.py +105 -0
- mgpsogui/gui/SetupTab/FunctionsList.py +15 -0
- {mg_pso_gui-0.1.223.dist-info → mg_pso_gui-0.1.225.dist-info}/WHEEL +0 -0
- {mg_pso_gui-0.1.223.dist-info → mg_pso_gui-0.1.225.dist-info}/entry_points.txt +0 -0
- {mg_pso_gui-0.1.223.dist-info → mg_pso_gui-0.1.225.dist-info}/top_level.txt +0 -0
@@ -11,7 +11,9 @@ mgpsogui/gui/RunTab/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
|
|
11
11
|
mgpsogui/gui/SetupTab/BoundsEditorWindow.py,sha256=U64oaiDIOaimjbqKMz5rQNq2o1SrQtrRHDdTYQ9ux1s,2870
|
12
12
|
mgpsogui/gui/SetupTab/BoundsList.py,sha256=L77UEaUJNiUE-ZsYIl44tWRb1zBfxaEQ-bAG1V5_IH0,12268
|
13
13
|
mgpsogui/gui/SetupTab/CalibrationParametersView.py,sha256=ppVBHG3nphku9-P6Z8az-HTpgk8vHxnj-A5m80BZTgA,2784
|
14
|
-
mgpsogui/gui/SetupTab/
|
14
|
+
mgpsogui/gui/SetupTab/CustomFunctionEditorWindow.py,sha256=yx0dHSNa7fGy99Q6qFcI6j9r8p0DlV3iOBgyPMGd8pM,2884
|
15
|
+
mgpsogui/gui/SetupTab/CustomFunctionMetrics.py,sha256=aPQxE82SGynEr38jLHc1cZLLMtOn0d06fAWzlOShiNY,3902
|
16
|
+
mgpsogui/gui/SetupTab/FunctionsList.py,sha256=1nAW1ICl2b9D8AAxKZ9G0dVuRTSm8RhfPUTQ4rKF2Vw,6365
|
15
17
|
mgpsogui/gui/SetupTab/ListEditor.py,sha256=vlP0KDPu8J1_6KXuUTlE7OClgfF0Qk6cISsFm_SglUw,3232
|
16
18
|
mgpsogui/gui/SetupTab/ListParametersView.py,sha256=wYcDcaooYkw-y7XW6dJUwhTWxLuUUOK5tGUFVHBf3ck,7352
|
17
19
|
mgpsogui/gui/SetupTab/OptimalParameterView.py,sha256=VKn-4BlVyqspFIOkbWsM0q9pYVsmqnSND0xP2hDKb60,1785
|
@@ -60,8 +62,8 @@ mgpsogui/util/recosu/utils/trace_writer.py,sha256=V9BJlOjCbNYGoXGEk3CF5wjifBxvar
|
|
60
62
|
mgpsogui/util/recosu/utils/utils.py,sha256=QB8vftq3142ekG0ORjz0ZBHU5YknXbR0oTsrxrPAsF0,3951
|
61
63
|
mgpsogui/util/recosu/utils/plot/__init__.py,sha256=h1KjM7_tNDv351pcwt8A6Ibb1jhwWyx5Gbu-zj-sI3Q,71
|
62
64
|
mgpsogui/util/recosu/utils/plot/cost_steps.py,sha256=1Ce11AJyweWkmvjXPxEygzS-h8yVLmQEDLS53yjPLqQ,3779
|
63
|
-
mg_pso_gui-0.1.
|
64
|
-
mg_pso_gui-0.1.
|
65
|
-
mg_pso_gui-0.1.
|
66
|
-
mg_pso_gui-0.1.
|
67
|
-
mg_pso_gui-0.1.
|
65
|
+
mg_pso_gui-0.1.225.dist-info/METADATA,sha256=7nTpN6GNelgFtoA9bk_IfLGiqFS7krY0L4A_GyGeLGM,9456
|
66
|
+
mg_pso_gui-0.1.225.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
|
67
|
+
mg_pso_gui-0.1.225.dist-info/entry_points.txt,sha256=jg82VOFjR1XDGrchs1wJSCqKYE4Ozv12aBcCSp--koA,117
|
68
|
+
mg_pso_gui-0.1.225.dist-info/top_level.txt,sha256=y7JuS9xJN5YdxUsQ3PSVjN8MzQAnR146bP3ZN3PYWdE,9
|
69
|
+
mg_pso_gui-0.1.225.dist-info/RECORD,,
|
@@ -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 .CustomFunctionMetrics import CustomFunctionsMetricsView as ListView
|
8
|
+
|
9
|
+
class CustomFunctionEditorWindow(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
|
+
function_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.function_index = function_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 = ListView(
|
35
|
+
self, step_index=self.step_index, function_index=self.function_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()
|
@@ -0,0 +1,105 @@
|
|
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
|
+
from customtkinter import CTkOptionMenu
|
7
|
+
import tkinter as tk
|
8
|
+
import subprocess
|
9
|
+
import platform
|
10
|
+
import os
|
11
|
+
|
12
|
+
global option_manager
|
13
|
+
|
14
|
+
class CustomFunctionsMetricsView(CTkScrollableFrame):
|
15
|
+
def __init__(self, *args,
|
16
|
+
option_manager: None,
|
17
|
+
step_index: 0,
|
18
|
+
function_index: 0,
|
19
|
+
**kwargs):
|
20
|
+
super().__init__(*args, **kwargs)
|
21
|
+
|
22
|
+
self.option_manager = option_manager
|
23
|
+
self.step_index = step_index
|
24
|
+
self.functions_index = function_index
|
25
|
+
self.key_values = []
|
26
|
+
|
27
|
+
self.edit_mode = False
|
28
|
+
|
29
|
+
self.columns = ["absdiff",
|
30
|
+
"absdifflog",
|
31
|
+
"ave",
|
32
|
+
"bias",
|
33
|
+
"fhf",
|
34
|
+
"ioa",
|
35
|
+
"ioa2",
|
36
|
+
"kge",
|
37
|
+
"kge09",
|
38
|
+
"mns",
|
39
|
+
"mse",
|
40
|
+
"ns",
|
41
|
+
"ns2log",
|
42
|
+
"nslog1p",
|
43
|
+
"nslog2",
|
44
|
+
"pbias",
|
45
|
+
"pmcc",
|
46
|
+
"rmse",
|
47
|
+
"trmse"]
|
48
|
+
|
49
|
+
self.render()
|
50
|
+
|
51
|
+
def clear(self):
|
52
|
+
self.containerFrame.destroy()
|
53
|
+
|
54
|
+
def toggle_edit_mode(self):
|
55
|
+
self.clear()
|
56
|
+
self.edit_mode = not self.edit_mode
|
57
|
+
self.render()
|
58
|
+
|
59
|
+
def add_key(self, key="ns", value="0"):
|
60
|
+
obj = {"name": tk.StringVar(), "value": tk.StringVar()}
|
61
|
+
obj['name'].set(key)
|
62
|
+
obj['value'].set(value)
|
63
|
+
self.key_values.append(obj)
|
64
|
+
|
65
|
+
def remove_key(self, index):
|
66
|
+
self.key_values.pop(index)
|
67
|
+
|
68
|
+
def render(self):
|
69
|
+
row = 0
|
70
|
+
index = 0
|
71
|
+
|
72
|
+
self.containerFrame = CTkFrame(self)
|
73
|
+
self.containerFrame.grid(row=0, column=0, padx=(5, 5), pady=(5, 5), sticky="nsew")
|
74
|
+
self.containerFrame.grid_columnconfigure((0, 1), weight=1)
|
75
|
+
|
76
|
+
CTkLabel(self.containerFrame, text="Objective:").grid(row=row, column=0, columnspan=1, padx=5, pady=5, sticky="")
|
77
|
+
CTkLabel(self.containerFrame, text="Weight:").grid(row=row, column=1, columnspan=1, padx=5, pady=5, sticky="")
|
78
|
+
row += 1
|
79
|
+
|
80
|
+
for key_value_pair in self.key_values:
|
81
|
+
CTkOptionMenu(self.containerFrame, values=self.columns, variable=self.key_values[index]["name"]).grid(row=row, column=1, padx=(5, 5), pady=(5, 5), sticky="ew")
|
82
|
+
|
83
|
+
|
84
|
+
if self.edit_mode:
|
85
|
+
return_func = lambda index=index: (self.clear(), self.remove_key(index), self.render())
|
86
|
+
CTkButton(self.containerFrame, text="Remove", command=return_func).grid(row=row, column=1, padx=(5, 5), pady=(5, 5), sticky="ew")
|
87
|
+
else:
|
88
|
+
bb = CTkEntry(self.containerFrame)
|
89
|
+
bb.grid(row=row, column=1, padx=(5, 5), pady=(5, 5), sticky="ew")
|
90
|
+
bb.configure(textvariable=self.key_values[index]["value"])
|
91
|
+
row += 1
|
92
|
+
index += 1
|
93
|
+
|
94
|
+
if self.edit_mode:
|
95
|
+
CTkButton(self.containerFrame, text="Exit", command=self.toggle_edit_mode).grid(row=row, column=0, padx=(5, 5), pady=(5, 5), sticky="ew")
|
96
|
+
else:
|
97
|
+
CTkButton(self.containerFrame, text="Edit", command=self.toggle_edit_mode).grid(row=row, column=0, padx=(5, 5), pady=(5, 5), sticky="ew")
|
98
|
+
|
99
|
+
add_key_func = lambda: (self.clear(), self.add_key(), self.render())
|
100
|
+
CTkButton(self.containerFrame, text="Add", command=add_key_func).grid(row=row, column=1, padx=(5, 5), pady=(5, 5), sticky="ew")
|
101
|
+
|
102
|
+
row += 1
|
103
|
+
|
104
|
+
def push_to_option_manager(self):
|
105
|
+
pass
|
@@ -4,6 +4,11 @@ from customtkinter import CTkLabel
|
|
4
4
|
from customtkinter import CTkButton
|
5
5
|
from customtkinter import CTkEntry
|
6
6
|
from customtkinter import CTkOptionMenu
|
7
|
+
from customtkinter import CTkImage
|
8
|
+
from .CustomFunctionEditorWindow import CustomFunctionEditorWindow as CFEW
|
9
|
+
import os
|
10
|
+
import PIL
|
11
|
+
from PIL import Image
|
7
12
|
import tkinter as tk
|
8
13
|
|
9
14
|
class FunctionsList(CTkFrame):
|
@@ -88,6 +93,16 @@ class FunctionsList(CTkFrame):
|
|
88
93
|
CTkEntry(self.containerFrame, textvariable=func["custom_function"]).grid(row=row, column=0, columnspan=2, padx=(5, 5), pady=(5, 5), sticky="ew")
|
89
94
|
CTkOptionMenu(self.containerFrame, values=["+ Best", "0 Best"], variable=func["custom_function_goal"]).grid(row=row, column=2, padx=(5, 5), pady=(5, 5), sticky="ew")
|
90
95
|
|
96
|
+
def button_click_event(function_index):
|
97
|
+
dialog = CFEW(title="Edit Custom Function", step_index=self.step_index, function_index=function_index, option_manager=self.option_manager)
|
98
|
+
|
99
|
+
|
100
|
+
open_window = lambda event=None, function_index=index: (button_click_event(function_index))
|
101
|
+
expand_image = CTkImage(Image.open(os.path.join("./images", "expand.png")), size=(20, 20))
|
102
|
+
button = CTkButton(self.containerFrame, width=30, text=None, image=expand_image, command=open_window)
|
103
|
+
button.grid(row=row, column=3, padx=(5, 5), pady=(5, 5), sticky="new")
|
104
|
+
|
105
|
+
|
91
106
|
row += 1
|
92
107
|
|
93
108
|
CTkLabel(self.containerFrame, text="Data:").grid(row=row, column=0, padx=(5, 5), pady=(5, 5), sticky="nsew")
|
File without changes
|
File without changes
|
File without changes
|