diff --git a/.qt_for_python/uic/left_column.py b/.qt_for_python/uic/left_column.py new file mode 100644 index 0000000..f8f80fb --- /dev/null +++ b/.qt_for_python/uic/left_column.py @@ -0,0 +1,133 @@ +# -*- coding: utf-8 -*- + +################################################################################ +## Form generated from reading UI file 'left_column.ui' +## +## Created by: Qt User Interface Compiler version 6.0.2 +## +## WARNING! All changes made in this file will be lost when recompiling UI file! +################################################################################ + +from PySide6.QtCore import * +from PySide6.QtGui import * +from PySide6.QtWidgets import * + + +class Ui_LeftColumn(object): + def setupUi(self, LeftColumn): + if not LeftColumn.objectName(): + LeftColumn.setObjectName(u"LeftColumn") + LeftColumn.resize(240, 600) + self.main_pages_layout = QVBoxLayout(LeftColumn) + self.main_pages_layout.setSpacing(0) + self.main_pages_layout.setObjectName(u"main_pages_layout") + self.main_pages_layout.setContentsMargins(5, 5, 5, 5) + self.menus = QStackedWidget(LeftColumn) + self.menus.setObjectName(u"menus") + self.menu_1 = QWidget() + self.menu_1.setObjectName(u"menu_1") + self.verticalLayout = QVBoxLayout(self.menu_1) + self.verticalLayout.setSpacing(5) + self.verticalLayout.setObjectName(u"verticalLayout") + self.verticalLayout.setContentsMargins(5, 5, 5, 5) + self.btn_1_widget = QWidget(self.menu_1) + self.btn_1_widget.setObjectName(u"btn_1_widget") + self.btn_1_widget.setMinimumSize(QSize(0, 40)) + self.btn_1_widget.setMaximumSize(QSize(16777215, 40)) + self.btn_1_layout = QVBoxLayout(self.btn_1_widget) + self.btn_1_layout.setSpacing(0) + self.btn_1_layout.setObjectName(u"btn_1_layout") + self.btn_1_layout.setContentsMargins(0, 0, 0, 0) + + self.verticalLayout.addWidget(self.btn_1_widget) + + self.btn_2_widget = QWidget(self.menu_1) + self.btn_2_widget.setObjectName(u"btn_2_widget") + self.btn_2_widget.setMinimumSize(QSize(0, 40)) + self.btn_2_widget.setMaximumSize(QSize(16777215, 40)) + self.btn_2_layout = QVBoxLayout(self.btn_2_widget) + self.btn_2_layout.setSpacing(0) + self.btn_2_layout.setObjectName(u"btn_2_layout") + self.btn_2_layout.setContentsMargins(0, 0, 0, 0) + + self.verticalLayout.addWidget(self.btn_2_widget) + + self.btn_3_widget = QWidget(self.menu_1) + self.btn_3_widget.setObjectName(u"btn_3_widget") + self.btn_3_widget.setMinimumSize(QSize(0, 40)) + self.btn_3_widget.setMaximumSize(QSize(16777215, 40)) + self.btn_3_layout = QVBoxLayout(self.btn_3_widget) + self.btn_3_layout.setSpacing(0) + self.btn_3_layout.setObjectName(u"btn_3_layout") + self.btn_3_layout.setContentsMargins(0, 0, 0, 0) + + self.verticalLayout.addWidget(self.btn_3_widget) + + self.label_1 = QLabel(self.menu_1) + self.label_1.setObjectName(u"label_1") + font = QFont() + font.setPointSize(16) + self.label_1.setFont(font) + self.label_1.setStyleSheet(u"font-size: 16pt") + self.label_1.setAlignment(Qt.AlignCenter) + + self.verticalLayout.addWidget(self.label_1) + + self.menus.addWidget(self.menu_1) + self.menu_2 = QWidget() + self.menu_2.setObjectName(u"menu_2") + self.verticalLayout_2 = QVBoxLayout(self.menu_2) + self.verticalLayout_2.setSpacing(5) + self.verticalLayout_2.setObjectName(u"verticalLayout_2") + self.verticalLayout_2.setContentsMargins(5, 5, 5, 5) + self.btn_4_widget = QWidget(self.menu_2) + self.btn_4_widget.setObjectName(u"btn_4_widget") + self.btn_4_widget.setMinimumSize(QSize(0, 40)) + self.btn_4_widget.setMaximumSize(QSize(16777215, 40)) + self.btn_4_layout = QVBoxLayout(self.btn_4_widget) + self.btn_4_layout.setSpacing(0) + self.btn_4_layout.setObjectName(u"btn_4_layout") + self.btn_4_layout.setContentsMargins(0, 0, 0, 0) + + self.verticalLayout_2.addWidget(self.btn_4_widget) + + self.label_2 = QLabel(self.menu_2) + self.label_2.setObjectName(u"label_2") + self.label_2.setFont(font) + self.label_2.setStyleSheet(u"font-size: 16pt") + self.label_2.setAlignment(Qt.AlignCenter) + + self.verticalLayout_2.addWidget(self.label_2) + + self.label_3 = QLabel(self.menu_2) + self.label_3.setObjectName(u"label_3") + font1 = QFont() + font1.setPointSize(9) + self.label_3.setFont(font1) + self.label_3.setStyleSheet(u"font-size: 9pt") + self.label_3.setAlignment(Qt.AlignCenter) + self.label_3.setWordWrap(True) + + self.verticalLayout_2.addWidget(self.label_3) + + self.menus.addWidget(self.menu_2) + + self.main_pages_layout.addWidget(self.menus) + + + self.retranslateUi(LeftColumn) + + self.menus.setCurrentIndex(0) + + + QMetaObject.connectSlotsByName(LeftColumn) + # setupUi + + def retranslateUi(self, LeftColumn): + LeftColumn.setWindowTitle(QCoreApplication.translate("LeftColumn", u"Form", None)) + self.label_1.setText(QCoreApplication.translate("LeftColumn", u"Menu 1 - Left Menu", None)) + self.label_2.setText(QCoreApplication.translate("LeftColumn", u"Menu 2 - Left Menu", None)) + self.label_3.setText(QCoreApplication.translate("LeftColumn", u"This is just an example menu.\n" +"Add Qt Widgets or your custom widgets here.", None)) + # retranslateUi + diff --git a/.qt_for_python/uic/main_pages.py b/.qt_for_python/uic/main_pages.py new file mode 100644 index 0000000..451f224 --- /dev/null +++ b/.qt_for_python/uic/main_pages.py @@ -0,0 +1,163 @@ +# -*- coding: utf-8 -*- + +################################################################################ +## Form generated from reading UI file 'main_pages.ui' +## +## Created by: Qt User Interface Compiler version 6.0.2 +## +## WARNING! All changes made in this file will be lost when recompiling UI file! +################################################################################ + +from PySide6.QtCore import * +from PySide6.QtGui import * +from PySide6.QtWidgets import * + + +class Ui_MainPages(object): + def setupUi(self, MainPages): + if not MainPages.objectName(): + MainPages.setObjectName(u"MainPages") + MainPages.resize(860, 600) + self.main_pages_layout = QVBoxLayout(MainPages) + self.main_pages_layout.setSpacing(0) + self.main_pages_layout.setObjectName(u"main_pages_layout") + self.main_pages_layout.setContentsMargins(5, 5, 5, 5) + self.pages = QStackedWidget(MainPages) + self.pages.setObjectName(u"pages") + self.page_1 = QWidget() + self.page_1.setObjectName(u"page_1") + self.page_1.setStyleSheet(u"font-size: 14pt") + self.page_1_layout = QVBoxLayout(self.page_1) + self.page_1_layout.setSpacing(5) + self.page_1_layout.setObjectName(u"page_1_layout") + self.page_1_layout.setContentsMargins(5, 5, 5, 5) + self.welcome_base = QFrame(self.page_1) + self.welcome_base.setObjectName(u"welcome_base") + self.welcome_base.setMinimumSize(QSize(300, 150)) + self.welcome_base.setMaximumSize(QSize(300, 150)) + self.welcome_base.setFrameShape(QFrame.NoFrame) + self.welcome_base.setFrameShadow(QFrame.Raised) + self.center_page_layout = QVBoxLayout(self.welcome_base) + self.center_page_layout.setSpacing(10) + self.center_page_layout.setObjectName(u"center_page_layout") + self.center_page_layout.setContentsMargins(0, 0, 0, 0) + self.logo = QFrame(self.welcome_base) + self.logo.setObjectName(u"logo") + self.logo.setMinimumSize(QSize(300, 120)) + self.logo.setMaximumSize(QSize(300, 120)) + self.logo.setFrameShape(QFrame.NoFrame) + self.logo.setFrameShadow(QFrame.Raised) + self.logo_layout = QVBoxLayout(self.logo) + self.logo_layout.setSpacing(0) + self.logo_layout.setObjectName(u"logo_layout") + self.logo_layout.setContentsMargins(0, 0, 0, 0) + + self.center_page_layout.addWidget(self.logo) + + self.label = QLabel(self.welcome_base) + self.label.setObjectName(u"label") + self.label.setAlignment(Qt.AlignCenter) + + self.center_page_layout.addWidget(self.label) + + + self.page_1_layout.addWidget(self.welcome_base, 0, Qt.AlignHCenter) + + self.pages.addWidget(self.page_1) + self.page_2 = QWidget() + self.page_2.setObjectName(u"page_2") + self.page_2_layout = QVBoxLayout(self.page_2) + self.page_2_layout.setSpacing(5) + self.page_2_layout.setObjectName(u"page_2_layout") + self.page_2_layout.setContentsMargins(5, 5, 5, 5) + self.scroll_area = QScrollArea(self.page_2) + self.scroll_area.setObjectName(u"scroll_area") + self.scroll_area.setStyleSheet(u"background: transparent;") + self.scroll_area.setFrameShape(QFrame.NoFrame) + self.scroll_area.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) + self.scroll_area.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) + self.scroll_area.setWidgetResizable(True) + self.contents = QWidget() + self.contents.setObjectName(u"contents") + self.contents.setGeometry(QRect(0, 0, 840, 580)) + self.contents.setStyleSheet(u"background: transparent;") + self.verticalLayout = QVBoxLayout(self.contents) + self.verticalLayout.setSpacing(15) + self.verticalLayout.setObjectName(u"verticalLayout") + self.verticalLayout.setContentsMargins(5, 5, 5, 5) + self.title_label = QLabel(self.contents) + self.title_label.setObjectName(u"title_label") + self.title_label.setMaximumSize(QSize(16777215, 40)) + font = QFont() + font.setPointSize(16) + self.title_label.setFont(font) + self.title_label.setStyleSheet(u"font-size: 16pt") + self.title_label.setAlignment(Qt.AlignCenter) + + self.verticalLayout.addWidget(self.title_label) + + self.description_label = QLabel(self.contents) + self.description_label.setObjectName(u"description_label") + self.description_label.setAlignment(Qt.AlignHCenter|Qt.AlignTop) + self.description_label.setWordWrap(True) + + self.verticalLayout.addWidget(self.description_label) + + self.row_1_layout = QHBoxLayout() + self.row_1_layout.setObjectName(u"row_1_layout") + + self.verticalLayout.addLayout(self.row_1_layout) + + self.row_2_layout = QHBoxLayout() + self.row_2_layout.setObjectName(u"row_2_layout") + + self.verticalLayout.addLayout(self.row_2_layout) + + self.row_3_layout = QHBoxLayout() + self.row_3_layout.setObjectName(u"row_3_layout") + + self.verticalLayout.addLayout(self.row_3_layout) + + self.scroll_area.setWidget(self.contents) + + self.page_2_layout.addWidget(self.scroll_area) + + self.pages.addWidget(self.page_2) + self.page_3 = QWidget() + self.page_3.setObjectName(u"page_3") + self.page_3.setStyleSheet(u"QFrame {\n" +" background: lightgreen;\n" +" font-size: 16pt;\n" +" border-radius: 8px;\n" +"}") + self.page_3_layout = QVBoxLayout(self.page_3) + self.page_3_layout.setObjectName(u"page_3_layout") + self.empty_page_label = QLabel(self.page_3) + self.empty_page_label.setObjectName(u"empty_page_label") + self.empty_page_label.setFont(font) + self.empty_page_label.setAlignment(Qt.AlignCenter) + + self.page_3_layout.addWidget(self.empty_page_label) + + self.pages.addWidget(self.page_3) + + self.main_pages_layout.addWidget(self.pages) + + + self.retranslateUi(MainPages) + + self.pages.setCurrentIndex(1) + + + QMetaObject.connectSlotsByName(MainPages) + # setupUi + + def retranslateUi(self, MainPages): + MainPages.setWindowTitle(QCoreApplication.translate("MainPages", u"Form", None)) + self.label.setText(QCoreApplication.translate("MainPages", u"Welcome To PyOneDark GUI", None)) + self.title_label.setText(QCoreApplication.translate("MainPages", u"Custom Widgets Page", None)) + self.description_label.setText(QCoreApplication.translate("MainPages", u"Here will be all the custom widgets, they will be added over time on this page.\n" +"I will try to always record a new tutorial when adding a new Widget and updating the project on Patreon before launching on GitHub and GitHub after the public release.", None)) + self.empty_page_label.setText(QCoreApplication.translate("MainPages", u"Empty Page", None)) + # retranslateUi + diff --git a/.qt_for_python/uic/right_column.py b/.qt_for_python/uic/right_column.py new file mode 100644 index 0000000..dfdf570 --- /dev/null +++ b/.qt_for_python/uic/right_column.py @@ -0,0 +1,111 @@ +# -*- coding: utf-8 -*- + +################################################################################ +## Form generated from reading UI file 'right_column.ui' +## +## Created by: Qt User Interface Compiler version 6.0.2 +## +## WARNING! All changes made in this file will be lost when recompiling UI file! +################################################################################ + +from PySide6.QtCore import * +from PySide6.QtGui import * +from PySide6.QtWidgets import * + + +class Ui_RightColumn(object): + def setupUi(self, RightColumn): + if not RightColumn.objectName(): + RightColumn.setObjectName(u"RightColumn") + RightColumn.resize(240, 600) + self.main_pages_layout = QVBoxLayout(RightColumn) + self.main_pages_layout.setSpacing(0) + self.main_pages_layout.setObjectName(u"main_pages_layout") + self.main_pages_layout.setContentsMargins(5, 5, 5, 5) + self.menus = QStackedWidget(RightColumn) + self.menus.setObjectName(u"menus") + self.menu_1 = QWidget() + self.menu_1.setObjectName(u"menu_1") + self.verticalLayout = QVBoxLayout(self.menu_1) + self.verticalLayout.setSpacing(5) + self.verticalLayout.setObjectName(u"verticalLayout") + self.verticalLayout.setContentsMargins(5, 5, 5, 5) + self.btn_1_widget = QWidget(self.menu_1) + self.btn_1_widget.setObjectName(u"btn_1_widget") + self.btn_1_widget.setMinimumSize(QSize(0, 40)) + self.btn_1_widget.setMaximumSize(QSize(16777215, 40)) + self.btn_1_layout = QVBoxLayout(self.btn_1_widget) + self.btn_1_layout.setSpacing(0) + self.btn_1_layout.setObjectName(u"btn_1_layout") + self.btn_1_layout.setContentsMargins(0, 0, 0, 0) + + self.verticalLayout.addWidget(self.btn_1_widget) + + self.label_1 = QLabel(self.menu_1) + self.label_1.setObjectName(u"label_1") + font = QFont() + font.setPointSize(16) + self.label_1.setFont(font) + self.label_1.setStyleSheet(u"font-size: 16pt") + self.label_1.setAlignment(Qt.AlignCenter) + + self.verticalLayout.addWidget(self.label_1) + + self.menus.addWidget(self.menu_1) + self.menu_2 = QWidget() + self.menu_2.setObjectName(u"menu_2") + self.verticalLayout_2 = QVBoxLayout(self.menu_2) + self.verticalLayout_2.setSpacing(5) + self.verticalLayout_2.setObjectName(u"verticalLayout_2") + self.verticalLayout_2.setContentsMargins(5, 5, 5, 5) + self.btn_2_widget = QWidget(self.menu_2) + self.btn_2_widget.setObjectName(u"btn_2_widget") + self.btn_2_widget.setMinimumSize(QSize(0, 40)) + self.btn_2_widget.setMaximumSize(QSize(16777215, 40)) + self.btn_2_layout = QVBoxLayout(self.btn_2_widget) + self.btn_2_layout.setSpacing(0) + self.btn_2_layout.setObjectName(u"btn_2_layout") + self.btn_2_layout.setContentsMargins(0, 0, 0, 0) + + self.verticalLayout_2.addWidget(self.btn_2_widget) + + self.label_2 = QLabel(self.menu_2) + self.label_2.setObjectName(u"label_2") + self.label_2.setFont(font) + self.label_2.setStyleSheet(u"font-size: 16pt") + self.label_2.setAlignment(Qt.AlignCenter) + + self.verticalLayout_2.addWidget(self.label_2) + + self.label_3 = QLabel(self.menu_2) + self.label_3.setObjectName(u"label_3") + font1 = QFont() + font1.setPointSize(9) + self.label_3.setFont(font1) + self.label_3.setStyleSheet(u"font-size: 9pt") + self.label_3.setAlignment(Qt.AlignCenter) + self.label_3.setWordWrap(True) + + self.verticalLayout_2.addWidget(self.label_3) + + self.menus.addWidget(self.menu_2) + + self.main_pages_layout.addWidget(self.menus) + + + self.retranslateUi(RightColumn) + + self.menus.setCurrentIndex(1) + + + QMetaObject.connectSlotsByName(RightColumn) + # setupUi + + def retranslateUi(self, RightColumn): + RightColumn.setWindowTitle(QCoreApplication.translate("RightColumn", u"Form", None)) + self.label_1.setText(QCoreApplication.translate("RightColumn", u"Menu 1 - Right Menu", None)) + self.label_2.setText(QCoreApplication.translate("RightColumn", u"Menu 2 - Right Menu", None)) + self.label_3.setText(QCoreApplication.translate("RightColumn", u"This is just an example menu.\n" +"Add Qt Widgets or your custom widgets here.", None)) + # retranslateUi + diff --git a/gui/images/svg_icons/icon_arrow_left.svg b/gui/images/svg_icons/icon_arrow_left.svg new file mode 100644 index 0000000..6bc8f9a --- /dev/null +++ b/gui/images/svg_icons/icon_arrow_left.svg @@ -0,0 +1,61 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/gui/images/svg_icons/icon_arrow_right.svg b/gui/images/svg_icons/icon_arrow_right.svg new file mode 100644 index 0000000..4f7bac9 --- /dev/null +++ b/gui/images/svg_icons/icon_arrow_right.svg @@ -0,0 +1,61 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/gui/images/svg_icons/icon_info.svg b/gui/images/svg_icons/icon_info.svg new file mode 100644 index 0000000..cf98b18 --- /dev/null +++ b/gui/images/svg_icons/icon_info.svg @@ -0,0 +1,78 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/gui/themes/default.json b/gui/themes/default.json index fdd17d9..61aad6a 100644 --- a/gui/themes/default.json +++ b/gui/themes/default.json @@ -18,6 +18,9 @@ "text_title" : "#dce1ec", "text_foreground" : "#8a95aa", "text_description" : "#4f5b6e", - "text_active" : "#dce1ec" + "text_active" : "#dce1ec", + "white" : "#f5f6f9", + "pink" : "#ff007f", + "green" : "#00ff7f" } } \ No newline at end of file diff --git a/gui/uis/columns/left_column.ui b/gui/uis/columns/left_column.ui index d514076..cd9c761 100644 --- a/gui/uis/columns/left_column.ui +++ b/gui/uis/columns/left_column.ui @@ -30,14 +30,11 @@ 5 - + 0 - - background: lightgreen; font-size: 16pt - 5 @@ -160,6 +157,9 @@ 16 + + font-size: 16pt + Menu 1 - Left Menu @@ -171,9 +171,6 @@ - - background: lightblue; font-size: 16pt - 5 @@ -230,6 +227,9 @@ 16 + + font-size: 16pt + Menu 2 - Left Menu diff --git a/gui/uis/columns/right_column.ui b/gui/uis/columns/right_column.ui index 6711a14..8ce2983 100644 --- a/gui/uis/columns/right_column.ui +++ b/gui/uis/columns/right_column.ui @@ -30,14 +30,11 @@ 5 - + - 0 + 1 - - background: lightgreen; font-size: 16pt - 5 @@ -87,6 +84,43 @@ + + + + + 16 + + + + font-size: 16pt + + + Menu 1 - Right Menu + + + Qt::AlignCenter + + + + + + + + + 5 + + + 5 + + + 5 + + + 5 + + + 5 + @@ -120,109 +154,6 @@ - - - - - 0 - 40 - - - - - 16777215 - 40 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - - 16 - - - - Menu 1 - Right Menu - - - Qt::AlignCenter - - - - - - - - background: lightblue; font-size: 16pt - - - - 5 - - - 5 - - - 5 - - - 5 - - - 5 - - - - - - 0 - 40 - - - - - 16777215 - 40 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - @@ -230,6 +161,9 @@ 16 + + font-size: 16pt + Menu 2 - Right Menu diff --git a/gui/uis/columns/ui_left_column.py b/gui/uis/columns/ui_left_column.py index db40bef..f66f7ae 100644 --- a/gui/uis/columns/ui_left_column.py +++ b/gui/uis/columns/ui_left_column.py @@ -28,11 +28,10 @@ class Ui_LeftColumn(object): self.main_pages_layout.setSpacing(0) self.main_pages_layout.setObjectName(u"main_pages_layout") self.main_pages_layout.setContentsMargins(5, 5, 5, 5) - self.pages = QStackedWidget(LeftColumn) - self.pages.setObjectName(u"pages") + self.menus = QStackedWidget(LeftColumn) + self.menus.setObjectName(u"menus") self.menu_1 = QWidget() self.menu_1.setObjectName(u"menu_1") - self.menu_1.setStyleSheet(u"background: lightgreen; font-size: 16pt") self.verticalLayout = QVBoxLayout(self.menu_1) self.verticalLayout.setSpacing(5) self.verticalLayout.setObjectName(u"verticalLayout") @@ -75,14 +74,14 @@ class Ui_LeftColumn(object): font = QFont() font.setPointSize(16) self.label_1.setFont(font) + self.label_1.setStyleSheet(u"font-size: 16pt") self.label_1.setAlignment(Qt.AlignCenter) self.verticalLayout.addWidget(self.label_1) - self.pages.addWidget(self.menu_1) + self.menus.addWidget(self.menu_1) self.menu_2 = QWidget() self.menu_2.setObjectName(u"menu_2") - self.menu_2.setStyleSheet(u"background: lightblue; font-size: 16pt") self.verticalLayout_2 = QVBoxLayout(self.menu_2) self.verticalLayout_2.setSpacing(5) self.verticalLayout_2.setObjectName(u"verticalLayout_2") @@ -101,6 +100,7 @@ class Ui_LeftColumn(object): self.label_2 = QLabel(self.menu_2) self.label_2.setObjectName(u"label_2") self.label_2.setFont(font) + self.label_2.setStyleSheet(u"font-size: 16pt") self.label_2.setAlignment(Qt.AlignCenter) self.verticalLayout_2.addWidget(self.label_2) @@ -116,14 +116,14 @@ class Ui_LeftColumn(object): self.verticalLayout_2.addWidget(self.label_3) - self.pages.addWidget(self.menu_2) + self.menus.addWidget(self.menu_2) - self.main_pages_layout.addWidget(self.pages) + self.main_pages_layout.addWidget(self.menus) self.retranslateUi(LeftColumn) - self.pages.setCurrentIndex(0) + self.menus.setCurrentIndex(0) QMetaObject.connectSlotsByName(LeftColumn) diff --git a/gui/uis/columns/ui_right_column.py b/gui/uis/columns/ui_right_column.py index ae097b7..9e91438 100644 --- a/gui/uis/columns/ui_right_column.py +++ b/gui/uis/columns/ui_right_column.py @@ -28,11 +28,10 @@ class Ui_RightColumn(object): self.main_pages_layout.setSpacing(0) self.main_pages_layout.setObjectName(u"main_pages_layout") self.main_pages_layout.setContentsMargins(5, 5, 5, 5) - self.pages = QStackedWidget(RightColumn) - self.pages.setObjectName(u"pages") + self.menus = QStackedWidget(RightColumn) + self.menus.setObjectName(u"menus") self.menu_1 = QWidget() self.menu_1.setObjectName(u"menu_1") - self.menu_1.setStyleSheet(u"background: lightgreen; font-size: 16pt") self.verticalLayout = QVBoxLayout(self.menu_1) self.verticalLayout.setSpacing(5) self.verticalLayout.setObjectName(u"verticalLayout") @@ -48,7 +47,24 @@ class Ui_RightColumn(object): self.verticalLayout.addWidget(self.btn_1_widget) - self.btn_2_widget = QWidget(self.menu_1) + self.label_1 = QLabel(self.menu_1) + self.label_1.setObjectName(u"label_1") + font = QFont() + font.setPointSize(16) + self.label_1.setFont(font) + self.label_1.setStyleSheet(u"font-size: 16pt") + self.label_1.setAlignment(Qt.AlignCenter) + + self.verticalLayout.addWidget(self.label_1) + + self.menus.addWidget(self.menu_1) + self.menu_2 = QWidget() + self.menu_2.setObjectName(u"menu_2") + self.verticalLayout_2 = QVBoxLayout(self.menu_2) + self.verticalLayout_2.setSpacing(5) + self.verticalLayout_2.setObjectName(u"verticalLayout_2") + self.verticalLayout_2.setContentsMargins(5, 5, 5, 5) + self.btn_2_widget = QWidget(self.menu_2) self.btn_2_widget.setObjectName(u"btn_2_widget") self.btn_2_widget.setMinimumSize(QSize(0, 40)) self.btn_2_widget.setMaximumSize(QSize(16777215, 40)) @@ -57,50 +73,12 @@ class Ui_RightColumn(object): self.btn_2_layout.setObjectName(u"btn_2_layout") self.btn_2_layout.setContentsMargins(0, 0, 0, 0) - self.verticalLayout.addWidget(self.btn_2_widget) - - self.btn_3_widget = QWidget(self.menu_1) - self.btn_3_widget.setObjectName(u"btn_3_widget") - self.btn_3_widget.setMinimumSize(QSize(0, 40)) - self.btn_3_widget.setMaximumSize(QSize(16777215, 40)) - self.btn_3_layout = QVBoxLayout(self.btn_3_widget) - self.btn_3_layout.setSpacing(0) - self.btn_3_layout.setObjectName(u"btn_3_layout") - self.btn_3_layout.setContentsMargins(0, 0, 0, 0) - - self.verticalLayout.addWidget(self.btn_3_widget) - - self.label_1 = QLabel(self.menu_1) - self.label_1.setObjectName(u"label_1") - font = QFont() - font.setPointSize(16) - self.label_1.setFont(font) - self.label_1.setAlignment(Qt.AlignCenter) - - self.verticalLayout.addWidget(self.label_1) - - self.pages.addWidget(self.menu_1) - self.menu_2 = QWidget() - self.menu_2.setObjectName(u"menu_2") - self.menu_2.setStyleSheet(u"background: lightblue; font-size: 16pt") - self.verticalLayout_2 = QVBoxLayout(self.menu_2) - self.verticalLayout_2.setSpacing(5) - self.verticalLayout_2.setObjectName(u"verticalLayout_2") - self.verticalLayout_2.setContentsMargins(5, 5, 5, 5) - self.btn_4_widget = QWidget(self.menu_2) - self.btn_4_widget.setObjectName(u"btn_4_widget") - self.btn_4_widget.setMinimumSize(QSize(0, 40)) - self.btn_4_widget.setMaximumSize(QSize(16777215, 40)) - self.btn_4_layout = QVBoxLayout(self.btn_4_widget) - self.btn_4_layout.setSpacing(0) - self.btn_4_layout.setObjectName(u"btn_4_layout") - self.btn_4_layout.setContentsMargins(0, 0, 0, 0) - - self.verticalLayout_2.addWidget(self.btn_4_widget) + self.verticalLayout_2.addWidget(self.btn_2_widget) self.label_2 = QLabel(self.menu_2) self.label_2.setObjectName(u"label_2") self.label_2.setFont(font) + self.label_2.setStyleSheet(u"font-size: 16pt") self.label_2.setAlignment(Qt.AlignCenter) self.verticalLayout_2.addWidget(self.label_2) @@ -116,14 +94,14 @@ class Ui_RightColumn(object): self.verticalLayout_2.addWidget(self.label_3) - self.pages.addWidget(self.menu_2) + self.menus.addWidget(self.menu_2) - self.main_pages_layout.addWidget(self.pages) + self.main_pages_layout.addWidget(self.menus) self.retranslateUi(RightColumn) - self.pages.setCurrentIndex(0) + self.menus.setCurrentIndex(1) QMetaObject.connectSlotsByName(RightColumn) diff --git a/gui/uis/pages/main_pages.ui b/gui/uis/pages/main_pages.ui index 415e3c8..8661b2f 100644 --- a/gui/uis/pages/main_pages.ui +++ b/gui/uis/pages/main_pages.ui @@ -32,13 +32,13 @@ - 0 + 1 font-size: 14pt - + 5 @@ -145,41 +145,138 @@ - - background: lightblue; font-size: 16pt - - + + + 5 + + + 5 + + + 5 + + + 5 + + + 5 + - - - - 16 - + + + background: transparent; - - Page 2 + + QFrame::NoFrame - - Qt::AlignCenter + + Qt::ScrollBarAlwaysOff + + Qt::ScrollBarAlwaysOff + + + true + + + + + 0 + 0 + 840 + 580 + + + + background: transparent; + + + + 15 + + + 5 + + + 5 + + + 5 + + + 5 + + + + + + 16777215 + 40 + + + + + 16 + + + + font-size: 16pt + + + Custom Widgets Page + + + Qt::AlignCenter + + + + + + + Here will be all the custom widgets, they will be added over time on this page. +I will try to always record a new tutorial when adding a new Widget and updating the project on Patreon before launching on GitHub and GitHub after the public release. + + + Qt::AlignHCenter|Qt::AlignTop + + + true + + + + + + + + + + + + + + - background: pink; font-size: 16pt + QFrame { + background: lightgreen; + font-size: 16pt; + border-radius: 8px; +} - + - + 16 - Page 3 + Empty Page Qt::AlignCenter diff --git a/gui/uis/pages/ui_main_pages.py b/gui/uis/pages/ui_main_pages.py index 36e7ec8..f832c87 100644 --- a/gui/uis/pages/ui_main_pages.py +++ b/gui/uis/pages/ui_main_pages.py @@ -33,10 +33,10 @@ class Ui_MainPages(object): self.page_1 = QWidget() self.page_1.setObjectName(u"page_1") self.page_1.setStyleSheet(u"font-size: 14pt") - self.verticalLayout = QVBoxLayout(self.page_1) - self.verticalLayout.setSpacing(5) - self.verticalLayout.setObjectName(u"verticalLayout") - self.verticalLayout.setContentsMargins(5, 5, 5, 5) + self.page_1_layout = QVBoxLayout(self.page_1) + self.page_1_layout.setSpacing(5) + self.page_1_layout.setObjectName(u"page_1_layout") + self.page_1_layout.setContentsMargins(5, 5, 5, 5) self.welcome_base = QFrame(self.page_1) self.welcome_base.setObjectName(u"welcome_base") self.welcome_base.setMinimumSize(QSize(300, 150)) @@ -67,35 +67,83 @@ class Ui_MainPages(object): self.center_page_layout.addWidget(self.label) - self.verticalLayout.addWidget(self.welcome_base, 0, Qt.AlignHCenter) + self.page_1_layout.addWidget(self.welcome_base, 0, Qt.AlignHCenter) self.pages.addWidget(self.page_1) self.page_2 = QWidget() self.page_2.setObjectName(u"page_2") - self.page_2.setStyleSheet(u"background: lightblue; font-size: 16pt") - self.verticalLayout_2 = QVBoxLayout(self.page_2) - self.verticalLayout_2.setObjectName(u"verticalLayout_2") - self.label_2 = QLabel(self.page_2) - self.label_2.setObjectName(u"label_2") + self.page_2_layout = QVBoxLayout(self.page_2) + self.page_2_layout.setSpacing(5) + self.page_2_layout.setObjectName(u"page_2_layout") + self.page_2_layout.setContentsMargins(5, 5, 5, 5) + self.scroll_area = QScrollArea(self.page_2) + self.scroll_area.setObjectName(u"scroll_area") + self.scroll_area.setStyleSheet(u"background: transparent;") + self.scroll_area.setFrameShape(QFrame.NoFrame) + self.scroll_area.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) + self.scroll_area.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) + self.scroll_area.setWidgetResizable(True) + self.contents = QWidget() + self.contents.setObjectName(u"contents") + self.contents.setGeometry(QRect(0, 0, 840, 580)) + self.contents.setStyleSheet(u"background: transparent;") + self.verticalLayout = QVBoxLayout(self.contents) + self.verticalLayout.setSpacing(15) + self.verticalLayout.setObjectName(u"verticalLayout") + self.verticalLayout.setContentsMargins(5, 5, 5, 5) + self.title_label = QLabel(self.contents) + self.title_label.setObjectName(u"title_label") + self.title_label.setMaximumSize(QSize(16777215, 40)) font = QFont() font.setPointSize(16) - self.label_2.setFont(font) - self.label_2.setAlignment(Qt.AlignCenter) + self.title_label.setFont(font) + self.title_label.setStyleSheet(u"font-size: 16pt") + self.title_label.setAlignment(Qt.AlignCenter) - self.verticalLayout_2.addWidget(self.label_2) + self.verticalLayout.addWidget(self.title_label) + + self.description_label = QLabel(self.contents) + self.description_label.setObjectName(u"description_label") + self.description_label.setAlignment(Qt.AlignHCenter|Qt.AlignTop) + self.description_label.setWordWrap(True) + + self.verticalLayout.addWidget(self.description_label) + + self.row_1_layout = QHBoxLayout() + self.row_1_layout.setObjectName(u"row_1_layout") + + self.verticalLayout.addLayout(self.row_1_layout) + + self.row_2_layout = QHBoxLayout() + self.row_2_layout.setObjectName(u"row_2_layout") + + self.verticalLayout.addLayout(self.row_2_layout) + + self.row_3_layout = QHBoxLayout() + self.row_3_layout.setObjectName(u"row_3_layout") + + self.verticalLayout.addLayout(self.row_3_layout) + + self.scroll_area.setWidget(self.contents) + + self.page_2_layout.addWidget(self.scroll_area) self.pages.addWidget(self.page_2) self.page_3 = QWidget() self.page_3.setObjectName(u"page_3") - self.page_3.setStyleSheet(u"background: pink; font-size: 16pt") - self.verticalLayout_3 = QVBoxLayout(self.page_3) - self.verticalLayout_3.setObjectName(u"verticalLayout_3") - self.label_3 = QLabel(self.page_3) - self.label_3.setObjectName(u"label_3") - self.label_3.setFont(font) - self.label_3.setAlignment(Qt.AlignCenter) + self.page_3.setStyleSheet(u"QFrame {\n" +" background: lightgreen;\n" +" font-size: 16pt;\n" +" border-radius: 8px;\n" +"}") + self.page_3_layout = QVBoxLayout(self.page_3) + self.page_3_layout.setObjectName(u"page_3_layout") + self.empty_page_label = QLabel(self.page_3) + self.empty_page_label.setObjectName(u"empty_page_label") + self.empty_page_label.setFont(font) + self.empty_page_label.setAlignment(Qt.AlignCenter) - self.verticalLayout_3.addWidget(self.label_3) + self.page_3_layout.addWidget(self.empty_page_label) self.pages.addWidget(self.page_3) @@ -104,7 +152,7 @@ class Ui_MainPages(object): self.retranslateUi(MainPages) - self.pages.setCurrentIndex(0) + self.pages.setCurrentIndex(1) QMetaObject.connectSlotsByName(MainPages) @@ -113,7 +161,9 @@ class Ui_MainPages(object): def retranslateUi(self, MainPages): MainPages.setWindowTitle(QCoreApplication.translate("MainPages", u"Form", None)) self.label.setText(QCoreApplication.translate("MainPages", u"Welcome To PyOneDark GUI", None)) - self.label_2.setText(QCoreApplication.translate("MainPages", u"Page 2", None)) - self.label_3.setText(QCoreApplication.translate("MainPages", u"Page 3", None)) + self.title_label.setText(QCoreApplication.translate("MainPages", u"Custom Widgets Page", None)) + self.description_label.setText(QCoreApplication.translate("MainPages", u"Here will be all the custom widgets, they will be added over time on this page.\n" +"I will try to always record a new tutorial when adding a new Widget and updating the project on Patreon before launching on GitHub and GitHub after the public release.", None)) + self.empty_page_label.setText(QCoreApplication.translate("MainPages", u"Empty Page", None)) # retranslateUi diff --git a/gui/uis/windows/main_window/functions_main_window.py b/gui/uis/windows/main_window/functions_main_window.py index ad7d970..d527a32 100644 --- a/gui/uis/windows/main_window/functions_main_window.py +++ b/gui/uis/windows/main_window/functions_main_window.py @@ -49,7 +49,7 @@ class MainFunctions(): title, icon_path ): - self.ui.left_column.menus.pages.setCurrentWidget(menu) + self.ui.left_column.menus.menus.setCurrentWidget(menu) self.ui.left_column.title_label.setText(title) self.ui.left_column.icon.set_icon(icon_path) @@ -74,7 +74,7 @@ class MainFunctions(): # SET RIGHT COLUMN PAGES # /////////////////////////////////////////////////////////////// def set_right_column_menu(self, menu): - self.ui.right_column.pages.setCurrentWidget(menu) + self.ui.right_column.menus.setCurrentWidget(menu) # GET TITLE BUTTON BY OBJECT NAME # /////////////////////////////////////////////////////////////// diff --git a/gui/uis/windows/main_window/setup_main_window.py b/gui/uis/windows/main_window/setup_main_window.py index 793b788..acbdd33 100644 --- a/gui/uis/windows/main_window/setup_main_window.py +++ b/gui/uis/windows/main_window/setup_main_window.py @@ -67,7 +67,7 @@ class SetupMainWindow: { "btn_icon" : "icon_widgets.svg", "btn_id" : "btn_widgets", - "btn_text" : "Open Widgets", + "btn_text" : "Show Custom Widgets", "btn_tooltip" : "Show custom widgets", "show_top" : True, "is_active" : False @@ -105,7 +105,7 @@ class SetupMainWindow: "is_active" : False }, { - "btn_icon" : "icon_widgets.svg", + "btn_icon" : "icon_info.svg", "btn_id" : "btn_info", "btn_text" : "Information", "btn_tooltip" : "Open informations", @@ -215,11 +215,291 @@ class SetupMainWindow: ) MainFunctions.set_right_column_menu(self, self.ui.right_column.menu_1) - # ADD LOGO TO MAIN PAGE # /////////////////////////////////////////////////////////////// + # EXAMPLE CUSTOM WIDGETS + # Here are added the custom widgets to pages and columns that + # were created using Qt Designer. + # This is just an example and should be deleted when creating + # your application. + # /////////////////////////////////////////////////////////////// + + # LOAD SETTINGS + # /////////////////////////////////////////////////////////////// + settings = Settings() + self.settings = settings.items + + # LOAD THEME COLOR + # /////////////////////////////////////////////////////////////// + themes = Themes() + self.themes = themes.items + + # LEFT COLUMN + # /////////////////////////////////////////////////////////////// + + # BTN 1 + self.left_btn_1 = PyPushButton( + text="Btn 1", + radius=8, + color=self.themes["app_color"]["text_foreground"], + bg_color=self.themes["app_color"]["dark_one"], + bg_color_hover=self.themes["app_color"]["dark_three"], + bg_color_pressed=self.themes["app_color"]["dark_four"] + ) + self.left_btn_1.setMaximumHeight(40) + self.ui.left_column.menus.btn_1_layout.addWidget(self.left_btn_1) + + # BTN 2 + self.left_btn_2 = PyPushButton( + text="Btn With Icon", + radius=8, + color=self.themes["app_color"]["text_foreground"], + bg_color=self.themes["app_color"]["dark_one"], + bg_color_hover=self.themes["app_color"]["dark_three"], + bg_color_pressed=self.themes["app_color"]["dark_four"] + ) + self.icon = QIcon(Functions.set_svg_icon("icon_settings.svg")) + self.left_btn_2.setIcon(self.icon) + self.left_btn_2.setMaximumHeight(40) + self.ui.left_column.menus.btn_2_layout.addWidget(self.left_btn_2) + + # BTN 3 - Default QPushButton + self.left_btn_3 = QPushButton("Default QPushButton") + self.left_btn_3.setMaximumHeight(40) + self.ui.left_column.menus.btn_3_layout.addWidget(self.left_btn_3) + + # PAGES + # /////////////////////////////////////////////////////////////// + + # PAGE 1 - ADD LOGO TO MAIN PAGE self.logo_svg = QSvgWidget(Functions.set_svg_image("logo_home.svg")) self.ui.load_pages.logo_layout.addWidget(self.logo_svg, Qt.AlignCenter, Qt.AlignCenter) + # PAGE 2 + # CIRCULAR PROGRESS 1 + self.circular_progress_1 = PyCircularProgress( + value = 80, + progress_color = self.themes["app_color"]["context_color"], + text_color = self.themes["app_color"]["text_title"], + font_size = 14, + bg_color = self.themes["app_color"]["dark_four"] + ) + self.circular_progress_1.setFixedSize(200,200) + + # CIRCULAR PROGRESS 2 + self.circular_progress_2 = PyCircularProgress( + value = 45, + progress_width = 4, + progress_color = self.themes["app_color"]["context_color"], + text_color = self.themes["app_color"]["context_color"], + font_size = 14, + bg_color = self.themes["app_color"]["bg_three"] + ) + self.circular_progress_2.setFixedSize(160,160) + + # CIRCULAR PROGRESS 3 + self.circular_progress_3 = PyCircularProgress( + value = 75, + progress_width = 2, + progress_color = self.themes["app_color"]["pink"], + text_color = self.themes["app_color"]["white"], + font_size = 14, + bg_color = self.themes["app_color"]["bg_three"] + ) + self.circular_progress_3.setFixedSize(140,140) + + # PY SLIDER 1 + self.vertical_slider_1 = PySlider( + margin=8, + bg_size=10, + bg_radius=5, + handle_margin=-3, + handle_size=16, + handle_radius=8, + bg_color = self.themes["app_color"]["dark_three"], + bg_color_hover = self.themes["app_color"]["dark_four"], + handle_color = self.themes["app_color"]["context_color"], + handle_color_hover = self.themes["app_color"]["context_hover"], + handle_color_pressed = self.themes["app_color"]["context_pressed"] + ) + self.vertical_slider_1.setMinimumHeight(100) + + # PY SLIDER 2 + self.vertical_slider_2 = PySlider( + bg_color = self.themes["app_color"]["dark_three"], + bg_color_hover = self.themes["app_color"]["dark_three"], + handle_color = self.themes["app_color"]["context_color"], + handle_color_hover = self.themes["app_color"]["context_hover"], + handle_color_pressed = self.themes["app_color"]["context_pressed"] + ) + self.vertical_slider_2.setMinimumHeight(100) + + # PY SLIDER 3 + self.vertical_slider_3 = PySlider( + margin=8, + bg_size=10, + bg_radius=5, + handle_margin=-3, + handle_size=16, + handle_radius=8, + bg_color = self.themes["app_color"]["dark_three"], + bg_color_hover = self.themes["app_color"]["dark_four"], + handle_color = self.themes["app_color"]["context_color"], + handle_color_hover = self.themes["app_color"]["context_hover"], + handle_color_pressed = self.themes["app_color"]["context_pressed"] + ) + self.vertical_slider_3.setOrientation(Qt.Horizontal) + self.vertical_slider_3.setMaximumWidth(200) + + # PY SLIDER 4 + self.vertical_slider_4 = PySlider( + bg_color = self.themes["app_color"]["dark_three"], + bg_color_hover = self.themes["app_color"]["dark_three"], + handle_color = self.themes["app_color"]["context_color"], + handle_color_hover = self.themes["app_color"]["context_hover"], + handle_color_pressed = self.themes["app_color"]["context_pressed"] + ) + self.vertical_slider_4.setOrientation(Qt.Horizontal) + self.vertical_slider_4.setMaximumWidth(200) + + # ICON BUTTON 1 + self.icon_button_1 = PyIconButton( + icon_path = Functions.set_svg_icon("icon_heart.svg"), + parent = self, + app_parent = self.ui.central_widget, + tooltip_text = "Icon button - Heart", + width = 40, + height = 40, + radius = 20, + dark_one = self.themes["app_color"]["dark_one"], + icon_color = self.themes["app_color"]["icon_color"], + icon_color_hover = self.themes["app_color"]["icon_hover"], + icon_color_pressed = self.themes["app_color"]["icon_active"], + icon_color_active = self.themes["app_color"]["icon_active"], + bg_color = self.themes["app_color"]["dark_one"], + bg_color_hover = self.themes["app_color"]["dark_three"], + bg_color_pressed = self.themes["app_color"]["pink"] + ) + + # ICON BUTTON 2 + self.icon_button_2 = PyIconButton( + icon_path = Functions.set_svg_icon("icon_add_user.svg"), + parent = self, + app_parent = self.ui.central_widget, + tooltip_text = "BTN with tooltip", + width = 40, + height = 40, + radius = 8, + dark_one = self.themes["app_color"]["dark_one"], + icon_color = self.themes["app_color"]["icon_color"], + icon_color_hover = self.themes["app_color"]["icon_hover"], + icon_color_pressed = self.themes["app_color"]["white"], + icon_color_active = self.themes["app_color"]["icon_active"], + bg_color = self.themes["app_color"]["dark_one"], + bg_color_hover = self.themes["app_color"]["dark_three"], + bg_color_pressed = self.themes["app_color"]["green"], + ) + + # ICON BUTTON 3 + self.icon_button_3 = PyIconButton( + icon_path = Functions.set_svg_icon("icon_add_user.svg"), + parent = self, + app_parent = self.ui.central_widget, + tooltip_text = "BTN actived! (is_actived = True)", + width = 40, + height = 40, + radius = 8, + dark_one = self.themes["app_color"]["dark_one"], + icon_color = self.themes["app_color"]["icon_color"], + icon_color_hover = self.themes["app_color"]["icon_hover"], + icon_color_pressed = self.themes["app_color"]["white"], + icon_color_active = self.themes["app_color"]["icon_active"], + bg_color = self.themes["app_color"]["dark_one"], + bg_color_hover = self.themes["app_color"]["dark_three"], + bg_color_pressed = self.themes["app_color"]["context_color"], + is_active = True + ) + + # PUSH BUTTON 1 + self.push_button_1 = PyPushButton( + text = "Button Without Icon", + radius =8, + color = self.themes["app_color"]["text_foreground"], + bg_color = self.themes["app_color"]["dark_one"], + bg_color_hover = self.themes["app_color"]["dark_three"], + bg_color_pressed = self.themes["app_color"]["dark_four"] + ) + self.push_button_1.setMinimumHeight(40) + + # PUSH BUTTON 2 + self.push_button_2 = PyPushButton( + text = "Button With Icon", + radius = 8, + color = self.themes["app_color"]["text_foreground"], + bg_color = self.themes["app_color"]["dark_one"], + bg_color_hover = self.themes["app_color"]["dark_three"], + bg_color_pressed = self.themes["app_color"]["dark_four"] + ) + self.icon_2 = QIcon(Functions.set_svg_icon("icon_settings.svg")) + self.push_button_2.setMinimumHeight(40) + self.push_button_2.setIcon(self.icon_2) + + # ADD WIDGETS + self.ui.load_pages.row_1_layout.addWidget(self.circular_progress_1) + self.ui.load_pages.row_1_layout.addWidget(self.circular_progress_2) + self.ui.load_pages.row_1_layout.addWidget(self.circular_progress_3) + self.ui.load_pages.row_2_layout.addWidget(self.vertical_slider_1) + self.ui.load_pages.row_2_layout.addWidget(self.vertical_slider_2) + self.ui.load_pages.row_2_layout.addWidget(self.vertical_slider_3) + self.ui.load_pages.row_2_layout.addWidget(self.vertical_slider_4) + self.ui.load_pages.row_3_layout.addWidget(self.icon_button_1) + self.ui.load_pages.row_3_layout.addWidget(self.icon_button_2) + self.ui.load_pages.row_3_layout.addWidget(self.icon_button_3) + self.ui.load_pages.row_3_layout.addWidget(self.push_button_1) + self.ui.load_pages.row_3_layout.addWidget(self.push_button_2) + + # RIGHT COLUMN + # /////////////////////////////////////////////////////////////// + + # BTN 1 + self.right_btn_1 = PyPushButton( + text="Show Menu 2", + radius=8, + color=self.themes["app_color"]["text_foreground"], + bg_color=self.themes["app_color"]["dark_one"], + bg_color_hover=self.themes["app_color"]["dark_three"], + bg_color_pressed=self.themes["app_color"]["dark_four"] + ) + self.icon_right = QIcon(Functions.set_svg_icon("icon_arrow_right.svg")) + self.right_btn_1.setIcon(self.icon_right) + self.right_btn_1.setMaximumHeight(40) + self.right_btn_1.clicked.connect(lambda: MainFunctions.set_right_column_menu( + self, + self.ui.right_column.menu_2 + )) + self.ui.right_column.btn_1_layout.addWidget(self.right_btn_1) + + # BTN 2 + self.right_btn_2 = PyPushButton( + text="Show Menu 1", + radius=8, + color=self.themes["app_color"]["text_foreground"], + bg_color=self.themes["app_color"]["dark_one"], + bg_color_hover=self.themes["app_color"]["dark_three"], + bg_color_pressed=self.themes["app_color"]["dark_four"] + ) + self.icon_left = QIcon(Functions.set_svg_icon("icon_arrow_left.svg")) + self.right_btn_2.setIcon(self.icon_left) + self.right_btn_2.setMaximumHeight(40) + self.right_btn_2.clicked.connect(lambda: MainFunctions.set_right_column_menu( + self, + self.ui.right_column.menu_1 + )) + self.ui.right_column.btn_2_layout.addWidget(self.right_btn_2) + + # /////////////////////////////////////////////////////////////// + # END - EXAMPLE CUSTOM WIDGETS + # /////////////////////////////////////////////////////////////// + # RESIZE GRIPS AND CHANGE POSITION # Resize or change position when window is resized # /////////////////////////////////////////////////////////////// diff --git a/gui/widgets/__init__.py b/gui/widgets/__init__.py index 087aed5..edbb386 100644 --- a/gui/widgets/__init__.py +++ b/gui/widgets/__init__.py @@ -40,4 +40,24 @@ from . py_title_bar import PyTitleBar # PY CREDITS # /////////////////////////////////////////////////////////////// -from . py_credits_bar import PyCredits \ No newline at end of file +from . py_credits_bar import PyCredits + +# PY PUSH BUTTON +# /////////////////////////////////////////////////////////////// +from . py_push_button import PyPushButton + +# PY TOGGLE +# /////////////////////////////////////////////////////////////// +from . py_toggle import PyToggle + +# PY SLIDER +# /////////////////////////////////////////////////////////////// +from . py_slider import PySlider + +# PY CIRCULAR PROGRESS +# /////////////////////////////////////////////////////////////// +from . py_circular_progress import PyCircularProgress + +# PY ICON BUTTON +# /////////////////////////////////////////////////////////////// +from . py_icon_button import PyIconButton \ No newline at end of file diff --git a/gui/widgets/py_circular_progress/__init__.py b/gui/widgets/py_circular_progress/__init__.py new file mode 100644 index 0000000..a9b7346 --- /dev/null +++ b/gui/widgets/py_circular_progress/__init__.py @@ -0,0 +1,19 @@ +# /////////////////////////////////////////////////////////////// +# +# BY: WANDERSON M.PIMENTA +# PROJECT MADE WITH: Qt Designer and PySide6 +# V: 1.0.0 +# +# This project can be used freely for all uses, as long as they maintain the +# respective credits only in the Python scripts, any information in the visual +# interface (GUI) can be modified without any implication. +# +# There are limitations on Qt licenses if you want to use your products +# commercially, I recommend reading them on the official website: +# https://doc.qt.io/qtforpython/licenses.html +# +# /////////////////////////////////////////////////////////////// + +# PY TITLE BAR +# /////////////////////////////////////////////////////////////// +from . py_circular_progress import PyCircularProgress \ No newline at end of file diff --git a/gui/widgets/py_circular_progress/py_circular_progress.py b/gui/widgets/py_circular_progress/py_circular_progress.py new file mode 100644 index 0000000..e667f54 --- /dev/null +++ b/gui/widgets/py_circular_progress/py_circular_progress.py @@ -0,0 +1,114 @@ +# /////////////////////////////////////////////////////////////// +# +# BY: WANDERSON M.PIMENTA +# PROJECT MADE WITH: Qt Designer and PySide6 +# V: 1.0.0 +# +# This project can be used freely for all uses, as long as they maintain the +# respective credits only in the Python scripts, any information in the visual +# interface (GUI) can be modified without any implication. +# +# There are limitations on Qt licenses if you want to use your products +# commercially, I recommend reading them on the official website: +# https://doc.qt.io/qtforpython/licenses.html +# +# /////////////////////////////////////////////////////////////// + +# IMPORT QT CORE +# /////////////////////////////////////////////////////////////// +from qt_core import * + +class PyCircularProgress(QWidget): + def __init__( + self, + value = 0, + progress_width = 10, + is_rounded = True, + max_value = 100, + progress_color = "#ff79c6", + enable_text = True, + font_family = "Segoe UI", + font_size = 12, + suffix = "%", + text_color = "#ff79c6", + enable_bg = True, + bg_color = "#44475a" + ): + QWidget.__init__(self) + + # CUSTOM PROPERTIES + self.value = value + self.progress_width = progress_width + self.progress_rounded_cap = is_rounded + self.max_value = max_value + self.progress_color = progress_color + # Text + self.enable_text = enable_text + self.font_family = font_family + self.font_size = font_size + self.suffix = suffix + self.text_color = text_color + # BG + self.enable_bg = enable_bg + self.bg_color = bg_color + + # ADD DROPSHADOW + def add_shadow(self, enable): + if enable: + self.shadow = QGraphicsDropShadowEffect(self) + self.shadow.setBlurRadius(15) + self.shadow.setXOffset(0) + self.shadow.setYOffset(0) + self.shadow.setColor(QColor(0, 0, 0, 80)) + self.setGraphicsEffect(self.shadow) + + # SET VALUE + def set_value(self, value): + self.value = value + self.repaint() # Render progress bar after change value + + + # PAINT EVENT (DESIGN YOUR CIRCULAR PROGRESS HERE) + def paintEvent(self, e): + # SET PROGRESS PARAMETERS + width = self.width() - self.progress_width + height = self.height() - self.progress_width + margin = self.progress_width / 2 + value = self.value * 360 / self.max_value + + # PAINTER + paint = QPainter() + paint.begin(self) + paint.setRenderHint(QPainter.Antialiasing) # remove pixelated edges + paint.setFont(QFont(self.font_family, self.font_size)) + + # CREATE RECTANGLE + rect = QRect(0, 0, self.width(), self.height()) + paint.setPen(Qt.NoPen) + + # PEN + pen = QPen() + pen.setWidth(self.progress_width) + # Set Round Cap + if self.progress_rounded_cap: + pen.setCapStyle(Qt.RoundCap) + + # ENABLE BG + if self.enable_bg: + pen.setColor(QColor(self.bg_color)) + paint.setPen(pen) + paint.drawArc(margin, margin, width, height, 0, 360 * 16) + + # CREATE ARC / CIRCULAR PROGRESS + pen.setColor(QColor(self.progress_color)) + paint.setPen(pen) + paint.drawArc(margin, margin, width, height, -90 * 16, -value * 16) + + # CREATE TEXT + if self.enable_text: + pen.setColor(QColor(self.text_color)) + paint.setPen(pen) + paint.drawText(rect, Qt.AlignCenter, f"{self.value}{self.suffix}") + + # END + paint.end() \ No newline at end of file diff --git a/gui/widgets/py_icon_button/__init__.py b/gui/widgets/py_icon_button/__init__.py new file mode 100644 index 0000000..cb6fe88 --- /dev/null +++ b/gui/widgets/py_icon_button/__init__.py @@ -0,0 +1,19 @@ +# /////////////////////////////////////////////////////////////// +# +# BY: WANDERSON M.PIMENTA +# PROJECT MADE WITH: Qt Designer and PySide6 +# V: 1.0.0 +# +# This project can be used freely for all uses, as long as they maintain the +# respective credits only in the Python scripts, any information in the visual +# interface (GUI) can be modified without any implication. +# +# There are limitations on Qt licenses if you want to use your products +# commercially, I recommend reading them on the official website: +# https://doc.qt.io/qtforpython/licenses.html +# +# /////////////////////////////////////////////////////////////// + +# PY ICON BUTTON +# /////////////////////////////////////////////////////////////// +from . py_icon_button import PyIconButton \ No newline at end of file diff --git a/gui/widgets/py_icon_button/py_icon_button.py b/gui/widgets/py_icon_button/py_icon_button.py new file mode 100644 index 0000000..76a6d61 --- /dev/null +++ b/gui/widgets/py_icon_button/py_icon_button.py @@ -0,0 +1,268 @@ +# /////////////////////////////////////////////////////////////// +# +# BY: WANDERSON M.PIMENTA +# PROJECT MADE WITH: Qt Designer and PySide6 +# V: 1.0.0 +# +# This project can be used freely for all uses, as long as they maintain the +# respective credits only in the Python scripts, any information in the visual +# interface (GUI) can be modified without any implication. +# +# There are limitations on Qt licenses if you want to use your products +# commercially, I recommend reading them on the official website: +# https://doc.qt.io/qtforpython/licenses.html +# +# /////////////////////////////////////////////////////////////// + +# IMPORT QT CORE +# /////////////////////////////////////////////////////////////// +from qt_core import * + +# PY TITLE BUTTON +# /////////////////////////////////////////////////////////////// +class PyIconButton(QPushButton): + def __init__( + self, + icon_path = None, + parent = None, + app_parent = None, + tooltip_text = "", + btn_id = None, + width = 30, + height = 30, + radius = 8, + bg_color = "#343b48", + bg_color_hover = "#3c4454", + bg_color_pressed = "#2c313c", + icon_color = "#c3ccdf", + icon_color_hover = "#dce1ec", + icon_color_pressed = "#edf0f5", + icon_color_active = "#f5f6f9", + dark_one = "#1b1e23", + text_foreground = "#8a95aa", + context_color = "#568af2", + top_margin = 40, + is_active = False + ): + super().__init__() + + # SET DEFAULT PARAMETERS + self.setFixedSize(width, height) + self.setCursor(Qt.PointingHandCursor) + self.setObjectName(btn_id) + + # PROPERTIES + self._bg_color = bg_color + self._bg_color_hover = bg_color_hover + self._bg_color_pressed = bg_color_pressed + self._icon_color = icon_color + self._icon_color_hover = icon_color_hover + self._icon_color_pressed = icon_color_pressed + self._icon_color_active = icon_color_active + self._context_color = context_color + self._top_margin = top_margin + self._is_active = is_active + # Set Parameters + self._set_bg_color = bg_color + self._set_icon_path = icon_path + self._set_icon_color = icon_color + self._set_border_radius = radius + # Parent + self._parent = parent + self._app_parent = app_parent + + # TOOLTIP + self._tooltip_text = tooltip_text + self._tooltip = _ToolTip( + app_parent, + tooltip_text, + dark_one, + text_foreground + ) + self._tooltip.hide() + + # SET ACTIVE MENU + # /////////////////////////////////////////////////////////////// + def set_active(self, is_active): + self._is_active = is_active + self.repaint() + + # RETURN IF IS ACTIVE MENU + # /////////////////////////////////////////////////////////////// + def is_active(self): + return self._is_active + + # PAINT EVENT + # painting the button and the icon + # /////////////////////////////////////////////////////////////// + def paintEvent(self, event): + # PAINTER + paint = QPainter() + paint.begin(self) + paint.setRenderHint(QPainter.RenderHint.Antialiasing) + + if self._is_active: + # BRUSH + brush = QBrush(QColor(self._context_color)) + else: + # BRUSH + brush = QBrush(QColor(self._set_bg_color)) + + # CREATE RECTANGLE + rect = QRect(0, 0, self.width(), self.height()) + paint.setPen(Qt.NoPen) + paint.setBrush(brush) + paint.drawRoundedRect( + rect, + self._set_border_radius, + self._set_border_radius + ) + + # DRAW ICONS + self.icon_paint(paint, self._set_icon_path, rect) + + # END PAINTER + paint.end() + + # CHANGE STYLES + # Functions with custom styles + # /////////////////////////////////////////////////////////////// + def change_style(self, event): + if event == QEvent.Enter: + self._set_bg_color = self._bg_color_hover + self._set_icon_color = self._icon_color_hover + self.repaint() + elif event == QEvent.Leave: + self._set_bg_color = self._bg_color + self._set_icon_color = self._icon_color + self.repaint() + elif event == QEvent.MouseButtonPress: + self._set_bg_color = self._bg_color_pressed + self._set_icon_color = self._icon_color_pressed + self.repaint() + elif event == QEvent.MouseButtonRelease: + self._set_bg_color = self._bg_color_hover + self._set_icon_color = self._icon_color_hover + self.repaint() + + # MOUSE OVER + # Event triggered when the mouse is over the BTN + # /////////////////////////////////////////////////////////////// + def enterEvent(self, event): + self.change_style(QEvent.Enter) + self.move_tooltip() + self._tooltip.show() + + # MOUSE LEAVE + # Event fired when the mouse leaves the BTN + # /////////////////////////////////////////////////////////////// + def leaveEvent(self, event): + self.change_style(QEvent.Leave) + self.move_tooltip() + self._tooltip.hide() + + # MOUSE PRESS + # Event triggered when the left button is pressed + # /////////////////////////////////////////////////////////////// + def mousePressEvent(self, event): + if event.button() == Qt.LeftButton: + self.change_style(QEvent.MouseButtonPress) + # SET FOCUS + self.setFocus() + # EMIT SIGNAL + return self.clicked.emit() + + # MOUSE RELEASED + # Event triggered after the mouse button is released + # /////////////////////////////////////////////////////////////// + def mouseReleaseEvent(self, event): + if event.button() == Qt.LeftButton: + self.change_style(QEvent.MouseButtonRelease) + # EMIT SIGNAL + return self.released.emit() + + # DRAW ICON WITH COLORS + # /////////////////////////////////////////////////////////////// + def icon_paint(self, qp, image, rect): + icon = QPixmap(image) + painter = QPainter(icon) + painter.setCompositionMode(QPainter.CompositionMode_SourceIn) + if self._is_active: + painter.fillRect(icon.rect(), self._icon_color_active) + else: + painter.fillRect(icon.rect(), self._set_icon_color) + qp.drawPixmap( + (rect.width() - icon.width()) / 2, + (rect.height() - icon.height()) / 2, + icon + ) + painter.end() + + # SET ICON + # /////////////////////////////////////////////////////////////// + def set_icon(self, icon_path): + self._set_icon_path = icon_path + self.repaint() + + # MOVE TOOLTIP + # /////////////////////////////////////////////////////////////// + def move_tooltip(self): + # GET MAIN WINDOW PARENT + gp = self.mapToGlobal(QPoint(0, 0)) + + # SET WIDGET TO GET POSTION + # Return absolute position of widget inside app + pos = self._parent.mapFromGlobal(gp) + + # FORMAT POSITION + # Adjust tooltip position with offset + pos_x = (pos.x() - (self._tooltip.width() // 2)) + (self.width() // 2) + pos_y = pos.y() - self._top_margin + + # SET POSITION TO WIDGET + # Move tooltip position + self._tooltip.move(pos_x, pos_y) + +# TOOLTIP +# /////////////////////////////////////////////////////////////// +class _ToolTip(QLabel): + # TOOLTIP / LABEL StyleSheet + style_tooltip = """ + QLabel {{ + background-color: {_dark_one}; + color: {_text_foreground}; + padding-left: 10px; + padding-right: 10px; + border-radius: 17px; + border: 0px solid transparent; + font: 800 9pt "Segoe UI"; + }} + """ + def __init__( + self, + parent, + tooltip, + dark_one, + text_foreground + ): + QLabel.__init__(self) + + # LABEL SETUP + style = self.style_tooltip.format( + _dark_one = dark_one, + _text_foreground = text_foreground + ) + self.setObjectName(u"label_tooltip") + self.setStyleSheet(style) + self.setMinimumHeight(34) + self.setParent(parent) + self.setText(tooltip) + self.adjustSize() + + # SET DROP SHADOW + self.shadow = QGraphicsDropShadowEffect(self) + self.shadow.setBlurRadius(30) + self.shadow.setXOffset(0) + self.shadow.setYOffset(0) + self.shadow.setColor(QColor(0, 0, 0, 80)) + self.setGraphicsEffect(self.shadow) diff --git a/gui/widgets/py_push_button/__init__.py b/gui/widgets/py_push_button/__init__.py new file mode 100644 index 0000000..9467b6a --- /dev/null +++ b/gui/widgets/py_push_button/__init__.py @@ -0,0 +1,19 @@ +# /////////////////////////////////////////////////////////////// +# +# BY: WANDERSON M.PIMENTA +# PROJECT MADE WITH: Qt Designer and PySide6 +# V: 1.0.0 +# +# This project can be used freely for all uses, as long as they maintain the +# respective credits only in the Python scripts, any information in the visual +# interface (GUI) can be modified without any implication. +# +# There are limitations on Qt licenses if you want to use your products +# commercially, I recommend reading them on the official website: +# https://doc.qt.io/qtforpython/licenses.html +# +# /////////////////////////////////////////////////////////////// + +# PY PUSH BUTTON +# /////////////////////////////////////////////////////////////// +from . py_push_button import PyPushButton \ No newline at end of file diff --git a/gui/widgets/py_push_button/py_push_button.py b/gui/widgets/py_push_button/py_push_button.py new file mode 100644 index 0000000..4783ab7 --- /dev/null +++ b/gui/widgets/py_push_button/py_push_button.py @@ -0,0 +1,71 @@ +# /////////////////////////////////////////////////////////////// +# +# BY: WANDERSON M.PIMENTA +# PROJECT MADE WITH: Qt Designer and PySide6 +# V: 1.0.0 +# +# This project can be used freely for all uses, as long as they maintain the +# respective credits only in the Python scripts, any information in the visual +# interface (GUI) can be modified without any implication. +# +# There are limitations on Qt licenses if you want to use your products +# commercially, I recommend reading them on the official website: +# https://doc.qt.io/qtforpython/licenses.html +# +# /////////////////////////////////////////////////////////////// + +# IMPORT QT CORE +# /////////////////////////////////////////////////////////////// +from qt_core import * + +# STYLE +# /////////////////////////////////////////////////////////////// +style = ''' +QPushButton {{ + border: none; + padding-left: 10px; + padding-right: 5px; + color: {_color}; + border-radius: {_radius}; + background-color: {_bg_color}; +}} +QPushButton:hover {{ + background-color: {_bg_color_hover}; +}} +QPushButton:pressed {{ + background-color: {_bg_color_pressed}; +}} +''' + +# PY PUSH BUTTON +# /////////////////////////////////////////////////////////////// +class PyPushButton(QPushButton): + def __init__( + self, + text, + radius, + color, + bg_color, + bg_color_hover, + bg_color_pressed, + parent = None, + ): + super().__init__() + + # SET PARAMETRES + self.setText(text) + if parent != None: + self.setParent(parent) + self.setCursor(Qt.PointingHandCursor) + + # SET STYLESHEET + custom_style = style.format( + _color = color, + _radius = radius, + _bg_color = bg_color, + _bg_color_hover = bg_color_hover, + _bg_color_pressed = bg_color_pressed + ) + self.setStyleSheet(custom_style) + + \ No newline at end of file diff --git a/gui/widgets/py_slider/__init__.py b/gui/widgets/py_slider/__init__.py new file mode 100644 index 0000000..2ba529d --- /dev/null +++ b/gui/widgets/py_slider/__init__.py @@ -0,0 +1,19 @@ +# /////////////////////////////////////////////////////////////// +# +# BY: WANDERSON M.PIMENTA +# PROJECT MADE WITH: Qt Designer and PySide6 +# V: 1.0.0 +# +# This project can be used freely for all uses, as long as they maintain the +# respective credits only in the Python scripts, any information in the visual +# interface (GUI) can be modified without any implication. +# +# There are limitations on Qt licenses if you want to use your products +# commercially, I recommend reading them on the official website: +# https://doc.qt.io/qtforpython/licenses.html +# +# /////////////////////////////////////////////////////////////// + +# PY SLIDER +# /////////////////////////////////////////////////////////////// +from . py_slider import PySlider \ No newline at end of file diff --git a/gui/widgets/py_slider/py_slider.py b/gui/widgets/py_slider/py_slider.py new file mode 100644 index 0000000..7ef65cd --- /dev/null +++ b/gui/widgets/py_slider/py_slider.py @@ -0,0 +1,97 @@ +# /////////////////////////////////////////////////////////////// +# +# BY: WANDERSON M.PIMENTA +# PROJECT MADE WITH: Qt Designer and PySide6 +# V: 1.0.0 +# +# This project can be used freely for all uses, as long as they maintain the +# respective credits only in the Python scripts, any information in the visual +# interface (GUI) can be modified without any implication. +# +# There are limitations on Qt licenses if you want to use your products +# commercially, I recommend reading them on the official website: +# https://doc.qt.io/qtforpython/licenses.html +# +# /////////////////////////////////////////////////////////////// + +# IMPORT QT CORE +# /////////////////////////////////////////////////////////////// +from qt_core import * + +style = """ +/* HORIZONTAL */ +QSlider {{ margin: {_margin}px; }} +QSlider::groove:horizontal {{ + border-radius: {_bg_radius}px; + height: {_bg_size}px; + margin: 0px; + background-color: {_bg_color}; +}} +QSlider::groove:horizontal:hover {{ background-color: {_bg_color_hover}; }} +QSlider::handle:horizontal {{ + border: none; + height: {_handle_size}px; + width: {_handle_size}px; + margin: {_handle_margin}px; + border-radius: {_handle_radius}px; + background-color: {_handle_color}; +}} +QSlider::handle:horizontal:hover {{ background-color: {_handle_color_hover}; }} +QSlider::handle:horizontal:pressed {{ background-color: {_handle_color_pressed}; }} + +/* VERTICAL */ +QSlider::groove:vertical {{ + border-radius: {_bg_radius}px; + width: {_bg_size}px; + margin: 0px; + background-color: {_bg_color}; +}} +QSlider::groove:vertical:hover {{ background-color: {_bg_color_hover}; }} +QSlider::handle:vertical {{ + border: none; + height: {_handle_size}px; + width: {_handle_size}px; + margin: {_handle_margin}px; + border-radius: {_handle_radius}px; + background-color: {_handle_color}; +}} +QSlider::handle:vertical:hover {{ background-color: {_handle_color_hover}; }} +QSlider::handle:vertical:pressed {{ background-color: {_handle_color_pressed}; }} +""" + +class PySlider(QSlider): + def __init__( + self, + margin = 0, + bg_size = 20, + bg_radius = 10, + bg_color = "#1b1e23", + bg_color_hover = "#1e2229", + handle_margin = 2, + handle_size = 16, + handle_radius = 8, + handle_color = "#568af2", + handle_color_hover = "#6c99f4", + handle_color_pressed = "#3f6fd1" + ): + super(PySlider, self).__init__() + + # FORMAT STYLE + # /////////////////////////////////////////////////////////////// + adjust_style = style.format( + _margin = margin, + _bg_size = bg_size, + _bg_radius = bg_radius, + _bg_color = bg_color, + _bg_color_hover = bg_color_hover, + _handle_margin = handle_margin, + _handle_size = handle_size, + _handle_radius = handle_radius, + _handle_color = handle_color, + _handle_color_hover = handle_color_hover, + _handle_color_pressed = handle_color_pressed + ) + + # APPLY CUSTOM STYLE + # /////////////////////////////////////////////////////////////// + self.setStyleSheet(adjust_style) \ No newline at end of file diff --git a/gui/widgets/py_title_bar/py_title_bar.py b/gui/widgets/py_title_bar/py_title_bar.py index ebfdd76..4d951b5 100644 --- a/gui/widgets/py_title_bar/py_title_bar.py +++ b/gui/widgets/py_title_bar/py_title_bar.py @@ -16,7 +16,6 @@ # IMPORT QT CORE # /////////////////////////////////////////////////////////////// -from PySide6 import QtSvgWidgets from qt_core import * # IMPORT FUNCTIONS diff --git a/gui/widgets/py_title_bar/py_title_button.py b/gui/widgets/py_title_bar/py_title_button.py index dcc949f..42c5131 100644 --- a/gui/widgets/py_title_bar/py_title_button.py +++ b/gui/widgets/py_title_bar/py_title_button.py @@ -103,7 +103,7 @@ class PyTitleButton(QPushButton): if self._is_active: # BRUSH - brush = QBrush(QColor(self._bg_color_pressed)) + brush = QBrush(QColor(self._context_color)) else: # BRUSH brush = QBrush(QColor(self._set_bg_color)) @@ -188,7 +188,7 @@ class PyTitleButton(QPushButton): painter = QPainter(icon) painter.setCompositionMode(QPainter.CompositionMode_SourceIn) if self._is_active: - painter.fillRect(icon.rect(), self._context_color) + painter.fillRect(icon.rect(), self._icon_color_active) else: painter.fillRect(icon.rect(), self._set_icon_color) qp.drawPixmap( diff --git a/gui/widgets/py_toggle/__init__.py b/gui/widgets/py_toggle/__init__.py new file mode 100644 index 0000000..1f0b5af --- /dev/null +++ b/gui/widgets/py_toggle/__init__.py @@ -0,0 +1,19 @@ +# /////////////////////////////////////////////////////////////// +# +# BY: WANDERSON M.PIMENTA +# PROJECT MADE WITH: Qt Designer and PySide6 +# V: 1.0.0 +# +# This project can be used freely for all uses, as long as they maintain the +# respective credits only in the Python scripts, any information in the visual +# interface (GUI) can be modified without any implication. +# +# There are limitations on Qt licenses if you want to use your products +# commercially, I recommend reading them on the official website: +# https://doc.qt.io/qtforpython/licenses.html +# +# /////////////////////////////////////////////////////////////// + +# PY PUSH BUTTON +# /////////////////////////////////////////////////////////////// +from . py_toggle import PyToggle \ No newline at end of file diff --git a/gui/widgets/py_toggle/py_toggle.py b/gui/widgets/py_toggle/py_toggle.py new file mode 100644 index 0000000..b9bead5 --- /dev/null +++ b/gui/widgets/py_toggle/py_toggle.py @@ -0,0 +1,89 @@ +# /////////////////////////////////////////////////////////////// +# +# BY: WANDERSON M.PIMENTA +# PROJECT MADE WITH: Qt Designer and PySide6 +# V: 1.0.0 +# +# This project can be used freely for all uses, as long as they maintain the +# respective credits only in the Python scripts, any information in the visual +# interface (GUI) can be modified without any implication. +# +# There are limitations on Qt licenses if you want to use your products +# commercially, I recommend reading them on the official website: +# https://doc.qt.io/qtforpython/licenses.html +# +# /////////////////////////////////////////////////////////////// + +# IMPORT QT CORE +# /////////////////////////////////////////////////////////////// +from qt_core import * + +class PyToggle(QCheckBox): + def __init__( + self, + width = 50, + bg_color = "#777", + circle_color = "#DDD", + active_color = "#00BCFF", + animation_curve = QEasingCurve.OutBounce + ): + QCheckBox.__init__(self) + self.setFixedSize(width, 28) + self.setCursor(Qt.PointingHandCursor) + + # COLORS + self._bg_color = bg_color + self._circle_color = circle_color + self._active_color = active_color + + self._position = 3 + self.animation = QPropertyAnimation(self, b"position") + self.animation.setEasingCurve(animation_curve) + self.animation.setDuration(500) + self.stateChanged.connect(self.setup_animation) + + @Property(float) + def position(self): + return self._position + + @position.setter + def position(self, pos): + self._position = pos + self.update() + + # START STOP ANIMATION + def setup_animation(self, value): + self.animation.stop() + if value: + self.animation.setEndValue(self.width() - 26) + else: + self.animation.setEndValue(4) + self.animation.start() + print(f"Status: {self.isChecked()}") + + def hitButton(self, pos: QPoint): + return self.contentsRect().contains(pos) + + def paintEvent(self, e): + p = QPainter(self) + p.setRenderHint(QPainter.Antialiasing) + p.setFont(QFont("Segoe UI", 9)) + + # SET PEN + p.setPen(Qt.NoPen) + + # DRAW RECT + rect = QRect(0, 0, self.width(), self.height()) + + if not self.isChecked(): + p.setBrush(QColor(self._bg_color)) + p.drawRoundedRect(0,0,rect.width(), 28, 14, 14) + p.setBrush(QColor(self._circle_color)) + p.drawEllipse(self._position, 3, 22, 22) + else: + p.setBrush(QColor(self._active_color)) + p.drawRoundedRect(0,0,rect.width(), 28, 14, 14) + p.setBrush(QColor(self._circle_color)) + p.drawEllipse(self._position, 3, 22, 22) + + p.end() \ No newline at end of file diff --git a/main.py b/main.py index dee08f8..612b9e1 100644 --- a/main.py +++ b/main.py @@ -134,8 +134,8 @@ class MainWindow(QMainWindow): MainFunctions.set_left_column_menu( self, menu = self.ui.left_column.menus.menu_2, - title = "Add Users", - icon_path = Functions.set_svg_icon("icon_home.svg") + title = "Info tab", + icon_path = Functions.set_svg_icon("icon_info.svg") ) # SETTINGS LEFT