New scrollbar + developing versions and autoupdates
This commit is contained in:
5
horsy.py
5
horsy.py
@@ -29,7 +29,10 @@ os.system('title horsy')
|
|||||||
if not os.path.exists(horsy_vars.horsypath + 'apps'):
|
if not os.path.exists(horsy_vars.horsypath + 'apps'):
|
||||||
os.makedirs(horsy_vars.horsypath + 'apps')
|
os.makedirs(horsy_vars.horsypath + 'apps')
|
||||||
if not os.path.isfile(horsy_vars.horsypath + 'config.cfg'):
|
if not os.path.isfile(horsy_vars.horsypath + 'config.cfg'):
|
||||||
with open(horsy_vars.horsypath + 'config.cfg', 'w') as f:
|
with open(horsy_vars.horsypath + 'config.cfg', 'w+') as f:
|
||||||
|
f.write('{}')
|
||||||
|
if not os.path.isfile(horsy_vars.horsypath + 'apps/versions.json'):
|
||||||
|
with open(horsy_vars.horsypath + 'apps/versions.json', 'w+') as f:
|
||||||
f.write('{}')
|
f.write('{}')
|
||||||
|
|
||||||
# Checking version
|
# Checking version
|
||||||
|
|||||||
15
horsygui.py
15
horsygui.py
@@ -58,7 +58,7 @@ def installed_apps():
|
|||||||
|
|
||||||
def update_app():
|
def update_app():
|
||||||
try:
|
try:
|
||||||
app_name = ui.installed_table.currentItem().text()
|
app_name = ui.installed_table.currentItem().text().replace('!', '')
|
||||||
if app_name == "":
|
if app_name == "":
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
@@ -70,7 +70,7 @@ def update_app():
|
|||||||
|
|
||||||
def uninstall_app():
|
def uninstall_app():
|
||||||
try:
|
try:
|
||||||
app_name = ui.installed_table.currentItem().text()
|
app_name = ui.installed_table.currentItem().text().replace('!', '')
|
||||||
if app_name == "":
|
if app_name == "":
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
@@ -107,6 +107,16 @@ def install_app():
|
|||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
def check_updates():
|
||||||
|
from modules.updates import check
|
||||||
|
needupdate = check()
|
||||||
|
try:
|
||||||
|
for module in needupdate:
|
||||||
|
print(module)
|
||||||
|
except:
|
||||||
|
gui.cpopup("Error", str(needupdate))
|
||||||
|
|
||||||
|
|
||||||
def get_source_gui():
|
def get_source_gui():
|
||||||
from modules.source import get_source
|
from modules.source import get_source
|
||||||
try:
|
try:
|
||||||
@@ -263,6 +273,7 @@ if __name__ == "__main__":
|
|||||||
ui.tabWidget.currentChanged.connect(refresh_gui)
|
ui.tabWidget.currentChanged.connect(refresh_gui)
|
||||||
ui.update_button.clicked.connect(update_app)
|
ui.update_button.clicked.connect(update_app)
|
||||||
ui.delete_button.clicked.connect(uninstall_app)
|
ui.delete_button.clicked.connect(uninstall_app)
|
||||||
|
ui.check_updates_button.clicked.connect(check_updates)
|
||||||
ui.search_button.clicked.connect(search_gui)
|
ui.search_button.clicked.connect(search_gui)
|
||||||
ui.install_button.clicked.connect(install_app)
|
ui.install_button.clicked.connect(install_app)
|
||||||
ui.source_button.clicked.connect(get_source_gui)
|
ui.source_button.clicked.connect(get_source_gui)
|
||||||
|
|||||||
110
modules/gui.py
110
modules/gui.py
@@ -14,10 +14,84 @@ class Ui_MainWindow(object):
|
|||||||
MainWindow.setWindowIcon(icon)
|
MainWindow.setWindowIcon(icon)
|
||||||
MainWindow.setWindowOpacity(0.99)
|
MainWindow.setWindowOpacity(0.99)
|
||||||
self.centralwidget = QtWidgets.QWidget(MainWindow)
|
self.centralwidget = QtWidgets.QWidget(MainWindow)
|
||||||
self.centralwidget.setStyleSheet("QWidget{\n"
|
self.centralwidget.setStyleSheet("""QWidget{\n"
|
||||||
" background-color: rgb(30, 30, 30);\n"
|
background-color: rgb(30, 30, 30);
|
||||||
"}\n"
|
}
|
||||||
"")
|
QScrollBar:horizontal {
|
||||||
|
border: none;
|
||||||
|
background: rgb(52, 59, 72);
|
||||||
|
height: 8px;
|
||||||
|
margin: 0px 21px 0 21px;
|
||||||
|
border-radius: 0px;
|
||||||
|
}
|
||||||
|
QScrollBar::handle:horizontal {
|
||||||
|
background: rgb(47, 48, 50);
|
||||||
|
min-width: 25px;
|
||||||
|
border-radius: 4px
|
||||||
|
}
|
||||||
|
QScrollBar::add-line:horizontal {
|
||||||
|
border: none;
|
||||||
|
background: rgb(55, 63, 77);
|
||||||
|
width: 20px;
|
||||||
|
border-top-right-radius: 4px;
|
||||||
|
border-bottom-right-radius: 4px;
|
||||||
|
subcontrol-position: right;
|
||||||
|
subcontrol-origin: margin;
|
||||||
|
}
|
||||||
|
QScrollBar::sub-line:horizontal {
|
||||||
|
border: none;
|
||||||
|
background: rgb(55, 63, 77);
|
||||||
|
width: 20px;
|
||||||
|
border-top-left-radius: 4px;
|
||||||
|
border-bottom-left-radius: 4px;
|
||||||
|
subcontrol-position: left;
|
||||||
|
subcontrol-origin: margin;
|
||||||
|
}
|
||||||
|
QScrollBar::up-arrow:horizontal, QScrollBar::down-arrow:horizontal
|
||||||
|
{
|
||||||
|
background: none;
|
||||||
|
}
|
||||||
|
QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal
|
||||||
|
{
|
||||||
|
background: none;
|
||||||
|
}
|
||||||
|
QScrollBar:vertical {
|
||||||
|
border: none;
|
||||||
|
background: rgb(52, 59, 72);
|
||||||
|
width: 8px;
|
||||||
|
margin: 21px 0 21px 0;
|
||||||
|
border-radius: 0px;
|
||||||
|
}
|
||||||
|
QScrollBar::handle:vertical {
|
||||||
|
background: rgb(47, 48, 50);
|
||||||
|
min-height: 25px;
|
||||||
|
border-radius: 4px
|
||||||
|
}
|
||||||
|
QScrollBar::add-line:vertical {
|
||||||
|
border: none;
|
||||||
|
background: transparent;
|
||||||
|
height: 10px;
|
||||||
|
border-radius: 4px;
|
||||||
|
subcontrol-position: bottom;
|
||||||
|
subcontrol-origin: margin;
|
||||||
|
}
|
||||||
|
QScrollBar::sub-line:vertical {
|
||||||
|
border: none;
|
||||||
|
background: transparent;
|
||||||
|
height: 10px;
|
||||||
|
border-radius: 4px;
|
||||||
|
subcontrol-position: top;
|
||||||
|
subcontrol-origin: margin;
|
||||||
|
}
|
||||||
|
QScrollBar::up-arrow:vertical, QScrollBar::down-arrow:vertical {
|
||||||
|
background: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {
|
||||||
|
background: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
""")
|
||||||
self.centralwidget.setObjectName("centralwidget")
|
self.centralwidget.setObjectName("centralwidget")
|
||||||
self.horsy_logo_lefttop = QtWidgets.QLabel(self.centralwidget)
|
self.horsy_logo_lefttop = QtWidgets.QLabel(self.centralwidget)
|
||||||
self.horsy_logo_lefttop.setGeometry(QtCore.QRect(10, 10, 32, 32))
|
self.horsy_logo_lefttop.setGeometry(QtCore.QRect(10, 10, 32, 32))
|
||||||
@@ -574,7 +648,7 @@ class Ui_MainWindow(object):
|
|||||||
self.installed_tab.setObjectName("installed_tab")
|
self.installed_tab.setObjectName("installed_tab")
|
||||||
self.delete_button = QtWidgets.QPushButton(self.installed_tab)
|
self.delete_button = QtWidgets.QPushButton(self.installed_tab)
|
||||||
self.delete_button.setEnabled(True)
|
self.delete_button.setEnabled(True)
|
||||||
self.delete_button.setGeometry(QtCore.QRect(440, 575, 421, 50))
|
self.delete_button.setGeometry(QtCore.QRect(300, 575, 275, 50))
|
||||||
self.delete_button.setMinimumSize(QtCore.QSize(0, 50))
|
self.delete_button.setMinimumSize(QtCore.QSize(0, 50))
|
||||||
self.delete_button.setStyleSheet("QPushButton {\n"
|
self.delete_button.setStyleSheet("QPushButton {\n"
|
||||||
" color: rgb(204, 204, 204);\n"
|
" color: rgb(204, 204, 204);\n"
|
||||||
@@ -597,7 +671,7 @@ class Ui_MainWindow(object):
|
|||||||
self.delete_button.setObjectName("delete_button")
|
self.delete_button.setObjectName("delete_button")
|
||||||
self.update_button = QtWidgets.QPushButton(self.installed_tab)
|
self.update_button = QtWidgets.QPushButton(self.installed_tab)
|
||||||
self.update_button.setEnabled(True)
|
self.update_button.setEnabled(True)
|
||||||
self.update_button.setGeometry(QtCore.QRect(20, 575, 401, 50))
|
self.update_button.setGeometry(QtCore.QRect(5, 575, 275, 50))
|
||||||
self.update_button.setMinimumSize(QtCore.QSize(0, 50))
|
self.update_button.setMinimumSize(QtCore.QSize(0, 50))
|
||||||
self.update_button.setStyleSheet("QPushButton {\n"
|
self.update_button.setStyleSheet("QPushButton {\n"
|
||||||
" color: rgb(204, 204, 204);\n"
|
" color: rgb(204, 204, 204);\n"
|
||||||
@@ -618,6 +692,29 @@ class Ui_MainWindow(object):
|
|||||||
" background-color: rgb(92, 99, 109);\n"
|
" background-color: rgb(92, 99, 109);\n"
|
||||||
"}")
|
"}")
|
||||||
self.update_button.setObjectName("update_button")
|
self.update_button.setObjectName("update_button")
|
||||||
|
self.check_updates_button = QtWidgets.QPushButton(self.installed_tab)
|
||||||
|
self.check_updates_button.setEnabled(True)
|
||||||
|
self.check_updates_button.setGeometry(QtCore.QRect(595, 575, 275, 50))
|
||||||
|
self.check_updates_button.setMinimumSize(QtCore.QSize(0, 50))
|
||||||
|
self.check_updates_button.setStyleSheet("QPushButton {\n"
|
||||||
|
" color: rgb(204, 204, 204);\n"
|
||||||
|
" border-width: 1px;\n"
|
||||||
|
" border-radius:6px;\n"
|
||||||
|
" border-style: solid;\n"
|
||||||
|
" background-color: rgb(28, 30, 33);\n"
|
||||||
|
" border-color: rgb(66, 143, 225);\n"
|
||||||
|
"}\n"
|
||||||
|
"QPushButton:hover{\n"
|
||||||
|
" border-width: 2px;\n"
|
||||||
|
"}\n"
|
||||||
|
"QPushButton:pressed{\n"
|
||||||
|
" background-color: rgb(50, 60, 63);\n"
|
||||||
|
"}\n"
|
||||||
|
"QPushButton:disabled{\n"
|
||||||
|
" border-width: 0px;\n"
|
||||||
|
" background-color: rgb(92, 99, 109);\n"
|
||||||
|
"}")
|
||||||
|
self.check_updates_button.setObjectName("check_updates_button")
|
||||||
self.installed_table = QtWidgets.QTableWidget(self.installed_tab)
|
self.installed_table = QtWidgets.QTableWidget(self.installed_tab)
|
||||||
self.installed_table.setGeometry(QtCore.QRect(0, 10, 871, 571))
|
self.installed_table.setGeometry(QtCore.QRect(0, 10, 871, 571))
|
||||||
self.installed_table.setStyleSheet("QTableWidget\n"
|
self.installed_table.setStyleSheet("QTableWidget\n"
|
||||||
@@ -733,6 +830,7 @@ class Ui_MainWindow(object):
|
|||||||
self.tabWidget.setTabText(self.tabWidget.indexOf(self.browse_tab), _translate("MainWindow", "Browse"))
|
self.tabWidget.setTabText(self.tabWidget.indexOf(self.browse_tab), _translate("MainWindow", "Browse"))
|
||||||
self.delete_button.setText(_translate("MainWindow", "Uninstall"))
|
self.delete_button.setText(_translate("MainWindow", "Uninstall"))
|
||||||
self.update_button.setText(_translate("MainWindow", "Update"))
|
self.update_button.setText(_translate("MainWindow", "Update"))
|
||||||
|
self.check_updates_button.setText(_translate("MainWindow", "Check all updates"))
|
||||||
self.installed_table.setSortingEnabled(True)
|
self.installed_table.setSortingEnabled(True)
|
||||||
__sortingEnabled = self.installed_table.isSortingEnabled()
|
__sortingEnabled = self.installed_table.isSortingEnabled()
|
||||||
self.installed_table.setSortingEnabled(False)
|
self.installed_table.setSortingEnabled(False)
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ def install(package):
|
|||||||
# Create launch script
|
# Create launch script
|
||||||
print(f"Generating launch script")
|
print(f"Generating launch script")
|
||||||
|
|
||||||
with open('{1}apps\{0}.bat'.format(r['name'], horsy_vars.horsypath), 'w') as f:
|
with open('{1}apps\{0}.bat'.format(r['name'], horsy_vars.horsypath), 'w+') as f:
|
||||||
f.write(f"@ECHO off\n")
|
f.write(f"@ECHO off\n")
|
||||||
f.write(f"""{r['run'].replace('$appdir$', f'%horsypath%/apps/{r["name"]}')} %*\n""")
|
f.write(f"""{r['run'].replace('$appdir$', f'%horsypath%/apps/{r["name"]}')} %*\n""")
|
||||||
|
|
||||||
|
|||||||
22
modules/updates.py
Normal file
22
modules/updates.py
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import json
|
||||||
|
import requests
|
||||||
|
import modules.vars as horsy_vars
|
||||||
|
from modules.http_status import handle
|
||||||
|
from modules.manager import apps_list
|
||||||
|
from rich import print
|
||||||
|
|
||||||
|
|
||||||
|
def check():
|
||||||
|
r = requests.get(f"{horsy_vars.protocol}{horsy_vars.server_url}/packages/json/"
|
||||||
|
f"{','.join(apps_list(True))}")
|
||||||
|
r_code = handle(r.status_code)
|
||||||
|
|
||||||
|
if r_code[1] not in [200, 201]:
|
||||||
|
return r_code[0]
|
||||||
|
r = r.text
|
||||||
|
r = json.loads(r)
|
||||||
|
print(r)
|
||||||
|
|
||||||
|
update_this = list()
|
||||||
|
|
||||||
|
return update_this
|
||||||
Reference in New Issue
Block a user