first commit

This commit is contained in:
VFX - Visual Effects
2021-05-26 13:56:50 -03:00
commit bccd10fc77
59 changed files with 13333 additions and 0 deletions
+21
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
#
# ///////////////////////////////////////////////////////////////
# APP WIDGETS
from . pyside_or_pyqt import *
# APP WIDGETS
from . widgets import *
+18
View File
@@ -0,0 +1,18 @@
# ///////////////////////////////////////////////////////////////
#
# 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
#
# ///////////////////////////////////////////////////////////////
# APP WIDGETS
from . pyside_or_pyqt import *
@@ -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
#
# ///////////////////////////////////////////////////////////////
from PySide6.QtCore import *
from PySide6.QtGui import *
from PySide6.QtWidgets import *
+34
View File
@@ -0,0 +1,34 @@
# ///////////////////////////////////////////////////////////////
#
# 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
#
# ///////////////////////////////////////////////////////////////
# CUSTOM GRIP
# Resize window using application edges
from . custom_grips import CustomGrip
# LEFT MENU BUTTON
# Custom button with tooltip
from . left_menu_button import LeftMenuButton
# TOP USER BOX
# Top user information and status
from . top_user_box import TopUserInfo
# FRIEND MENU MESSAGE / MESSAGE BUTTON
# Friends messages with name and status
from . friend_message_button import FriendMessageButton
# CIRCULAR PROGRESS BAR
from . circular_progress import CircularProgress
@@ -0,0 +1,14 @@
# ///////////////////////////////////////////////////////////////
#
# 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.
#
# ///////////////////////////////////////////////////////////////
# CIRCULAR PROGRESS BAR
from . circular_progress import CircularProgress
@@ -0,0 +1,106 @@
# ///////////////////////////////////////////////////////////////
#
# 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.
#
# ///////////////////////////////////////////////////////////////
from PySide6.QtCore import *
from PySide6.QtGui import *
from PySide6.QtWidgets import *
class CircularProgress(QWidget):
def __init__(self):
QWidget.__init__(self)
# CUSTOM PROPERTIES
self.value = 0
self.width = 200
self.height = 200
self.progress_width = 10
self.progress_rounded_cap = True
self.max_value = 100
self.progress_color = 0xff79c6
# Text
self.enable_text = True
self.font_family = "Segoe UI"
self.font_size = 12
self.suffix = "%"
self.text_color = 0xff79c6
# BG
self.enable_bg = True
self.bg_color = 0x44475a
# SET DEFAULT SIZE WITHOUT LAYOUT
self.resize(self.width, self.height)
# 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)
paint.drawRect(rect)
# 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()
if __name__ == "__main__":
progress = CircularProgress()
progress.__init__()
@@ -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
@@ -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)
@@ -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
#
# ///////////////////////////////////////////////////////////////
# FRIEND MENU MESSAGE / MESSAGE BUTTON
# Friends messages with name and status
from . friend_message_button import FriendMessageButton
@@ -0,0 +1,230 @@
# ///////////////////////////////////////////////////////////////
#
# 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
from app.packages.pyside_or_pyqt import *
# Modules
import os
# FRIEND MENU MESSAGE / MESSAGE BUTTON
# Friends messages with name and status
class FriendMessageButton(QWidget):
# SIGNALS
# ///////////////////////////////////////////////////////////////
clicked = Signal()
released = Signal()
def __init__(
self,
id,
user_image,
user_name,
user_descrition,
user_status,
unread_messages,
is_active
):
QWidget.__init__(self)
# ICON PATH
# ///////////////////////////////////////////////////////////////
image = user_image
app_path = os.path.abspath(os.getcwd())
image_path = os.path.join(app_path, image)
# CUSTOM PARAMETERS
# ///////////////////////////////////////////////////////////////
self.user_image = image_path
self.user_name = user_name
self.user_description = user_descrition
self.user_status = user_status
self.unread_messages = unread_messages
self.is_active = is_active
self._status_color = "#46b946"
self.bg_color_entered = "#22CCCCCC"
self.bg_color_leave = "#00000000"
self.bg_color_active = "#33CCCCCC"
self._bg_color = self.bg_color_leave
# SETUP
self.setFixedSize(240, 50)
self.setCursor(Qt.PointingHandCursor)
self.setObjectName(str(id))
self.setup_ui()
# SHOW UNREAD MESSAGES
if self.unread_messages > 0:
self.label_messages.show()
self.label_messages.setText(str(self.unread_messages))
# CHANGE COLOR
if self.user_status == "online":
self._status_color = "#46b946"
elif self.user_status == "ilde":
self._status_color = "#ff9955"
elif self.user_status == "busy":
self._status_color = "#a02c2c"
elif self.user_status == "invisible":
self._status_color = "#808080"
# CHANGE OPACITY
if self.user_status == "invisible":
self.opacity = QGraphicsOpacityEffect()
self.opacity.setOpacity(0.4)
self.setGraphicsEffect(self.opacity)
def reset_unread_message(self):
self.unread_messages = 0
self.label_messages.hide()
self.repaint()
# MOUSE PRESS
# Event triggered when the left button is pressed
def mousePressEvent(self, event):
if event.button() == Qt.LeftButton:
# EMIT SIGNAL
self.clicked.emit()
# MOUSE RELEASE
# Event fired when the mouse leaves the BTN
def mouseReleaseEvent(self, event):
if event.button() == Qt.LeftButton:
self.released.emit()
# MOUSE ENTER
# Event fired when the mouse enter
def enterEvent(self, event):
if not self.is_active:
self._bg_color = self.bg_color_entered
self.repaint()
# MOUSE LEAVE
# Event fired when the mouse leave
def leaveEvent(self, event):
if not self.is_active:
self._bg_color = self.bg_color_leave
self.repaint()
def set_active(self, active):
if active:
self.is_active = active
else:
self.is_active = active
self._bg_color = self.bg_color_leave
self.repaint()
# SETUP WIDGETS
# ///////////////////////////////////////////////////////////////
def setup_ui(self):
# FRAME TEXT
self.text_frame = QFrame(self)
self.text_frame.setGeometry(60, 0, 170, 50)
# USER NAME
self.label_user = QLabel(self.text_frame)
self.label_user.setGeometry(0, 8, self.text_frame.width(), 20)
self.label_user.setAlignment(Qt.AlignVCenter)
self.label_user.setText(self.user_name.capitalize())
self.label_user.setStyleSheet("color: #e7e7e7; font: 700 10pt 'Segoe UI';")
# USER STATUS
self.label_description = QLabel(self.text_frame)
self.label_description.setGeometry(0, 22, self.text_frame.width(), 18)
self.label_description.setAlignment(Qt.AlignVCenter)
self.label_description.setText(self.user_description)
self.label_description.setStyleSheet("color: #A6A6A6; font: 9pt 'Segoe UI';")
# USER STATUS
self.label_messages = QLabel(self)
self.label_messages.setFixedSize(35, 20)
self.label_messages.setAlignment(Qt.AlignCenter)
self.label_messages.setStyleSheet("""
background-color: #1e2021;
padding-left: 5px;
padding-right: 5px;
color: #bdff00;
border-radius: 10px;
border: 3px solid #333;
font: 9pt 'Segoe UI';
""")
self.label_messages.move(self.width() - 45, 16)
self.label_messages.hide()
# PAINT EVENT
# PAINT USER IMAGE EVENTS
# ///////////////////////////////////////////////////////////////
def paintEvent(self, event):
# PAINTER USER IMAGE
painter = QPainter()
painter.begin(self)
painter.setRenderHint(QPainter.Antialiasing)
painter.setPen(Qt.NoPen)
# RECT
rect = QRect(10, 5, 40, 40)
# DRAW BG
if self.is_active:
painter.setBrush(QBrush(QColor(self.bg_color_active)))
else:
painter.setBrush(QBrush(QColor(self._bg_color)))
painter.drawRoundedRect(5, 0, 230, 50, 25, 25)
# CIRCLE
painter.setBrush(QBrush(QColor("#000000")))
painter.drawEllipse(rect)
# DRAW USER IMAGE
self.draw_user_image(painter, self.user_image, rect)
painter.end()
# DRAW USER IMAGE
if self.user_status != "invisible":
self.draw_status(self.user_image, rect)
# DRAW USER IMAGE
# ///////////////////////////////////////////////////////////////
def draw_user_image(self, qp, image, rect):
user_image = QImage(image)
path = QPainterPath()
path.addEllipse(rect)
qp.setClipPath(path)
qp.drawImage(rect, user_image)
# DRAW STATUS
# ///////////////////////////////////////////////////////////////
def draw_status(self, status, rect):
painter = QPainter()
painter.begin(self)
painter.setRenderHint(QPainter.Antialiasing)
# PEN
pen = QPen()
pen.setWidth(3)
pen.setColor(QColor("#151617"))
painter.setPen(pen)
# BRUSH/STATUS COLOR
painter.setBrush(QBrush(QColor(self._status_color)))
# DRAW
painter.drawEllipse(rect.x() + 27, rect.y() + 27, 13, 13)
painter.end()
@@ -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
#
# ///////////////////////////////////////////////////////////////
# LEFT MENU BUTTON
# Custom button with tooltip
from . left_menu_button import LeftMenuButton
@@ -0,0 +1,226 @@
# ///////////////////////////////////////////////////////////////
#
# 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
from app.packages.pyside_or_pyqt import *
# Modules
import app.modules.ui_functions.functions as ui_functions
from app.modules.app_settings.settings import *
import os
# TOOLTIP / LABEL StyleSheet
style_tooltip = """
QLabel {
background-color: #0b0b0c;
color: rgb(230, 230, 230);
padding-left: 10px;
padding-right: 10px;
border-radius: 17px;
border: 1px solid #2f3032;
border-left: 3px solid #bdff00;
font: 800 9pt "Segoe UI";
}
"""
# CUSTOM LEFT MENU
class LeftMenuButton(QWidget):
# SIGNALS
clicked = Signal()
released = Signal()
def __init__(self, parent, name, icon, tooltip):
QWidget.__init__(self)
# APP PATH
app_path = os.path.abspath(os.getcwd())
icon_path = os.path.join(app_path, icon)
# GET SETTINGS
settings = Settings()
self.settings = settings.items
# DEFAULT PARAMETERS
self.width = 40
self.height = 40
self.pos_x = 0
self.pos_y = 0
self.border_radius = 10
self.parent = parent
self.setGeometry(0, 0, self.width, self.height)
self.setMinimumSize(self.width, self.height)
self.setCursor(Qt.PointingHandCursor)
self.setObjectName(name)
# BG COLORS
self.color_default = QColor(self.settings["left_menu"]["color"])
self.color_hover = QColor(self.settings["left_menu"]["color_hover"])
self.color_pressed = QColor(self.settings["left_menu"]["color_pressed"])
self._set_color = self.color_default
# ICON
self.icon_color = QColor(0xE6E6E6)
self.icon_color_pressed = QColor(0x151617)
self._set_icon_path = icon_path
self._set_icon_color = self.icon_color
# TOOLTIP
self.tooltip_text = tooltip
self.tooltip = _ToolTip(parent, tooltip)
self.tooltip.hide()
# PAINT EVENT
# Responsible for painting the button, as well as the icon
def paintEvent(self, event):
# PAINTER
paint = QPainter()
paint.begin(self)
paint.setRenderHint(QPainter.RenderHint.Antialiasing)
# BRUSH
brush = QBrush(self._set_color)
# CREATE RECTANGLE
rect = QRect(0, 0, self.width, self.height)
paint.setPen(Qt.NoPen)
paint.setBrush(brush)
paint.drawRoundedRect(rect, self.border_radius, self.border_radius)
# DRAW ICONS
self.icon_paint(paint, self._set_icon_path, rect)
# END PAINTER
paint.end()
# DRAW ICON WITH COLORS
def icon_paint(self, qp, image, rect):
icon = QPixmap(image)
painter = QPainter(icon)
painter.setCompositionMode(QPainter.CompositionMode_SourceIn)
painter.fillRect(icon.rect(), self._set_icon_color)
qp.drawPixmap(
(rect.width() - icon.width()) / 2,
(rect.height() - icon.height()) / 2,
icon
)
painter.end()
# REPAINT BTN
# Reaload/Repaint BTN
def repaint_btn(self, event):
if event == QEvent.Enter:
self.repaint()
if event == QEvent.Leave:
self.repaint()
if event == QEvent.MouseButtonPress:
self.repaint()
if event == QEvent.MouseButtonRelease:
self.repaint()
# CHANGE STYLES
# Functions with custom styles
def change_style(self, event):
if event == QEvent.Enter:
self._set_color = self.color_hover
self.repaint_btn(event)
elif event == QEvent.Leave:
self._set_color = self.color_default
self.repaint_btn(event)
elif event == QEvent.MouseButtonPress:
self._set_color = self.color_pressed
self._set_icon_color = self.icon_color_pressed
self.repaint_btn(event)
elif event == QEvent.MouseButtonRelease:
self._set_color = self.color_hover
self._set_icon_color = self.icon_color
self.repaint_btn(event)
# 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.width + 12
pos_y = pos.y() + (self.width - self.tooltip.height()) // 2
# SET POSITION TO WIDGET
# Move tooltip position
self.tooltip.move(pos_x, pos_y)
# 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)
# EMIT SIGNAL
self.clicked.emit()
# SET FOCUS
self.setFocus()
# 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
self.released.emit()
class _ToolTip(QLabel):
def __init__(self, parent, tooltip):
QLabel.__init__(self)
# LABEL SETUP
self.setObjectName(u"label_tooltip")
self.setStyleSheet(style_tooltip)
self.setMinimumHeight(36)
self.setParent(parent)
self.setText(tooltip)
self.adjustSize()
# SET DROP SHADOW
self.shadow = QGraphicsDropShadowEffect(self)
self.shadow.setBlurRadius(15)
self.shadow.setXOffset(0)
self.shadow.setYOffset(0)
self.shadow.setColor(QColor(0, 0, 0, 160))
self.setGraphicsEffect(self.shadow)
# SET OPACITY
self.opacity = QGraphicsOpacityEffect(self)
self.opacity.setOpacity(0.85)
self.setGraphicsEffect(self.opacity)
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>220</width>
<height>30</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>220</width>
<height>30</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="label_layout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label">
<property name="styleSheet">
<string notr="true">QLabel {
background-color: rgb(12, 12, 13);
color: rgb(230, 230, 230);
padding-left: 10px;
padding-right: 10px;
border-radius: 8px;
}</string>
</property>
<property name="text">
<string>ToolTip</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
@@ -0,0 +1,20 @@
# ///////////////////////////////////////////////////////////////
#
# 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
#
# ///////////////////////////////////////////////////////////////
# TOP USER BOX
# Top user information and status
from . top_user_box import TopUserInfo
@@ -0,0 +1,362 @@
# ///////////////////////////////////////////////////////////////
#
# 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
from app.packages.pyside_or_pyqt import *
# Modules
import os
# TOP USER BOX
# Top box with name, description and status
# ///////////////////////////////////////////////////////////////
class TopUserInfo(QWidget):
status = Signal(str)
def __init__(self, parent, left, top, my_name, my_description):
QWidget.__init__(self)
# ICON PATH
# ///////////////////////////////////////////////////////////////
image = "images/users/me.png"
icon_settings = "images/icons_svg/icon_settings.svg"
app_path = os.path.abspath(os.getcwd())
image_path = os.path.join(app_path, image)
icon_settings_path = os.path.join(app_path, icon_settings)
# INITIAL SETUP
# ///////////////////////////////////////////////////////////////
self.setGeometry(0, 0, 240, 60)
self.setObjectName("top_text_box")
self.setStyleSheet("#top_text_box { background-color: #F00000 }")
# CUSTOM PARAMETERS
# ///////////////////////////////////////////////////////////////
self.user_name = my_name
self.user_description = my_description
self.user_status = "online"
self.user_image = image_path
self.icon_settings = icon_settings
self._status_color = "#46b946"
# DRAW BASE FRAME
# ///////////////////////////////////////////////////////////////
self.setup_ui()
# IMAGE FRAME EVENTS
# ///////////////////////////////////////////////////////////////
self.user_overlay.mousePressEvent = self.mouse_press
self.user_overlay.enterEvent = self.mouse_enter
self.user_overlay.leaveEvent = self.mouse_leave
# SETUP STATUS BOX
# ///////////////////////////////////////////////////////////////
self.status_box = _ChangeStatus(parent)
self.status_box.move(left, top)
self.status_box.focusOutEvent = self.lost_focus_status_box
self.status_box.line_edit.focusOutEvent = self.lost_focus_line_edit
self.status_box.line_edit.keyReleaseEvent = self.change_description
self.status_box.hide()
self.status_box.status.connect(self.change_status)
# CHANGE USER STATUS
# Change when is connected with status signal
# ///////////////////////////////////////////////////////////////
def change_status(self, status):
# CHANGE STATUS
if status == "online":
self._status_color = "#46b946"
self.repaint()
elif status == "idle":
self._status_color = "#ff9955"
self.repaint()
elif status == "busy":
self._status_color = "#a02c2c"
self.repaint()
elif status == "invisible":
self._status_color = "#808080"
self.repaint()
# EMIT SIGNAL
self.status.emit(status)
# CHANGE TEXT DESCRIPTION
# ///////////////////////////////////////////////////////////////
def change_description(self, event):
if event.key() == Qt.Key_Return or event.key() == Qt.Key_Enter:
self.label_description.setText(self.status_box.line_edit.text())
self.status_box.line_edit.setText("")
self.status_box.hide()
# SHO HIDE DIALOP POPUP
# ///////////////////////////////////////////////////////////////
# HIDE LINE EDIT WHEN LOST FOCUS
def lost_focus_status_box(self, event):
if not self.status_box.line_edit.hasFocus():
self.status_box.hide()
self.status_box.line_edit.setText("")
# HIDE WHEN LOST FOCUS
def lost_focus_line_edit(self, event):
if not self.status_box.hasFocus():
self.status_box.hide()
self.status_box.line_edit.setText("")
# OPEN STATUS BOX POPUP
# ///////////////////////////////////////////////////////////////
def mouse_press(self, event):
if self.status_box.isVisible():
self.status_box.hide()
self.status_box.line_edit.setText("")
else:
self.status_box.show()
self.status_box.line_edit.setFocus()
# SHOW ICON
# ///////////////////////////////////////////////////////////////
def mouse_enter(self, event):
self.user_overlay.setPixmap(self.icon_settings)
# HIDE ICON
# ///////////////////////////////////////////////////////////////
def mouse_leave(self, event):
self.user_overlay.setPixmap(None)
# SETUP WIDGETS
# ///////////////////////////////////////////////////////////////
def setup_ui(self):
# LAYOUT AND BORDER
self.layout = QVBoxLayout(self)
self.layout.setContentsMargins(10,10,10,0)
self.border = QFrame(self)
self.layout.addWidget(self.border)
# FRAME IMAGE
self.user_overlay = QLabel(self.border)
self.user_overlay.setGeometry(0, 5, 40, 40)
self.user_overlay.setCursor(QCursor(Qt.PointingHandCursor))
self.user_overlay.setAlignment(Qt.AlignCenter)
opacity = QGraphicsOpacityEffect(self)
opacity.setOpacity(0.75)
self.user_overlay.setGraphicsEffect(opacity)
# FRAME TEXT
self.text_frame = QFrame(self.border)
self.text_frame.setGeometry(50, 0, 170, 50)
# USER NAME
self.label_user = QLabel(self.text_frame)
self.label_user.setGeometry(0, 8, self.text_frame.width(), 20)
self.label_user.setAlignment(Qt.AlignVCenter)
self.label_user.setText(self.user_name.capitalize())
self.label_user.setStyleSheet("color: #bdff00; font: 700 10pt 'Segoe UI';")
# USER STATUS
self.label_description = QLabel(self.text_frame)
self.label_description.setGeometry(0, 22, self.text_frame.width(), 18)
self.label_description.setAlignment(Qt.AlignVCenter)
self.label_description.setText(self.user_description)
self.label_description.setStyleSheet("color: #A6A6A6; font: 9pt 'Segoe UI';")
# PAINT USER IMAGE EVENTS
# ///////////////////////////////////////////////////////////////
def paintEvent(self, event):
# PAINTER USER IMAGE
painter = QPainter()
painter.begin(self)
painter.setRenderHint(QPainter.Antialiasing)
# RECT
rect = QRect(10, 15, 40, 40)
# CIRCLE
painter.setPen(Qt.NoPen)
painter.setBrush(QBrush(QColor("#000000")))
painter.drawEllipse(rect)
# DRAW USER IMAGE
self.draw_user_image(painter, self.user_image, rect)
# PAINT END
painter.end()
# DRAW USER IMAGE
self.draw_status(self.user_image, rect)
# DRAW USER IMAGE
# ///////////////////////////////////////////////////////////////
def draw_user_image(self, qp, image, rect):
user_image = QImage(image)
path = QPainterPath()
path.addEllipse(rect)
qp.setClipPath(path)
qp.drawImage(rect, user_image)
# DRAW STATUS
# ///////////////////////////////////////////////////////////////
def draw_status(self, status, rect):
painter = QPainter()
painter.begin(self)
painter.setRenderHint(QPainter.Antialiasing)
# PEN
pen = QPen()
pen.setWidth(3)
pen.setColor(QColor("#151617"))
painter.setPen(pen)
# BRUSH/STATUS COLOR
painter.setBrush(QBrush(QColor(self._status_color)))
# DRAW
painter.drawEllipse(rect.x() + 27, rect.y() + 27, 13, 13)
painter.end()
# SET STYLE TO POPUP
# ///////////////////////////////////////////////////////////////
style = """
/* QFrame */
QFrame {
background: #333436; border-radius: 10px;
}
/* Search Message */
.QLineEdit {
border: 2px solid rgb(47, 48, 50);
border-radius: 15px;
background-color: rgb(47, 48, 50);
color: rgb(121, 121, 121);
padding-left: 10px;
padding-right: 10px;
}
.QLineEdit:hover {
color: rgb(230, 230, 230);
border: 2px solid rgb(62, 63, 66);
}
.QLineEdit:focus {
color: rgb(230, 230, 230);
border: 2px solid rgb(53, 54, 56);
background-color: rgb(14, 14, 15);
}
/* QPushButton */
.QPushButton{
background-color: transparent;
border: none;
border-radius: 10px;
background-repeat: no-repeat;
background-position: left center;
text-align: left;
color: #999999;
padding-left: 38px;
}
.QPushButton:hover{
background-color: #151617;
color: #CCCCCC;
}
"""
# CHAN STATUS POPUP
# # ///////////////////////////////////////////////////////////////
class _ChangeStatus(QFrame):
status = Signal(str)
def __init__(self, parent):
QFrame.__init__(self)
# SETUP
# ///////////////////////////////////////////////////////////////
self.setFixedSize(230, 205)
self.setStyleSheet(style)
self.setParent(parent)
# LAYOUT AND BORDER
# ///////////////////////////////////////////////////////////////
self.layout = QVBoxLayout(self)
self.layout.setContentsMargins(10,10,10,10)
self.border = QFrame(self)
self.layout.addWidget(self.border)
# LINEEDIT AND BTNS BOX
# ///////////////////////////////////////////////////////////////
self.layout_content = QVBoxLayout(self.border)
self.layout_content.setContentsMargins(0,0,0,0)
self.layout_content.setSpacing(1)
# CHANGE DESCRIPTION
# ///////////////////////////////////////////////////////////////
self.line_edit = QLineEdit()
self.line_edit.setMinimumHeight(30)
self.line_edit.setPlaceholderText("Write what you are doing...")
# TOP LABEL
# ///////////////////////////////////////////////////////////////
self.label = QLabel("Change status:")
self.label.setStyleSheet("padding-top: 5px; padding-bottom: 5px; color: rgb(121, 121, 121);")
# BTN ONLINE
# ///////////////////////////////////////////////////////////////
self.btn_online = QPushButton()
self.btn_online.setText("Online")
self.btn_online.setMinimumHeight(30)
self.btn_online.setStyleSheet("background-image: url(:/icons_svg/images/icons_svg/icon_online.svg)")
self.btn_online.clicked.connect(lambda: self.send_signal("online"))
self.btn_online.setCursor(Qt.PointingHandCursor)
# BTNL ILDE
# ///////////////////////////////////////////////////////////////
self.btn_idle = QPushButton()
self.btn_idle.setText("Idle")
self.btn_idle.setMinimumHeight(30)
self.btn_idle.setStyleSheet("background-image: url(:/icons_svg/images/icons_svg/icon_idle.svg)")
self.btn_idle.clicked.connect(lambda: self.send_signal("idle"))
self.btn_idle.setCursor(Qt.PointingHandCursor)
# BTN BUSE
# ///////////////////////////////////////////////////////////////
self.btn_busy = QPushButton()
self.btn_busy.setText("Do not disturb")
self.btn_busy.setMinimumHeight(30)
self.btn_busy.setStyleSheet("background-image: url(:/icons_svg/images/icons_svg/icon_busy.svg)")
self.btn_busy.clicked.connect(lambda: self.send_signal("busy"))
self.btn_busy.setCursor(Qt.PointingHandCursor)
# BTN INVISIBLE
self.btn_invisible = QPushButton()
self.btn_invisible.setText("Invisible")
self.btn_invisible.setMinimumHeight(30)
self.btn_invisible.setStyleSheet("background-image: url(:/icons_svg/images/icons_svg/icon_invisible.svg)")
self.btn_invisible.clicked.connect(lambda: self.send_signal("invisible"))
self.btn_invisible.setCursor(Qt.PointingHandCursor)
# ADD WIDGETS TO LAYOUT
# ///////////////////////////////////////////////////////////////
self.layout_content.addWidget(self.line_edit)
self.layout_content.addWidget(self.label)
self.layout_content.addWidget(self.btn_online)
self.layout_content.addWidget(self.btn_idle)
self.layout_content.addWidget(self.btn_busy)
self.layout_content.addWidget(self.btn_invisible)
# SET DROP SHADOW
# ///////////////////////////////////////////////////////////////
self.shadow = QGraphicsDropShadowEffect(self)
self.shadow.setBlurRadius(15)
self.shadow.setXOffset(0)
self.shadow.setYOffset(0)
self.shadow.setColor(QColor(0, 0, 0, 160))
self.setGraphicsEffect(self.shadow)
# SEND SIGNAL TO TOP USER WIDGET
# ///////////////////////////////////////////////////////////////
def send_signal(self, status):
self.status.emit(status)