From b73eba7f7e2caac248d3d528dcb41984b8a89494 Mon Sep 17 00:00:00 2001 From: Andrew Date: Wed, 18 Dec 2024 12:58:37 +0300 Subject: [PATCH] =?UTF-8?q?chore:=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=BE=D0=BF=D0=B8=D1=81=D0=B0=D0=BD=D0=B8=D0=B5=20?= =?UTF-8?q?=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=B9=20=D0=B2=20=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D1=8B=D0=B9=20=D0=BA=D0=BB=D0=B0=D1=81=D1=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../__pycache__/monitor.cpython-310.pyc | Bin 2557 -> 2543 bytes src/controller/monitor.py | 2 +- src/gui/__pycache__/mainGui.cpython-310.pyc | Bin 3958 -> 4045 bytes src/gui/__pycache__/plotter.cpython-310.pyc | Bin 9617 -> 9619 bytes src/gui/__pycache__/reportGui.cpython-310.pyc | Bin 4907 -> 5896 bytes .../settings_window.cpython-310.pyc | Bin 5558 -> 5549 bytes src/gui/mainGui.py | 12 ++-- src/gui/plotter.py | 4 +- src/gui/reportGui.py | 63 ++++++++++++++---- src/gui/settings_window.py | 1 - 10 files changed, 61 insertions(+), 21 deletions(-) diff --git a/src/controller/__pycache__/monitor.cpython-310.pyc b/src/controller/__pycache__/monitor.cpython-310.pyc index 47083417f637ea3b855feb43429b3c10a9ba84bd..c222d517a446315976939b0096d526f70b071ccc 100644 GIT binary patch delta 30 kcmew>{9c$hpO=@50SLV3B&FMJ None: self.stop() - operator_params, system_params = data + _, system_params = data self._directory_path = system_params['trace_storage_path'][0] self._update_time = system_params['monitor_update_period'][0] self._init_state() diff --git a/src/gui/__pycache__/mainGui.cpython-310.pyc b/src/gui/__pycache__/mainGui.cpython-310.pyc index b3ab3bdcf374efd703bd458da343aa63d6551b98..0a5cf6f6a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$Jivux_NZfj-3)Jn|idtLh1yh($ diff --git a/src/gui/__pycache__/plotter.cpython-310.pyc b/src/gui/__pycache__/plotter.cpython-310.pyc index d524b62282216b3f91c0faf9aaafb4a12022e7dc..d6427a321a823af462887d7179c1ecf6b49759cf 100644 GIT binary patch delta 46 ycmbQ}J=vQ#pO=@50SF}LB&EOE$h%*Gv1s#I1p&s%eo{P>UnpvV=*==prOW_5xDCPp delta 60 zcmbR2J<*#tpO=@50SF=|CZ)gH$h%*Gv0(FA1p!8`lGNgy#Q2iT+|C Fm;p%=6iNU9 diff --git a/src/gui/__pycache__/reportGui.cpython-310.pyc b/src/gui/__pycache__/reportGui.cpython-310.pyc index f68774832afb9473f12e5b3ad096e9451bc289f7..6dc859861003832b29e5358eb010cc13d124ef0a 100644 GIT binary patch delta 1541 zcmb_cU1%It6rOu$XLfcbnQYqBs4Y4bs;-n43Pn^bMa+YWK~2#IK}gwcMX+7(W(q9{ zn@t;9SY-+Kp$|S}m(V9gHa}a(Y_kFJMSQsz--7hXXAyi5#3udD-A&S#qJ8KrbLZT1 z&pqcm-#KT$dH&jw@O*#2Z{hjp>(gid*gqF8`W|*C@s@s{`}w(aluzfqE2+6Zr`^1r zPo43kV6U))@>}*(*&DNRnOMM9HB?7^uU1r3we(E%-nbb5yf9G^r$nI;LEYB1NPnf; zs-UDGqLUy9U{uHeFKq?YxxYU(R0QLEc0RkcV;wT53u{QzT}wV_zSH`#ED@*@9* z4a*Vx1RIr??OzW(4J00Sna6zQ*&a)6W*wJhS!ye^<+;>InZ-=JFv;qyVTnWd@;q;_ zDL%>TcEifk>9bwAo@!Xk>ROh1Q-ic}**>%1EPfg;|cs$y9P?@vDnj^0|Q*Xs@LhjX)c&1vy zZ_7me5@o9rWaAWv_i3q+YSjRr)>Y}aaqtqH{YA}{a^$Q#`(gb4uJ`Ruc|`A&ilGCs zA7~XBq%Q==;aMERa_Nw)xlhR(=}TPC$b()jI0i?XHvvhHxUFr4LI^p3mficOaE$ z3ubO-ZV$f(QOzTITVK{!;ev=)Ys)|SMHYNS##E`$k+1jtUC3bS{P<(Kavi4IIXoC% zS04rz9ca>|9$e~ng^?0e6^RsSaA|1etNkzfqq&rzB5n-HquG6Oy8l{mj=&6I$)=b0 zh6AkkA8_VT(A?7@NR_7lKe2%GCe;8;V*D}l#B3toKqxUn%iCDw%LDr{{T~e62xhP? zJ%c6dN}m0xI8cdCEQ?#C^2x!;;5xyg@&VTT;E6OB8Ei)7 zZ-WbEqRq3O;Qn47a>lnf^S5|#zvS-djMNvx&Pc-#V;n#it*y7;$2IAw`b}u1hUVY delta 477 zcmXv~J4*vW5Z>8bE}OgLT;knf4$(zX*KFZzK`pCUV|b3C3_K z+Mvx_{EAlf3E8GyfK}~Gr1<)dJ|&|u*#=P&_ui14W`P zzIP0x#V_<_Nt*&V+&uCQ_*X2G7{y%TTwj-bPrzfU^T&~bhTZ&}h~zU879^|)z=m1Y ki^2(}alip<2DhwJC(xVNl<|a?V7AzO%rw8n&i5hu diff --git a/src/gui/mainGui.py b/src/gui/mainGui.py index 5223802..83813f0 100644 --- a/src/gui/mainGui.py +++ b/src/gui/mainGui.py @@ -9,7 +9,7 @@ from gui.reportGui import ReportSettings class MainWindow(BaseMainWindow): def __init__(self, - controller: Optional[BaseController] = None): + controller: Optional[BaseController] = None) -> None: super().__init__() self._controller = controller self.initUI() @@ -61,11 +61,13 @@ class MainWindow(BaseMainWindow): for i in range(0, tab_count-2): self._close_tab(i) - def keyPressEvent(self, a0): + def keyPressEvent(self, a0) -> None: if a0.key() == Qt.Key_F5: - pass + tab_count = self.tabWidget.count() + for i in range(0, tab_count): + self._close_tab(i) - def _show_settings(self): + def _show_settings(self) -> None: self.operSettings.show() self.sysSettings.show() @@ -86,7 +88,7 @@ class MainWindow(BaseMainWindow): if folder_path: self._controller.open_custom_file(folder_path) - def _report_window(self): + def _report_window(self) -> None: tab = self.tabWidget.currentWidget() reg_items = tab.property("reg_items") curve_items = tab.property("curve_items") diff --git a/src/gui/plotter.py b/src/gui/plotter.py index 0f8e0bf..6abeaf2 100644 --- a/src/gui/plotter.py +++ b/src/gui/plotter.py @@ -270,8 +270,8 @@ class PlotWidget(BasePlotWidget): Создает набор виджетов по предоставленному списку данных. Предполагается, что data — это список элементов вида: [ - [dataframe, points_pocket, tesla_time], - [dataframe, points_pocket, tesla_time], + [dataframe, points_pocket, useful_data], + [dataframe, points_pocket, useful_data], ... ] """ diff --git a/src/gui/reportGui.py b/src/gui/reportGui.py index 79293e9..65ec102 100644 --- a/src/gui/reportGui.py +++ b/src/gui/reportGui.py @@ -7,6 +7,7 @@ from PyQt5 import QtWidgets class ReportSettings(QtWidgets.QWidget): def build(self, reg_items: dict, curve_items: dict) -> None: + """Создает ParameterTree для элементов всех графиков выбранной вкладки""" self._clear() param_tree = ParameterTree() layout = self.layout() @@ -18,11 +19,17 @@ class ReportSettings(QtWidgets.QWidget): ] # Добавляем параметры в дерево params = Parameter.create(name='params', type='group', children=body) - params.sigTreeStateChanged.connect(lambda: self._update_settings(reg_items, curve_items, params)) + params.sigTreeStateChanged.connect( + lambda: self._update_settings(reg_items, curve_items, params) + ) param_tree.setParameters(params, showTop=False) self.show() - def _clear(self): + def _clear(self) -> None: + """ + Приводит виджет в готовое к работе состояние. + Удаляет все содержимое, если имеется + """ main = self.layout() if self.layout() is not None: while main.count(): @@ -32,7 +39,10 @@ class ReportSettings(QtWidgets.QWidget): else: self.setLayout(QtWidgets.QVBoxLayout()) - def _generate_reg_params(self, reg_items: dict) -> dict: + def _generate_reg_params(self, + reg_items: dict) -> dict: + + """Созадет реальные и идеальные секторы""" res = {'name': 'Sectors', 'type': 'group', 'children': [ {'name': 'Real sectors', 'type': 'group', 'children': self._create_samples(reg_items["real"])}, @@ -40,7 +50,10 @@ class ReportSettings(QtWidgets.QWidget): ]} return res - def _generate_curve_params(self, curve_items: dict) -> dict: + def _generate_curve_params(self, + curve_items: dict) -> dict: + + """Создает реальные и идеальные линии графиков""" res = {'name': 'Plots', 'type': 'group', 'children': [ {'name': 'Real plots', 'type': 'group', 'children': self._create_samples(curve_items["real"])}, @@ -48,15 +61,22 @@ class ReportSettings(QtWidgets.QWidget): ]} return res - def _create_ideal_curves(self, curve: dict) -> list[dict]: - """Создаем секторы с этапами циклограммы""" + def _create_ideal_curves(self, + curve: dict) -> list[dict]: + + """Создает секторы с этапами циклограммы""" + res = [] for key, item in curve.items(): param = {'name': key, 'type': 'group', 'children': self._create_samples(item)} res.append(param) return res - def _create_samples(self, sector: dict) -> list[dict]: + def _create_samples(self, + sector: dict) -> list[dict]: + + """Создает список представленных элементов с их параметрами""" + res = [] for key, item in sector.items(): sample = item[0] if type(item) == list else item @@ -64,8 +84,11 @@ class ReportSettings(QtWidgets.QWidget): res.append(param) return res - def _create_settings(self, item: Union[pg.LinearRegionItem, pg.PlotDataItem]) -> list[dict]: - """Настройки для элемента""" + def _create_settings(self, + item: Union[pg.LinearRegionItem, pg.PlotDataItem]) -> list[dict]: + + """Получает настройки для элемента""" + if type(item) == pg.LinearRegionItem: pen = item.lines[0].pen brush = item.brush @@ -84,7 +107,13 @@ class ReportSettings(QtWidgets.QWidget): {'name': 'Fill color', 'type': 'color', 'value': fill_color}, ] - def _update_settings(self, reg_items: dict, curve_items: dict, params: Parameter): + def _update_settings(self, + reg_items: dict, + curve_items: dict, + params: Parameter) -> None: + + """Задает параметры элементов в соответствии с paramTree""" + real_sectors = params.child("Sectors").child("Real sectors") ideal_sectors = params.child("Sectors").child("Ideal sectors") @@ -98,7 +127,12 @@ class ReportSettings(QtWidgets.QWidget): for key, item_dict in curve_items["ideal"].items(): self._set_plot_settings(item_dict, ideal_plots.child(key)) - def _set_sector_settings(self, sectors: dict, settings: Parameter) -> None: + def _set_sector_settings(self, + sectors: dict, + settings: Parameter) -> None: + + """Задает параметры секторов в соответствии с настройками""" + for key, item in sectors.items(): sample = settings.child(key) line_color = sample.child("Line color").value() @@ -114,7 +148,12 @@ class ReportSettings(QtWidgets.QWidget): reg.lines[1].setPen(pen) reg.setBrush(brush) - def _set_plot_settings(self, curves:dict, settings: Parameter) -> None: + def _set_plot_settings(self, + curves:dict, + settings: Parameter) -> None: + + """Задает параметры кривых в соответствии с настройками""" + for key, item in curves.items(): sample = settings.child(key) line_color = sample.child("Line color").value() diff --git a/src/gui/settings_window.py b/src/gui/settings_window.py index 416fad3..d81e302 100644 --- a/src/gui/settings_window.py +++ b/src/gui/settings_window.py @@ -12,7 +12,6 @@ class settingsWindow(QWidget): def __init__(self, path: str, name: str, upd_func: Callable[[], None]): """ Окно настроек для редактирования параметров. - :param path: Путь к файлу настроек (JSON). :param name: Название набора настроек. :param upd_func: Функция обновления (коллбэк).