This commit is contained in:
VFX - Visual Effects
2021-04-09 11:14:41 -03:00
parent 270192ef7d
commit ac38f49cae
9 changed files with 310 additions and 8 deletions

3
.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
__pycache__/
.git/
.pyc

View File

@@ -17,9 +17,10 @@
import sys
import platform
# IMPORT / GUI AND MODULES
# IMPORT / GUI AND MODULES AND WIDGETS
# ///////////////////////////////////////////////////////////////
from modules import *
from widgets import *
# SET AS GLOBAL WIDGETS
# ///////////////////////////////////////////////////////////////
@@ -136,6 +137,12 @@ class MainWindow(QMainWindow):
print(f'Button "{btnName}" pressed!')
# RESIZE EVENTS
# ///////////////////////////////////////////////////////////////
def resizeEvent(self, event):
# Update Size Grips
UIFunctions.resize_grips(self)
# MOUSE CLICK EVENTS
# ///////////////////////////////////////////////////////////////
def mousePressEvent(self, event):

View File

@@ -2998,7 +2998,7 @@ background-repeat: no-repeat;</string>
<item>
<widget class="QLabel" name="version">
<property name="text">
<string>v1.0.1</string>
<string>v1.0.2</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>

View File

@@ -36,6 +36,10 @@ class UIFunctions(MainWindow):
self.ui.maximizeRestoreAppBtn.setToolTip("Restore")
self.ui.maximizeRestoreAppBtn.setIcon(QIcon(u":/icons/images/icons/icon_restore.png"))
self.ui.frame_size_grip.hide()
self.left_grip.hide()
self.right_grip.hide()
self.top_grip.hide()
self.bottom_grip.hide()
else:
GLOBAL_STATE = False
self.showNormal()
@@ -44,6 +48,10 @@ class UIFunctions(MainWindow):
self.ui.maximizeRestoreAppBtn.setToolTip("Maximize")
self.ui.maximizeRestoreAppBtn.setIcon(QIcon(u":/icons/images/icons/icon_maximize.png"))
self.ui.frame_size_grip.show()
self.left_grip.show()
self.right_grip.show()
self.top_grip.show()
self.bottom_grip.show()
# RETURN STATUS
# ///////////////////////////////////////////////////////////////
@@ -206,9 +214,14 @@ class UIFunctions(MainWindow):
self.move(self.pos() + event.globalPos() - self.dragPos)
self.dragPos = event.globalPos()
event.accept()
self.ui.titleRightInfo.mouseMoveEvent = moveWindow
# CUSTOM GRIPS
self.left_grip = CustomGrip(self, Qt.LeftEdge, True)
self.right_grip = CustomGrip(self, Qt.RightEdge, True)
self.top_grip = CustomGrip(self, Qt.TopEdge, True)
self.bottom_grip = CustomGrip(self, Qt.BottomEdge, True)
else:
self.ui.appMargins.setContentsMargins(0, 0, 0, 0)
self.ui.minimizeAppBtn.hide()
@@ -237,5 +250,12 @@ class UIFunctions(MainWindow):
# CLOSE APPLICATION
self.ui.closeAppBtn.clicked.connect(lambda: self.close())
def resize_grips(self):
if Settings.ENABLE_CUSTOM_TITLE_BAR:
self.left_grip.setGeometry(0, 10, 10, self.height())
self.right_grip.setGeometry(self.width() - 10, 10, 10, self.height())
self.top_grip.setGeometry(0, 0, self.width(), 10)
self.bottom_grip.setGeometry(0, self.height() - 10, self.width(), 10)
# ///////////////////////////////////////////////////////////////
# END - GUI DEFINITIONS
# END - GUI DEFINITIONS

View File

@@ -1655,6 +1655,5 @@ class Ui_MainWindow(object):
self.btn_print.setText(QCoreApplication.translate("MainWindow", u"Print", None))
self.btn_logout.setText(QCoreApplication.translate("MainWindow", u"Logout", None))
self.creditsLabel.setText(QCoreApplication.translate("MainWindow", u"By: Wanderson M. Pimenta", None))
self.version.setText(QCoreApplication.translate("MainWindow", u"v1.0.1", None))
self.version.setText(QCoreApplication.translate("MainWindow", u"v1.0.2", None))
# retranslateUi

View File

@@ -1,4 +1,4 @@
import sys
import sys
import os
from cx_Freeze import setup, Executable
@@ -20,4 +20,5 @@ setup(
author = "Wanderson M. Pimenta",
options = {'build_exe' : {'include_files' : files}},
executables = [target]
)
)

17
widgets/__init__.py Normal file
View File

@@ -0,0 +1,17 @@
# ///////////////////////////////////////////////////////////////
#
# 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
#
# ///////////////////////////////////////////////////////////////
from . custom_grips import CustomGrip

View File

@@ -0,0 +1,17 @@
# ///////////////////////////////////////////////////////////////
#
# 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
#
# ///////////////////////////////////////////////////////////////
from . custom_grips import CustomGrip

View File

@@ -0,0 +1,238 @@
# ///////////////////////////////////////////////////////////////
#
# 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
#
# ///////////////////////////////////////////////////////////////
from PySide6.QtCore import *
from PySide6.QtGui import *
from PySide6.QtWidgets import *
class CustomGrip(QWidget):
def __init__(self, parent, position, disable_color = False):
# SETUP UI
QWidget.__init__(self)
self.parent = parent
self.setParent(parent)
self.wi = Widgets()
# SHOW TOP GRIP
if position == Qt.TopEdge:
self.wi.top(self)
self.setGeometry(0, 0, self.parent.width(), 10)
self.setMaximumHeight(10)
# GRIPS
top_left = QSizeGrip(self.wi.top_left)
top_right = QSizeGrip(self.wi.top_right)
# RESIZE TOP
def resize_top(event):
delta = event.pos()
height = max(self.parent.minimumHeight(), self.parent.height() - delta.y())
geo = self.parent.geometry()
geo.setTop(geo.bottom() - height)
self.parent.setGeometry(geo)
event.accept()
self.wi.top.mouseMoveEvent = resize_top
# ENABLE COLOR
if disable_color:
self.wi.top_left.setStyleSheet("background: transparent")
self.wi.top_right.setStyleSheet("background: transparent")
self.wi.top.setStyleSheet("background: transparent")
# SHOW BOTTOM GRIP
elif position == Qt.BottomEdge:
self.wi.bottom(self)
self.setGeometry(0, self.parent.height() - 10, self.parent.width(), 10)
self.setMaximumHeight(10)
# GRIPS
self.bottom_left = QSizeGrip(self.wi.bottom_left)
self.bottom_right = QSizeGrip(self.wi.bottom_right)
# RESIZE BOTTOM
def resize_bottom(event):
delta = event.pos()
height = max(self.parent.minimumHeight(), self.parent.height() + delta.y())
self.parent.resize(self.parent.width(), height)
event.accept()
self.wi.bottom.mouseMoveEvent = resize_bottom
# ENABLE COLOR
if disable_color:
self.wi.bottom_left.setStyleSheet("background: transparent")
self.wi.bottom_right.setStyleSheet("background: transparent")
self.wi.bottom.setStyleSheet("background: transparent")
# SHOW LEFT GRIP
elif position == Qt.LeftEdge:
self.wi.left(self)
self.setGeometry(0, 10, 10, self.parent.height())
self.setMaximumWidth(10)
# RESIZE LEFT
def resize_left(event):
delta = event.pos()
width = max(self.parent.minimumWidth(), self.parent.width() - delta.x())
geo = self.parent.geometry()
geo.setLeft(geo.right() - width)
self.parent.setGeometry(geo)
event.accept()
self.wi.leftgrip.mouseMoveEvent = resize_left
# ENABLE COLOR
if disable_color:
self.wi.leftgrip.setStyleSheet("background: transparent")
# RESIZE RIGHT
elif position == Qt.RightEdge:
self.wi.right(self)
self.setGeometry(self.parent.width() - 10, 10, 10, self.parent.height())
self.setMaximumWidth(10)
def resize_right(event):
delta = event.pos()
width = max(self.parent.minimumWidth(), self.parent.width() + delta.x())
self.parent.resize(width, self.parent.height())
event.accept()
self.wi.rightgrip.mouseMoveEvent = resize_right
# ENABLE COLOR
if disable_color:
self.wi.rightgrip.setStyleSheet("background: transparent")
def mouseReleaseEvent(self, event):
self.mousePos = None
def resizeEvent(self, event):
if hasattr(self.wi, 'container_top'):
self.wi.container_top.setGeometry(0, 0, self.width(), 10)
elif hasattr(self.wi, 'container_bottom'):
self.wi.container_bottom.setGeometry(0, 0, self.width(), 10)
elif hasattr(self.wi, 'leftgrip'):
self.wi.leftgrip.setGeometry(0, 0, 10, self.height() - 20)
elif hasattr(self.wi, 'rightgrip'):
self.wi.rightgrip.setGeometry(0, 0, 10, self.height() - 20)
class Widgets(object):
def top(self, Form):
if not Form.objectName():
Form.setObjectName(u"Form")
self.container_top = QFrame(Form)
self.container_top.setObjectName(u"container_top")
self.container_top.setGeometry(QRect(0, 0, 500, 10))
self.container_top.setMinimumSize(QSize(0, 10))
self.container_top.setMaximumSize(QSize(16777215, 10))
self.container_top.setFrameShape(QFrame.NoFrame)
self.container_top.setFrameShadow(QFrame.Raised)
self.top_layout = QHBoxLayout(self.container_top)
self.top_layout.setSpacing(0)
self.top_layout.setObjectName(u"top_layout")
self.top_layout.setContentsMargins(0, 0, 0, 0)
self.top_left = QFrame(self.container_top)
self.top_left.setObjectName(u"top_left")
self.top_left.setMinimumSize(QSize(10, 10))
self.top_left.setMaximumSize(QSize(10, 10))
self.top_left.setCursor(QCursor(Qt.SizeFDiagCursor))
self.top_left.setStyleSheet(u"background-color: rgb(33, 37, 43);")
self.top_left.setFrameShape(QFrame.NoFrame)
self.top_left.setFrameShadow(QFrame.Raised)
self.top_layout.addWidget(self.top_left)
self.top = QFrame(self.container_top)
self.top.setObjectName(u"top")
self.top.setCursor(QCursor(Qt.SizeVerCursor))
self.top.setStyleSheet(u"background-color: rgb(85, 255, 255);")
self.top.setFrameShape(QFrame.NoFrame)
self.top.setFrameShadow(QFrame.Raised)
self.top_layout.addWidget(self.top)
self.top_right = QFrame(self.container_top)
self.top_right.setObjectName(u"top_right")
self.top_right.setMinimumSize(QSize(10, 10))
self.top_right.setMaximumSize(QSize(10, 10))
self.top_right.setCursor(QCursor(Qt.SizeBDiagCursor))
self.top_right.setStyleSheet(u"background-color: rgb(33, 37, 43);")
self.top_right.setFrameShape(QFrame.NoFrame)
self.top_right.setFrameShadow(QFrame.Raised)
self.top_layout.addWidget(self.top_right)
def bottom(self, Form):
if not Form.objectName():
Form.setObjectName(u"Form")
self.container_bottom = QFrame(Form)
self.container_bottom.setObjectName(u"container_bottom")
self.container_bottom.setGeometry(QRect(0, 0, 500, 10))
self.container_bottom.setMinimumSize(QSize(0, 10))
self.container_bottom.setMaximumSize(QSize(16777215, 10))
self.container_bottom.setFrameShape(QFrame.NoFrame)
self.container_bottom.setFrameShadow(QFrame.Raised)
self.bottom_layout = QHBoxLayout(self.container_bottom)
self.bottom_layout.setSpacing(0)
self.bottom_layout.setObjectName(u"bottom_layout")
self.bottom_layout.setContentsMargins(0, 0, 0, 0)
self.bottom_left = QFrame(self.container_bottom)
self.bottom_left.setObjectName(u"bottom_left")
self.bottom_left.setMinimumSize(QSize(10, 10))
self.bottom_left.setMaximumSize(QSize(10, 10))
self.bottom_left.setCursor(QCursor(Qt.SizeBDiagCursor))
self.bottom_left.setStyleSheet(u"background-color: rgb(33, 37, 43);")
self.bottom_left.setFrameShape(QFrame.NoFrame)
self.bottom_left.setFrameShadow(QFrame.Raised)
self.bottom_layout.addWidget(self.bottom_left)
self.bottom = QFrame(self.container_bottom)
self.bottom.setObjectName(u"bottom")
self.bottom.setCursor(QCursor(Qt.SizeVerCursor))
self.bottom.setStyleSheet(u"background-color: rgb(85, 170, 0);")
self.bottom.setFrameShape(QFrame.NoFrame)
self.bottom.setFrameShadow(QFrame.Raised)
self.bottom_layout.addWidget(self.bottom)
self.bottom_right = QFrame(self.container_bottom)
self.bottom_right.setObjectName(u"bottom_right")
self.bottom_right.setMinimumSize(QSize(10, 10))
self.bottom_right.setMaximumSize(QSize(10, 10))
self.bottom_right.setCursor(QCursor(Qt.SizeFDiagCursor))
self.bottom_right.setStyleSheet(u"background-color: rgb(33, 37, 43);")
self.bottom_right.setFrameShape(QFrame.NoFrame)
self.bottom_right.setFrameShadow(QFrame.Raised)
self.bottom_layout.addWidget(self.bottom_right)
def left(self, Form):
if not Form.objectName():
Form.setObjectName(u"Form")
self.leftgrip = QFrame(Form)
self.leftgrip.setObjectName(u"left")
self.leftgrip.setGeometry(QRect(0, 10, 10, 480))
self.leftgrip.setMinimumSize(QSize(10, 0))
self.leftgrip.setCursor(QCursor(Qt.SizeHorCursor))
self.leftgrip.setStyleSheet(u"background-color: rgb(255, 121, 198);")
self.leftgrip.setFrameShape(QFrame.NoFrame)
self.leftgrip.setFrameShadow(QFrame.Raised)
def right(self, Form):
if not Form.objectName():
Form.setObjectName(u"Form")
Form.resize(500, 500)
self.rightgrip = QFrame(Form)
self.rightgrip.setObjectName(u"right")
self.rightgrip.setGeometry(QRect(0, 0, 10, 500))
self.rightgrip.setMinimumSize(QSize(10, 0))
self.rightgrip.setCursor(QCursor(Qt.SizeHorCursor))
self.rightgrip.setStyleSheet(u"background-color: rgb(255, 0, 127);")
self.rightgrip.setFrameShape(QFrame.NoFrame)
self.rightgrip.setFrameShadow(QFrame.Raised)