19/05/2021

This commit is contained in:
VFX - Visual Effects
2021-05-19 14:29:18 -03:00
parent a5ce102b1a
commit ef930c2ad0
12 changed files with 494 additions and 89 deletions

50
gui/core/functions.py Normal file
View File

@@ -0,0 +1,50 @@
# ///////////////////////////////////////////////////////////////
#
# 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 os
# APP FUNCTIONS
# ///////////////////////////////////////////////////////////////
class Functions:
# SET SVG ICON
# ///////////////////////////////////////////////////////////////
def set_svg_icon(icon_name):
app_path = os.path.abspath(os.getcwd())
folder = "gui/images/svg_icons/"
path = os.path.join(app_path, folder)
icon = os.path.normpath(os.path.join(path, icon_name))
return icon
# SET SVG IMAGE
# ///////////////////////////////////////////////////////////////
def set_svg_image(icon_name):
app_path = os.path.abspath(os.getcwd())
folder = "gui/images/svg_images/"
path = os.path.join(app_path, folder)
icon = os.path.normpath(os.path.join(path, icon_name))
return icon
# SET IMAGE
# ///////////////////////////////////////////////////////////////
def set_image(image_name):
app_path = os.path.abspath(os.getcwd())
folder = "gui/images/images/"
path = os.path.join(app_path, folder)
image = os.path.normpath(os.path.join(path, image_name))
return image

View File

@@ -0,0 +1,157 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="100"
height="22"
viewBox="0 0 26.458333 5.8208334"
version="1.1"
id="svg1132"
inkscape:version="1.0.2-2 (e86c870879, 2021-01-15)"
sodipodi:docname="logo_top_100x22.svg">
<defs
id="defs1126">
<inkscape:path-effect
effect="fillet_chamfer"
id="path-effect1836"
is_visible="true"
lpeversion="1"
satellites_param="F,0,0,1,0,0,0,1 @ F,0,1,1,0,0.26458333,0,1 @ F,0,1,1,0,0.26458333,0,1 @ F,0,0,1,0,0,0,1 @ F,0,0,1,0,0,0,1 @ F,0,0,1,0,0,0,1 @ F,0,0,1,0,0,0,1 @ F,0,0,1,0,0,0,1 @ F,0,0,1,0,0,0,1"
unit="px"
method="auto"
mode="F"
radius="1"
chamfer_steps="1"
flexible="false"
use_knot_distance="true"
apply_no_radius="true"
apply_with_radius="true"
only_selected="true"
hide_knots="false" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="4.7556835"
inkscape:cx="29.382824"
inkscape:cy="2.9469558"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
inkscape:document-rotation="0"
showgrid="false"
units="px"
inkscape:window-width="1920"
inkscape:window-height="1027"
inkscape:window-x="1912"
inkscape:window-y="-8"
inkscape:window-maximized="1" />
<metadata
id="metadata1129">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<g
id="g1811">
<g
id="g1822"
transform="matrix(0.37563903,0,0,0.37563903,-64.288753,-32.575173)">
<g
id="g1810">
<g
id="g1804">
<g
aria-label="PY"
id="g1800"
style="font-style:normal;font-weight:normal;font-size:2.85476px;line-height:1.25;font-family:sans-serif;fill:#dce1ec;fill-opacity:1;stroke:none;stroke-width:0.0713691"
transform="translate(-0.108475,-0.0784345)">
<path
d="m 196.06915,94.086075 c 0,-0.336862 -0.27406,-0.610919 -0.61092,-0.610919 h -0.80504 v 2.14107 h 0.34257 v -0.919233 h 0.46247 c 0.33686,0 0.61092,-0.274056 0.61092,-0.610918 z m -0.34257,0 c 0,0.171285 -0.11134,0.311169 -0.28262,0.311169 h -0.4482 v -0.622338 h 0.4482 c 0.17128,0 0.28262,0.139883 0.28262,0.311169 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Ano Bold';-inkscape-font-specification:'Ano Bold, ';fill:#dce1ec;fill-opacity:1;stroke-width:0.0713691"
id="path1796" />
<path
d="m 197.84548,93.475156 -0.61378,0.802188 -0.61091,-0.802188 h -0.41109 l 0.85072,1.113357 v 1.027713 h 0.34257 v -1.024859 l 0.85357,-1.116211 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Ano Bold';-inkscape-font-specification:'Ano Bold, ';fill:#dce1ec;fill-opacity:1;stroke-width:0.0713691"
id="path1798" />
</g>
<path
id="path1802"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.8299px;line-height:1.25;font-family:'Ano Regular';-inkscape-font-specification:'Ano Regular, ';letter-spacing:0px;word-spacing:0px;fill:#dce1ec;fill-opacity:1;stroke:none;stroke-width:0.25106"
d="m 200.31312,94.467255 c 0,-2.189227 -1.77749,-3.966719 -3.96672,-3.966719 -2.18923,0 -3.96672,1.777492 -3.96672,3.966719 0,2.18923 1.77749,3.966722 3.96672,3.966722 2.18923,0 3.96672,-1.777492 3.96672,-3.966722 z m -0.80338,0 c 0,1.797579 -1.41598,3.263759 -3.16334,3.263759 -1.74736,0 -3.16333,-1.46618 -3.16333,-3.263759 0,-1.797577 1.41597,-3.263756 3.16333,-3.263756 1.74736,0 3.16334,1.466179 3.16334,3.263756 z" />
</g>
<path
d="m 207.29882,90.701382 h -0.80339 V 96.8975 l -4.06714,-6.196118 h -0.80339 v 7.531748 h 0.80339 v -6.186075 l 4.06714,6.186075 h 0.80339 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.8299px;line-height:1.25;font-family:'Ano Regular';-inkscape-font-specification:'Ano Regular, ';letter-spacing:0px;word-spacing:0px;fill:#dce1ec;fill-opacity:1;stroke:none;stroke-width:0.25106"
id="path1806" />
<path
d="m 213.06923,97.530167 h -3.36418 v -2.711429 h 3.06291 v -0.702963 h -3.06291 v -2.71143 h 3.36418 v -0.702963 h -4.16757 v 7.531748 h 4.16757 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.8299px;line-height:1.25;font-family:'Ano Regular';-inkscape-font-specification:'Ano Regular, ';letter-spacing:0px;word-spacing:0px;fill:#dce1ec;fill-opacity:1;stroke:none;stroke-width:0.25106"
id="path1808" />
</g>
<g
id="g1820">
<path
d="m 220.63801,94.467255 c 0,-2.068719 -1.67707,-3.765873 -3.75582,-3.765873 h -2.61101 v 7.531748 h 2.61101 c 2.07875,0 3.75582,-1.687111 3.75582,-3.765875 z m -1.72728,0 c 0,1.174954 -0.94398,2.118932 -2.11893,2.118932 h -0.79335 v -4.237862 h 0.79335 c 1.17495,0 2.11893,0.954021 2.11893,2.11893 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.8299px;line-height:1.25;font-family:'Ano Black';-inkscape-font-specification:'Ano Black, ';letter-spacing:0px;word-spacing:0px;fill:#4f9fee;fill-opacity:1;stroke:none;stroke-width:0.25106"
id="path1812" />
<path
d="m 225.71316,90.701382 h -1.80763 l -2.86207,7.531748 h 1.83776 l 0.40169,-1.064486 h 3.04282 l 0.39166,1.064486 h 1.84778 z m -1.81766,4.830361 0.91384,-2.420202 0.90382,2.420202 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.8299px;line-height:1.25;font-family:'Ano Black';-inkscape-font-specification:'Ano Black, ';letter-spacing:0px;word-spacing:0px;fill:#4f9fee;fill-opacity:1;stroke:none;stroke-width:0.25106"
id="path1814" />
<path
d="m 232.31144,95.190303 c 0.93393,-0.281185 1.6168,-1.154867 1.6168,-2.189227 0,-1.265333 -1.02432,-2.299694 -2.28963,-2.299694 h -2.48047 v 7.531748 h 1.72728 v -2.118932 l 1.67708,2.118932 h 2.14905 z m -0.1105,-2.189227 c 0,0.411736 -0.25106,0.652752 -0.56238,0.652752 h -0.75317 v -1.305503 h 0.75317 c 0.31132,0 0.56238,0.241015 0.56238,0.652751 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.8299px;line-height:1.25;font-family:'Ano Black';-inkscape-font-specification:'Ano Black, ';letter-spacing:0px;word-spacing:0px;fill:#4f9fee;fill-opacity:1;stroke:none;stroke-width:0.25106"
id="path1816" />
<path
d="m 238.75845,90.701382 -2.00846,2.36999 v -2.36999 h -1.72729 v 7.531748 h 1.72729 v -2.339863 l 1.98839,2.339863 h 2.17918 l -3.19346,-3.755832 3.21354,-3.775916 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.8299px;line-height:1.25;font-family:'Ano Black';-inkscape-font-specification:'Ano Black, ';letter-spacing:0px;word-spacing:0px;fill:#4f9fee;fill-opacity:1;stroke:none;stroke-width:0.25106"
id="path1818" />
</g>
</g>
<g
id="g1790">
<path
id="path1824"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.5833px;line-height:1.25;font-family:'Ano Black';-inkscape-font-specification:'Ano Black, ';fill:#4f9fee;fill-opacity:1;stroke:none;stroke-width:0.171201"
d="m 6.0294424,2.568037 c 0,-1.4106927 -1.1436221,-2.568008872565 -2.56116,-2.568008872565 H 1.7851565 V 5.1360473 h 1.6831259 c 1.4175379,0 2.56116,-1.1504695 2.56116,-2.5680103 z m -1.1778576,0 c 0,0.8012186 -0.6437136,1.4449327 -1.4449349,1.4449327 H 2.3364893 v -2.889866 h 1.0701606 c 0.8012213,0 1.4449349,0.6505625 1.4449349,1.4449333 z"
sodipodi:nodetypes="ssccssssccss" />
<path
id="path1826"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.5833px;line-height:1.25;font-family:'Ano Black';-inkscape-font-specification:'Ano Black, ';fill:#3d8ad5;fill-opacity:1;stroke:none;stroke-width:0.171201"
d="M 2.0300435,1.255144e-5 1.6876461,0.00635735 V 1.0924146 C 1.876678,1.0921558 2.0300435,1.2454526 2.0300435,1.4344813 V 5.1360358 H 3.0666136 C 3.1729317,4.9320827 3.2265932,4.6974519 3.2080542,4.451231 V 4.0128603 H 2.3364893 V 1.1231724 H 3.2023729 C 3.1322897,0.52831193 2.6497261,0.04664426 2.0300435,2.3144399e-7 Z"
sodipodi:nodetypes="cccsccccccccc" />
<path
d="M 1.852148,1.255144e-5 1.6876461,0.00635735 V 1.0924146 C 1.876678,1.0921558 2.0300435,1.2454526 2.0300435,1.4344813 V 5.1360358 H 2.8887173 C 2.9950362,4.9320827 3.0486959,4.6974519 3.0301587,4.451231 V 4.0128603 H 2.1585938 V 1.1231724 H 3.0244775 C 2.9543925,0.52831193 2.4075378,2.3144399e-7 1.852148,2.3144399e-7 Z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.5833px;line-height:1.25;font-family:'Ano Black';-inkscape-font-specification:'Ano Black, ';fill:#2d7bc5;fill-opacity:1;stroke:none;stroke-width:0.171201"
id="path1828"
sodipodi:nodetypes="cccsccccccccc" />
<path
inkscape:original-d="M 1.6877949,2.2554433e-6 1.1470667,0.00944201 0.10799299,1.0937135 1.3453905,1.0924815 c 0.1890319,-2.581e-4 0.3424044,0.152908 0.3424044,0.3419373 V 5.8208335 C 2.3912578,5.7679015 2.9185985,5.1546923 2.8656498,4.4512261 V 1.3696243 C 2.9185792,0.66616151 2.3912578,0.05296662 1.6877949,1.5103439e-5 Z"
inkscape:path-effect="#path-effect1836"
sodipodi:nodetypes="ccccccccsc"
id="path1830"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.5833px;line-height:1.25;font-family:'Ano Black';-inkscape-font-specification:'Ano Black, ';fill:#dce1ec;fill-opacity:1;stroke:none;stroke-width:0.171201"
d="M 1.6877949,2.2554433e-6 1.4116097,0.00482375 A 0.63531929,0.63531929 156.39022 0 0 0.96400189,0.2004698 L 0.2910578,0.90268571 A 0.11275169,0.11275169 66.861767 0 0 0.37257619,1.0934501 L 1.3453905,1.0924815 c 0.1890319,-2.581e-4 0.3424044,0.152908 0.3424044,0.3419373 V 5.8208335 C 2.3912578,5.7679015 2.9185985,5.1546923 2.8656498,4.4512261 V 1.3696243 C 2.9185792,0.66616151 2.3912578,0.05296662 1.6877949,1.5103439e-5 Z" />
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -7,7 +7,7 @@
"dark_four" : "#272c36",
"bg_one" : "#2c313c",
"bg_two" : "#343b48",
"icon_normal" : "#c3ccdf",
"icon_color" : "#c3ccdf",
"icon_hover" : "#dce1ec",
"icon_pressed" : "#edf0f5",
"icon_active" : "#f5f6f9",

View File

@@ -37,6 +37,68 @@ from gui.widgets import *
# PY WINDOW
# ///////////////////////////////////////////////////////////////
class SetupMainWindow:
# ADD LEFT MENUS
# ///////////////////////////////////////////////////////////////
add_left_menus = [
{
"btn_icon" : "icon_home.svg",
"btn_id" : "btn_home",
"btn_text" : "Home",
"btn_tooltip" : "Home page",
"show_top" : True,
"is_active" : False
},
{
"btn_icon" : "icon_widgets.svg",
"btn_id" : "btn_widgets",
"btn_text" : "Open Widgets",
"btn_tooltip" : "Show custom widgets",
"show_top" : True,
"is_active" : False
},
{
"btn_icon" : "icon_add_user.svg",
"btn_id" : "btn_add_user",
"btn_text" : "Add Users",
"btn_tooltip" : "Add users",
"show_top" : True,
"is_active" : False
},
{
"btn_icon" : "icon_file.svg",
"btn_id" : "btn_new_file",
"btn_text" : "New File",
"btn_tooltip" : "Create new file",
"show_top" : True,
"is_active" : False
},
{
"btn_icon" : "icon_folder_open.svg",
"btn_id" : "btn_open_file",
"btn_text" : "Open File",
"btn_tooltip" : "Open file",
"show_top" : True,
"is_active" : False
},
{
"btn_icon" : "icon_save.svg",
"btn_id" : "btn_save",
"btn_text" : "Save File",
"btn_tooltip" : "Save file",
"show_top" : True,
"is_active" : False
},
{
"btn_icon" : "icon_settings.svg",
"btn_id" : "btn_settings",
"btn_text" : "Settings",
"btn_tooltip" : "Open settings",
"show_top" : False,
"is_active" : False
}
]
# SETUP MAIN WINDOW WITH CUSTOM PARAMETERS
# ///////////////////////////////////////////////////////////////
def setup(self):

View File

@@ -113,9 +113,18 @@ class UI_MainWindow(object):
self.left_menu = PyLeftMenu(
parent = self.left_menu_frame,
app_parent = self.central_widget, # For tooltip parent
dark_one = self.themes["app_color"]["dark_one"]
dark_one = self.themes["app_color"]["dark_one"],
dark_three = self.themes["app_color"]["dark_three"],
dark_four = self.themes["app_color"]["dark_four"],
bg_one = self.themes["app_color"]["bg_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_pressed"],
icon_color_active = self.themes["app_color"]["icon_active"],
context_color = self.themes["app_color"]["context_color"],
text_foreground = self.themes["app_color"]["text_foreground"],
text_active = self.themes["app_color"]["text_active"]
)
self.left_menu.add_menus(self.settings["add_menus"])
self.left_menu_layout.addWidget(self.left_menu)
# ADD LEFT COLUMN
@@ -138,14 +147,18 @@ class UI_MainWindow(object):
self.right_app_layout.setSpacing(6)
# ADD TITLE BAR FRAME
# ///////////////////////////////////////////////////////////////
self.title_bar_frame = QFrame()
self.title_bar_frame.setMaximumHeight(40)
self.title_bar_frame.setMaximumHeight(40)
self.title_bar_frame.setStyleSheet("background: #343b48; border-radius: 8px;")
# apagar
close = QPushButton("Fechar")
close.setParent(self.title_bar_frame)
close.clicked.connect(lambda: parent.close())
self.title_bar_layout = QVBoxLayout(self.title_bar_frame)
self.title_bar_layout.setContentsMargins(0,0,0,0)
# ADD CUSTOM TITLE BAR TO LAYOUT
self.title_bar = PyTitleBar(
parent
)
self.title_bar_layout.addWidget(self.title_bar)
# ADD CONTENT AREA
self.content_area_frame = QFrame()

View File

@@ -28,4 +28,8 @@ from . py_grips import PyGrips
# LEFT MENU
# ///////////////////////////////////////////////////////////////
from . py_left_menu import PyLeftMenu
from . py_left_menu import PyLeftMenu
# PY TITLE BAR
# ///////////////////////////////////////////////////////////////
from . py_title_bar import PyTitleBar

View File

@@ -23,6 +23,10 @@ from qt_core import *
from . py_left_menu_button import PyLeftMenuButton
from . py_div import PyDiv
# IMPORT FUNCTIONS
# ///////////////////////////////////////////////////////////////
from gui.core.functions import *
# PY LEFT MENU
# ///////////////////////////////////////////////////////////////
class PyLeftMenu(QWidget):
@@ -43,12 +47,14 @@ class PyLeftMenu(QWidget):
icon_color_pressed = "#edf0f5",
icon_color_active = "#f5f6f9",
context_color = "#568af2",
text_foreground = "#8a95aa",
text_active = "#dce1ec",
duration_time = 500,
radius = 8,
minimum_width = 50,
maximum_width = 240,
icon_path = "gui/images/svg_icons/icon_menu.svg",
icon_path_close = "gui/images/svg_icons/icon_menu_close.svg",
icon_path = "icon_menu.svg",
icon_path_close = "icon_menu_close.svg",
toggle_text = "Hide Menu",
toggle_tooltip = "Expand/Retract menu"
):
@@ -56,19 +62,23 @@ class PyLeftMenu(QWidget):
# PROPERTIES
# ///////////////////////////////////////////////////////////////
self._bg_dark_one = dark_one,
self._bg_one = bg_one,
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._dark_one = dark_one
self._dark_three = dark_three
self._dark_four = dark_four
self._bg_one = bg_one
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._text_foreground = text_foreground
self._text_active = text_active
self._duration_time = duration_time
self._radius = radius
self._minimum_width = minimum_width
self._maximum_width = maximum_width
self._icon_path = icon_path
self._icon_path_close = icon_path_close
self._icon_path = Functions.set_svg_icon(icon_path)
self._icon_path_close = Functions.set_svg_icon(icon_path_close)
# SET PARENT
self._parent = parent
@@ -86,6 +96,17 @@ class PyLeftMenu(QWidget):
app_parent,
text = toggle_text,
tooltip_text = toggle_tooltip,
dark_one = self._dark_one,
dark_three = self._dark_three,
dark_four = self._dark_four,
bg_one = self._bg_one,
icon_color = self._icon_color,
icon_color_hover = self._icon_color_active,
icon_color_pressed = self._icon_color_pressed,
icon_color_active = self._icon_color_active,
context_color = self._context_color,
text_foreground = self._text_foreground,
text_active = self._text_active,
icon_path = icon_path
)
self.toggle_button.clicked.connect(self.toggle_animation)
@@ -124,6 +145,17 @@ class PyLeftMenu(QWidget):
text = _btn_text,
btn_id = _btn_id,
tooltip_text = _btn_tooltip,
dark_one = self._dark_one,
dark_three = self._dark_three,
dark_four = self._dark_four,
bg_one = self._bg_one,
icon_color = self._icon_color,
icon_color_hover = self._icon_color_active,
icon_color_pressed = self._icon_color_pressed,
icon_color_active = self._icon_color_active,
context_color = self._context_color,
text_foreground = self._text_foreground,
text_active = self._text_active,
icon_path = _btn_icon,
is_active = _is_active
)
@@ -148,6 +180,7 @@ class PyLeftMenu(QWidget):
# EXPAND / RETRACT LEF MENU
# ///////////////////////////////////////////////////////////////
def toggle_animation(self):
# SELECT TOGGLE WHEN EXPANDED
if self.toggle_button._is_toggle_active:
self.toggle_button.set_active_toggle(False)
self.toggle_button.set_icon(self._icon_path)
@@ -155,6 +188,7 @@ class PyLeftMenu(QWidget):
self.toggle_button.set_active_toggle(True)
self.toggle_button.set_icon(self._icon_path_close)
# CREATE ANIMATION
self.animation = QPropertyAnimation(self._parent, b"minimumWidth")
self.animation.stop()
if self.width() == self._minimum_width:
@@ -168,7 +202,7 @@ class PyLeftMenu(QWidget):
self.animation.start()
# SET APP LAYOUT
# SETUP APP
# ///////////////////////////////////////////////////////////////
def setup_ui(self):
# ADD MENU LAYOUT

View File

@@ -22,6 +22,10 @@ import os
# ///////////////////////////////////////////////////////////////
from qt_core import *
# IMPORT FUNCTIONS
# ///////////////////////////////////////////////////////////////
from gui.core.functions import *
# CUSTOM LEFT MENU
# ///////////////////////////////////////////////////////////////
class PyLeftMenuButton(QPushButton):
@@ -43,8 +47,8 @@ class PyLeftMenuButton(QPushButton):
context_color = "#568af2",
text_foreground = "#8a95aa",
text_active = "#dce1ec",
icon_path = "gui/images/svg_icons/icon_add_user.svg",
icon_active_menu = "gui/images/svg_icons/active_menu.svg",
icon_path = "icon_add_user.svg",
icon_active_menu = "active_menu.svg",
is_active = False,
is_toggle_active = False
):
@@ -56,8 +60,8 @@ class PyLeftMenuButton(QPushButton):
self.setObjectName(btn_id)
# APP PATH
app_path = os.path.abspath(os.getcwd())
self._icon_path = os.path.normpath(os.path.join(app_path, icon_path))
self._icon_path = Functions.set_svg_icon(icon_path)
self._icon_active_menu = Functions.set_svg_icon(icon_active_menu)
# PROPERTIES
self._margin = margin
@@ -70,7 +74,6 @@ class PyLeftMenuButton(QPushButton):
self._icon_color_hover = icon_color_hover
self._icon_color_pressed = icon_color_pressed
self._icon_color_active = icon_color_active
self._icon_active_menu = icon_active_menu
self._set_icon_color = self._icon_color # Set icon color
self._set_bg_color = self._dark_one # Set BG color
self._set_text_foreground = text_foreground
@@ -108,10 +111,6 @@ class PyLeftMenuButton(QPushButton):
rect_inside_active = QRect(7, 5, self.width(), self.height() - 10)
rect_text = QRect(45, 0, self.width() - 50, self.height())
# DRAW DEFAULT BG
p.setBrush(QColor(self._dark_one))
p.drawRoundedRect(rect, 0, 0)
if self._is_active:
# DRAW BG BLUE
p.setBrush(QColor(self._context_color))

View File

@@ -0,0 +1,21 @@
# ///////////////////////////////////////////////////////////////
#
# 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
# Top bar with move application, maximize, restore, minimize,
# close buttons and extra buttons
# ///////////////////////////////////////////////////////////////
from . py_title_bar import PyTitleBar

View File

@@ -0,0 +1,113 @@
# ///////////////////////////////////////////////////////////////
#
# 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 *
# IMPORT FUNCTIONS
# ///////////////////////////////////////////////////////////////
from gui.core.functions import *
# IMPORT SETTINGS
# ///////////////////////////////////////////////////////////////
from gui.core.json_settings import Settings
# PY TITLE BAR
# Top bar with move application, maximize, restore, minimize,
# close buttons and extra buttons
# ///////////////////////////////////////////////////////////////
class PyTitleBar(QWidget):
def __init__(
self,
parent,
logo_image = "logo_top_100x22.svg",
logo_width = 100,
buttons = None,
bg_color = "#343b48",
radius = 8
):
super(PyTitleBar, self).__init__()
settings = Settings()
self.settings = settings.items
# SETUP UI
self.setup_ui()
# ADD BG COLOR
self.bg.setStyleSheet(f"background-color: {bg_color}; border-radius: {radius}px;")
# SET LOGO AND WIDTH
self.top_logo.setMinimumWidth(logo_width)
self.top_logo.setMaximumWidth(logo_width)
self.top_logo.setPixmap(Functions.set_svg_image(logo_image))
# ADD TITLE TEXT
self.title_label.setText(self.settings["app_name"])
# MOVE WINDOW / MAXIMIZE / RESTORE
def moveWindow(event):
# IF MAXIMIZED CHANGE TO NORMAL
# if self.isMaximized():
# UiFunctions.maximize_restore(self)
# self.resize(_old_size)
# curso_x = self.pos().x()
# curso_y = event.globalPos().y() - QCursor.pos().y()
# self.move(curso_x, curso_y)
# MOVE WINDOW
if event.buttons() == Qt.LeftButton:
parent.move(parent.pos() + event.globalPos() - parent.dragPos)
parent.dragPos = event.globalPos()
event.accept()
self.top_logo.mouseMoveEvent = moveWindow
self.title_label.mouseMoveEvent = moveWindow
# ADD WIDGETS TO TITLE BAR
self.bg_layout.addWidget(self.top_logo)
self.bg_layout.addWidget(self.title_label)
self.bg_layout.addWidget(self.right_frame)
# SETUP APP
# ///////////////////////////////////////////////////////////////
def setup_ui(self):
# ADD MENU LAYOUT
self.title_bar_layout = QVBoxLayout(self)
self.title_bar_layout.setContentsMargins(0,0,0,0)
# ADD BG
self.bg = QFrame()
# ADD BG LAYOUT
self.bg_layout = QHBoxLayout(self.bg)
self.bg_layout.setContentsMargins(10,0,0,0)
self.bg_layout.setSpacing(0)
# LEFT FRAME WITH MOVE APP
self.top_logo = QLabel()
# TITLE LABEL
self.title_label = QLabel()
self.title_label.setAlignment(Qt.AlignVCenter)
self.title_label.setStyleSheet("padding-left: 10px; font-size: 10pt")
# RIGHT FRAME WITH BUTTONS
self.right_frame = QFrame()
self.right_frame.setMinimumWidth(100)
self.right_frame.setStyleSheet("background: #CCC")
# ADD TO LAYOUT
self.title_bar_layout.addWidget(self.bg)

14
main.py
View File

@@ -62,10 +62,14 @@ class MainWindow(QMainWindow):
self.hide_grips = True # Show/Hide resize grips
SetupMainWindow.setup(self)
# GET SIGNALS WHEN LEFT MENU BTN IS CLICKED / RELEASED
# LEFT MENUS / GET SIGNALS WHEN LEFT MENU BTN IS CLICKED / RELEASED
# ///////////////////////////////////////////////////////////////
# ADD MENUS
self.ui.left_menu.add_menus(SetupMainWindow.add_left_menus)
# SET SIGNALS
self.ui.left_menu.clicked.connect(self.left_menu_btn_clicked)
self.ui.left_menu.clicked.connect(self.left_menu_btn_released)
self.ui.left_menu.released.connect(self.left_menu_btn_released)
# SHOW MAIN WINDOW
# ///////////////////////////////////////////////////////////////
@@ -104,6 +108,12 @@ class MainWindow(QMainWindow):
def resizeEvent(self, event):
SetupMainWindow.resize_grips(self)
# MOUSE CLICK EVENTS
# ///////////////////////////////////////////////////////////////
def mousePressEvent(self, event):
# SET DRAG POS WINDOW
self.dragPos = event.globalPos()
# SETTINGS WHEN TO START
# Set the initial class and also additional parameters of the "QApplication" class

View File

@@ -18,63 +18,5 @@
"minimum" : 240,
"maximum" : 240
},
"add_menus" : [
{
"btn_icon" : "gui/images/svg_icons/icon_home.svg",
"btn_id" : "btn_home",
"btn_text" : "Home",
"btn_tooltip" : "Home page",
"show_top" : true,
"is_active" : false
},
{
"btn_icon" : "gui/images/svg_icons/icon_widgets.svg",
"btn_id" : "btn_widgets",
"btn_text" : "Open Widgets",
"btn_tooltip" : "Show custom widgets",
"show_top" : true,
"is_active" : false
},
{
"btn_icon" : "gui/images/svg_icons/icon_add_user.svg",
"btn_id" : "btn_add_user",
"btn_text" : "Add Users",
"btn_tooltip" : "Add users",
"show_top" : true,
"is_active" : false
},
{
"btn_icon" : "gui/images/svg_icons/icon_file.svg",
"btn_id" : "btn_new_file",
"btn_text" : "New File",
"btn_tooltip" : "Create new file",
"show_top" : true,
"is_active" : false
},
{
"btn_icon" : "gui/images/svg_icons/icon_folder_open.svg",
"btn_id" : "btn_open_file",
"btn_text" : "Open File",
"btn_tooltip" : "Open file",
"show_top" : true,
"is_active" : false
},
{
"btn_icon" : "gui/images/svg_icons/icon_save.svg",
"btn_id" : "btn_save",
"btn_text" : "Save File",
"btn_tooltip" : "Save file",
"show_top" : true,
"is_active" : false
},
{
"btn_icon" : "gui/images/svg_icons/icon_settings.svg",
"btn_id" : "btn_settings",
"btn_text" : "Settings",
"btn_tooltip" : "Open settings",
"show_top" : false,
"is_active" : false
}
],
"theme_name": "default"
}