Compare commits
No commits in common. "afcbb1abdc035f880c07d93ccd4cdd06c6381f91" and "74b65eee5d99a3633f219f5947cafb15e3cc7748" have entirely different histories.
afcbb1abdc
...
74b65eee5d
Binary file not shown.
Binary file not shown.
@ -1,6 +1,5 @@
|
|||||||
from PyQt5.QtWidgets import QWidget
|
from PyQt5.QtWidgets import QWidget
|
||||||
from PyQt5.QtCore import pyqtSignal
|
from PyQt5.QtCore import pyqtSignal
|
||||||
from typing import Union
|
|
||||||
|
|
||||||
from utils.base.base import BaseController
|
from utils.base.base import BaseController
|
||||||
|
|
||||||
@ -10,8 +9,6 @@ class Controller(BaseController):
|
|||||||
signal_widgets = pyqtSignal(list)
|
signal_widgets = pyqtSignal(list)
|
||||||
signal_settings = pyqtSignal(list)
|
signal_settings = pyqtSignal(list)
|
||||||
signal_open_file = pyqtSignal(str)
|
signal_open_file = pyqtSignal(str)
|
||||||
signal_statusBar = pyqtSignal(int)
|
|
||||||
signal_statusText = pyqtSignal(str)
|
|
||||||
signal_raport_mode = pyqtSignal()
|
signal_raport_mode = pyqtSignal()
|
||||||
signal_seeking_mode = pyqtSignal()
|
signal_seeking_mode = pyqtSignal()
|
||||||
signal_update_plots = pyqtSignal()
|
signal_update_plots = pyqtSignal()
|
||||||
@ -34,10 +31,5 @@ class Controller(BaseController):
|
|||||||
def update_plots(self) -> None:
|
def update_plots(self) -> None:
|
||||||
self.signal_update_plots.emit()
|
self.signal_update_plots.emit()
|
||||||
|
|
||||||
def update_status(self, msg: Union[str, float, int]) -> None:
|
|
||||||
if type(msg) == float or type(msg) == int:
|
|
||||||
self.signal_statusBar.emit(int(msg))
|
|
||||||
else:
|
|
||||||
self.signal_statusText.emit(msg)
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,5 +1,4 @@
|
|||||||
import pandas as pd
|
import pandas as pd
|
||||||
import time
|
|
||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
from PyQt5.QtWidgets import QWidget
|
from PyQt5.QtWidgets import QWidget
|
||||||
@ -16,26 +15,19 @@ class Mediator(BaseMediator):
|
|||||||
data: Union[list[str], list[pd.DataFrame], list[list], list[QWidget]]):
|
data: Union[list[str], list[pd.DataFrame], list[list], list[QWidget]]):
|
||||||
|
|
||||||
if issubclass(source.__class__, BaseDirectoryMonitor):
|
if issubclass(source.__class__, BaseDirectoryMonitor):
|
||||||
self.update_status("CSV found! Calculating...")
|
|
||||||
self._converter.convert_data(data)
|
self._converter.convert_data(data)
|
||||||
|
|
||||||
if issubclass(source.__class__, BaseDataConverter):
|
if issubclass(source.__class__, BaseDataConverter):
|
||||||
self.update_status(0.5)
|
|
||||||
self._passportFormer.form_passports(data)
|
self._passportFormer.form_passports(data)
|
||||||
|
|
||||||
if issubclass(source.__class__, BasePointPassportFormer):
|
if issubclass(source.__class__, BasePointPassportFormer):
|
||||||
self.update_status(1)
|
|
||||||
self._plot.build(data)
|
self._plot.build(data)
|
||||||
|
|
||||||
if issubclass(source.__class__, BasePlotWidget):
|
if issubclass(source.__class__, BasePlotWidget):
|
||||||
self.update_status(100)
|
|
||||||
self._controller.send_widgets(data)
|
self._controller.send_widgets(data)
|
||||||
|
|
||||||
def update_settings(self, settings: list[dict]):
|
def update_settings(self, settings: list[dict]):
|
||||||
self._monitor.update_settings(settings)
|
self._monitor.update_settings(settings)
|
||||||
self._passportFormer.update_settings(settings)
|
self._passportFormer.update_settings(settings)
|
||||||
|
|
||||||
def update_status(self, msg: Union[str, float]) -> None:
|
|
||||||
self._controller.update_status(msg)
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@ -3,7 +3,6 @@ from typing import Optional
|
|||||||
from PyQt5 import QtWidgets
|
from PyQt5 import QtWidgets
|
||||||
from PyQt5.QtCore import Qt
|
from PyQt5.QtCore import Qt
|
||||||
from PyQt5.QtGui import QPixmap, QIcon
|
from PyQt5.QtGui import QPixmap, QIcon
|
||||||
from PyQt5.QtWidgets import QSizePolicy as QSP
|
|
||||||
|
|
||||||
from utils.base.base import BaseMainWindow, BaseController
|
from utils.base.base import BaseMainWindow, BaseController
|
||||||
from gui.settings_window import SystemSettings, OperatorSettings
|
from gui.settings_window import SystemSettings, OperatorSettings
|
||||||
@ -31,7 +30,7 @@ class MainWindow(BaseMainWindow):
|
|||||||
self.operSettings = OperatorSettings("params/operator_params.json", 'Operator', self._upd_settings)
|
self.operSettings = OperatorSettings("params/operator_params.json", 'Operator', self._upd_settings)
|
||||||
self.sysSettings = SystemSettings("params/system_params.json", 'System', self._upd_settings)
|
self.sysSettings = SystemSettings("params/system_params.json", 'System', self._upd_settings)
|
||||||
self.repSettings = ReportSettings()
|
self.repSettings = ReportSettings()
|
||||||
|
self.statusBar().showMessage("Ready")
|
||||||
|
|
||||||
self._clear()
|
self._clear()
|
||||||
self.resize(800,800)
|
self.resize(800,800)
|
||||||
@ -62,8 +61,6 @@ class MainWindow(BaseMainWindow):
|
|||||||
mainLayout.addWidget(label, alignment=Qt.AlignCenter)
|
mainLayout.addWidget(label, alignment=Qt.AlignCenter)
|
||||||
mainLayout.addWidget(button_widget)
|
mainLayout.addWidget(button_widget)
|
||||||
|
|
||||||
self._init_statusBar()
|
|
||||||
|
|
||||||
def _init_dock_widgets(self) -> None:
|
def _init_dock_widgets(self) -> None:
|
||||||
"""
|
"""
|
||||||
Инициализация док-виджетов для настроек.
|
Инициализация док-виджетов для настроек.
|
||||||
@ -135,41 +132,7 @@ class MainWindow(BaseMainWindow):
|
|||||||
settings_menu.addAction(operator_settings)
|
settings_menu.addAction(operator_settings)
|
||||||
settings_menu.addAction(view_settings)
|
settings_menu.addAction(view_settings)
|
||||||
|
|
||||||
def _init_statusBar(self) -> None:
|
|
||||||
# Создание пользовательского виджета для StatusBar
|
|
||||||
note_widget = QtWidgets.QWidget()
|
|
||||||
note_layout = QtWidgets.QHBoxLayout(note_widget)
|
|
||||||
note_layout.setContentsMargins(10, 1, 10, 1)
|
|
||||||
note_layout.setSpacing(15) # Устанавливаем расстояние между элементами
|
|
||||||
|
|
||||||
# Создание QLabel и QProgressBar
|
|
||||||
self.mode_label = QtWidgets.QLabel()
|
|
||||||
self.note_label = QtWidgets.QLabel()
|
|
||||||
self.progress_bar = QtWidgets.QProgressBar()
|
|
||||||
self.progress_bar.setRange(0, 100)
|
|
||||||
self.progress_bar.setValue(0)
|
|
||||||
self.progress_bar.setMinimumWidth(250)
|
|
||||||
self.progress_bar.setMaximumHeight(10)
|
|
||||||
self.progress_bar.setTextVisible(False)
|
|
||||||
|
|
||||||
# Создание QSpacerItem
|
|
||||||
|
|
||||||
# Установка политики размеров
|
|
||||||
self.mode_label.setSizePolicy(QSP.Policy.Preferred, QSP.Policy.Preferred)
|
|
||||||
self.note_label.setSizePolicy(QSP.Policy.MinimumExpanding, QSP.Policy.Preferred)
|
|
||||||
self.progress_bar.setSizePolicy(QSP.Policy.Fixed, QSP.Policy.Preferred)
|
|
||||||
|
|
||||||
# Добавление виджетов в макет
|
|
||||||
note_layout.addWidget(self.mode_label)
|
|
||||||
note_layout.addWidget(self.note_label)
|
|
||||||
note_layout.addStretch(1)
|
|
||||||
note_layout.addWidget(self.progress_bar)
|
|
||||||
|
|
||||||
# Установка политики размеров для note_widget
|
|
||||||
note_widget.setSizePolicy(QSP.Policy.Expanding, QSP.Policy.Preferred)
|
|
||||||
|
|
||||||
# Добавление пользовательского виджета в StatusBar как Permanent Widget
|
|
||||||
self.statusBar().addPermanentWidget(note_widget, 1)
|
|
||||||
|
|
||||||
def _toggle_visibility(self, body:QtWidgets.QDockWidget = None) -> None:
|
def _toggle_visibility(self, body:QtWidgets.QDockWidget = None) -> None:
|
||||||
"""
|
"""
|
||||||
@ -204,9 +167,10 @@ class MainWindow(BaseMainWindow):
|
|||||||
button_widget = QtWidgets.QWidget()
|
button_widget = QtWidgets.QWidget()
|
||||||
button_widget.setLayout(button_layout)
|
button_widget.setLayout(button_layout)
|
||||||
|
|
||||||
self.mode_label.setText("online mode")
|
title = QtWidgets.QLabel("online mode")
|
||||||
self._central_layout.addWidget(self.tabWidget)
|
self._central_layout.addWidget(self.tabWidget)
|
||||||
self._central_layout.addWidget(button_widget)
|
self._central_layout.addWidget(button_widget)
|
||||||
|
self._central_layout.addWidget(title, alignment=Qt.AlignRight)
|
||||||
self._controller.seeking_mode()
|
self._controller.seeking_mode()
|
||||||
|
|
||||||
def _init_raportUI(self) -> None:
|
def _init_raportUI(self) -> None:
|
||||||
@ -229,9 +193,10 @@ class MainWindow(BaseMainWindow):
|
|||||||
button_widget = QtWidgets.QWidget()
|
button_widget = QtWidgets.QWidget()
|
||||||
button_widget.setLayout(button_layout)
|
button_widget.setLayout(button_layout)
|
||||||
|
|
||||||
self.mode_label.setText("raport mode")
|
title = QtWidgets.QLabel("raport mode")
|
||||||
self._central_layout.addWidget(self.tabWidget)
|
self._central_layout.addWidget(self.tabWidget)
|
||||||
self._central_layout.addWidget(button_widget)
|
self._central_layout.addWidget(button_widget)
|
||||||
|
self._central_layout.addWidget(title, alignment=Qt.AlignRight)
|
||||||
|
|
||||||
self._controller.raport_mode()
|
self._controller.raport_mode()
|
||||||
|
|
||||||
@ -254,8 +219,6 @@ class MainWindow(BaseMainWindow):
|
|||||||
for i in range(0, tab_count-10):
|
for i in range(0, tab_count-10):
|
||||||
self._close_tab(i)
|
self._close_tab(i)
|
||||||
|
|
||||||
self.update_stateLabel("Done!")
|
|
||||||
|
|
||||||
def keyPressEvent(self, a0) -> None:
|
def keyPressEvent(self, a0) -> None:
|
||||||
if a0.key() == Qt.Key_F5:
|
if a0.key() == Qt.Key_F5:
|
||||||
tab_count = self.tabWidget.count()
|
tab_count = self.tabWidget.count()
|
||||||
@ -268,14 +231,6 @@ class MainWindow(BaseMainWindow):
|
|||||||
self.repSettings.close()
|
self.repSettings.close()
|
||||||
super().closeEvent(a0)
|
super().closeEvent(a0)
|
||||||
|
|
||||||
def update_progressBar(self, percent:int) -> None:
|
|
||||||
if percent > 100: percent = 100
|
|
||||||
self.progress_bar.setValue(percent)
|
|
||||||
|
|
||||||
def update_stateLabel(self, msg: str = None) -> None:
|
|
||||||
self.note_label.setText(msg)
|
|
||||||
self.note_label.adjustSize()
|
|
||||||
|
|
||||||
def _transfer_settings(self) -> None:
|
def _transfer_settings(self) -> None:
|
||||||
self.tabWidget.clear()
|
self.tabWidget.clear()
|
||||||
operator_params = self.operSettings.getParams()
|
operator_params = self.operSettings.getParams()
|
||||||
|
|||||||
@ -199,12 +199,7 @@ class PlotWidget(BasePlotWidget):
|
|||||||
|
|
||||||
dat_is_none = dataframe is None
|
dat_is_none = dataframe is None
|
||||||
|
|
||||||
widget_steps = len(self._plt_channels)
|
if not dat_is_none: dataframe_headers = dataframe.columns.tolist()
|
||||||
|
|
||||||
if not dat_is_none:
|
|
||||||
dataframe_headers = dataframe.columns.tolist()
|
|
||||||
point_steps = len(points_pocket)
|
|
||||||
else: point_steps = 1
|
|
||||||
|
|
||||||
for widget_num, (channel, description) in enumerate(self._plt_channels.items()):
|
for widget_num, (channel, description) in enumerate(self._plt_channels.items()):
|
||||||
plot_item, legend = self._init_plot_item(title=channel)
|
plot_item, legend = self._init_plot_item(title=channel)
|
||||||
@ -304,9 +299,6 @@ class PlotWidget(BasePlotWidget):
|
|||||||
worst_perf = curr_perf
|
worst_perf = curr_perf
|
||||||
worst_timeframe = point_timeframe
|
worst_timeframe = point_timeframe
|
||||||
|
|
||||||
# Считаем прогресс
|
|
||||||
self._update_status(widget_steps, point_steps, widget_num, cur_point)
|
|
||||||
|
|
||||||
# Добавляем реальные сигналы
|
# Добавляем реальные сигналы
|
||||||
if not dat_is_none:
|
if not dat_is_none:
|
||||||
self._add_real_signals(plot_item, dataframe, description["Real_signals"], legend, curve_items)
|
self._add_real_signals(plot_item, dataframe, description["Real_signals"], legend, curve_items)
|
||||||
@ -341,8 +333,7 @@ class PlotWidget(BasePlotWidget):
|
|||||||
]
|
]
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
self._datalen = len(data)
|
widgets_datapack = [self._build_widget(data_sample) for data_sample in data]
|
||||||
widgets_datapack = [self._build_widget(data_sample) for self._datastep, data_sample in enumerate(data)]
|
|
||||||
except:
|
except:
|
||||||
tb = sys.exc_info()[2]
|
tb = sys.exc_info()[2]
|
||||||
tbinfo = traceback.format_tb(tb)[0]
|
tbinfo = traceback.format_tb(tb)[0]
|
||||||
@ -352,19 +343,5 @@ class PlotWidget(BasePlotWidget):
|
|||||||
finally:
|
finally:
|
||||||
self._mediator.notify(self, widgets_datapack)
|
self._mediator.notify(self, widgets_datapack)
|
||||||
|
|
||||||
def _update_status(self, widgsteps:int, pointsteps:int, cur_widg:int, cur_point:int):
|
|
||||||
if self._datalen != 0:
|
|
||||||
sycle_start = self._datastep/self._datalen*100 + 1
|
|
||||||
period1 = 100/self._datalen
|
|
||||||
else:
|
|
||||||
sycle_start = 1
|
|
||||||
period1 = 100
|
|
||||||
|
|
||||||
period2 = period1/widgsteps if widgsteps != 0 else period1
|
|
||||||
period3 = period2/pointsteps if pointsteps != 0 else period2
|
|
||||||
|
|
||||||
progress = sycle_start + period2*cur_widg + period3*cur_point
|
|
||||||
self._mediator.update_status(progress)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -24,8 +24,6 @@ def main():
|
|||||||
window.show()
|
window.show()
|
||||||
|
|
||||||
controller.signal_widgets.connect(window.show_plot_tabs)
|
controller.signal_widgets.connect(window.show_plot_tabs)
|
||||||
controller.signal_statusBar.connect(window.update_progressBar)
|
|
||||||
controller.signal_statusText.connect(window.update_stateLabel)
|
|
||||||
controller.signal_settings.connect(mediator.update_settings)
|
controller.signal_settings.connect(mediator.update_settings)
|
||||||
controller.signal_open_file.connect(monitor.custom_csv_extract_only)
|
controller.signal_open_file.connect(monitor.custom_csv_extract_only)
|
||||||
controller.signal_raport_mode.connect(monitor.start_raport)
|
controller.signal_raport_mode.connect(monitor.start_raport)
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@ -40,9 +40,6 @@ class BaseMediator:
|
|||||||
def update_settings (self, data: list[dict]):
|
def update_settings (self, data: list[dict]):
|
||||||
...
|
...
|
||||||
|
|
||||||
def update_status(self, msg: Union[str, float]) -> None:
|
|
||||||
...
|
|
||||||
|
|
||||||
class BaseDirectoryMonitor:
|
class BaseDirectoryMonitor:
|
||||||
|
|
||||||
update_timer = QTimer()
|
update_timer = QTimer()
|
||||||
@ -360,9 +357,6 @@ class BaseController(QObject):
|
|||||||
def update_plots(self) -> None:
|
def update_plots(self) -> None:
|
||||||
...
|
...
|
||||||
|
|
||||||
def update_status(self, msg: Union[str, float]) -> None:
|
|
||||||
...
|
|
||||||
|
|
||||||
class BaseIdealDataBuilder(OptAlgorithm):
|
class BaseIdealDataBuilder(OptAlgorithm):
|
||||||
|
|
||||||
def __init__(self, params: list[dict]):
|
def __init__(self, params: list[dict]):
|
||||||
|
|||||||
@ -263,9 +263,7 @@ QDockWidget::close-button, QDockWidget::float-button {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QDockWidget::close-button:hover, QDockWidget::float-button:hover {
|
QDockWidget::close-button:hover, QDockWidget::float-button:hover {
|
||||||
border: none;
|
|
||||||
background-color: #FFD700 ;
|
background-color: #FFD700 ;
|
||||||
icon-size: 18px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -323,12 +321,6 @@ QTableView QScrollBar::handle:vertical {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
QProgressBar {
|
|
||||||
border: 2px solid grey;
|
|
||||||
border-radius: 5px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
------------------------------------------------------
|
------------------------------------------------------
|
||||||
Завершение стиля
|
Завершение стиля
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user