Loads database and fills gui with items

This commit is contained in:
BarsTiger
2022-07-29 18:11:05 +03:00
commit 096e9d7f0d
30 changed files with 3864 additions and 0 deletions

8
.gitignore vendored Normal file
View File

@@ -0,0 +1,8 @@
/.idea/
/venv/
/build/
/dist/
/tests/
*.spec
*.gtabase
*.cfg

20
GtaBuyBaseGui.py Normal file
View File

@@ -0,0 +1,20 @@
import threading
from PyQt5 import QtWidgets
from gui.gui import Ui_MainWindow
from modules.core.exceptions import hook, thread_hook
from gui.modules import setup_ui
import sys
sys.excepthook = hook
threading.excepthook = thread_hook
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
setup_ui.on_load(ui, MainWindow)
MainWindow.show()
sys.exit(app.exec_())

1
README.md Normal file
View File

@@ -0,0 +1 @@
# GtaBuyBase GUI

0
data/__init__.py Normal file
View File

72
data/common.py Normal file
View File

@@ -0,0 +1,72 @@
items_class = [
"Vehicle",
"Property",
"Other"
]
vehicle_type = [
"Boats",
"Commercial",
"Compacts",
"Coupes",
"Cycle",
"Emergency",
"Helicopters",
"Industrial",
"Military",
"Motorcycles",
"Muscle",
"Off-Road",
"Open Wheel",
"Planes",
"Remote Control",
"Sedans",
"Service",
"Sports",
"Sports Classics",
"Super",
"SUVs",
"Tuners",
"Utility",
"Vans",
"Other"
]
property_type = [
"Agencies",
"Apartments",
"Arena Workshop",
"Auto Shops",
"Bunkers",
"Casino Penthouse",
"Command Centers",
"Crate Warehouses",
"Executive Office Garages",
"Executive Offices",
"Facilities",
"Garages",
"Hangars",
"MC Businesses",
"MC Clubhouses",
"Nightclubs",
"Retro Arcades",
"Vehicle Warehouses",
"Yachts",
"Other"
]
shop_sites = [
"TheDiamondCasinoandResort.com",
"Arenawar.tv",
"Dynasty8realestate.com",
"Elitastravel.com",
"Legendary Motorsport",
"Southern San Andreas Super Autos",
"Pandmcycles.com",
"docktease.com",
"warstock-cache-and-carry.com",
"Bennysoriginalmotorworks.com",
"foreclosure.maze-bank.com",
"dynasty8executiverealty.com",
"Other"
]

0
gui/__init__.py Normal file
View File

133
gui/gui.py Normal file
View File

@@ -0,0 +1,133 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'gui.ui'
#
# Created by: PyQt5 UI code generator 5.15.7
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(800, 435)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(":/img/img/icon.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
MainWindow.setWindowIcon(icon)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setStyleSheet("")
self.centralwidget.setObjectName("centralwidget")
self.horizontalLayout = QtWidgets.QHBoxLayout(self.centralwidget)
self.horizontalLayout.setContentsMargins(9, 9, 9, 9)
self.horizontalLayout.setObjectName("horizontalLayout")
self.content = QtWidgets.QStackedWidget(self.centralwidget)
self.content.setObjectName("content")
self.main_page = QtWidgets.QWidget()
self.main_page.setObjectName("main_page")
self.verticalLayout = QtWidgets.QVBoxLayout(self.main_page)
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.verticalLayout.setObjectName("verticalLayout")
self.topmenu = QtWidgets.QWidget(self.main_page)
self.topmenu.setObjectName("topmenu")
self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.topmenu)
self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.open_filter_button = QtWidgets.QPushButton(self.topmenu)
self.open_filter_button.setMinimumSize(QtCore.QSize(48, 48))
self.open_filter_button.setMaximumSize(QtCore.QSize(48, 48))
self.open_filter_button.setText("")
icon1 = QtGui.QIcon()
icon1.addPixmap(QtGui.QPixmap(":/img/img/menu.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.open_filter_button.setIcon(icon1)
self.open_filter_button.setIconSize(QtCore.QSize(32, 32))
self.open_filter_button.setObjectName("open_filter_button")
self.horizontalLayout_2.addWidget(self.open_filter_button)
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_2.addItem(spacerItem)
self.add_item_button = QtWidgets.QPushButton(self.topmenu)
self.add_item_button.setMinimumSize(QtCore.QSize(48, 48))
self.add_item_button.setMaximumSize(QtCore.QSize(48, 48))
self.add_item_button.setText("")
icon2 = QtGui.QIcon()
icon2.addPixmap(QtGui.QPixmap(":/img/img/plus.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.add_item_button.setIcon(icon2)
self.add_item_button.setIconSize(QtCore.QSize(32, 32))
self.add_item_button.setObjectName("add_item_button")
self.horizontalLayout_2.addWidget(self.add_item_button)
self.manage_profiles_button = QtWidgets.QPushButton(self.topmenu)
self.manage_profiles_button.setMinimumSize(QtCore.QSize(48, 48))
self.manage_profiles_button.setMaximumSize(QtCore.QSize(48, 48))
self.manage_profiles_button.setText("")
icon3 = QtGui.QIcon()
icon3.addPixmap(QtGui.QPixmap(":/img/img/account.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.manage_profiles_button.setIcon(icon3)
self.manage_profiles_button.setIconSize(QtCore.QSize(32, 32))
self.manage_profiles_button.setObjectName("manage_profiles_button")
self.horizontalLayout_2.addWidget(self.manage_profiles_button)
self.open_settings_button = QtWidgets.QPushButton(self.topmenu)
self.open_settings_button.setMinimumSize(QtCore.QSize(48, 48))
self.open_settings_button.setMaximumSize(QtCore.QSize(48, 48))
self.open_settings_button.setText("")
icon4 = QtGui.QIcon()
icon4.addPixmap(QtGui.QPixmap(":/img/img/settings.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.open_settings_button.setIcon(icon4)
self.open_settings_button.setIconSize(QtCore.QSize(32, 32))
self.open_settings_button.setObjectName("open_settings_button")
self.horizontalLayout_2.addWidget(self.open_settings_button)
self.verticalLayout.addWidget(self.topmenu)
self.content_layout = QtWidgets.QWidget(self.main_page)
self.content_layout.setObjectName("content_layout")
self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.content_layout)
self.horizontalLayout_3.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
self.logo_if_empty = QtWidgets.QTextBrowser(self.content_layout)
self.logo_if_empty.setMaximumSize(QtCore.QSize(16777215, 16777215))
self.logo_if_empty.setTextInteractionFlags(QtCore.Qt.NoTextInteraction)
self.logo_if_empty.setObjectName("logo_if_empty")
self.horizontalLayout_3.addWidget(self.logo_if_empty)
self.items_list = QtWidgets.QListWidget(self.content_layout)
self.items_list.setMaximumSize(QtCore.QSize(16777215, 16777215))
self.items_list.setStyleSheet("QListWidget:item {\n"
" padding-left: 10px;\n"
" height: 60px;\n"
"}")
self.items_list.setIconSize(QtCore.QSize(16777215, 56))
self.items_list.setObjectName("items_list")
self.horizontalLayout_3.addWidget(self.items_list)
self.verticalLayout.addWidget(self.content_layout)
self.content.addWidget(self.main_page)
self.add_page = QtWidgets.QWidget()
self.add_page.setObjectName("add_page")
self.content.addWidget(self.add_page)
self.horizontalLayout.addWidget(self.content)
MainWindow.setCentralWidget(self.centralwidget)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "GTABuyBase"))
self.logo_if_empty.setHtml(_translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'Segoe UI\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:28pt; font-weight:600;\">GTABuyBase</span></p>\n"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><img src=\":/img/img/icon.ico\" /></p>\n"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:12pt;\">Press add button on top right corner to add item</span></p>\n"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:12pt;\">To use own options create profile on profile page</span></p></body></html>"))
import gui.images_rc
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())

501
gui/gui.ui Normal file
View File

@@ -0,0 +1,501 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>435</height>
</rect>
</property>
<property name="windowTitle">
<string>GTABuyBase</string>
</property>
<property name="windowIcon">
<iconset resource="images.qrc">
<normaloff>:/img/img/icon.ico</normaloff>:/img/img/icon.ico</iconset>
</property>
<property name="styleSheet">
<string notr="true">
QWidget {
background-color: rgb(30, 30, 30);
color: rgb(255, 255, 255);
font: 10pt &quot;Segoe UI&quot;;
}
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 &quot;Segoe UI&quot;;
}
QListWidget {
border-width: 1px;
border-radius: 15px;
border-style: solid;
border-color: #303030;
padding: 10px;
background-color: #242424;
font: 10pt &quot;Segoe UI&quot;;
}
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;
}
</string>
</property>
<widget class="QWidget" name="centralwidget">
<property name="styleSheet">
<string notr="true"/>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<item>
<widget class="QStackedWidget" name="content">
<widget class="QWidget" name="main_page">
<layout class="QVBoxLayout" name="verticalLayout">
<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="QWidget" name="topmenu" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<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="QPushButton" name="open_filter_button">
<property name="minimumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/img/img/menu.png</normaloff>:/img/img/menu.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="top_menu_spacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="add_item_button">
<property name="minimumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/img/img/plus.png</normaloff>:/img/img/plus.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="manage_profiles_button">
<property name="minimumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/img/img/account.png</normaloff>:/img/img/account.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="open_settings_button">
<property name="minimumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/img/img/settings.png</normaloff>:/img/img/settings.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="content_layout" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<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="QTextBrowser" name="logo_if_empty">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Segoe UI'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:28pt; font-weight:600;&quot;&gt;GTABuyBase&lt;/span&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;img src=&quot;:/img/img/icon.ico&quot; /&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;Press add button on top right corner to add item&lt;/span&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;To use own options create profile on profile page&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textInteractionFlags">
<set>Qt::NoTextInteraction</set>
</property>
</widget>
</item>
<item>
<widget class="QListWidget" name="items_list">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QListWidget:item {
padding-left: 10px;
height: 60px;
}</string>
</property>
<property name="iconSize">
<size>
<width>16777215</width>
<height>56</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="add_page"/>
</widget>
</item>
</layout>
</widget>
</widget>
<resources>
<include location="images.qrc"/>
</resources>
<connections/>
</ui>

9
gui/images.qrc Normal file
View File

@@ -0,0 +1,9 @@
<RCC>
<qresource prefix="img">
<file>img/account.png</file>
<file>img/icon.ico</file>
<file>img/menu.png</file>
<file>img/plus.png</file>
<file>img/settings.png</file>
</qresource>
</RCC>

2234
gui/images_rc.py Normal file

File diff suppressed because it is too large Load Diff

BIN
gui/img/account.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 947 B

BIN
gui/img/icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 KiB

BIN
gui/img/menu.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 B

BIN
gui/img/plus.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 816 B

BIN
gui/img/settings.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

0
gui/modules/__init__.py Normal file
View File

133
gui/modules/blur.py Normal file
View 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)

20
gui/modules/popup.py Normal file
View File

@@ -0,0 +1,20 @@
import ctypes
def qtpopup(title, text):
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)

32
gui/modules/setup_ui.py Normal file
View File

@@ -0,0 +1,32 @@
import requests
from gui.gui import Ui_MainWindow
from .blur import GlobalBlur
from gui.modules import styles
from PyQt5 import QtWidgets, QtGui
from PyQt5.QtWidgets import QMainWindow
from modules.config import Config
from modules.database import Database
def on_load(ui: Ui_MainWindow, MainWindow: QMainWindow):
ui.logo_if_empty.hide()
ui.content.setCurrentIndex(0)
MainWindow.setStyleSheet(styles.centralwidget())
if 'acrylic' in Config.get().theme:
GlobalBlur(MainWindow.winId(), acrylic=True)
if Database.get().items:
for item in Database.get().items:
item = Database.get().items[item]
list_item = QtWidgets.QListWidgetItem()
list_item.setText(f'{item.item_name} - ${"{:,}".format(item.price)}')
pixmap = QtGui.QPixmap()
pixmap.loadFromData(requests.get(item.image).content)
list_item.setIcon(QtGui.QIcon(pixmap))
ui.items_list.addItem(list_item)
else:
ui.logo_if_empty.show()
ui.items_list.hide()

545
gui/modules/styles.py Normal file
View File

@@ -0,0 +1,545 @@
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;
}
"""
menupage_b = """
QListWidget {
border-width: 0px;
border-radius: 0px;
border: none;
padding: 0px;
background-color: rgba(36, 36, 36, 0);
font: 10pt "Segoe UI";
}
QListWidget:item {
padding-left: 10px;
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;
}
"""
menupage_g = """
QListWidget {
border-width: 0px;
border-radius: 0px;
border: none;
padding: 0px;
background-color: #242424;
font: 10pt "Segoe UI";
}
QListWidget:item {
padding-left: 10px;
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

0
modules/__init__.py Normal file
View File

View File

@@ -0,0 +1 @@
from .settings import Config

11
modules/config/model.py Normal file
View File

@@ -0,0 +1,11 @@
from typing import Dict, List
from dataclasses import dataclass
from dataclasses_json import dataclass_json
@dataclass_json
@dataclass(frozen=True)
class ConfigModel:
database: str
profile: str | None
theme: str

View File

@@ -0,0 +1,41 @@
from modules.config.model import ConfigModel
import json
class Config:
@staticmethod
def default():
return {
"database": "default.gtabase",
"profile": None,
"theme": "Dark gray"
}
@staticmethod
def fix() -> None:
try:
with open("config.cfg", "w") as file:
json.dump(Config.default(), file)
except FileNotFoundError:
Config.fix()
@staticmethod
def get() -> ConfigModel:
try:
with open("config.cfg", "r") as file:
return ConfigModel.from_dict(json.load(file))
except:
Config.fix()
return Config.get()
@staticmethod
def update(key: str, value: str) -> dict:
with open("config.cfg", "r") as file:
settings = json.load(file)
settings[key] = value
with open("config.cfg", "w") as file:
json.dump(settings, file)
return settings

0
modules/core/__init__.py Normal file
View File

View File

@@ -0,0 +1,15 @@
from traceback import format_exception
def hook(type_, value, traceback):
print("[!] Error happened")
print("Error type: ", type_.__name__)
print("Error value: ", value)
print("Error traceback: ", format_exception(type_, value, traceback)[2])
def thread_hook(exception):
print(f"[!] Error happened in {exception.thread}")
print("Error type: ", exception.exc_type.__name__)
print("Error value: ", exception.exc_value)
print("Error traceback: ", format_exception(exception.exc_type, exception.exc_value, exception.exc_traceback)[2])

View File

@@ -0,0 +1,2 @@
from .model import DatabaseModel
from .database import Database

View File

@@ -0,0 +1,15 @@
import json
from .model import DatabaseModel, default_database
from modules.config import Config
import os
class Database:
@staticmethod
def get():
try:
return DatabaseModel.from_dict(json.load(open(Config.get().database)))
except:
with open(Config.get().database, 'w') as f:
json.dump(default_database, f, indent=4)
return DatabaseModel.from_dict(default_database)

66
modules/database/model.py Normal file
View File

@@ -0,0 +1,66 @@
from typing import Dict, List
from dataclasses import dataclass
from dataclasses_json import dataclass_json
@dataclass_json
@dataclass(frozen=True)
class Item:
item_name: str
item_class: str
item_type: str
shop: str
price: int
image: str
@dataclass_json
@dataclass(frozen=True)
class Profile:
profile_name: str
owned_items: List[str]
@dataclass_json
@dataclass(frozen=True)
class DatabaseModel:
items: Dict[str, Item] | None
profiles: Dict[str, Profile] | None
default_database = {
"items": None,
"profiles": None
}
aa = DatabaseModel.from_dict(
{
"items": {
"sieg": {
"item_name": "seig",
"item_class": "meow",
"item_type": "bebra44ka",
"shop": "aaaaaaatb",
"price": 100000000,
"image": "https://magichitler.sieg/public/static/img/mama.png"
},
"aaaaaaaaaaaaa": {
"item_name": "aaaaaaaaaaaaa",
"item_class": "aaaaaaaaaaaaaaaaaaaa",
"item_type": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"shop": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"price": 10000000000000000,
"image": "https://sieg-heil.com/"
}
},
"profiles": {
"BarsTiger": {
"profile_name": "BarsTiger",
"owned_items": [
"aaaaaaaaaaaaa"
]
}
}
}
)

5
requirements.txt Normal file
View File

@@ -0,0 +1,5 @@
wheel
PyQt5
pyinstaller
dataclasses-json
requests