From 504426107b444f3109be99be3fc5f30e4ce9628c Mon Sep 17 00:00:00 2001 From: mhawryluk Date: Mon, 18 Apr 2022 17:06:57 +0200 Subject: [PATCH 001/328] feat: Create AlgorithmWidget --- qt-designer-uis/algorithm-widget.ui | 1547 +++++++++++++++++++++++++++ src/widgets/algorithm_widget.py | 68 ++ src/widgets/main_layout.py | 22 +- 3 files changed, 1627 insertions(+), 10 deletions(-) create mode 100644 qt-designer-uis/algorithm-widget.ui create mode 100644 src/widgets/algorithm_widget.py diff --git a/qt-designer-uis/algorithm-widget.ui b/qt-designer-uis/algorithm-widget.ui new file mode 100644 index 0000000..718f527 --- /dev/null +++ b/qt-designer-uis/algorithm-widget.ui @@ -0,0 +1,1547 @@ + + + Form + + + + 0 + 0 + 815 + 491 + + + + Form + + + + + 0 + 0 + 111 + 491 + + + + Qt::LeftToRight + + + background-color: rgb(177, 221, 240); +writing-mode: vertical-rl; +-webkit-transform: rotate(-180deg); +-moz-transform: rotate(-180deg); + + + QFrame::Box + + + ALGORITHM + + + false + + + Qt::AlignCenter + + + true + + + false + + + + + + 109 + -1 + 711 + 501 + + + + false + + + background-color: rgb(245, 252, 255); + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + 30 + 90 + 221 + 111 + + + + + + + + + 0 + 0 + 0 + + + + + + + 252 + 254 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 253 + 254 + 255 + + + + + + + 126 + 127 + 127 + + + + + + + 168 + 169 + 170 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 252 + 254 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 253 + 254 + 255 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + 252 + 254 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 253 + 254 + 255 + + + + + + + 126 + 127 + 127 + + + + + + + 168 + 169 + 170 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 252 + 254 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 253 + 254 + 255 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + + + 126 + 127 + 127 + + + + + + + 252 + 254 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 253 + 254 + 255 + + + + + + + 126 + 127 + 127 + + + + + + + 168 + 169 + 170 + + + + + + + 126 + 127 + 127 + + + + + + + 255 + 255 + 255 + + + + + + + 126 + 127 + 127 + + + + + + + 252 + 254 + 255 + + + + + + + 252 + 254 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 252 + 254 + 255 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + + Exploration technique + + + + + 30 + 50 + 121 + 41 + + + + color: rgb(0,0,0); + + + + clastering + + + + + associations + + + + + + + + 40 + 270 + 221 + 111 + + + + + + + + + 0 + 0 + 0 + + + + + + + 245 + 252 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 253 + 254 + 255 + + + + + + + 126 + 127 + 127 + + + + + + + 168 + 169 + 170 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 245 + 252 + 255 + + + + + + + 245 + 252 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 253 + 254 + 255 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + 245 + 252 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 253 + 254 + 255 + + + + + + + 126 + 127 + 127 + + + + + + + 168 + 169 + 170 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 245 + 252 + 255 + + + + + + + 245 + 252 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 253 + 254 + 255 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + + + 126 + 127 + 127 + + + + + + + 245 + 252 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 253 + 254 + 255 + + + + + + + 126 + 127 + 127 + + + + + + + 168 + 169 + 170 + + + + + + + 126 + 127 + 127 + + + + + + + 255 + 255 + 255 + + + + + + + 126 + 127 + 127 + + + + + + + 245 + 252 + 255 + + + + + + + 245 + 252 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 252 + 254 + 255 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + + Algorithm + + + + + 30 + 50 + 121 + 41 + + + + color: rgb(0,0,0); + + + + + + + 340 + 100 + 281 + 251 + + + + + + + + + 0 + 0 + 0 + + + + + + + 245 + 252 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 253 + 254 + 255 + + + + + + + 126 + 127 + 127 + + + + + + + 168 + 169 + 170 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 245 + 252 + 255 + + + + + + + 245 + 252 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 253 + 254 + 255 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + 245 + 252 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 253 + 254 + 255 + + + + + + + 126 + 127 + 127 + + + + + + + 168 + 169 + 170 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 245 + 252 + 255 + + + + + + + 245 + 252 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 253 + 254 + 255 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + + + 126 + 127 + 127 + + + + + + + 245 + 252 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 253 + 254 + 255 + + + + + + + 126 + 127 + 127 + + + + + + + 168 + 169 + 170 + + + + + + + 126 + 127 + 127 + + + + + + + 255 + 255 + 255 + + + + + + + 126 + 127 + 127 + + + + + + + 245 + 252 + 255 + + + + + + + 245 + 252 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 252 + 254 + 255 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + + Options + + + + + 160 + 70 + 81 + 31 + + + + color: rgb(0,0,0) + + + + + + 20 + 60 + 131 + 51 + + + + color: rgb(0,0,0); + + + number of clasters + + + Qt::AlignCenter + + + + + + 20 + 160 + 131 + 51 + + + + color: rgb(0,0,0); + + + initialization method + + + Qt::AlignCenter + + + + + + 170 + 170 + 81 + 41 + + + + color: rgb(0,0,0) + + + Forgy + + + + + + + + diff --git a/src/widgets/algorithm_widget.py b/src/widgets/algorithm_widget.py new file mode 100644 index 0000000..cc3de9b --- /dev/null +++ b/src/widgets/algorithm_widget.py @@ -0,0 +1,68 @@ +from PyQt5 import QtCore, QtWidgets + + +class AlgorithmWidget(QtWidgets.QWidget): + def __init__(self): + super().__init__() + self.resize(815, 491) + + # vertical label + self.label = QtWidgets.QLabel(self) + self.label.setText("ALGORITHM") + self.label.setGeometry(QtCore.QRect(0, 0, 111, 491)) + self.label.setLayoutDirection(QtCore.Qt.LeftToRight) + self.label.setStyleSheet("background-color: rgb(177, 221, 240);") + self.label.setScaledContents(False) + self.label.setAlignment(QtCore.Qt.AlignCenter) + self.label.setWordWrap(True) + + # algorithm frame + self.frame = QtWidgets.QFrame(self) + self.frame.setGeometry(QtCore.QRect(109, -1, 711, 491)) + self.frame.setStyleSheet("background-color: rgb(245, 252, 255);") + + # exploration technique selection + self.technique_group = QtWidgets.QGroupBox(self.frame) + self.technique_group.setGeometry(QtCore.QRect(30, 90, 221, 111)) + self.technique_group.setTitle("Exploration technique") + + self.technique_box = QtWidgets.QComboBox(self.technique_group) + self.technique_box.setGeometry(QtCore.QRect(30, 50, 121, 41)) + self.technique_box.setStyleSheet("color: rgb(0,0,0);") + self.technique_box.addItem("clustering") + self.technique_box.addItem("associations") + + # algorithm selection group + self.algorithm_selection_group = QtWidgets.QGroupBox(self.frame) + self.algorithm_selection_group.setGeometry(QtCore.QRect(40, 270, 221, 111)) + self.algorithm_selection_group.setTitle("Algorithm") + + self.algorithm_box = QtWidgets.QComboBox(self.algorithm_selection_group) + self.algorithm_box.setGeometry(QtCore.QRect(30, 50, 121, 41)) + self.algorithm_box.setStyleSheet("color: rgb(0,0,0);") + + # options group + self.options_group = QtWidgets.QGroupBox(self.frame) + self.options_group.setGeometry(QtCore.QRect(340, 100, 281, 251)) + self.options_group.setTitle("Options") + + self.num_clusters_spinbox = QtWidgets.QSpinBox(self.options_group) + self.num_clusters_spinbox.setGeometry(QtCore.QRect(160, 70, 81, 31)) + self.num_clusters_spinbox.setStyleSheet("color: rgb(0,0,0)") + + self.num_clusters_label = QtWidgets.QLabel(self.options_group) + self.num_clusters_label.setGeometry(QtCore.QRect(20, 60, 131, 51)) + self.num_clusters_label.setStyleSheet("color: rgb(0,0,0);") + self.num_clusters_label.setAlignment(QtCore.Qt.AlignCenter) + self.num_clusters_label.setText("number of clusters") + + self.num_clusters_label_2 = QtWidgets.QLabel(self.options_group) + self.num_clusters_label_2.setGeometry(QtCore.QRect(20, 160, 131, 51)) + self.num_clusters_label_2.setStyleSheet("color: rgb(0,0,0);") + self.num_clusters_label_2.setAlignment(QtCore.Qt.AlignCenter) + self.num_clusters_label_2.setText("initialization method") + + self.checkbox_1 = QtWidgets.QCheckBox(self.options_group) + self.checkbox_1.setGeometry(QtCore.QRect(170, 170, 81, 41)) + self.checkbox_1.setStyleSheet("color: rgb(0,0,0)") + self.checkbox_1.setText("Forgy") diff --git a/src/widgets/main_layout.py b/src/widgets/main_layout.py index da2e69a..f10d6a4 100644 --- a/src/widgets/main_layout.py +++ b/src/widgets/main_layout.py @@ -1,6 +1,7 @@ -from PyQt5.QtWidgets import QMainWindow, QHBoxLayout, QWidget +from PyQt5.QtWidgets import QMainWindow, QHBoxLayout, QWidget, QFrame from algorithms.generate_number import NumberGenerator +from widgets.algorithm_widget import AlgorithmWidget from widgets.chart_widget import ChartWidget from widgets.generate_widget import GenerateWidget @@ -10,23 +11,24 @@ class RandomGenerator(QMainWindow): def __init__(self): super().__init__() self.setWindowTitle('Random Generator') - self.setFixedSize(235*6, 235*2) + # self.setFixedSize(235 * 6, 235 * 2) self.generalLayout = QHBoxLayout() self._centralWidget = QWidget(self) self.setCentralWidget(self._centralWidget) self._centralWidget.setLayout(self.generalLayout) - self.generator = NumberGenerator(0, 10) - self.generate_widget = GenerateWidget(self) - self.chart_widget = ChartWidget() - self.generalLayout.addLayout(self.generate_widget) - self.generalLayout.addLayout(self.chart_widget) + # self.generator = NumberGenerator(0, 10) + # self.generate_widget = GenerateWidget(self) + # self.chart_widget = ChartWidget() + # self.generalLayout.addLayout(self.generate_widget) + # self.generalLayout.addLayout(self.chart_widget) - self.show() + self.algorithm_widget = AlgorithmWidget() + self.generalLayout.addWidget(self.algorithm_widget) + + self.showMaximized() def on_click_listener(self): value = self.generator.get_number() self.generate_widget.display_number(value) self.chart_widget.display_number(value) - - From dba5af13980f107f683d856a4742aee009b3080e Mon Sep 17 00:00:00 2001 From: mhawryluk Date: Mon, 18 Apr 2022 17:21:38 +0200 Subject: [PATCH 002/328] feat: Create UnfoldWidget parent class --- src/widgets/algorithm_widget.py | 14 +++----------- src/widgets/main_layout.py | 4 ++-- src/widgets/unfold_widget.py | 19 +++++++++++++++++++ 3 files changed, 24 insertions(+), 13 deletions(-) create mode 100644 src/widgets/unfold_widget.py diff --git a/src/widgets/algorithm_widget.py b/src/widgets/algorithm_widget.py index cc3de9b..9fa662e 100644 --- a/src/widgets/algorithm_widget.py +++ b/src/widgets/algorithm_widget.py @@ -1,24 +1,16 @@ from PyQt5 import QtCore, QtWidgets +from widgets.unfold_widget import UnfoldWidget -class AlgorithmWidget(QtWidgets.QWidget): +class AlgorithmWidget(UnfoldWidget): def __init__(self): super().__init__() - self.resize(815, 491) # vertical label - self.label = QtWidgets.QLabel(self) self.label.setText("ALGORITHM") - self.label.setGeometry(QtCore.QRect(0, 0, 111, 491)) - self.label.setLayoutDirection(QtCore.Qt.LeftToRight) - self.label.setStyleSheet("background-color: rgb(177, 221, 240);") - self.label.setScaledContents(False) - self.label.setAlignment(QtCore.Qt.AlignCenter) - self.label.setWordWrap(True) + self.label.setStyleSheet("background-color: rgb(177, 221, 240);") # algorithm frame - self.frame = QtWidgets.QFrame(self) - self.frame.setGeometry(QtCore.QRect(109, -1, 711, 491)) self.frame.setStyleSheet("background-color: rgb(245, 252, 255);") # exploration technique selection diff --git a/src/widgets/main_layout.py b/src/widgets/main_layout.py index f10d6a4..edf596a 100644 --- a/src/widgets/main_layout.py +++ b/src/widgets/main_layout.py @@ -11,7 +11,7 @@ class RandomGenerator(QMainWindow): def __init__(self): super().__init__() self.setWindowTitle('Random Generator') - # self.setFixedSize(235 * 6, 235 * 2) + self.setFixedSize(815, 491) self.generalLayout = QHBoxLayout() self._centralWidget = QWidget(self) self.setCentralWidget(self._centralWidget) @@ -26,7 +26,7 @@ def __init__(self): self.algorithm_widget = AlgorithmWidget() self.generalLayout.addWidget(self.algorithm_widget) - self.showMaximized() + self.show() def on_click_listener(self): value = self.generator.get_number() diff --git a/src/widgets/unfold_widget.py b/src/widgets/unfold_widget.py new file mode 100644 index 0000000..de674c3 --- /dev/null +++ b/src/widgets/unfold_widget.py @@ -0,0 +1,19 @@ +from PyQt5 import QtCore, QtWidgets + + +class UnfoldWidget(QtWidgets.QWidget): + def __init__(self): + super().__init__() + self.resize(815, 491) + + # vertical label + self.label = QtWidgets.QLabel(self) + self.label.setGeometry(QtCore.QRect(0, 0, 111, 491)) + self.label.setLayoutDirection(QtCore.Qt.LeftToRight) + self.label.setScaledContents(False) + self.label.setAlignment(QtCore.Qt.AlignCenter) + self.label.setWordWrap(True) + + # main frame + self.frame = QtWidgets.QFrame(self) + self.frame.setGeometry(QtCore.QRect(109, -1, 711, 491)) \ No newline at end of file From adcabdbd2308c76a7a0238184190245d222f8414 Mon Sep 17 00:00:00 2001 From: mhawryluk Date: Mon, 18 Apr 2022 17:36:44 +0200 Subject: [PATCH 003/328] feat: Add remaining unfold widget classes: ImportWidget, PreprocessingWidget, VisualizationWidget --- src/widgets/import_widget.py | 14 ++++++++++++++ src/widgets/main_layout.py | 12 ++++++++++++ src/widgets/preprocessing_widget.py | 13 +++++++++++++ src/widgets/visualization_widget.py | 13 +++++++++++++ 4 files changed, 52 insertions(+) create mode 100644 src/widgets/import_widget.py create mode 100644 src/widgets/preprocessing_widget.py create mode 100644 src/widgets/visualization_widget.py diff --git a/src/widgets/import_widget.py b/src/widgets/import_widget.py new file mode 100644 index 0000000..9c9ca5b --- /dev/null +++ b/src/widgets/import_widget.py @@ -0,0 +1,14 @@ +from PyQt5 import QtCore, QtWidgets +from widgets.unfold_widget import UnfoldWidget + + +class ImportWidget(UnfoldWidget): + def __init__(self): + super().__init__() + + # vertical label + self.label.setText("IMPORT DATA") + self.label.setStyleSheet("background-color: #BAC8D3;") + + # algorithm frame + self.frame.setStyleSheet("background-color: rgb(245, 245, 245);") diff --git a/src/widgets/main_layout.py b/src/widgets/main_layout.py index edf596a..c34bca9 100644 --- a/src/widgets/main_layout.py +++ b/src/widgets/main_layout.py @@ -4,6 +4,9 @@ from widgets.algorithm_widget import AlgorithmWidget from widgets.chart_widget import ChartWidget from widgets.generate_widget import GenerateWidget +from widgets.import_widget import ImportWidget +from widgets.preprocessing_widget import PreprocessingWidget +from widgets.visualization_widget import VisualizationWidget class RandomGenerator(QMainWindow): @@ -23,9 +26,18 @@ def __init__(self): # self.generalLayout.addLayout(self.generate_widget) # self.generalLayout.addLayout(self.chart_widget) + self.import_widget = ImportWidget() + self.generalLayout.addWidget(self.import_widget) + + self.preprocessing_widget = PreprocessingWidget() + self.generalLayout.addWidget(self.preprocessing_widget) + self.algorithm_widget = AlgorithmWidget() self.generalLayout.addWidget(self.algorithm_widget) + self.visualization_widget = VisualizationWidget() + self.generalLayout.addWidget(self.visualization_widget) + self.show() def on_click_listener(self): diff --git a/src/widgets/preprocessing_widget.py b/src/widgets/preprocessing_widget.py new file mode 100644 index 0000000..a409e05 --- /dev/null +++ b/src/widgets/preprocessing_widget.py @@ -0,0 +1,13 @@ +from widgets.unfold_widget import UnfoldWidget + + +class PreprocessingWidget(UnfoldWidget): + def __init__(self): + super().__init__() + + # vertical label + self.label.setText("PREPROCESSING") + self.label.setStyleSheet("background-color: #B0E3E6;") + + # algorithm frame + self.frame.setStyleSheet("background-color: #E6F4F4;") diff --git a/src/widgets/visualization_widget.py b/src/widgets/visualization_widget.py new file mode 100644 index 0000000..e20ec70 --- /dev/null +++ b/src/widgets/visualization_widget.py @@ -0,0 +1,13 @@ +from widgets.unfold_widget import UnfoldWidget + + +class VisualizationWidget(UnfoldWidget): + def __init__(self): + super().__init__() + + # vertical label + self.label.setText("VISUALIZATION") + self.label.setStyleSheet("background-color: #D0CEE2;") + + # algorithm frame + self.frame.setStyleSheet("background-color: #F6F5F9;") From 6288752e81fbfc9b148e564644740f4a175c3c52 Mon Sep 17 00:00:00 2001 From: mhawryluk Date: Mon, 18 Apr 2022 18:05:57 +0200 Subject: [PATCH 004/328] chore: Stack unfold widgets side by side --- src/app.py | 4 ++-- src/widgets/__init__.py | 4 ++++ src/widgets/algorithm_widget.py | 6 ++--- src/widgets/import_widget.py | 5 ++-- src/widgets/main_layout.py | 37 +++++++---------------------- src/widgets/main_widget.py | 25 +++++++++++++++++++ src/widgets/preprocessing_widget.py | 4 ++-- src/widgets/unfold_widget.py | 12 ++++++---- src/widgets/visualization_widget.py | 4 ++-- 9 files changed, 55 insertions(+), 46 deletions(-) create mode 100644 src/widgets/main_widget.py diff --git a/src/app.py b/src/app.py index 2a890bf..4f4483d 100644 --- a/src/app.py +++ b/src/app.py @@ -1,12 +1,12 @@ import sys from PyQt5.QtWidgets import QApplication -from widgets.main_layout import RandomGenerator +from widgets.main_layout import MainWindow def main(): app = QApplication(sys.argv) - window = RandomGenerator() + window = MainWindow() sys.exit(app.exec_()) diff --git a/src/widgets/__init__.py b/src/widgets/__init__.py index e69de29..df0b761 100644 --- a/src/widgets/__init__.py +++ b/src/widgets/__init__.py @@ -0,0 +1,4 @@ +WINDOW_WIDTH = 1200 +WINDOW_HEIGHT = 500 +UNFOLD_BUTTON_WIDTH = 110 +UNFOLD_WIDGET_WIDTH = 800 diff --git a/src/widgets/algorithm_widget.py b/src/widgets/algorithm_widget.py index 9fa662e..76622a4 100644 --- a/src/widgets/algorithm_widget.py +++ b/src/widgets/algorithm_widget.py @@ -3,8 +3,8 @@ class AlgorithmWidget(UnfoldWidget): - def __init__(self): - super().__init__() + def __init__(self, parent): + super().__init__(parent) # vertical label self.label.setText("ALGORITHM") @@ -26,7 +26,7 @@ def __init__(self): # algorithm selection group self.algorithm_selection_group = QtWidgets.QGroupBox(self.frame) - self.algorithm_selection_group.setGeometry(QtCore.QRect(40, 270, 221, 111)) + self.algorithm_selection_group.setGeometry(QtCore.QRect(30, 270, 221, 111)) self.algorithm_selection_group.setTitle("Algorithm") self.algorithm_box = QtWidgets.QComboBox(self.algorithm_selection_group) diff --git a/src/widgets/import_widget.py b/src/widgets/import_widget.py index 9c9ca5b..c8fbf77 100644 --- a/src/widgets/import_widget.py +++ b/src/widgets/import_widget.py @@ -1,10 +1,9 @@ -from PyQt5 import QtCore, QtWidgets from widgets.unfold_widget import UnfoldWidget class ImportWidget(UnfoldWidget): - def __init__(self): - super().__init__() + def __init__(self, parent): + super().__init__(parent) # vertical label self.label.setText("IMPORT DATA") diff --git a/src/widgets/main_layout.py b/src/widgets/main_layout.py index c34bca9..8dad569 100644 --- a/src/widgets/main_layout.py +++ b/src/widgets/main_layout.py @@ -1,42 +1,21 @@ -from PyQt5.QtWidgets import QMainWindow, QHBoxLayout, QWidget, QFrame +from PyQt5.QtWidgets import QMainWindow, QHBoxLayout, QWidget +from widgets.main_widget import MainWidget +from widgets import WINDOW_WIDTH, WINDOW_HEIGHT -from algorithms.generate_number import NumberGenerator -from widgets.algorithm_widget import AlgorithmWidget -from widgets.chart_widget import ChartWidget -from widgets.generate_widget import GenerateWidget -from widgets.import_widget import ImportWidget -from widgets.preprocessing_widget import PreprocessingWidget -from widgets.visualization_widget import VisualizationWidget - -class RandomGenerator(QMainWindow): +class MainWindow(QMainWindow): def __init__(self): super().__init__() - self.setWindowTitle('Random Generator') - self.setFixedSize(815, 491) + self.setWindowTitle('Data Mining Tool') + self.setFixedSize(WINDOW_WIDTH, WINDOW_HEIGHT) + self.generalLayout = QHBoxLayout() self._centralWidget = QWidget(self) self.setCentralWidget(self._centralWidget) self._centralWidget.setLayout(self.generalLayout) - # self.generator = NumberGenerator(0, 10) - # self.generate_widget = GenerateWidget(self) - # self.chart_widget = ChartWidget() - # self.generalLayout.addLayout(self.generate_widget) - # self.generalLayout.addLayout(self.chart_widget) - - self.import_widget = ImportWidget() - self.generalLayout.addWidget(self.import_widget) - - self.preprocessing_widget = PreprocessingWidget() - self.generalLayout.addWidget(self.preprocessing_widget) - - self.algorithm_widget = AlgorithmWidget() - self.generalLayout.addWidget(self.algorithm_widget) - - self.visualization_widget = VisualizationWidget() - self.generalLayout.addWidget(self.visualization_widget) + self.generalLayout.addWidget(MainWidget()) self.show() diff --git a/src/widgets/main_widget.py b/src/widgets/main_widget.py new file mode 100644 index 0000000..e2d9bf2 --- /dev/null +++ b/src/widgets/main_widget.py @@ -0,0 +1,25 @@ +from PyQt5.QtWidgets import QWidget + +from widgets import UNFOLD_BUTTON_WIDTH, UNFOLD_WIDGET_WIDTH +from widgets.algorithm_widget import AlgorithmWidget +from widgets.import_widget import ImportWidget +from widgets.preprocessing_widget import PreprocessingWidget +from widgets.visualization_widget import VisualizationWidget + + +class MainWidget(QWidget): + def __init__(self): + super().__init__() + + self.import_widget = ImportWidget(self) + self.preprocessing_widget = PreprocessingWidget(self) + self.algorithm_widget = AlgorithmWidget(self) + self.visualization_widget = VisualizationWidget(self) + + self.import_widget.setFixedWidth(UNFOLD_BUTTON_WIDTH) + self.preprocessing_widget.setFixedWidth(UNFOLD_BUTTON_WIDTH) + self.visualization_widget.setFixedWidth(UNFOLD_BUTTON_WIDTH) + + self.preprocessing_widget.move(UNFOLD_BUTTON_WIDTH, 0) + self.algorithm_widget.move(2*UNFOLD_BUTTON_WIDTH, 0) + self.visualization_widget.move(2*UNFOLD_BUTTON_WIDTH+UNFOLD_WIDGET_WIDTH, 0) diff --git a/src/widgets/preprocessing_widget.py b/src/widgets/preprocessing_widget.py index a409e05..41d7a45 100644 --- a/src/widgets/preprocessing_widget.py +++ b/src/widgets/preprocessing_widget.py @@ -2,8 +2,8 @@ class PreprocessingWidget(UnfoldWidget): - def __init__(self): - super().__init__() + def __init__(self, parent): + super().__init__(parent) # vertical label self.label.setText("PREPROCESSING") diff --git a/src/widgets/unfold_widget.py b/src/widgets/unfold_widget.py index de674c3..aaf0da7 100644 --- a/src/widgets/unfold_widget.py +++ b/src/widgets/unfold_widget.py @@ -1,14 +1,16 @@ from PyQt5 import QtCore, QtWidgets +from widgets import WINDOW_HEIGHT, UNFOLD_BUTTON_WIDTH, UNFOLD_WIDGET_WIDTH + class UnfoldWidget(QtWidgets.QWidget): - def __init__(self): - super().__init__() - self.resize(815, 491) + def __init__(self, parent): + super().__init__(parent) + self.resize(UNFOLD_WIDGET_WIDTH, WINDOW_HEIGHT) # vertical label self.label = QtWidgets.QLabel(self) - self.label.setGeometry(QtCore.QRect(0, 0, 111, 491)) + self.label.setGeometry(QtCore.QRect(0, 0, UNFOLD_BUTTON_WIDTH, WINDOW_HEIGHT)) self.label.setLayoutDirection(QtCore.Qt.LeftToRight) self.label.setScaledContents(False) self.label.setAlignment(QtCore.Qt.AlignCenter) @@ -16,4 +18,4 @@ def __init__(self): # main frame self.frame = QtWidgets.QFrame(self) - self.frame.setGeometry(QtCore.QRect(109, -1, 711, 491)) \ No newline at end of file + self.frame.setGeometry(QtCore.QRect(UNFOLD_BUTTON_WIDTH, 0, UNFOLD_WIDGET_WIDTH - UNFOLD_BUTTON_WIDTH, WINDOW_HEIGHT)) \ No newline at end of file diff --git a/src/widgets/visualization_widget.py b/src/widgets/visualization_widget.py index e20ec70..8711e88 100644 --- a/src/widgets/visualization_widget.py +++ b/src/widgets/visualization_widget.py @@ -2,8 +2,8 @@ class VisualizationWidget(UnfoldWidget): - def __init__(self): - super().__init__() + def __init__(self, parent): + super().__init__(parent) # vertical label self.label.setText("VISUALIZATION") From 8d91e8ac031a33b57e8a3d1d25a863e47f4227b8 Mon Sep 17 00:00:00 2001 From: mhawryluk Date: Mon, 18 Apr 2022 18:27:37 +0200 Subject: [PATCH 005/328] feat: Change vertical labels into buttons --- src/widgets/algorithm_widget.py | 6 +++--- src/widgets/import_widget.py | 6 +++--- src/widgets/preprocessing_widget.py | 6 +++--- src/widgets/unfold_widget.py | 11 ++++------- src/widgets/visualization_widget.py | 6 +++--- 5 files changed, 16 insertions(+), 19 deletions(-) diff --git a/src/widgets/algorithm_widget.py b/src/widgets/algorithm_widget.py index 76622a4..0868041 100644 --- a/src/widgets/algorithm_widget.py +++ b/src/widgets/algorithm_widget.py @@ -6,9 +6,9 @@ class AlgorithmWidget(UnfoldWidget): def __init__(self, parent): super().__init__(parent) - # vertical label - self.label.setText("ALGORITHM") - self.label.setStyleSheet("background-color: rgb(177, 221, 240);") + # unfold button + self.button.setText("ALGORITHM") + self.button.setStyleSheet("background-color: rgb(177, 221, 240);") # algorithm frame self.frame.setStyleSheet("background-color: rgb(245, 252, 255);") diff --git a/src/widgets/import_widget.py b/src/widgets/import_widget.py index c8fbf77..b9e894d 100644 --- a/src/widgets/import_widget.py +++ b/src/widgets/import_widget.py @@ -5,9 +5,9 @@ class ImportWidget(UnfoldWidget): def __init__(self, parent): super().__init__(parent) - # vertical label - self.label.setText("IMPORT DATA") - self.label.setStyleSheet("background-color: #BAC8D3;") + # unfold button + self.button.setText("IMPORT DATA") + self.button.setStyleSheet("background-color: #BAC8D3;") # algorithm frame self.frame.setStyleSheet("background-color: rgb(245, 245, 245);") diff --git a/src/widgets/preprocessing_widget.py b/src/widgets/preprocessing_widget.py index 41d7a45..5485683 100644 --- a/src/widgets/preprocessing_widget.py +++ b/src/widgets/preprocessing_widget.py @@ -5,9 +5,9 @@ class PreprocessingWidget(UnfoldWidget): def __init__(self, parent): super().__init__(parent) - # vertical label - self.label.setText("PREPROCESSING") - self.label.setStyleSheet("background-color: #B0E3E6;") + # unfold button + self.button.setText("PREPROCESSING") + self.button.setStyleSheet("background-color: #B0E3E6;") # algorithm frame self.frame.setStyleSheet("background-color: #E6F4F4;") diff --git a/src/widgets/unfold_widget.py b/src/widgets/unfold_widget.py index aaf0da7..3e2a4bc 100644 --- a/src/widgets/unfold_widget.py +++ b/src/widgets/unfold_widget.py @@ -8,13 +8,10 @@ def __init__(self, parent): super().__init__(parent) self.resize(UNFOLD_WIDGET_WIDTH, WINDOW_HEIGHT) - # vertical label - self.label = QtWidgets.QLabel(self) - self.label.setGeometry(QtCore.QRect(0, 0, UNFOLD_BUTTON_WIDTH, WINDOW_HEIGHT)) - self.label.setLayoutDirection(QtCore.Qt.LeftToRight) - self.label.setScaledContents(False) - self.label.setAlignment(QtCore.Qt.AlignCenter) - self.label.setWordWrap(True) + # unfold button + self.button = QtWidgets.QPushButton(self) + self.button.setGeometry(QtCore.QRect(0, 0, UNFOLD_BUTTON_WIDTH, WINDOW_HEIGHT)) + self.button.setLayoutDirection(QtCore.Qt.LeftToRight) # main frame self.frame = QtWidgets.QFrame(self) diff --git a/src/widgets/visualization_widget.py b/src/widgets/visualization_widget.py index 8711e88..6b9073f 100644 --- a/src/widgets/visualization_widget.py +++ b/src/widgets/visualization_widget.py @@ -5,9 +5,9 @@ class VisualizationWidget(UnfoldWidget): def __init__(self, parent): super().__init__(parent) - # vertical label - self.label.setText("VISUALIZATION") - self.label.setStyleSheet("background-color: #D0CEE2;") + # unfold button + self.button.setText("VISUALIZATION") + self.button.setStyleSheet("background-color: #D0CEE2;") # algorithm frame self.frame.setStyleSheet("background-color: #F6F5F9;") From 5388708111d92226cb0bc8143ce3c54557834329 Mon Sep 17 00:00:00 2001 From: mhawryluk Date: Mon, 18 Apr 2022 19:42:36 +0200 Subject: [PATCH 006/328] feat: Add unfolding widgets on click --- src/widgets/__init__.py | 6 +++--- src/widgets/algorithm_widget.py | 3 ++- src/widgets/import_widget.py | 1 + src/widgets/main_widget.py | 21 +++++++++++++++------ src/widgets/preprocessing_widget.py | 1 + src/widgets/unfold_widget.py | 2 +- src/widgets/visualization_widget.py | 1 + 7 files changed, 24 insertions(+), 11 deletions(-) diff --git a/src/widgets/__init__.py b/src/widgets/__init__.py index df0b761..ec717e0 100644 --- a/src/widgets/__init__.py +++ b/src/widgets/__init__.py @@ -1,4 +1,4 @@ WINDOW_WIDTH = 1200 -WINDOW_HEIGHT = 500 -UNFOLD_BUTTON_WIDTH = 110 -UNFOLD_WIDGET_WIDTH = 800 +WINDOW_HEIGHT = 600 +UNFOLD_BUTTON_WIDTH = 100 +UNFOLD_WIDGET_WIDTH = WINDOW_WIDTH - 3*UNFOLD_BUTTON_WIDTH - 20 diff --git a/src/widgets/algorithm_widget.py b/src/widgets/algorithm_widget.py index 0868041..9209d8e 100644 --- a/src/widgets/algorithm_widget.py +++ b/src/widgets/algorithm_widget.py @@ -9,9 +9,10 @@ def __init__(self, parent): # unfold button self.button.setText("ALGORITHM") self.button.setStyleSheet("background-color: rgb(177, 221, 240);") + self.button.clicked.connect(lambda: self.parent().unfold(2)) # algorithm frame - self.frame.setStyleSheet("background-color: rgb(245, 252, 255);") + self.frame.setStyleSheet("background-color: #EBF4F7;") # exploration technique selection self.technique_group = QtWidgets.QGroupBox(self.frame) diff --git a/src/widgets/import_widget.py b/src/widgets/import_widget.py index b9e894d..7916fc5 100644 --- a/src/widgets/import_widget.py +++ b/src/widgets/import_widget.py @@ -8,6 +8,7 @@ def __init__(self, parent): # unfold button self.button.setText("IMPORT DATA") self.button.setStyleSheet("background-color: #BAC8D3;") + self.button.clicked.connect(lambda: self.parent().unfold(0)) # algorithm frame self.frame.setStyleSheet("background-color: rgb(245, 245, 245);") diff --git a/src/widgets/main_widget.py b/src/widgets/main_widget.py index e2d9bf2..7116827 100644 --- a/src/widgets/main_widget.py +++ b/src/widgets/main_widget.py @@ -8,6 +8,7 @@ class MainWidget(QWidget): + def __init__(self): super().__init__() @@ -16,10 +17,18 @@ def __init__(self): self.algorithm_widget = AlgorithmWidget(self) self.visualization_widget = VisualizationWidget(self) - self.import_widget.setFixedWidth(UNFOLD_BUTTON_WIDTH) - self.preprocessing_widget.setFixedWidth(UNFOLD_BUTTON_WIDTH) - self.visualization_widget.setFixedWidth(UNFOLD_BUTTON_WIDTH) + self.widgets = [self.import_widget, self.preprocessing_widget, self.algorithm_widget, self.visualization_widget] + self.unfold(0) + + def unfold(self, widget_index): + for i, widget in enumerate(self.widgets[:widget_index]): + widget.setFixedWidth(UNFOLD_BUTTON_WIDTH) + widget.move(i*UNFOLD_BUTTON_WIDTH, 0) + + self.widgets[widget_index].setFixedWidth(UNFOLD_WIDGET_WIDTH) + self.widgets[widget_index].move(widget_index*UNFOLD_BUTTON_WIDTH, 0) + + for i, widget in enumerate(self.widgets[widget_index+1:]): + widget.setFixedWidth(UNFOLD_BUTTON_WIDTH) + widget.move((widget_index+i)*UNFOLD_BUTTON_WIDTH+UNFOLD_WIDGET_WIDTH, 0) - self.preprocessing_widget.move(UNFOLD_BUTTON_WIDTH, 0) - self.algorithm_widget.move(2*UNFOLD_BUTTON_WIDTH, 0) - self.visualization_widget.move(2*UNFOLD_BUTTON_WIDTH+UNFOLD_WIDGET_WIDTH, 0) diff --git a/src/widgets/preprocessing_widget.py b/src/widgets/preprocessing_widget.py index 5485683..205e594 100644 --- a/src/widgets/preprocessing_widget.py +++ b/src/widgets/preprocessing_widget.py @@ -8,6 +8,7 @@ def __init__(self, parent): # unfold button self.button.setText("PREPROCESSING") self.button.setStyleSheet("background-color: #B0E3E6;") + self.button.clicked.connect(lambda: self.parent().unfold(1)) # algorithm frame self.frame.setStyleSheet("background-color: #E6F4F4;") diff --git a/src/widgets/unfold_widget.py b/src/widgets/unfold_widget.py index 3e2a4bc..4f8a210 100644 --- a/src/widgets/unfold_widget.py +++ b/src/widgets/unfold_widget.py @@ -15,4 +15,4 @@ def __init__(self, parent): # main frame self.frame = QtWidgets.QFrame(self) - self.frame.setGeometry(QtCore.QRect(UNFOLD_BUTTON_WIDTH, 0, UNFOLD_WIDGET_WIDTH - UNFOLD_BUTTON_WIDTH, WINDOW_HEIGHT)) \ No newline at end of file + self.frame.setGeometry(QtCore.QRect(UNFOLD_BUTTON_WIDTH, 0, UNFOLD_WIDGET_WIDTH - UNFOLD_BUTTON_WIDTH, WINDOW_HEIGHT)) diff --git a/src/widgets/visualization_widget.py b/src/widgets/visualization_widget.py index 6b9073f..f82522f 100644 --- a/src/widgets/visualization_widget.py +++ b/src/widgets/visualization_widget.py @@ -8,6 +8,7 @@ def __init__(self, parent): # unfold button self.button.setText("VISUALIZATION") self.button.setStyleSheet("background-color: #D0CEE2;") + self.button.clicked.connect(lambda: self.parent().unfold(3)) # algorithm frame self.frame.setStyleSheet("background-color: #F6F5F9;") From 8d420254e5b5cbb1386d3bd3e0bae52a4207d6f8 Mon Sep 17 00:00:00 2001 From: mhawryluk Date: Tue, 19 Apr 2022 18:51:21 +0200 Subject: [PATCH 007/328] refactor: Simplify imports * create config.py file * add imports to __init__.py * change import style for PyQt5 --- src/widgets/__init__.py | 11 ++++--- src/widgets/algorithm_widget.py | 46 +++++++++++++++-------------- src/widgets/config.py | 4 +++ src/widgets/import_widget.py | 2 +- src/widgets/main_widget.py | 6 +--- src/widgets/preprocessing_widget.py | 2 +- src/widgets/unfold_widget.py | 15 +++++----- src/widgets/visualization_widget.py | 2 +- 8 files changed, 47 insertions(+), 41 deletions(-) create mode 100644 src/widgets/config.py diff --git a/src/widgets/__init__.py b/src/widgets/__init__.py index ec717e0..089bdf5 100644 --- a/src/widgets/__init__.py +++ b/src/widgets/__init__.py @@ -1,4 +1,7 @@ -WINDOW_WIDTH = 1200 -WINDOW_HEIGHT = 600 -UNFOLD_BUTTON_WIDTH = 100 -UNFOLD_WIDGET_WIDTH = WINDOW_WIDTH - 3*UNFOLD_BUTTON_WIDTH - 20 +from .config import WINDOW_HEIGHT, WINDOW_WIDTH, UNFOLD_BUTTON_WIDTH, UNFOLD_WIDGET_WIDTH +from .unfold_widget import UnfoldWidget +from .algorithm_widget import AlgorithmWidget +from .import_widget import ImportWidget +from .preprocessing_widget import PreprocessingWidget +from .visualization_widget import VisualizationWidget +from .main_layout import MainWindow diff --git a/src/widgets/algorithm_widget.py b/src/widgets/algorithm_widget.py index 9209d8e..8a80ce6 100644 --- a/src/widgets/algorithm_widget.py +++ b/src/widgets/algorithm_widget.py @@ -1,5 +1,7 @@ -from PyQt5 import QtCore, QtWidgets -from widgets.unfold_widget import UnfoldWidget +from PyQt5.QtCore import QRect, Qt +from PyQt5.QtWidgets import QGroupBox, QCheckBox, QLabel, QSpinBox, QComboBox + +from widgets import UnfoldWidget class AlgorithmWidget(UnfoldWidget): @@ -15,47 +17,47 @@ def __init__(self, parent): self.frame.setStyleSheet("background-color: #EBF4F7;") # exploration technique selection - self.technique_group = QtWidgets.QGroupBox(self.frame) - self.technique_group.setGeometry(QtCore.QRect(30, 90, 221, 111)) + self.technique_group = QGroupBox(self.frame) + self.technique_group.setGeometry(QRect(30, 90, 221, 111)) self.technique_group.setTitle("Exploration technique") - self.technique_box = QtWidgets.QComboBox(self.technique_group) - self.technique_box.setGeometry(QtCore.QRect(30, 50, 121, 41)) + self.technique_box = QComboBox(self.technique_group) + self.technique_box.setGeometry(QRect(30, 50, 121, 41)) self.technique_box.setStyleSheet("color: rgb(0,0,0);") self.technique_box.addItem("clustering") self.technique_box.addItem("associations") # algorithm selection group - self.algorithm_selection_group = QtWidgets.QGroupBox(self.frame) - self.algorithm_selection_group.setGeometry(QtCore.QRect(30, 270, 221, 111)) + self.algorithm_selection_group = QGroupBox(self.frame) + self.algorithm_selection_group.setGeometry(QRect(30, 270, 221, 111)) self.algorithm_selection_group.setTitle("Algorithm") - self.algorithm_box = QtWidgets.QComboBox(self.algorithm_selection_group) - self.algorithm_box.setGeometry(QtCore.QRect(30, 50, 121, 41)) + self.algorithm_box = QComboBox(self.algorithm_selection_group) + self.algorithm_box.setGeometry(QRect(30, 50, 121, 41)) self.algorithm_box.setStyleSheet("color: rgb(0,0,0);") # options group - self.options_group = QtWidgets.QGroupBox(self.frame) - self.options_group.setGeometry(QtCore.QRect(340, 100, 281, 251)) + self.options_group = QGroupBox(self.frame) + self.options_group.setGeometry(QRect(340, 100, 281, 251)) self.options_group.setTitle("Options") - self.num_clusters_spinbox = QtWidgets.QSpinBox(self.options_group) - self.num_clusters_spinbox.setGeometry(QtCore.QRect(160, 70, 81, 31)) + self.num_clusters_spinbox = QSpinBox(self.options_group) + self.num_clusters_spinbox.setGeometry(QRect(160, 70, 81, 31)) self.num_clusters_spinbox.setStyleSheet("color: rgb(0,0,0)") - self.num_clusters_label = QtWidgets.QLabel(self.options_group) - self.num_clusters_label.setGeometry(QtCore.QRect(20, 60, 131, 51)) + self.num_clusters_label = QLabel(self.options_group) + self.num_clusters_label.setGeometry(QRect(20, 60, 131, 51)) self.num_clusters_label.setStyleSheet("color: rgb(0,0,0);") - self.num_clusters_label.setAlignment(QtCore.Qt.AlignCenter) + self.num_clusters_label.setAlignment(Qt.AlignCenter) self.num_clusters_label.setText("number of clusters") - self.num_clusters_label_2 = QtWidgets.QLabel(self.options_group) - self.num_clusters_label_2.setGeometry(QtCore.QRect(20, 160, 131, 51)) + self.num_clusters_label_2 = QLabel(self.options_group) + self.num_clusters_label_2.setGeometry(QRect(20, 160, 131, 51)) self.num_clusters_label_2.setStyleSheet("color: rgb(0,0,0);") - self.num_clusters_label_2.setAlignment(QtCore.Qt.AlignCenter) + self.num_clusters_label_2.setAlignment(Qt.AlignCenter) self.num_clusters_label_2.setText("initialization method") - self.checkbox_1 = QtWidgets.QCheckBox(self.options_group) - self.checkbox_1.setGeometry(QtCore.QRect(170, 170, 81, 41)) + self.checkbox_1 = QCheckBox(self.options_group) + self.checkbox_1.setGeometry(QRect(170, 170, 81, 41)) self.checkbox_1.setStyleSheet("color: rgb(0,0,0)") self.checkbox_1.setText("Forgy") diff --git a/src/widgets/config.py b/src/widgets/config.py new file mode 100644 index 0000000..ec717e0 --- /dev/null +++ b/src/widgets/config.py @@ -0,0 +1,4 @@ +WINDOW_WIDTH = 1200 +WINDOW_HEIGHT = 600 +UNFOLD_BUTTON_WIDTH = 100 +UNFOLD_WIDGET_WIDTH = WINDOW_WIDTH - 3*UNFOLD_BUTTON_WIDTH - 20 diff --git a/src/widgets/import_widget.py b/src/widgets/import_widget.py index 7916fc5..f9709cb 100644 --- a/src/widgets/import_widget.py +++ b/src/widgets/import_widget.py @@ -1,4 +1,4 @@ -from widgets.unfold_widget import UnfoldWidget +from widgets import UnfoldWidget class ImportWidget(UnfoldWidget): diff --git a/src/widgets/main_widget.py b/src/widgets/main_widget.py index 7116827..c8889cc 100644 --- a/src/widgets/main_widget.py +++ b/src/widgets/main_widget.py @@ -1,10 +1,6 @@ from PyQt5.QtWidgets import QWidget -from widgets import UNFOLD_BUTTON_WIDTH, UNFOLD_WIDGET_WIDTH -from widgets.algorithm_widget import AlgorithmWidget -from widgets.import_widget import ImportWidget -from widgets.preprocessing_widget import PreprocessingWidget -from widgets.visualization_widget import VisualizationWidget +from widgets import UNFOLD_BUTTON_WIDTH, UNFOLD_WIDGET_WIDTH, AlgorithmWidget, ImportWidget, PreprocessingWidget, VisualizationWidget class MainWidget(QWidget): diff --git a/src/widgets/preprocessing_widget.py b/src/widgets/preprocessing_widget.py index 205e594..05d8da3 100644 --- a/src/widgets/preprocessing_widget.py +++ b/src/widgets/preprocessing_widget.py @@ -1,4 +1,4 @@ -from widgets.unfold_widget import UnfoldWidget +from widgets import UnfoldWidget class PreprocessingWidget(UnfoldWidget): diff --git a/src/widgets/unfold_widget.py b/src/widgets/unfold_widget.py index 4f8a210..09b238a 100644 --- a/src/widgets/unfold_widget.py +++ b/src/widgets/unfold_widget.py @@ -1,18 +1,19 @@ -from PyQt5 import QtCore, QtWidgets +from PyQt5.QtCore import QRect, Qt +from PyQt5.QtWidgets import QPushButton, QFrame, QWidget from widgets import WINDOW_HEIGHT, UNFOLD_BUTTON_WIDTH, UNFOLD_WIDGET_WIDTH -class UnfoldWidget(QtWidgets.QWidget): +class UnfoldWidget(QWidget): def __init__(self, parent): super().__init__(parent) self.resize(UNFOLD_WIDGET_WIDTH, WINDOW_HEIGHT) # unfold button - self.button = QtWidgets.QPushButton(self) - self.button.setGeometry(QtCore.QRect(0, 0, UNFOLD_BUTTON_WIDTH, WINDOW_HEIGHT)) - self.button.setLayoutDirection(QtCore.Qt.LeftToRight) + self.button = QPushButton(self) + self.button.setGeometry(QRect(0, 0, UNFOLD_BUTTON_WIDTH, WINDOW_HEIGHT)) + self.button.setLayoutDirection(Qt.LeftToRight) # main frame - self.frame = QtWidgets.QFrame(self) - self.frame.setGeometry(QtCore.QRect(UNFOLD_BUTTON_WIDTH, 0, UNFOLD_WIDGET_WIDTH - UNFOLD_BUTTON_WIDTH, WINDOW_HEIGHT)) + self.frame = QFrame(self) + self.frame.setGeometry(QRect(UNFOLD_BUTTON_WIDTH, 0, UNFOLD_WIDGET_WIDTH - UNFOLD_BUTTON_WIDTH, WINDOW_HEIGHT)) diff --git a/src/widgets/visualization_widget.py b/src/widgets/visualization_widget.py index f82522f..b6b6329 100644 --- a/src/widgets/visualization_widget.py +++ b/src/widgets/visualization_widget.py @@ -1,4 +1,4 @@ -from widgets.unfold_widget import UnfoldWidget +from widgets import UnfoldWidget class VisualizationWidget(UnfoldWidget): From 3ed6312aa15aa414e0668ab1874c446f1d1e8736 Mon Sep 17 00:00:00 2001 From: mhawryluk Date: Tue, 19 Apr 2022 19:19:46 +0200 Subject: [PATCH 008/328] refactor: Create a styles.css file * add IDs to unfold widgets * move CSS properties to the common styles.css file --- src/widgets/algorithm_widget.py | 11 +--------- src/widgets/import_widget.py | 6 ++---- src/widgets/main_layout.py | 3 +++ src/widgets/preprocessing_widget.py | 6 ++---- src/widgets/visualization_widget.py | 6 ++---- static/css/styles.css | 31 +++++++++++++++++++++++++++++ 6 files changed, 41 insertions(+), 22 deletions(-) create mode 100644 static/css/styles.css diff --git a/src/widgets/algorithm_widget.py b/src/widgets/algorithm_widget.py index 8a80ce6..10f6b01 100644 --- a/src/widgets/algorithm_widget.py +++ b/src/widgets/algorithm_widget.py @@ -7,15 +7,12 @@ class AlgorithmWidget(UnfoldWidget): def __init__(self, parent): super().__init__(parent) + self.setObjectName('algorithm_widget') # unfold button self.button.setText("ALGORITHM") - self.button.setStyleSheet("background-color: rgb(177, 221, 240);") self.button.clicked.connect(lambda: self.parent().unfold(2)) - # algorithm frame - self.frame.setStyleSheet("background-color: #EBF4F7;") - # exploration technique selection self.technique_group = QGroupBox(self.frame) self.technique_group.setGeometry(QRect(30, 90, 221, 111)) @@ -23,7 +20,6 @@ def __init__(self, parent): self.technique_box = QComboBox(self.technique_group) self.technique_box.setGeometry(QRect(30, 50, 121, 41)) - self.technique_box.setStyleSheet("color: rgb(0,0,0);") self.technique_box.addItem("clustering") self.technique_box.addItem("associations") @@ -34,7 +30,6 @@ def __init__(self, parent): self.algorithm_box = QComboBox(self.algorithm_selection_group) self.algorithm_box.setGeometry(QRect(30, 50, 121, 41)) - self.algorithm_box.setStyleSheet("color: rgb(0,0,0);") # options group self.options_group = QGroupBox(self.frame) @@ -43,21 +38,17 @@ def __init__(self, parent): self.num_clusters_spinbox = QSpinBox(self.options_group) self.num_clusters_spinbox.setGeometry(QRect(160, 70, 81, 31)) - self.num_clusters_spinbox.setStyleSheet("color: rgb(0,0,0)") self.num_clusters_label = QLabel(self.options_group) self.num_clusters_label.setGeometry(QRect(20, 60, 131, 51)) - self.num_clusters_label.setStyleSheet("color: rgb(0,0,0);") self.num_clusters_label.setAlignment(Qt.AlignCenter) self.num_clusters_label.setText("number of clusters") self.num_clusters_label_2 = QLabel(self.options_group) self.num_clusters_label_2.setGeometry(QRect(20, 160, 131, 51)) - self.num_clusters_label_2.setStyleSheet("color: rgb(0,0,0);") self.num_clusters_label_2.setAlignment(Qt.AlignCenter) self.num_clusters_label_2.setText("initialization method") self.checkbox_1 = QCheckBox(self.options_group) self.checkbox_1.setGeometry(QRect(170, 170, 81, 41)) - self.checkbox_1.setStyleSheet("color: rgb(0,0,0)") self.checkbox_1.setText("Forgy") diff --git a/src/widgets/import_widget.py b/src/widgets/import_widget.py index f9709cb..d4db170 100644 --- a/src/widgets/import_widget.py +++ b/src/widgets/import_widget.py @@ -5,10 +5,8 @@ class ImportWidget(UnfoldWidget): def __init__(self, parent): super().__init__(parent) + self.setObjectName("import_widget") + # unfold button self.button.setText("IMPORT DATA") - self.button.setStyleSheet("background-color: #BAC8D3;") self.button.clicked.connect(lambda: self.parent().unfold(0)) - - # algorithm frame - self.frame.setStyleSheet("background-color: rgb(245, 245, 245);") diff --git a/src/widgets/main_layout.py b/src/widgets/main_layout.py index 8dad569..4cee8bb 100644 --- a/src/widgets/main_layout.py +++ b/src/widgets/main_layout.py @@ -15,6 +15,9 @@ def __init__(self): self.setCentralWidget(self._centralWidget) self._centralWidget.setLayout(self.generalLayout) + with open('../static/css/styles.css') as stylesheet: + self.setStyleSheet(stylesheet.read()) + self.generalLayout.addWidget(MainWidget()) self.show() diff --git a/src/widgets/preprocessing_widget.py b/src/widgets/preprocessing_widget.py index 05d8da3..a6875fd 100644 --- a/src/widgets/preprocessing_widget.py +++ b/src/widgets/preprocessing_widget.py @@ -5,10 +5,8 @@ class PreprocessingWidget(UnfoldWidget): def __init__(self, parent): super().__init__(parent) + self.setObjectName('preprocessing_widget') + # unfold button self.button.setText("PREPROCESSING") - self.button.setStyleSheet("background-color: #B0E3E6;") self.button.clicked.connect(lambda: self.parent().unfold(1)) - - # algorithm frame - self.frame.setStyleSheet("background-color: #E6F4F4;") diff --git a/src/widgets/visualization_widget.py b/src/widgets/visualization_widget.py index b6b6329..e7b3be6 100644 --- a/src/widgets/visualization_widget.py +++ b/src/widgets/visualization_widget.py @@ -5,10 +5,8 @@ class VisualizationWidget(UnfoldWidget): def __init__(self, parent): super().__init__(parent) + self.setObjectName("visualization_widget") + # unfold button self.button.setText("VISUALIZATION") - self.button.setStyleSheet("background-color: #D0CEE2;") self.button.clicked.connect(lambda: self.parent().unfold(3)) - - # algorithm frame - self.frame.setStyleSheet("background-color: #F6F5F9;") diff --git a/static/css/styles.css b/static/css/styles.css new file mode 100644 index 0000000..74c3dee --- /dev/null +++ b/static/css/styles.css @@ -0,0 +1,31 @@ +#algorithm_widget > QPushButton { + background-color: #b1ddf0; +} + +#algorithm_widget > QFrame { + background-color: #EBF4F7; +} + +#import_widget > QPushButton { + background-color: #BAC8D3; +} + +#import_widget > QFrame { + background-color: #f5f5f5; +} + +#preprocessing_widget > QPushButton { + background-color: #B0E3E6; +} + +#preprocessing_widget > QFrame { + background-color: #E6F4F4; +} + +#visualization_widget > QPushButton { + background-color: #D0CEE2; +} + +#visualization_widget > QFrame { + background-color: #F6F5F9; +} \ No newline at end of file From ffcdce28d4c862d924f7a18347211aa74c59b123 Mon Sep 17 00:00:00 2001 From: mhawryluk Date: Tue, 19 Apr 2022 19:38:35 +0200 Subject: [PATCH 009/328] style: Create rotated buttons * Add RotatedButton implementation * Make buttons rotated and more narrow --- src/widgets/config.py | 2 +- src/widgets/main_layout.py | 2 +- src/widgets/rotated_button.py | 56 +++++++++++++++++++++++++++++++++++ src/widgets/unfold_widget.py | 5 ++-- 4 files changed, 61 insertions(+), 4 deletions(-) create mode 100644 src/widgets/rotated_button.py diff --git a/src/widgets/config.py b/src/widgets/config.py index ec717e0..0baa94e 100644 --- a/src/widgets/config.py +++ b/src/widgets/config.py @@ -1,4 +1,4 @@ WINDOW_WIDTH = 1200 WINDOW_HEIGHT = 600 -UNFOLD_BUTTON_WIDTH = 100 +UNFOLD_BUTTON_WIDTH = 60 UNFOLD_WIDGET_WIDTH = WINDOW_WIDTH - 3*UNFOLD_BUTTON_WIDTH - 20 diff --git a/src/widgets/main_layout.py b/src/widgets/main_layout.py index 4cee8bb..1814e67 100644 --- a/src/widgets/main_layout.py +++ b/src/widgets/main_layout.py @@ -1,6 +1,6 @@ from PyQt5.QtWidgets import QMainWindow, QHBoxLayout, QWidget -from widgets.main_widget import MainWidget from widgets import WINDOW_WIDTH, WINDOW_HEIGHT +from .main_widget import MainWidget class MainWindow(QMainWindow): diff --git a/src/widgets/rotated_button.py b/src/widgets/rotated_button.py new file mode 100644 index 0000000..046ba8b --- /dev/null +++ b/src/widgets/rotated_button.py @@ -0,0 +1,56 @@ +from PyQt5.QtWidgets import QPushButton, QStylePainter, QStyle, QStyleOptionButton + + +class RotatedButton(QPushButton): + def __init__(self, parent, orientation="east"): + super().__init__(parent) + self.orientation = orientation + + def paintEvent(self, event): + painter = QStylePainter(self) + if self.orientation == "east": + painter.rotate(270) + painter.translate(-1 * self.height(), 0) + if self.orientation == "west": + painter.rotate(90) + painter.translate(0, -1 * self.width()) + painter.drawControl(QStyle.CE_PushButton, self.get_style_options()) + + def minimumSizeHint(self): + size = super(RotatedButton, self).minimumSizeHint() + size.transpose() + return size + + def sizeHint(self): + size = super(RotatedButton, self).sizeHint() + size.transpose() + return size + + def get_style_options(self): + options = QStyleOptionButton() + options.initFrom(self) + size = options.rect.size() + size.transpose() + options.rect.setSize(size) + options.features = QStyleOptionButton.None_ + + if self.isFlat(): + options.features |= QStyleOptionButton.Flat + if self.menu(): + options.features |= QStyleOptionButton.HasMenu + if self.autoDefault() or self.isDefault(): + options.features |= QStyleOptionButton.AutoDefaultButton + if self.isDefault(): + options.features |= QStyleOptionButton.DefaultButton + if self.isDown() or (self.menu() and self.menu().isVisible()): + options.state |= QStyle.State_Sunken + if self.isChecked(): + options.state |= QStyle.State_On + if not self.isFlat() and not self.isDown(): + options.state |= QStyle.State_Raised + + options.text = self.text() + options.icon = self.icon() + options.iconSize = self.iconSize() + + return options diff --git a/src/widgets/unfold_widget.py b/src/widgets/unfold_widget.py index 09b238a..dd66fb1 100644 --- a/src/widgets/unfold_widget.py +++ b/src/widgets/unfold_widget.py @@ -1,5 +1,6 @@ from PyQt5.QtCore import QRect, Qt -from PyQt5.QtWidgets import QPushButton, QFrame, QWidget +from PyQt5.QtWidgets import QFrame, QWidget +from .rotated_button import RotatedButton from widgets import WINDOW_HEIGHT, UNFOLD_BUTTON_WIDTH, UNFOLD_WIDGET_WIDTH @@ -10,7 +11,7 @@ def __init__(self, parent): self.resize(UNFOLD_WIDGET_WIDTH, WINDOW_HEIGHT) # unfold button - self.button = QPushButton(self) + self.button = RotatedButton(self) self.button.setGeometry(QRect(0, 0, UNFOLD_BUTTON_WIDTH, WINDOW_HEIGHT)) self.button.setLayoutDirection(Qt.LeftToRight) From 5f4fa7948bf8772aefb2670ce88ddcfbb3c9a41d Mon Sep 17 00:00:00 2001 From: Tomasz Date: Wed, 20 Apr 2022 11:53:57 +0200 Subject: [PATCH 010/328] feat: Initialize database connection --- .idea/inspectionProfiles/Project_Default.xml | 21 ++++ .idea/vcs.xml | 6 + .idea/workspace.xml | 106 ++++++++++++++++++ .../__pycache__/__init__.cpython-38.pyc | Bin 0 -> 178 bytes .../generate_number.cpython-38.pyc | Bin 0 -> 772 bytes src/app.py | 1 + src/database/__init__.py | 4 + .../__pycache__/__init__.cpython-38.pyc | Bin 0 -> 181 bytes .../__pycache__/chart.cpython-38.pyc | Bin 0 -> 1246 bytes .../__pycache__/__init__.cpython-38.pyc | Bin 0 -> 175 bytes .../__pycache__/chart_widget.cpython-38.pyc | Bin 0 -> 850 bytes .../generate_widget.cpython-38.pyc | Bin 0 -> 1081 bytes .../__pycache__/main_layout.cpython-38.pyc | Bin 0 -> 1388 bytes 13 files changed, 138 insertions(+) create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/vcs.xml create mode 100644 .idea/workspace.xml create mode 100644 src/algorithms/__pycache__/__init__.cpython-38.pyc create mode 100644 src/algorithms/__pycache__/generate_number.cpython-38.pyc create mode 100644 src/visualization/__pycache__/__init__.cpython-38.pyc create mode 100644 src/visualization/__pycache__/chart.cpython-38.pyc create mode 100644 src/widgets/__pycache__/__init__.cpython-38.pyc create mode 100644 src/widgets/__pycache__/chart_widget.cpython-38.pyc create mode 100644 src/widgets/__pycache__/generate_widget.cpython-38.pyc create mode 100644 src/widgets/__pycache__/main_layout.cpython-38.pyc diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..1b75f5e --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,21 @@ + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..4c7ffd8 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1649604573835 + + + + + + + \ No newline at end of file diff --git a/src/algorithms/__pycache__/__init__.cpython-38.pyc b/src/algorithms/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6b8316ec259faf0a33fd98439f8d618ef6e264eb GIT binary patch literal 178 zcmWIL<>g`k0_X2RNg(<$h(HF6K#l_t7qb9~6oz01O-8?!3`HPe1o1Tl$aS`g2`x@7 zDvt5U&rOYSNiEJU$uEd0E-6jPOpNi&JG!SbFEh0$J256Du_RG9H#09YFI~4JKR+j? txF|U$F(*C0D6=FZw>Ty~9w=85AFo$Xd5gm)H$SB`C)EyQ;b$Ob008{RFEaoD literal 0 HcmV?d00001 diff --git a/src/algorithms/__pycache__/generate_number.cpython-38.pyc b/src/algorithms/__pycache__/generate_number.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6327cf0fbe9ae6e4974e9d43d6c09e3f03aafb40 GIT binary patch literal 772 zcmZuv&1&2*5Y~_Fb(e(XP)GLRl$WZ)|xxk^>vuQ}P%& zq{qBNuYCz!d&&cpUOV#crc3C+e4df!?;H7adwWPwMt?q@9a2Jm1!q$@I&V?!0fHim zRwSn7Vn!{7w@#aaLv51u2rQhKA4|B7N*p2Aqyp) zJgQ4mn(2{inyRocDP%QmpmbkqTTGWTYhii{$Mc0xg}`_xM1qZMXisQDulApiJYI)o z)F+@_3uc1P@+g62Aks5EM8lC8y`$erM`p-&#`nqdVDmlljk>6#ie5A1&&CfSHH$qn z^E?4*R8#j0=vU!mXj-E(24OrOU&^Z0{bH7ohST9xyA`AG&#XwipjQV^N&E{OXM;f9 z$XW~GheFhiYO7#x3Gua+)#`?q#=*0`_j%Pw2RmqQ3=rN3!W0l_g!T39Q??uRCmGLU ZT=skcTkD|zW&8B?a)38ssW#L~`CooCuq^-p literal 0 HcmV?d00001 diff --git a/src/app.py b/src/app.py index 2a890bf..b24bc42 100644 --- a/src/app.py +++ b/src/app.py @@ -2,6 +2,7 @@ from PyQt5.QtWidgets import QApplication from widgets.main_layout import RandomGenerator +import database # only for checking init purposes def main(): diff --git a/src/database/__init__.py b/src/database/__init__.py index e69de29..7e08e64 100644 --- a/src/database/__init__.py +++ b/src/database/__init__.py @@ -0,0 +1,4 @@ +from pymongo import MongoClient + +client = MongoClient('mongodb+srv://admin:FvjBbir5bhJl7GvC@dataminingtooldb.trcgm.mongodb.net/') +print(client.list_database_names()) diff --git a/src/visualization/__pycache__/__init__.cpython-38.pyc b/src/visualization/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6a1d22d0b26a4eb64b4ade02804d9099711b44d3 GIT binary patch literal 181 zcmWIL<>g`k0_X2RNg(<$h(HF6K#l_t7qb9~6oz01O-8?!3`HPe1o1T-$aS`g2`x@7 zDvt5U&rOYSNiEJU$uEd0E-6jPOpNi&JG!SbFEh0$J256Du_RG9H#09YFI~4JKR+j? wxF|WMEVH;YF(2KczG$)edCmXCP((0GyF9jsO4v literal 0 HcmV?d00001 diff --git a/src/visualization/__pycache__/chart.cpython-38.pyc b/src/visualization/__pycache__/chart.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1437f7689c17339651c9efac9aa2d7e5b6641aa7 GIT binary patch literal 1246 zcmZ8hOK;mo5Z)K5hb`20UFU(EawE|A79c2!Agzitxfp1ZTnGY-m3B=trYL!LZ66?8SIwvOkPF z^y5k9{8Sezds%(@cvcn09;ys0JsLsfDu3k1<1%x0m>m~xs>5!p`pPi@;Pw$Euu~A;b9PLM-rw`>@?VAUuHimR?YM7oVEm zgF(DQDyI26hL#ztfd-0E9CW(WArdTN8wU41yN86}8OZz2%HbT%;%m}mh-NJ~H<8y2 zEweUy8WP3c{0po(g{CZuq!V~)D!T!Ch}C3bDs4B>+pyXLE#-iFDv(q7OsqOdxZT2t zJLv3I=F|hN+ML>-(AtO{&_Wldp_+~crh(OA4MHCPpzCx8eqFjn&v#Z~{dOS{76*DE zaGWi&lC*G!Dm5}NLtQCHV?8ZVUzhR-=v;buQTe8%eE^q2Z#g+bQBEuo`08ab*d3_hA>iX~6?xJeY&|42onqc9?dt=BwDHY S4W9O|i}s%)4^3eJhJOW*awv)b literal 0 HcmV?d00001 diff --git a/src/widgets/__pycache__/__init__.cpython-38.pyc b/src/widgets/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bdc9ff0df51906dcb128a94c352f9e7cf379ff2a GIT binary patch literal 175 zcmWIL<>g`kf(zH;lR)%i5P=LBfgA@QE@lA|DGb33nv8xc8Hzx{2;yrXkn3y}6Iz^F zR2<`xpPL%vl3JWyl3x&0TvD2nnHb}lcXUr>US?`hc4ACQVo9QIZf0I)Ub=2cetu3& qaZz$id1gv_YDsZSd^}L1BtBlRpz;=nO>TZlX-=vg$hOZw%m4th)h=cL literal 0 HcmV?d00001 diff --git a/src/widgets/__pycache__/chart_widget.cpython-38.pyc b/src/widgets/__pycache__/chart_widget.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4d1ea507b4932000af38e18570986fb97e7c182f GIT binary patch literal 850 zcmY*X&2AGx4EF3#nuMf9z=Ko(t&&sc_#iFb%g`8;z5uL9|RXA&XSK@^@t08xv;wrxM8@&tVBUEz}4RXhgtk@NQ9b$6e={A0%E)wNMl^-dMsSc*}KAGON>7!Tg z%hb#=vDlVU&NxuEyt_Nv|7C+c+HWCp#d+Q3JTGOHk>BI|b0xCok0V_BX<_vNVfD9b zPE?lRz5JVm-m)fWP4AXi7;@TPujMjytp{%xWBYJ8w#}}LrYWP_^VA?-x)e4oi=o@N ayKr}I2f~3l#_h+=v`^@TIh-Er`F{bs+R0r2 literal 0 HcmV?d00001 diff --git a/src/widgets/__pycache__/generate_widget.cpython-38.pyc b/src/widgets/__pycache__/generate_widget.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0ac12a7f9c89ce6a1195eef6948eedc1218d2446 GIT binary patch literal 1081 zcmZuv%}x|S5bmCTmR%I00TVr&IY7La7-NjE5;VaLiy&q)NvC(aS!bE)S-X3LC3}N} zlW)KQj=Y0cUt+GFd;sIs>KQ;VR#KJf>guYmzpCw4tARk;zc+i2ErfoU!%cDE@CsBt z1H%x*Davq!vGJ|c%IwI_oXE-C$j!XS!)OgLn>ojbIov+7BcHkNQRw}I*C@oL)zzU> zPIo`7eEW0buQrWjwWI!5iH;Do3}T`U^1effZ-^@3`G{V z89v1)Xcse!*~iVu;VyGdF>{%B>_pxPa!}+07QdWX8WTL6J_p7o z=*;8>#%BnSIGxgPGDXv5ATsD51#7FF)y?It)v#H*su*!u281Lc(S%3?rgYPatSQP^ zjb0j@<@B{`QcTu4n+l+%GgO_gskbdA%HWu0r+3C}~!@TBmAN ZY7D00jaF6Dihes{z_8;wN4b=bu literal 0 HcmV?d00001 diff --git a/src/widgets/__pycache__/main_layout.cpython-38.pyc b/src/widgets/__pycache__/main_layout.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8d300ca65058cc8b85def4677fb15fcfda13b89e GIT binary patch literal 1388 zcmZWpOK;Rj5bpM4#xvvbB)|#;7myIr9GDv%Rx5pDG9QPE>PO70U8ip~iU9ZBat z>x=F)GLF7ML^Ag4!Pes}FJI=Rs1Cq*aIbpzC_AiXw(f4d%*D2}V_J_kXT>Y2@5@r^ z%vKtp!NyLe?b0J@*JOiCG5YG|w}!b6iX@B*!o2t7H5F8NClT|7FM<=og7+jKEQAch zdh|4dtcvAVr*tJE>ewC(Z2kvf$($_cDWT+;EIdI^sndMn3IEii#0GO%;i2sulQ{*g z3x3ft+3hx-yWK?(tPm~R7l8=p9(WCG-1-k~;v$UDYq17$*zRnsQTxSp%s~(+p|g3k z*3@uySw#L{NJ#z#($`qRHzdILTpgO(zSMQZd0yt0bCwth-NmUq&#jUy2K%4-IwYKC3Zv47~ zXgtMnw-D=PLNqa0V0Nkl;6q@fdi{acJ2UQ`{zopr; z)qZO1OypVmu>AD#u*{|2%Tkfq>}CPwm)kdORjJhIY1-sq(gH}zl_Tb4|4^a?wCeSCSDBhh$b}gjxPN|p~+c)f8vq{F|eZ>@R%DQV787+{{l~Ty@h|=vS~Ls z)7^aO<~YJoh^|*9bS|In zag`g3lf444!R}*$F+IBWYcap=7ptg2C1wisnDaNYOf@U6d-@Oj=&+sE zR4T>!N=j?6sxdDefxyQgzalSQcgW^=P>-G*ZrNLtt@bZqH1^R^v*F_9Ol?;>w>yQI zEJ@Wi38}{}w9}oelFRXpT|8S_Zfx0z9CaD2B Date: Wed, 20 Apr 2022 12:37:21 +0200 Subject: [PATCH 011/328] feat: Add database manager --- .idea/data-mining-tool.iml | 10 +++ .../inspectionProfiles/profiles_settings.xml | 6 ++ .idea/misc.xml | 4 ++ .idea/modules.xml | 8 +++ .idea/workspace.xml | 67 +++++------------- requirements.txt | 2 + src/app.py | 8 +-- src/database/__init__.py | 5 +- .../__pycache__/__init__.cpython-38.pyc | Bin 0 -> 239 bytes .../__pycache__/config.cpython-38.pyc | Bin 0 -> 309 bytes .../db_object_manager.cpython-38.pyc | Bin 0 -> 1958 bytes src/database/config.py | 3 + src/database/db_object_manager.py | 33 +++++++++ .../__pycache__/__init__.cpython-38.pyc | Bin 175 -> 175 bytes .../__pycache__/main_layout.cpython-38.pyc | Bin 1388 -> 1388 bytes 15 files changed, 90 insertions(+), 56 deletions(-) create mode 100644 .idea/data-mining-tool.iml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 src/database/__pycache__/__init__.cpython-38.pyc create mode 100644 src/database/__pycache__/config.cpython-38.pyc create mode 100644 src/database/__pycache__/db_object_manager.cpython-38.pyc create mode 100644 src/database/config.py create mode 100644 src/database/db_object_manager.py diff --git a/.idea/data-mining-tool.iml b/.idea/data-mining-tool.iml new file mode 100644 index 0000000..2c80e12 --- /dev/null +++ b/.idea/data-mining-tool.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..db312b3 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f1115e7 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 4c7ffd8..88440fc 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,7 +1,11 @@ - + + + + + + + + - + - - - - + - - - - - - - 1649604573835 + + 1650449935460 - - - \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 718cf7c..4470e3c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,3 +12,5 @@ PyQt5-sip==12.9.1 PyQt5-stubs==5.15.2.0 python-dateutil==2.8.2 six==1.16.0 + +pymongo~=4.1.1 \ No newline at end of file diff --git a/src/app.py b/src/app.py index b24bc42..6806120 100644 --- a/src/app.py +++ b/src/app.py @@ -2,13 +2,13 @@ from PyQt5.QtWidgets import QApplication from widgets.main_layout import RandomGenerator -import database # only for checking init purposes +from database.db_object_manager import DatabaseObjectManager def main(): - app = QApplication(sys.argv) - window = RandomGenerator() - sys.exit(app.exec_()) + manager = DatabaseObjectManager() + manager.getDatabase("test") + print(manager.getDatabasesList()) if __name__ == '__main__': diff --git a/src/database/__init__.py b/src/database/__init__.py index 7e08e64..8963e55 100644 --- a/src/database/__init__.py +++ b/src/database/__init__.py @@ -1,4 +1 @@ -from pymongo import MongoClient - -client = MongoClient('mongodb+srv://admin:FvjBbir5bhJl7GvC@dataminingtooldb.trcgm.mongodb.net/') -print(client.list_database_names()) +from .db_object_manager import DatabaseObjectManager diff --git a/src/database/__pycache__/__init__.cpython-38.pyc b/src/database/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..00dc41dd650d48f35512b17953c554ced3af6127 GIT binary patch literal 239 zcmWIL<>g`kf_L}hlgxnhV-N=!FabFZKwK;UBvKes7;_kM8KW2(8B&;n88n$+G6ID) z8E=WYB$gy5B^IapCuOB3m-r^;C8nnq`Drpm38o~)=Ys{~b0MNdATw7o6fpxSF!41A z$a1!d2`x@7Dvt5U&rOYSNiEJU$uEd0E-6jPOpNi&JG!SbFEh0$J255&Xp?SkW?p7q tx^78+eojnrQ8HK%WPMD0JW!@2K3=b&@)n0pZhlH>PO2Tqk)MH>0RS)ALahJ* literal 0 HcmV?d00001 diff --git a/src/database/__pycache__/config.cpython-38.pyc b/src/database/__pycache__/config.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..017f9cd072d1e51b01b45dc66ee0c32888a16f18 GIT binary patch literal 309 zcmYk0%}T^D5XY15qN48IS17XWNrWP@SkZMs5o9kVAW0Kz+$O0>wotF)!}tzfeTiN? zc=7?fJEiHkzeONs;BF5BM;zBk;R0hMFpr*b5%JLt zipO6tMKSJoE{(2CUQ40<(_96?*}k)FmZp>|sk5{8;e<(h!0s3I;dz_SIQ0|;Qdi!X znzO{)vQo+4ZlZ-xui{a$*>pq8hL8G?j4Yk7j?9e`fjj7@o2B!@Jo{0w|TBA{st~*h9h*2_Y1*QK1qI2b#-b$?|$;lObL^%uIl+ zoD=yW?J@tM$M#S7R`t{$&^zxt#=Ca1DvafKJm1gb=Xve@e!okg{P}k6ebO5-il%=5)(nIRvc*Uz^!*7 z2r{Caz*5Scb24(d%NtNPc$2rFZt^zwplJDFnBiHkd-Oz;N zP>a{&cOo*sgh_ZHRD?*%g3oyL5N?fh4arCVhr6u2*F-q0eRToBcU zk^kO87(Vg$wNToBnNEejEA){`k9}=UxD5TDlfV8rO{7pqq0a%%)>I}kIoL938v9yB zwi7Y>a7Joz2GauQ_VH=%1p&-AK>z{}jbI3!Z7$`tT~3YcG@J?rpYfg(%*Z>E(VLdw z>^XZO3`1N9fsIeuu}VKkE;viVsbHyMkrJU1ED;}Bng}K*Od6J?hKWy78_h1LYQX*% zj%q=bw}A#OwXdfL9`>&s2vfqwj)IFbyHj@7G}^Ar{(rrY&TsVhg3gbYP7JtMI$>cP z`U$Ko8_z~P{zY_V#EZ}&3d^$G_43KsP$upfLAwp~(_0`p}q#Vu%**w37dX3kMd z{lMuP$Q|&WJA1^2hax({7hZy8AEh~D=1}TF9jIl(^r<#t%6|Pxt-_uI*Xp1UEF{J_ zK)RQy^(HdmC4+UCsZm1Wbm{DF*os)Nb2lrL9)1UP5DWT&%Gdce-g&Ui0Z($s*hm}1LlpohT#SV zbW%kf{5vT8&?$Vgm|hwk;!)4_8gMl++OfTX3xCBlnaBhCx3QhecFMh{1+r)O*Rrnd GxnBS Date: Wed, 20 Apr 2022 12:52:19 +0200 Subject: [PATCH 012/328] feat: Create database writer class --- .idea/workspace.xml | 3 --- src/app.py | 7 +++---- src/database/__init__.py | 1 + .../__pycache__/__init__.cpython-38.pyc | Bin 239 -> 285 bytes .../__pycache__/database_writer.cpython-38.pyc | Bin 0 -> 1124 bytes src/database/database_writer.py | 17 +++++++++++++++++ 6 files changed, 21 insertions(+), 7 deletions(-) create mode 100644 src/database/__pycache__/database_writer.cpython-38.pyc create mode 100644 src/database/database_writer.py diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 88440fc..01bce7c 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,11 +2,8 @@ - - - \ No newline at end of file diff --git a/src/database/__init__.py b/src/database/__init__.py index 444246b..9246796 100644 --- a/src/database/__init__.py +++ b/src/database/__init__.py @@ -1,3 +1,3 @@ -from .db_object_manager import DatabaseObjectManager +from .database_manager import DatabaseObjectManager from .database_writer import Writer from .database_reader import Reader diff --git a/src/database/__pycache__/db_object_manager.cpython-38.pyc b/src/database/__pycache__/db_object_manager.cpython-38.pyc deleted file mode 100644 index 3dcf218e7cb2d347478b74182a595157cdbba3f1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1958 zcma)7O>fjj7@o2B!@Jo{0w|TBA{st~*h9h*2_Y1*QK1qI2b#-b$?|$;lObL^%uIl+ zoD=yW?J@tM$M#S7R`t{$&^zxt#=Ca1DvafKJm1gb=Xve@e!okg{P}k6ebO5-il%=5)(nIRvc*Uz^!*7 z2r{Caz*5Scb24(d%NtNPc$2rFZt^zwplJDFnBiHkd-Oz;N zP>a{&cOo*sgh_ZHRD?*%g3oyL5N?fh4arCVhr6u2*F-q0eRToBcU zk^kO87(Vg$wNToBnNEejEA){`k9}=UxD5TDlfV8rO{7pqq0a%%)>I}kIoL938v9yB zwi7Y>a7Joz2GauQ_VH=%1p&-AK>z{}jbI3!Z7$`tT~3YcG@J?rpYfg(%*Z>E(VLdw z>^XZO3`1N9fsIeuu}VKkE;viVsbHyMkrJU1ED;}Bng}K*Od6J?hKWy78_h1LYQX*% zj%q=bw}A#OwXdfL9`>&s2vfqwj)IFbyHj@7G}^Ar{(rrY&TsVhg3gbYP7JtMI$>cP z`U$Ko8_z~P{zY_V#EZ}&3d^$G_43KsP$upfLAwp~(_0`p}q#Vu%**w37dX3kMd z{lMuP$Q|&WJA1^2hax({7hZy8AEh~D=1}TF9jIl(^r<#t%6|Pxt-_uI*Xp1UEF{J_ zK)RQy^(HdmC4+UCsZm1Wbm{DF*os)Nb2lrL9)1UP5DWT&%Gdce-g&Ui0Z($s*hm}1LlpohT#SV zbW%kf{5vT8&?$Vgm|hwk;!)4_8gMl++OfTX3xCBlnaBhCx3QhecFMh{1+r)O*Rrnd GxnBS Date: Wed, 20 Apr 2022 14:14:39 +0200 Subject: [PATCH 015/328] feat: Remove handle --- .idea/workspace.xml | 6 ++---- src/app.py | 8 ++++---- .../__pycache__/__init__.cpython-38.pyc | Bin 285 -> 330 bytes .../database_data_remover.cpython-38.pyc | Bin 0 -> 960 bytes .../database_manager.cpython-38.pyc | Bin 0 -> 2370 bytes .../database_reader.cpython-38.pyc | Bin 919 -> 986 bytes .../database_writer.cpython-38.pyc | Bin 1087 -> 1086 bytes src/database/database_data_remover.py | 14 ++++++++++++++ src/database/database_manager.py | 8 ++++++++ 9 files changed, 28 insertions(+), 8 deletions(-) create mode 100644 src/database/__pycache__/database_data_remover.cpython-38.pyc create mode 100644 src/database/__pycache__/database_manager.cpython-38.pyc create mode 100644 src/database/database_data_remover.py diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 9da23ea..6c8cf3c 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,10 +3,8 @@ - - - - + +