mirror of
https://github.com/Wanderson-Magalhaes/PyOneDark_Qt_Widgets_Modern_GUI.git
synced 2026-10-07 04:47:16 +00:00
25/05/2021
This commit is contained in:
1 parent
e7cf04e988
commit
5f376f3c45
8 files changed
+279
-25
No files matched your search
@@ -0,0 +1,109 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>MainPages</class>
|
||||||
|
<widget class="QWidget" name="MainPages">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>860</width>
|
||||||
|
<height>600</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="main_pages_layout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QStackedWidget" name="pages">
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="page_1">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background: lightgreen; font-size: 16pt</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_1">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>16</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Page 1</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="page_2">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background: lightblue; font-size: 16pt</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>16</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Page 2</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="page_3">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background: pink; font-size: 16pt</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>16</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Page 3</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
# ///////////////////////////////////////////////////////////////
|
||||||
|
#
|
||||||
|
# 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 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"background: lightgreen; font-size: 16pt")
|
||||||
|
self.verticalLayout = QVBoxLayout(self.page_1)
|
||||||
|
self.verticalLayout.setObjectName(u"verticalLayout")
|
||||||
|
self.label_1 = QLabel(self.page_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.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.label_2.setFont(font)
|
||||||
|
self.label_2.setAlignment(Qt.AlignCenter)
|
||||||
|
|
||||||
|
self.verticalLayout_2.addWidget(self.label_2)
|
||||||
|
|
||||||
|
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.verticalLayout_3.addWidget(self.label_3)
|
||||||
|
|
||||||
|
self.pages.addWidget(self.page_3)
|
||||||
|
|
||||||
|
self.main_pages_layout.addWidget(self.pages)
|
||||||
|
|
||||||
|
|
||||||
|
self.retranslateUi(MainPages)
|
||||||
|
|
||||||
|
self.pages.setCurrentIndex(2)
|
||||||
|
|
||||||
|
|
||||||
|
QMetaObject.connectSlotsByName(MainPages)
|
||||||
|
# setupUi
|
||||||
|
|
||||||
|
def retranslateUi(self, MainPages):
|
||||||
|
MainPages.setWindowTitle(QCoreApplication.translate("MainPages", u"Form", None))
|
||||||
|
self.label_1.setText(QCoreApplication.translate("MainPages", u"Page 1", None))
|
||||||
|
self.label_2.setText(QCoreApplication.translate("MainPages", u"Page 2", None))
|
||||||
|
self.label_3.setText(QCoreApplication.translate("MainPages", u"Page 3", None))
|
||||||
|
# retranslateUi
|
||||||
|
|
||||||
@@ -22,6 +22,19 @@ import sys
|
|||||||
# ///////////////////////////////////////////////////////////////
|
# ///////////////////////////////////////////////////////////////
|
||||||
from qt_core import *
|
from qt_core import *
|
||||||
|
|
||||||
|
# LOAD UI MAIN
|
||||||
|
# ///////////////////////////////////////////////////////////////
|
||||||
|
from . ui_main import *
|
||||||
|
|
||||||
# FUNCTIONS
|
# FUNCTIONS
|
||||||
class FunctionsMainWindow:
|
class FunctionsMain():
|
||||||
pass
|
def __init__(self):
|
||||||
|
super(FunctionsMain, self).__init__()
|
||||||
|
# SETUP MAIN WINDOw
|
||||||
|
# Load widgets from "gui\uis\main_window\ui_main.py"
|
||||||
|
# ///////////////////////////////////////////////////////////////
|
||||||
|
self.ui = UI_MainWindow()
|
||||||
|
self.ui.setup_ui(self)
|
||||||
|
|
||||||
|
def set_page(self, page):
|
||||||
|
self.ui.load_pages.pages.setCurrentWidget(page)
|
||||||
@@ -47,7 +47,7 @@ class SetupMainWindow:
|
|||||||
"btn_text" : "Home",
|
"btn_text" : "Home",
|
||||||
"btn_tooltip" : "Home page",
|
"btn_tooltip" : "Home page",
|
||||||
"show_top" : True,
|
"show_top" : True,
|
||||||
"is_active" : False
|
"is_active" : True
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"btn_icon" : "icon_widgets.svg",
|
"btn_icon" : "icon_widgets.svg",
|
||||||
@@ -55,7 +55,7 @@ class SetupMainWindow:
|
|||||||
"btn_text" : "Open Widgets",
|
"btn_text" : "Open Widgets",
|
||||||
"btn_tooltip" : "Show custom widgets",
|
"btn_tooltip" : "Show custom widgets",
|
||||||
"show_top" : True,
|
"show_top" : True,
|
||||||
"is_active" : True
|
"is_active" : False
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"btn_icon" : "icon_add_user.svg",
|
"btn_icon" : "icon_add_user.svg",
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
# IMPORT PACKAGES AND MODULES
|
# IMPORT PACKAGES AND MODULES
|
||||||
# ///////////////////////////////////////////////////////////////
|
# ///////////////////////////////////////////////////////////////
|
||||||
from gui.widgets.py_credits_bar.py_credits import PyCredits
|
from gui.widgets.py_credits_bar.py_credits import PyCredits
|
||||||
import sys
|
|
||||||
|
|
||||||
# IMPORT QT CORE
|
# IMPORT QT CORE
|
||||||
# ///////////////////////////////////////////////////////////////
|
# ///////////////////////////////////////////////////////////////
|
||||||
@@ -39,9 +38,9 @@ from gui.widgets import *
|
|||||||
# ///////////////////////////////////////////////////////////////
|
# ///////////////////////////////////////////////////////////////
|
||||||
from . setup_main_window import *
|
from . setup_main_window import *
|
||||||
|
|
||||||
# IMPORT FUNCTIONS MAIN WINDOW
|
# IMPORT MAIN WINDOW PAGES / AND SIDE BOXES FOR APP
|
||||||
# ///////////////////////////////////////////////////////////////
|
# ///////////////////////////////////////////////////////////////
|
||||||
from . functions_main_window import *
|
from gui.uis.pages.ui_main_pages import Ui_MainPages
|
||||||
|
|
||||||
# PY WINDOW
|
# PY WINDOW
|
||||||
# ///////////////////////////////////////////////////////////////
|
# ///////////////////////////////////////////////////////////////
|
||||||
@@ -155,7 +154,7 @@ class UI_MainWindow(object):
|
|||||||
# ADD TITLE BAR FRAME
|
# ADD TITLE BAR FRAME
|
||||||
# ///////////////////////////////////////////////////////////////
|
# ///////////////////////////////////////////////////////////////
|
||||||
self.title_bar_frame = QFrame()
|
self.title_bar_frame = QFrame()
|
||||||
self.title_bar_frame.setMaximumHeight(40)
|
self.title_bar_frame.setMinimumHeight(40)
|
||||||
self.title_bar_frame.setMaximumHeight(40)
|
self.title_bar_frame.setMaximumHeight(40)
|
||||||
self.title_bar_layout = QVBoxLayout(self.title_bar_frame)
|
self.title_bar_layout = QVBoxLayout(self.title_bar_frame)
|
||||||
self.title_bar_layout.setContentsMargins(0,0,0,0)
|
self.title_bar_layout.setContentsMargins(0,0,0,0)
|
||||||
@@ -187,12 +186,15 @@ class UI_MainWindow(object):
|
|||||||
# ADD CONTENT AREA
|
# ADD CONTENT AREA
|
||||||
# ///////////////////////////////////////////////////////////////
|
# ///////////////////////////////////////////////////////////////
|
||||||
self.content_area_frame = QFrame()
|
self.content_area_frame = QFrame()
|
||||||
self.content_area_frame.setStyleSheet("background: transparent")
|
|
||||||
|
# IMPORT MAIN PAGES TO CONTENT AREA
|
||||||
|
self.load_pages = Ui_MainPages()
|
||||||
|
self.load_pages.setupUi(self.content_area_frame)
|
||||||
|
|
||||||
# CREDITS / BOTTOM APP FRAME
|
# CREDITS / BOTTOM APP FRAME
|
||||||
# ///////////////////////////////////////////////////////////////
|
# ///////////////////////////////////////////////////////////////
|
||||||
self.credits_frame = QFrame()
|
self.credits_frame = QFrame()
|
||||||
self.credits_frame.setMaximumHeight(26)
|
self.credits_frame.setMinimumHeight(26)
|
||||||
self.credits_frame.setMaximumHeight(26)
|
self.credits_frame.setMaximumHeight(26)
|
||||||
|
|
||||||
# CREATE LAYOUT
|
# CREATE LAYOUT
|
||||||
|
|||||||
@@ -193,6 +193,20 @@ class PyLeftMenu(QWidget):
|
|||||||
self.animation.setDuration(self._duration_time)
|
self.animation.setDuration(self._duration_time)
|
||||||
self.animation.start()
|
self.animation.start()
|
||||||
|
|
||||||
|
# SELECT ONLY ONE BTN
|
||||||
|
# ///////////////////////////////////////////////////////////////
|
||||||
|
def select_only_one(self, widget: str):
|
||||||
|
for btn in self.findChildren(QPushButton):
|
||||||
|
if btn.objectName() == widget:
|
||||||
|
btn.set_active(True)
|
||||||
|
else:
|
||||||
|
btn.set_active(False)
|
||||||
|
|
||||||
|
# DESELECT ALL BTNs
|
||||||
|
# ///////////////////////////////////////////////////////////////
|
||||||
|
def deselect_all(self):
|
||||||
|
for btn in self.findChildren(QPushButton):
|
||||||
|
btn.set_active(False)
|
||||||
|
|
||||||
# SETUP APP
|
# SETUP APP
|
||||||
# ///////////////////////////////////////////////////////////////
|
# ///////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -170,6 +170,8 @@ class PyLeftMenuButton(QPushButton):
|
|||||||
self._is_active = is_active
|
self._is_active = is_active
|
||||||
if not is_active:
|
if not is_active:
|
||||||
self._set_icon_color = self._icon_color
|
self._set_icon_color = self._icon_color
|
||||||
|
if not is_active:
|
||||||
|
self._set_bg_color = self._dark_one
|
||||||
self.repaint()
|
self.repaint()
|
||||||
|
|
||||||
# RETURN IF IS ACTIVE MENU
|
# RETURN IF IS ACTIVE MENU
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
# IMPORT PACKAGES AND MODULES
|
# IMPORT PACKAGES AND MODULES
|
||||||
# ///////////////////////////////////////////////////////////////
|
# ///////////////////////////////////////////////////////////////
|
||||||
|
from gui.uis.windows.main_window.functions_main_window import *
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
|
||||||
@@ -68,8 +69,8 @@ class MainWindow(QMainWindow):
|
|||||||
self.ui.left_menu.add_menus(SetupMainWindow.add_left_menus)
|
self.ui.left_menu.add_menus(SetupMainWindow.add_left_menus)
|
||||||
|
|
||||||
# SET SIGNALS
|
# SET SIGNALS
|
||||||
self.ui.left_menu.clicked.connect(self.left_menu_btn_clicked)
|
self.ui.left_menu.clicked.connect(self.btn_clicked)
|
||||||
self.ui.left_menu.released.connect(self.left_menu_btn_released)
|
self.ui.left_menu.released.connect(self.btn_released)
|
||||||
|
|
||||||
# TITLE BAR / ADD EXTRA BUTTONS
|
# TITLE BAR / ADD EXTRA BUTTONS
|
||||||
# ///////////////////////////////////////////////////////////////
|
# ///////////////////////////////////////////////////////////////
|
||||||
@@ -77,8 +78,8 @@ class MainWindow(QMainWindow):
|
|||||||
self.ui.title_bar.add_menus(SetupMainWindow.add_title_bar_menus)
|
self.ui.title_bar.add_menus(SetupMainWindow.add_title_bar_menus)
|
||||||
|
|
||||||
# SET SIGNALS
|
# SET SIGNALS
|
||||||
self.ui.title_bar.clicked.connect(self.left_menu_btn_clicked)
|
self.ui.title_bar.clicked.connect(self.btn_clicked)
|
||||||
self.ui.title_bar.released.connect(self.left_menu_btn_released)
|
self.ui.title_bar.released.connect(self.btn_released)
|
||||||
|
|
||||||
# ADD Title
|
# ADD Title
|
||||||
if self.settings["custom_title_bar"]:
|
if self.settings["custom_title_bar"]:
|
||||||
@@ -86,6 +87,10 @@ class MainWindow(QMainWindow):
|
|||||||
else:
|
else:
|
||||||
self.ui.title_bar.set_title("Welcome to PyOneDark")
|
self.ui.title_bar.set_title("Welcome to PyOneDark")
|
||||||
|
|
||||||
|
# SET INITIAL PAGE
|
||||||
|
# ///////////////////////////////////////////////////////////////
|
||||||
|
FunctionsMain.set_page(self, self.ui.load_pages.page_1)
|
||||||
|
|
||||||
# SHOW MAIN WINDOW
|
# SHOW MAIN WINDOW
|
||||||
# ///////////////////////////////////////////////////////////////
|
# ///////////////////////////////////////////////////////////////
|
||||||
self.show()
|
self.show()
|
||||||
@@ -94,24 +99,42 @@ class MainWindow(QMainWindow):
|
|||||||
# Run function when btn is clicked
|
# Run function when btn is clicked
|
||||||
# Check funtion by object name / btn_id
|
# Check funtion by object name / btn_id
|
||||||
# ///////////////////////////////////////////////////////////////
|
# ///////////////////////////////////////////////////////////////
|
||||||
def left_menu_btn_clicked(self):
|
def btn_clicked(self):
|
||||||
# GET BT CLICKED
|
# GET BT CLICKED
|
||||||
btn = SetupMainWindow.setup_btns(self)
|
btn = SetupMainWindow.setup_btns(self)
|
||||||
|
|
||||||
# LEFT MENU
|
# LEFT MENU
|
||||||
# SELECT / DESELECT BTN HOME
|
# ///////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
# Load Home
|
||||||
if btn.objectName() == "btn_home":
|
if btn.objectName() == "btn_home":
|
||||||
if btn.is_active():
|
# Select Menu
|
||||||
btn.set_active(False)
|
self.ui.left_menu.select_only_one(btn.objectName())
|
||||||
else:
|
|
||||||
btn.set_active(True)
|
# Load Page 1
|
||||||
|
FunctionsMain.set_page(self, self.ui.load_pages.page_1)
|
||||||
|
|
||||||
|
# Load Widgets Page
|
||||||
|
if btn.objectName() == "btn_widgets":
|
||||||
|
# Select Menu
|
||||||
|
self.ui.left_menu.select_only_one(btn.objectName())
|
||||||
|
|
||||||
|
# Load Page 2
|
||||||
|
FunctionsMain.set_page(self, self.ui.load_pages.page_2)
|
||||||
|
|
||||||
|
# Load Add User
|
||||||
|
if btn.objectName() == "btn_add_user":
|
||||||
|
# Select Menu
|
||||||
|
self.ui.left_menu.select_only_one(btn.objectName())
|
||||||
|
|
||||||
|
# Load Page 3
|
||||||
|
FunctionsMain.set_page(self, self.ui.load_pages.page_3)
|
||||||
|
|
||||||
# TITLE BAR MENU
|
# TITLE BAR MENU
|
||||||
|
# ///////////////////////////////////////////////////////////////
|
||||||
if btn.objectName() == "btn_top_settings":
|
if btn.objectName() == "btn_top_settings":
|
||||||
if btn.is_active():
|
# Select Menu
|
||||||
btn.set_active(False)
|
btn.set_active(False) if btn.is_active() else btn.set_active(True)
|
||||||
else:
|
|
||||||
btn.set_active(True)
|
|
||||||
|
|
||||||
# DEBUG
|
# DEBUG
|
||||||
print(f"Button {btn.objectName()}, clicked!")
|
print(f"Button {btn.objectName()}, clicked!")
|
||||||
@@ -120,7 +143,7 @@ class MainWindow(QMainWindow):
|
|||||||
# Run function when btn is released
|
# Run function when btn is released
|
||||||
# Check funtion by object name / btn_id
|
# Check funtion by object name / btn_id
|
||||||
# ///////////////////////////////////////////////////////////////
|
# ///////////////////////////////////////////////////////////////
|
||||||
def left_menu_btn_released(self):
|
def btn_released(self):
|
||||||
# GET BT CLICKED
|
# GET BT CLICKED
|
||||||
btn = SetupMainWindow.setup_btns(self)
|
btn = SetupMainWindow.setup_btns(self)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user