mirror of
https://github.com/Wanderson-Magalhaes/PyOneDark_Qt_Widgets_Modern_GUI.git
synced 2026-02-16 23:43:57 +00:00
30/04/2021
This commit is contained in:
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
__pycache__/
|
||||
.vscode/
|
||||
.git/
|
||||
.pyc
|
||||
63
gui/core/json_settings.py
Normal file
63
gui/core/json_settings.py
Normal file
@@ -0,0 +1,63 @@
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
#
|
||||
# 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 PACKAGES AND MODULES
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
import json
|
||||
import os
|
||||
|
||||
# APP SETTINGS
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
class Settings(object):
|
||||
# APP PATH
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
json_file = "settings.json"
|
||||
app_path = os.path.abspath(os.getcwd())
|
||||
settings_path = os.path.join(app_path, json_file)
|
||||
if not os.path.isfile(settings_path):
|
||||
print(f"WARNING: \"settings.json\" not found! check in the folder {settings_path}")
|
||||
|
||||
# INIT SETTINGS
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
def __init__(self):
|
||||
super(Settings, self).__init__()
|
||||
|
||||
# DICTIONARY WITH SETTINGS
|
||||
self.items = {
|
||||
"app_name" : "",
|
||||
"custom_title_bar" : True,
|
||||
"startup_size" : [],
|
||||
"minimum_size" : [],
|
||||
"theme_name" : ""
|
||||
}
|
||||
|
||||
# DESERIALIZE
|
||||
self.deserialize()
|
||||
|
||||
# SERIALIZE JSON
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
def serialize(self):
|
||||
# WRITE JSON FILE
|
||||
with open(self.settings_path, "w", encoding='utf-8') as write:
|
||||
json.dump(self.items, write, indent=4)
|
||||
|
||||
# DESERIALIZE JSON
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
def deserialize(self):
|
||||
# READ JSON FILE
|
||||
with open(self.settings_path, "r", encoding='utf-8') as reader:
|
||||
settings = json.loads(reader.read())
|
||||
self.items = settings
|
||||
63
gui/core/json_themes.py
Normal file
63
gui/core/json_themes.py
Normal file
@@ -0,0 +1,63 @@
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
#
|
||||
# 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 PACKAGES AND MODULES
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
import json
|
||||
import os
|
||||
|
||||
# APP THEMES
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
class Settings(object):
|
||||
# APP PATH
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
json_file = "settings.json"
|
||||
app_path = os.path.abspath(os.getcwd())
|
||||
settings_path = os.path.join(app_path, json_file)
|
||||
if not os.path.isfile(settings_path):
|
||||
print(f"WARNING: \"settings.json\" not found! check in the folder {settings_path}")
|
||||
|
||||
# INIT SETTINGS
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
def __init__(self):
|
||||
super(Settings, self).__init__()
|
||||
|
||||
# DICTIONARY WITH SETTINGS
|
||||
self.items = {
|
||||
"app_name" : "",
|
||||
"custom_title_bar" : True,
|
||||
"startup_size" : [],
|
||||
"minimum_size" : [],
|
||||
"theme_name" : ""
|
||||
}
|
||||
|
||||
# DESERIALIZE
|
||||
self.deserialize()
|
||||
|
||||
# SERIALIZE JSON
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
def serialize(self):
|
||||
# WRITE JSON FILE
|
||||
with open(self.settings_path, "w", encoding='utf-8') as write:
|
||||
json.dump(self.items, write, indent=4)
|
||||
|
||||
# DESERIALIZE JSON
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
def deserialize(self):
|
||||
# READ JSON FILE
|
||||
with open(self.settings_path, "r", encoding='utf-8') as reader:
|
||||
settings = json.loads(reader.read())
|
||||
self.items = settings
|
||||
56
gui/uis/windows/main_window/ui_main.py
Normal file
56
gui/uis/windows/main_window/ui_main.py
Normal file
@@ -0,0 +1,56 @@
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
#
|
||||
# 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 PACKAGES AND MODULES
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
import sys
|
||||
|
||||
# IMPORT QT CORE
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
from qt_core import *
|
||||
|
||||
# IMPORT SETTINGS
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
from gui.core.json_settings import Settings
|
||||
|
||||
# IMPORT PY ONE DARK WIDGETS
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
from gui.widgets import *
|
||||
|
||||
# PY WINDOW
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
class UI_MainWindow(object):
|
||||
def setup_ui(self, parent):
|
||||
if not parent.objectName():
|
||||
parent.setObjectName("MainWindow")
|
||||
|
||||
# LOAD SETTINGS
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
settings = Settings()
|
||||
self.settings = settings.items
|
||||
|
||||
# SET INITIAL PARAMETERS
|
||||
parent.setMinimumSize(self.settings["startup_size"][0], self.settings["startup_size"][1])
|
||||
|
||||
# LOAD PY WINDOW CUSTOM WIDGET
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
self.window = PyWindow(parent)
|
||||
|
||||
# TEXT
|
||||
self.label = QLabel(self.settings["app_name"], self.window)
|
||||
|
||||
# ADD CENTRAL WIDGET
|
||||
parent.setCentralWidget(self.window)
|
||||
23
gui/widgets/__init__.py
Normal file
23
gui/widgets/__init__.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
#
|
||||
# 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 WIDGETS
|
||||
# ADD here all custom widgets
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
|
||||
# PY WINDOW
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
from . py_window import PyWindow
|
||||
19
gui/widgets/py_window/__init__.py
Normal file
19
gui/widgets/py_window/__init__.py
Normal file
@@ -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
|
||||
#
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
|
||||
# IMPORT WIDGETS
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
from . py_window import PyWindow
|
||||
56
gui/widgets/py_window/py_window.py
Normal file
56
gui/widgets/py_window/py_window.py
Normal file
@@ -0,0 +1,56 @@
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
#
|
||||
# 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 PACKAGES AND MODULES
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
import sys
|
||||
|
||||
# IMPORT QT CORE
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
from qt_core import *
|
||||
|
||||
# IMPORT SETTINGS
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
from gui.core.json_settings import Settings
|
||||
|
||||
# PY WINDOW
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
class PyWindow(QWidget):
|
||||
def __init__(self, parent):
|
||||
super(PyWindow, self).__init__()
|
||||
|
||||
# LOAD SETTINGS
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
settings = Settings()
|
||||
self.settings = settings.items
|
||||
|
||||
# APP MARGINS LAYOUT
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
self.app_margins_layout = QVBoxLayout(self)
|
||||
self.app_margins_layout.setContentsMargins(0,0,0,0)
|
||||
self.app_margins_layout.setObjectName("app_margins_layout")
|
||||
|
||||
# BG APP
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
self.bg_app = QFrame(self)
|
||||
self.bg_app.setStyleSheet("background: #333")
|
||||
self.bg_app.setObjectName("bg_app")
|
||||
|
||||
# ADD WIDGETS TO APP MARGINS LAUOUT
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
self.app_margins_layout.addWidget(self.bg_app)
|
||||
|
||||
|
||||
62
main.py
Normal file
62
main.py
Normal file
@@ -0,0 +1,62 @@
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
#
|
||||
# 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 PACKAGES AND MODULES
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
import sys
|
||||
|
||||
# IMPORT QT CORE
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
from qt_core import *
|
||||
|
||||
# IMPORT SETTINGS
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
from gui.core.json_settings import Settings
|
||||
|
||||
# IMPORT PY ONE DARK WINDOWS
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
# MAIN WINDOW
|
||||
from gui.uis.windows.main_window.ui_main import UI_MainWindow
|
||||
|
||||
# IMPORT PY ONE DARK WIDGETS
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
from gui.widgets import *
|
||||
|
||||
# MAIN WINDOW
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
class MainWindow(QMainWindow):
|
||||
def __init__(self):
|
||||
QMainWindow.__init__(self)
|
||||
# SETUP MAIN WINDOw
|
||||
# Load widgets from "gui\uis\main_window\ui_main.py"
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
self.ui = UI_MainWindow()
|
||||
self.ui.setup_ui(self)
|
||||
|
||||
|
||||
# SHOW MAIN WINDOW
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
self.show()
|
||||
|
||||
# SETTINGS WHEN TO START
|
||||
# Set the initial class and also additional parameters of the "QApplication" class
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
if __name__ == "__main__":
|
||||
# APPLICATION
|
||||
app = QApplication(sys.argv)
|
||||
# app.setWindowIcon(QIcon("icon.ico"))
|
||||
window = MainWindow()
|
||||
sys.exit(app.exec_())
|
||||
27
qt_core.py
Normal file
27
qt_core.py
Normal file
@@ -0,0 +1,27 @@
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
#
|
||||
# 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
|
||||
#
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
|
||||
# QT CORE
|
||||
# Change for PySide Or PyQt
|
||||
# ///////////////////////// WARNING: ////////////////////////////
|
||||
# Remember that changing to PyQt too many modules will have
|
||||
# problems because some classes have different names like:
|
||||
# Property (pyqtProperty), Slot (pyqtSlot), Signal (pyqtSignal)
|
||||
# among others.
|
||||
# ///////////////////////////////////////////////////////////////
|
||||
from PySide6.QtCore import *
|
||||
from PySide6.QtGui import *
|
||||
from PySide6.QtWidgets import *
|
||||
13
settings.json
Normal file
13
settings.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"app_name": "PyOneDark - Modern GUI",
|
||||
"custom_title_bar": true,
|
||||
"startup_size": [
|
||||
1200,
|
||||
720
|
||||
],
|
||||
"minimum_size": [
|
||||
960,
|
||||
540
|
||||
],
|
||||
"theme_name": "default"
|
||||
}
|
||||
Reference in New Issue
Block a user