Init repo - gui can launch and first pad list generates from list in pads settings!
This commit is contained in:
0
gui/modules/__init__.py
Normal file
0
gui/modules/__init__.py
Normal file
0
gui/modules/core/__init__.py
Normal file
0
gui/modules/core/__init__.py
Normal file
133
gui/modules/core/blur.py
Normal file
133
gui/modules/core/blur.py
Normal file
@@ -0,0 +1,133 @@
|
||||
# source: https://github.com/Opticos/GWSL-Source/blob/master/blur.py,
|
||||
# https://www.cnblogs.com/zhiyiYo/p/14659981.html ,
|
||||
# https://github.com/ifwe/digsby/blob/master/digsby/src/gui/vista.py
|
||||
import platform
|
||||
import ctypes
|
||||
|
||||
|
||||
if platform.system() == 'Windows':
|
||||
from ctypes.wintypes import DWORD, BOOL, HRGN, HWND
|
||||
|
||||
user32 = ctypes.windll.user32
|
||||
dwm = ctypes.windll.dwmapi
|
||||
|
||||
|
||||
class ACCENTPOLICY(ctypes.Structure):
|
||||
_fields_ = [
|
||||
("AccentState", ctypes.c_uint),
|
||||
("AccentFlags", ctypes.c_uint),
|
||||
("GradientColor", ctypes.c_uint),
|
||||
("AnimationId", ctypes.c_uint)
|
||||
]
|
||||
|
||||
|
||||
class WINDOWCOMPOSITIONATTRIBDATA(ctypes.Structure):
|
||||
_fields_ = [
|
||||
("Attribute", ctypes.c_int),
|
||||
("Data", ctypes.POINTER(ctypes.c_int)),
|
||||
("SizeOfData", ctypes.c_size_t)
|
||||
]
|
||||
|
||||
|
||||
class DWM_BLURBEHIND(ctypes.Structure):
|
||||
_fields_ = [
|
||||
('dwFlags', DWORD),
|
||||
('fEnable', BOOL),
|
||||
('hRgnBlur', HRGN),
|
||||
('fTransitionOnMaximized', BOOL)
|
||||
]
|
||||
|
||||
|
||||
class MARGINS(ctypes.Structure):
|
||||
_fields_ = [("cxLeftWidth", ctypes.c_int),
|
||||
("cxRightWidth", ctypes.c_int),
|
||||
("cyTopHeight", ctypes.c_int),
|
||||
("cyBottomHeight", ctypes.c_int)
|
||||
]
|
||||
|
||||
|
||||
SetWindowCompositionAttribute = user32.SetWindowCompositionAttribute
|
||||
SetWindowCompositionAttribute.argtypes = (HWND, WINDOWCOMPOSITIONATTRIBDATA)
|
||||
SetWindowCompositionAttribute.restype = ctypes.c_int
|
||||
|
||||
|
||||
def ExtendFrameIntoClientArea(hwnd):
|
||||
margins = MARGINS(-1, -1, -1, -1)
|
||||
dwm.DwmExtendFrameIntoClientArea(hwnd, ctypes.byref(margins))
|
||||
|
||||
|
||||
def Win7Blur(hwnd, Acrylic):
|
||||
if not Acrylic:
|
||||
DWM_BB_ENABLE = 0x01
|
||||
bb = DWM_BLURBEHIND()
|
||||
bb.dwFlags = DWM_BB_ENABLE
|
||||
bb.fEnable = 1
|
||||
bb.hRgnBlur = 1
|
||||
dwm.DwmEnableBlurBehindWindow(hwnd, ctypes.byref(bb))
|
||||
else:
|
||||
ExtendFrameIntoClientArea(hwnd)
|
||||
|
||||
|
||||
def HEXtoRGBAint(HEX: str):
|
||||
alpha = HEX[7:]
|
||||
blue = HEX[5:7]
|
||||
green = HEX[3:5]
|
||||
red = HEX[1:3]
|
||||
|
||||
gradient_color = alpha + blue + green + red
|
||||
return int(gradient_color, base=16)
|
||||
|
||||
|
||||
def blur(hwnd, hex_color=False, acrylic=False, dark=False):
|
||||
accent = ACCENTPOLICY()
|
||||
accent.AccentState = 3 # Default window Blur #ACCENT_ENABLE_BLURBEHIND
|
||||
|
||||
gradient_color = 0
|
||||
|
||||
if hex_color:
|
||||
gradient_color = HEXtoRGBAint(hex_color)
|
||||
accent.AccentFlags = 2 # Window Blur With Accent Color #ACCENT_ENABLE_TRANSPARENTGRADIENT
|
||||
|
||||
if acrylic:
|
||||
accent.AccentState = 4 # UWP but LAG #ACCENT_ENABLE_ACRYLICBLURBEHIND
|
||||
if not hex_color: # UWP without color is translucent
|
||||
accent.AccentFlags = 2
|
||||
gradient_color = HEXtoRGBAint('#12121240') # placeholder color
|
||||
|
||||
accent.GradientColor = gradient_color
|
||||
|
||||
data = WINDOWCOMPOSITIONATTRIBDATA()
|
||||
data.Attribute = 19 # WCA_ACCENT_POLICY
|
||||
data.SizeOfData = ctypes.sizeof(accent)
|
||||
data.Data = ctypes.cast(ctypes.pointer(accent), ctypes.POINTER(ctypes.c_int))
|
||||
|
||||
SetWindowCompositionAttribute(int(hwnd), data)
|
||||
|
||||
if dark:
|
||||
data.Attribute = 26 # WCA_USEDARKMODECOLORS
|
||||
SetWindowCompositionAttribute(int(hwnd), data)
|
||||
|
||||
|
||||
def BlurLinux(WID): # may not work in all distros (working in Deepin)
|
||||
import os
|
||||
|
||||
c = "xprop -f _KDE_NET_WM_BLUR_BEHIND_REGION 32c -set _KDE_NET_WM_BLUR_BEHIND_REGION 0 -id " + str(WID)
|
||||
os.system(c)
|
||||
|
||||
|
||||
def GlobalBlur(hwnd, hex_color=False, acrylic=False, dark=False):
|
||||
release = platform.release()
|
||||
system = platform.system()
|
||||
|
||||
if system == 'Windows':
|
||||
if release == 'Vista':
|
||||
Win7Blur(hwnd, acrylic)
|
||||
else:
|
||||
release = int(float(release))
|
||||
if release == 10 or release == 8 or release == 11:
|
||||
blur(hwnd, hex_color, acrylic, dark)
|
||||
else:
|
||||
Win7Blur(hwnd, acrylic)
|
||||
|
||||
if system == 'Linux':
|
||||
BlurLinux(hwnd)
|
||||
26
gui/modules/core/popup.py
Normal file
26
gui/modules/core/popup.py
Normal file
@@ -0,0 +1,26 @@
|
||||
import ctypes
|
||||
|
||||
|
||||
def qtpopup(title, text):
|
||||
"""
|
||||
Popup using Qt
|
||||
:param title: Title of popup
|
||||
:param text: Text
|
||||
:return: None
|
||||
"""
|
||||
from PyQt5 import QtWidgets
|
||||
QtWidgets.QMessageBox.information(None, title, text)
|
||||
|
||||
|
||||
def popup(title, text, style=0):
|
||||
"""
|
||||
Styles:
|
||||
0 : OK
|
||||
1 : OK | Cancel
|
||||
2 : Abort | Retry | Ignore
|
||||
3 : Yes | No | Cancel
|
||||
4 : Yes | No
|
||||
5 : Retry | Cancel
|
||||
6 : Cancel | Try Again | Continue
|
||||
"""
|
||||
return ctypes.windll.user32.MessageBoxW(0, text, title, style)
|
||||
0
gui/modules/handlers/__init__.py
Normal file
0
gui/modules/handlers/__init__.py
Normal file
15
gui/modules/handlers/register.py
Normal file
15
gui/modules/handlers/register.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from gui.gui import Ui_MainWindow
|
||||
from PyQt5.QtWidgets import QMainWindow
|
||||
from gui.modules import menu
|
||||
from gui.modules import pads
|
||||
|
||||
|
||||
def register_handlers(ui: Ui_MainWindow, MainWindow: QMainWindow):
|
||||
"""
|
||||
Register all handlers
|
||||
:param ui:
|
||||
:param MainWindow:
|
||||
:return:
|
||||
"""
|
||||
menu.register_handlers(ui)
|
||||
pads.register_handlers(ui, MainWindow)
|
||||
0
gui/modules/initialize/__init__.py
Normal file
0
gui/modules/initialize/__init__.py
Normal file
24
gui/modules/initialize/setup_ui.py
Normal file
24
gui/modules/initialize/setup_ui.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from gui.gui import Ui_MainWindow
|
||||
from gui.modules.core.blur import GlobalBlur
|
||||
from gui.modules.initialize import styles
|
||||
from gui.modules.handlers import register
|
||||
from PyQt5.QtWidgets import QMainWindow
|
||||
from PyQt5 import QtWidgets
|
||||
from modules.config import Config
|
||||
|
||||
|
||||
def on_load(ui: Ui_MainWindow, MainWindow: QMainWindow):
|
||||
"""
|
||||
Setup all UI elements
|
||||
:param ui:
|
||||
:param MainWindow:
|
||||
:return:
|
||||
"""
|
||||
ui.content.setCurrentIndex(0)
|
||||
|
||||
MainWindow.setStyleSheet(styles.centralwidget())
|
||||
ui.menu.setStyleSheet(styles.menupage())
|
||||
if 'acrylic' in Config.get().theme:
|
||||
GlobalBlur(MainWindow.winId(), acrylic=True)
|
||||
|
||||
register.register_handlers(ui, MainWindow)
|
||||
593
gui/modules/initialize/styles.py
Normal file
593
gui/modules/initialize/styles.py
Normal file
@@ -0,0 +1,593 @@
|
||||
from modules.config import Config
|
||||
|
||||
|
||||
centralwidget_b = """
|
||||
QWidget {
|
||||
background-color: rgba(30, 30, 30, 0.1);
|
||||
color: white;
|
||||
font: 10pt "Segoe UI";
|
||||
}
|
||||
|
||||
|
||||
QScrollBar:vertical,
|
||||
QScrollBar:horizontal {
|
||||
border: none;
|
||||
background: rgba(30, 30, 30, 0);
|
||||
width: 10px;
|
||||
margin: 15px 0 15px 0;
|
||||
border-radius: 0px;
|
||||
}
|
||||
|
||||
QScrollBar::handle:vertical,
|
||||
QScrollBar::handle:horizontal {
|
||||
background-color: rgba(139, 139, 139, 0);
|
||||
min-height: 30px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
QScrollBar::handle:vertical:hover,
|
||||
QScrollBar::handle:vertical:pressed,
|
||||
QScrollBar::handle:horizontal:hover,
|
||||
QScrollBar::handle:horizontal:pressed {
|
||||
background-color: rgba(149, 149, 149, 0);
|
||||
}
|
||||
|
||||
QScrollBar::sub-line:vertical,
|
||||
QScrollBar::add-line:vertical,
|
||||
QScrollBar::up-arrow:vertical,
|
||||
QScrollBar::down-arrow:vertical {
|
||||
height: 0px;
|
||||
}
|
||||
|
||||
QScrollBar::up-arrow:vertical, QScrollBar::down-arrow:vertical,
|
||||
QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical,
|
||||
QScrollBar::up-arrow:horizontal, QScrollBar::down-arrow:horizontal,
|
||||
QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal {
|
||||
background: none;
|
||||
}
|
||||
|
||||
|
||||
QPushButton {
|
||||
color: white;
|
||||
border-width: 1px;
|
||||
border-radius:6px;
|
||||
border-style: solid;
|
||||
border-color: rgba(48, 48, 48, 0.5);
|
||||
background-color: rgba(44, 45, 46, 0.3);
|
||||
}
|
||||
QPushButton:hover {
|
||||
border-width: 2px;
|
||||
background-color: rgba(50, 50, 50, 0.7);
|
||||
}
|
||||
QPushButton:pressed {
|
||||
background-color: rgba(38, 39, 40, 0.7);
|
||||
}
|
||||
QPushButton:disabled {
|
||||
background-color: rgba(67, 67, 67, 0.7);
|
||||
border-color: rgba(0, 0, 0, 0.7);
|
||||
}
|
||||
|
||||
|
||||
QLineEdit, QTextBrowser, QPlainTextEdit, QTextEdit {
|
||||
border-width: 1px;
|
||||
border-radius: 5px;
|
||||
border-style: solid;
|
||||
border-color: rgba(48, 48, 48);
|
||||
background-color: rgba(36, 36, 36, 0);
|
||||
font: 10pt "Segoe UI";
|
||||
}
|
||||
|
||||
|
||||
QListWidget {
|
||||
border-width: 1px;
|
||||
border-radius: 15px;
|
||||
border-style: solid;
|
||||
border-color: rgba(48, 48, 48);
|
||||
padding: 10px;
|
||||
background-color: rgba(100, 100, 100, 0);
|
||||
font: 10pt "Segoe UI";
|
||||
}
|
||||
QListWidget:item {
|
||||
background-color: rgba(36, 36, 36, 0);
|
||||
selection-color: white;
|
||||
}
|
||||
QListWidget:item:hover {
|
||||
background-color: rgba(50, 50, 50, 0);
|
||||
}
|
||||
QListWidget:item:selected {
|
||||
background-color: rgba(119, 119, 119, 1);
|
||||
}
|
||||
|
||||
|
||||
QComboBox
|
||||
{
|
||||
border-width: 1px;
|
||||
border-radius:6px;
|
||||
border-style: solid;
|
||||
border-color: rgba(48, 48, 48);
|
||||
background-color: rgba(44, 45, 46, 0);
|
||||
color: white;
|
||||
}
|
||||
|
||||
QComboBox::disabled
|
||||
{
|
||||
background-color: rgba(67, 67, 67, 0);
|
||||
color: #656565;
|
||||
border-color: rgba(67, 67, 67);
|
||||
}
|
||||
|
||||
QComboBox:hover
|
||||
{
|
||||
background-color: rgba(50, 50, 50, 0);
|
||||
}
|
||||
|
||||
QComboBox:on
|
||||
{
|
||||
background-color: rgba(67, 67, 67, 0);
|
||||
}
|
||||
|
||||
QComboBox QAbstractItemView
|
||||
{
|
||||
background-color: rgba(67, 67, 67, 0);
|
||||
color: #ffffff;
|
||||
selection-background-color: rgba(119, 119, 119, 0);
|
||||
selection-color: white;
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
QComboBox::drop-down
|
||||
{
|
||||
subcontrol-origin: padding;
|
||||
subcontrol-position: top right;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
|
||||
QTabBar::tab
|
||||
{
|
||||
background-color: rgba(44, 45, 46, 0);
|
||||
color: #ffffff;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
border-top-left-radius: 3px;
|
||||
border-top-right-radius: 3px;
|
||||
border-color: rgba(48, 48, 48);
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
QTabBar::tab:disabled
|
||||
{
|
||||
background-color: rgba(101, 101, 101, 0);
|
||||
color: #656565;
|
||||
}
|
||||
|
||||
QTabWidget::pane
|
||||
{
|
||||
background-color: rgba(160, 160, 160, 0);
|
||||
color: #ffffff;
|
||||
border: 3px solid;
|
||||
border-radius: 15px;
|
||||
border-color: rgba(28, 28, 28);
|
||||
}
|
||||
|
||||
QTabBar::tab:selected
|
||||
{
|
||||
background-color: rgba(38, 39, 40, 0);
|
||||
color: #ffffff;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
border-top-left-radius: 3px;
|
||||
border-top-right-radius: 3px;
|
||||
border-color: rgba(48, 48, 48);
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
QTabBar::tab:selected:disabled
|
||||
{
|
||||
background-color: rgba(64, 64, 64, 0);
|
||||
color: #656565;
|
||||
}
|
||||
|
||||
QTabBar::tab:!selected
|
||||
{
|
||||
background-color: rgba(38, 38, 38, 0);
|
||||
}
|
||||
|
||||
QTabBar::tab:!selected:hover
|
||||
{
|
||||
background-color: rgba(50, 50, 50, 0);
|
||||
}
|
||||
|
||||
QTabBar::tab:top:!selected
|
||||
{
|
||||
margin-top: 3px;
|
||||
}
|
||||
|
||||
QTabBar::tab:bottom:!selected
|
||||
{
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
QTabBar::tab:top, QTabBar::tab:bottom
|
||||
{
|
||||
min-width: 8ex;
|
||||
margin-right: -1px;
|
||||
padding: 5px 10px 5px 10px;
|
||||
}
|
||||
|
||||
QTabBar::tab:top:selected
|
||||
{
|
||||
border-bottom-color: none;
|
||||
}
|
||||
|
||||
QTabBar::tab:bottom:selected
|
||||
{
|
||||
border-top-color: none;
|
||||
}
|
||||
|
||||
QTabBar::tab:top:last, QTabBar::tab:bottom:last,
|
||||
QTabBar::tab:top:only-one, QTabBar::tab:bottom:only-one
|
||||
{
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
QTabBar::tab:left:!selected
|
||||
{
|
||||
margin-right: 3px;
|
||||
}
|
||||
|
||||
QTabBar::tab:right:!selected
|
||||
{
|
||||
margin-left: 3px;
|
||||
}
|
||||
|
||||
QTabBar::tab:left, QTabBar::tab:right
|
||||
{
|
||||
min-height: 8ex;
|
||||
margin-bottom: -1px;
|
||||
padding: 10px 5px 10px 5px;
|
||||
}
|
||||
|
||||
QTabBar::tab:left:selected
|
||||
{
|
||||
border-left-color: none;
|
||||
}
|
||||
|
||||
QTabBar::tab:right:selected
|
||||
{
|
||||
border-right-color: none;
|
||||
}
|
||||
|
||||
QTabBar::tab:left:last, QTabBar::tab:right:last,
|
||||
QTabBar::tab:left:only-one, QTabBar::tab:right:only-one
|
||||
{
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
QSpinBox {
|
||||
border-width: 1px;
|
||||
border-radius: 5px;
|
||||
border-style: solid;
|
||||
border-color: rgba(48, 48, 48);
|
||||
background-color: rgba(36, 36, 36, 0);
|
||||
font: 10pt "Segoe UI";
|
||||
}
|
||||
QSpinBox::up-button {
|
||||
border: none;
|
||||
background: none;
|
||||
}
|
||||
QSpinBox::down-button {
|
||||
border: none;
|
||||
background: none;
|
||||
}
|
||||
|
||||
QToolBox::tab {
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
border-radius: 5px;
|
||||
border-color: rgba(48, 48, 48, 0);
|
||||
}
|
||||
"""
|
||||
|
||||
menupage_b = """
|
||||
QListWidget {
|
||||
border-width: 0px;
|
||||
border-radius: 0px;
|
||||
border: none;
|
||||
padding: 0px;
|
||||
background-color: rgba(25, 25, 25, 0);
|
||||
font: 10pt "Segoe UI";
|
||||
}
|
||||
QListWidget:item {
|
||||
padding-left: 12px;
|
||||
height: 60px;
|
||||
background-color: rgba(25, 25, 25, 0);
|
||||
selection-color: rgba(255, 255, 255);
|
||||
}
|
||||
QListWidget:item:hover {
|
||||
background-color: rgba(50, 50, 50, 0);
|
||||
}
|
||||
QListWidget:item:selected {
|
||||
background-color: rgba(38, 39, 40, 0);
|
||||
}
|
||||
"""
|
||||
|
||||
centralwidget_g = """
|
||||
QWidget {
|
||||
background-color: rgb(30, 30, 30);
|
||||
color: rgb(255, 255, 255);
|
||||
font: 10pt "Segoe UI";
|
||||
}
|
||||
QScrollBar:vertical,
|
||||
QScrollBar:horizontal {
|
||||
border: none;
|
||||
background: rgb(30, 30, 30);
|
||||
width: 10px;
|
||||
margin: 15px 0 15px 0;
|
||||
border-radius: 0px;
|
||||
}
|
||||
QScrollBar::handle:vertical,
|
||||
QScrollBar::handle:horizontal {
|
||||
background-color: rgb(139, 139, 139);
|
||||
min-height: 30px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
QScrollBar::handle:vertical:hover,
|
||||
QScrollBar::handle:vertical:pressed,
|
||||
QScrollBar::handle:horizontal:hover,
|
||||
QScrollBar::handle:horizontal:pressed {
|
||||
background-color: rgb(149, 149, 149);
|
||||
}
|
||||
QScrollBar::sub-line:vertical,
|
||||
QScrollBar::add-line:vertical,
|
||||
QScrollBar::up-arrow:vertical,
|
||||
QScrollBar::down-arrow:vertical {
|
||||
height: 0px;
|
||||
}
|
||||
QScrollBar::up-arrow:vertical, QScrollBar::down-arrow:vertical,
|
||||
QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical,
|
||||
QScrollBar::up-arrow:horizontal, QScrollBar::down-arrow:horizontal,
|
||||
QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal {
|
||||
background: none;
|
||||
}
|
||||
QPushButton {
|
||||
color: white;
|
||||
border-width: 1px;
|
||||
border-radius:6px;
|
||||
border-style: solid;
|
||||
border-color: #303030;
|
||||
background-color: #2c2d2e;
|
||||
}
|
||||
QPushButton:hover {
|
||||
border-width: 2px;
|
||||
background-color: #323232;
|
||||
}
|
||||
QPushButton:pressed {
|
||||
background-color: #262728;
|
||||
}
|
||||
QPushButton:disabled {
|
||||
background-color: #434343;
|
||||
border-color: #0000;
|
||||
}
|
||||
QLineEdit, QTextBrowser, QPlainTextEdit, QTextEdit {
|
||||
border-width: 1px;
|
||||
border-radius: 5px;
|
||||
border-style: solid;
|
||||
border-color: #303030;
|
||||
background-color: #242424;
|
||||
font: 10pt "Segoe UI";
|
||||
}
|
||||
QListWidget {
|
||||
border-width: 1px;
|
||||
border-radius: 15px;
|
||||
border-style: solid;
|
||||
border-color: #303030;
|
||||
padding: 10px;
|
||||
background-color: #242424;
|
||||
font: 10pt "Segoe UI";
|
||||
}
|
||||
QListWidget:item {
|
||||
background-color: #242424;
|
||||
selection-color: white;
|
||||
}
|
||||
QListWidget:item:hover {
|
||||
background-color: #323232;
|
||||
}
|
||||
QListWidget:item:selected {
|
||||
background-color: #777777;
|
||||
}
|
||||
QComboBox
|
||||
{
|
||||
border-width: 1px;
|
||||
border-radius:6px;
|
||||
border-style: solid;
|
||||
border-color: #303030;
|
||||
background-color: #2c2d2e;
|
||||
color: #ffffff;
|
||||
}
|
||||
QComboBox::disabled
|
||||
{
|
||||
background-color: #434343;
|
||||
color: #656565;
|
||||
border-color: #434343;
|
||||
}
|
||||
QComboBox:hover
|
||||
{
|
||||
background-color: #323232;
|
||||
}
|
||||
QComboBox:on
|
||||
{
|
||||
background-color: #434343;
|
||||
}
|
||||
QComboBox QAbstractItemView
|
||||
{
|
||||
background-color: #434343;
|
||||
color: #ffffff;
|
||||
selection-background-color: #777777;
|
||||
selection-color: white;
|
||||
outline: 0;
|
||||
}
|
||||
QComboBox::drop-down
|
||||
{
|
||||
subcontrol-origin: padding;
|
||||
subcontrol-position: top right;
|
||||
border-radius: 6px;
|
||||
}
|
||||
QTabBar::tab
|
||||
{
|
||||
background-color: #2c2d2e;
|
||||
color: #ffffff;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
border-top-left-radius: 3px;
|
||||
border-top-right-radius: 3px;
|
||||
border-color: #303030;
|
||||
padding: 5px;
|
||||
}
|
||||
QTabBar::tab:disabled
|
||||
{
|
||||
background-color: #656565;
|
||||
color: #656565;
|
||||
}
|
||||
QTabWidget::pane
|
||||
{
|
||||
background-color: #a0a0a0;
|
||||
color: #ffffff;
|
||||
border: 3px solid;
|
||||
border-radius: 15px;
|
||||
border-color: #1c1c1c;
|
||||
}
|
||||
QTabBar::tab:selected
|
||||
{
|
||||
background-color: #262728;
|
||||
color: #ffffff;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
border-top-left-radius: 3px;
|
||||
border-top-right-radius: 3px;
|
||||
border-color: #303030;
|
||||
padding: 5px;
|
||||
}
|
||||
QTabBar::tab:selected:disabled
|
||||
{
|
||||
background-color: #404040;
|
||||
color: #656565;
|
||||
}
|
||||
QTabBar::tab:!selected
|
||||
{
|
||||
background-color: #262626;
|
||||
}
|
||||
QTabBar::tab:!selected:hover
|
||||
{
|
||||
background-color: #323232;
|
||||
}
|
||||
QTabBar::tab:top:!selected
|
||||
{
|
||||
margin-top: 3px;
|
||||
}
|
||||
QTabBar::tab:bottom:!selected
|
||||
{
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
QTabBar::tab:top, QTabBar::tab:bottom
|
||||
{
|
||||
min-width: 8ex;
|
||||
margin-right: -1px;
|
||||
padding: 5px 10px 5px 10px;
|
||||
}
|
||||
QTabBar::tab:top:selected
|
||||
{
|
||||
border-bottom-color: none;
|
||||
}
|
||||
QTabBar::tab:bottom:selected
|
||||
{
|
||||
border-top-color: none;
|
||||
}
|
||||
QTabBar::tab:top:last, QTabBar::tab:bottom:last,
|
||||
QTabBar::tab:top:only-one, QTabBar::tab:bottom:only-one
|
||||
{
|
||||
margin-right: 0;
|
||||
}
|
||||
QTabBar::tab:left:!selected
|
||||
{
|
||||
margin-right: 3px;
|
||||
}
|
||||
QTabBar::tab:right:!selected
|
||||
{
|
||||
margin-left: 3px;
|
||||
}
|
||||
QTabBar::tab:left, QTabBar::tab:right
|
||||
{
|
||||
min-height: 8ex;
|
||||
margin-bottom: -1px;
|
||||
padding: 10px 5px 10px 5px;
|
||||
}
|
||||
QTabBar::tab:left:selected
|
||||
{
|
||||
border-left-color: none;
|
||||
}
|
||||
QTabBar::tab:right:selected
|
||||
{
|
||||
border-right-color: none;
|
||||
}
|
||||
QTabBar::tab:left:last, QTabBar::tab:right:last,
|
||||
QTabBar::tab:left:only-one, QTabBar::tab:right:only-one
|
||||
{
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
QSpinBox {
|
||||
border-width: 1px;
|
||||
border-radius: 5px;
|
||||
border-style: solid;
|
||||
border-color: #303030;
|
||||
background-color: #242424;
|
||||
font: 10pt "Segoe UI";
|
||||
}
|
||||
QSpinBox::up-button {
|
||||
border: none;
|
||||
background: none;
|
||||
}
|
||||
QSpinBox::down-button {
|
||||
border: none;
|
||||
background: none;
|
||||
}
|
||||
|
||||
QToolBox::tab {
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
border-radius: 5px;
|
||||
border-color: #303030;
|
||||
}
|
||||
"""
|
||||
|
||||
menupage_g = """
|
||||
QListWidget {
|
||||
border-width: 0px;
|
||||
border-radius: 0px;
|
||||
border: none;
|
||||
padding: 0px;
|
||||
background-color: #191919;
|
||||
font: 10pt "Segoe UI";
|
||||
}
|
||||
QListWidget:item {
|
||||
padding-left: 12px;
|
||||
height: 60px;
|
||||
background-color: #191919;
|
||||
selection-color: rgba(255, 255, 255);
|
||||
}
|
||||
QListWidget:item:hover {
|
||||
background-color: #323232;
|
||||
}
|
||||
QListWidget:item:selected {
|
||||
background-color: #262728;
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
def centralwidget():
|
||||
return centralwidget_g if Config.get().theme == "Dark gray" else centralwidget_b
|
||||
|
||||
|
||||
def menupage():
|
||||
return menupage_g if Config.get().theme == "Dark gray" else menupage_b
|
||||
1
gui/modules/menu/__init__.py
Normal file
1
gui/modules/menu/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from .handlers import *
|
||||
11
gui/modules/menu/handlers.py
Normal file
11
gui/modules/menu/handlers.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from gui.gui import Ui_MainWindow
|
||||
from .menu import handle_menu_click
|
||||
|
||||
|
||||
def register_handlers(ui: Ui_MainWindow):
|
||||
"""
|
||||
Register this module handlers
|
||||
:param ui:
|
||||
:return:
|
||||
"""
|
||||
ui.menu.itemClicked.connect(lambda: handle_menu_click(ui.menu.currentItem().text(), ui))
|
||||
41
gui/modules/menu/menu.py
Normal file
41
gui/modules/menu/menu.py
Normal file
@@ -0,0 +1,41 @@
|
||||
from PyQt5 import QtCore
|
||||
from gui.gui import Ui_MainWindow
|
||||
|
||||
|
||||
def open_menu(ui: Ui_MainWindow) -> None:
|
||||
"""
|
||||
Animates the menu to open and close, using animation from config
|
||||
:return:
|
||||
"""
|
||||
width = ui.menu.geometry().width()
|
||||
Ui_MainWindow.animation = QtCore.QPropertyAnimation(ui.menu, b"minimumWidth")
|
||||
Ui_MainWindow.animation.setDuration(300)
|
||||
if width == 64:
|
||||
Ui_MainWindow.animation.setStartValue(64)
|
||||
Ui_MainWindow.animation.setEndValue(200)
|
||||
else:
|
||||
Ui_MainWindow.animation.setStartValue(200)
|
||||
Ui_MainWindow.animation.setEndValue(64)
|
||||
Ui_MainWindow.animation.setEasingCurve(QtCore.QEasingCurve.InOutQuart)
|
||||
|
||||
Ui_MainWindow.animation.start()
|
||||
|
||||
|
||||
def handle_menu_click(text: str, ui: Ui_MainWindow) -> None:
|
||||
"""
|
||||
Handles the click on the menu and changes the page
|
||||
:param text:
|
||||
:param ui:
|
||||
:return:
|
||||
"""
|
||||
index = {
|
||||
"Close menu": [lambda _: open_menu(ui), None],
|
||||
"Pads": [ui.content.setCurrentWidget, ui.pads_page],
|
||||
"Explorer": [ui.content.setCurrentWidget, ui.browser_page],
|
||||
"Collections": [ui.content.setCurrentWidget, ui.collections_page],
|
||||
"Stream": [ui.content.setCurrentWidget, ui.stream_page],
|
||||
"Collab": [ui.content.setCurrentWidget, ui.collab_page],
|
||||
"Download": [ui.content.setCurrentWidget, ui.download_page],
|
||||
"Settings": [ui.content.setCurrentWidget, ui.settings_page]
|
||||
}
|
||||
index[text][0](index[text][1])
|
||||
1
gui/modules/pads/__init__.py
Normal file
1
gui/modules/pads/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from .handlers import *
|
||||
33
gui/modules/pads/fill_pads_from_settings.py
Normal file
33
gui/modules/pads/fill_pads_from_settings.py
Normal file
@@ -0,0 +1,33 @@
|
||||
import os
|
||||
from gui.gui import Ui_MainWindow
|
||||
from PyQt5 import QtWidgets, QtCore
|
||||
from PyQt5.QtWidgets import QMainWindow
|
||||
|
||||
|
||||
def fill_pads(ui: Ui_MainWindow, MainWindow: QMainWindow):
|
||||
ui.first_pads_dict = dict()
|
||||
ui.second_pads_dict = dict()
|
||||
|
||||
first_pads_list = \
|
||||
[ui.edit_first_pads_collection_list.item(x).text() for x in range(ui.edit_first_pads_collection_list.count())]
|
||||
|
||||
for i in range(len(first_pads_list)):
|
||||
item = first_pads_list[i]
|
||||
if item == '':
|
||||
continue
|
||||
ui.first_pads_dict[os.path.split(item)[-1]] = item
|
||||
button = QtWidgets.QPushButton()
|
||||
button.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding,
|
||||
QtWidgets.QSizePolicy.Expanding))
|
||||
button.setText(os.path.split(item)[-1] if os.path.exists(item) else "File doesn't exist")
|
||||
button.clicked.connect(lambda: print(ui.first_pads_dict[MainWindow.sender().text()]
|
||||
if MainWindow.sender().text() != "File doesn't exist" else None))
|
||||
print(ui.first_pads_dict)
|
||||
ui.pads_collection_1_lay.addWidget(button, i // 4, i % 4)
|
||||
|
||||
for i in range(16):
|
||||
item = QtWidgets.QListWidgetItem()
|
||||
item.setFlags(
|
||||
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsEnabled
|
||||
)
|
||||
ui.edit_second_pads_collection_list.addItem(item)
|
||||
16
gui/modules/pads/handlers.py
Normal file
16
gui/modules/pads/handlers.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from gui.gui import Ui_MainWindow
|
||||
from PyQt5.QtWidgets import QMainWindow
|
||||
from .initialize_pads_settings import *
|
||||
from .fill_pads_from_settings import *
|
||||
|
||||
|
||||
def register_handlers(ui: Ui_MainWindow, MainWindow: QMainWindow):
|
||||
"""
|
||||
Register this module handlers
|
||||
:param ui:
|
||||
:param MainWindow:
|
||||
:return:
|
||||
"""
|
||||
fill_settings(ui)
|
||||
fill_pads(ui, MainWindow)
|
||||
ui.edit_first_pads_collection_list.itemChanged.connect(lambda: fill_pads(ui, MainWindow))
|
||||
18
gui/modules/pads/initialize_pads_settings.py
Normal file
18
gui/modules/pads/initialize_pads_settings.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from gui.gui import Ui_MainWindow
|
||||
from PyQt5 import QtWidgets, QtCore
|
||||
|
||||
|
||||
def fill_settings(ui: Ui_MainWindow):
|
||||
for i in range(16):
|
||||
item = QtWidgets.QListWidgetItem()
|
||||
item.setFlags(
|
||||
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsEnabled
|
||||
)
|
||||
ui.edit_first_pads_collection_list.addItem(item)
|
||||
|
||||
for i in range(16):
|
||||
item = QtWidgets.QListWidgetItem()
|
||||
item.setFlags(
|
||||
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsEnabled
|
||||
)
|
||||
ui.edit_second_pads_collection_list.addItem(item)
|
||||
Reference in New Issue
Block a user