GUI development
This commit is contained in:
21
horsygui.py
21
horsygui.py
@@ -6,7 +6,6 @@ from PyQt5 import QtCore, QtGui, QtWidgets
|
|||||||
|
|
||||||
import modules.gui as gui
|
import modules.gui as gui
|
||||||
from modules.console import cls
|
from modules.console import cls
|
||||||
from modules.manager import install, uninstall, apps_list
|
|
||||||
from modules.virustotal import add_to_cfg
|
from modules.virustotal import add_to_cfg
|
||||||
from modules.uploader import upload
|
from modules.uploader import upload
|
||||||
from modules.source import get_source
|
from modules.source import get_source
|
||||||
@@ -23,17 +22,37 @@ MainWindow.show()
|
|||||||
|
|
||||||
# Functions
|
# Functions
|
||||||
def installed_apps():
|
def installed_apps():
|
||||||
|
from modules.manager import apps_list
|
||||||
|
ui.installed_table.clear()
|
||||||
apps = apps_list(True)
|
apps = apps_list(True)
|
||||||
ui.installed_table.setColumnCount(4)
|
ui.installed_table.setColumnCount(4)
|
||||||
ui.installed_table.setRowCount(math.ceil(len(apps) / 4))
|
ui.installed_table.setRowCount(math.ceil(len(apps) / 4))
|
||||||
for i in range(len(apps)):
|
for i in range(len(apps)):
|
||||||
ui.installed_table.setItem(i // 4, i % 4, QtWidgets.QTableWidgetItem(str(apps[i])))
|
ui.installed_table.setItem(i // 4, i % 4, QtWidgets.QTableWidgetItem(str(apps[i])))
|
||||||
|
|
||||||
|
def update_app():
|
||||||
|
app_name = ui.installed_table.currentItem().text()
|
||||||
|
if app_name == "":
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
from modules.manager import install
|
||||||
|
install(app_name)
|
||||||
|
|
||||||
|
def uninstall_app():
|
||||||
|
app_name = ui.installed_table.currentItem().text()
|
||||||
|
if app_name == "":
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
from modules.manager import uninstall
|
||||||
|
uninstall(app_name)
|
||||||
|
installed_apps()
|
||||||
|
|
||||||
# Run functions on startup
|
# Run functions on startup
|
||||||
installed_apps()
|
installed_apps()
|
||||||
|
|
||||||
# Binds
|
# Binds
|
||||||
|
ui.update_button.clicked.connect(update_app)
|
||||||
|
ui.delete_button.clicked.connect(uninstall_app)
|
||||||
|
|
||||||
|
|
||||||
# Handle GUI exiting to exit whole program
|
# Handle GUI exiting to exit whole program
|
||||||
|
|||||||
@@ -126,7 +126,6 @@ def install(package, is_gui=False):
|
|||||||
|
|
||||||
|
|
||||||
def uninstall(package, is_gui=False):
|
def uninstall(package, is_gui=False):
|
||||||
if not is_gui:
|
|
||||||
if os.path.exists('{1}apps/{0}'.format(package, horsy_vars.horsypath)):
|
if os.path.exists('{1}apps/{0}'.format(package, horsy_vars.horsypath)):
|
||||||
os.system('rmdir /s /q "{1}apps/{0}"'.format(package, horsy_vars.horsypath))
|
os.system('rmdir /s /q "{1}apps/{0}"'.format(package, horsy_vars.horsypath))
|
||||||
print(f"[green][OK] Files deleted[/]")
|
print(f"[green][OK] Files deleted[/]")
|
||||||
|
|||||||
Reference in New Issue
Block a user