GUI development
This commit is contained in:
14
horsy.py
14
horsy.py
@@ -4,11 +4,7 @@ import sys
|
|||||||
|
|
||||||
import modules.tui as tui
|
import modules.tui as tui
|
||||||
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.source import get_source
|
|
||||||
from modules.search import search, info
|
|
||||||
import modules.vars as horsy_vars
|
import modules.vars as horsy_vars
|
||||||
|
|
||||||
# Getting the arguments
|
# Getting the arguments
|
||||||
@@ -64,32 +60,38 @@ if not args.option:
|
|||||||
'upload your app', 'search for app', 'get information about app'])]
|
'upload your app', 'search for app', 'get information about app'])]
|
||||||
isNoArgs = True
|
isNoArgs = True
|
||||||
|
|
||||||
|
|
||||||
# Checking user option (Yanderedev method)
|
|
||||||
if not args.app:
|
if not args.app:
|
||||||
if option not in ['list', 'upload', 'update']:
|
if option not in ['list', 'upload', 'update']:
|
||||||
print('\n')
|
print('\n')
|
||||||
app = tui.get(f'Select app to {option}')
|
app = tui.get(f'Select app to {option}')
|
||||||
|
|
||||||
|
# Checking user option (Yanderedev method)
|
||||||
if option in 'upload':
|
if option in 'upload':
|
||||||
|
from modules.uploader import upload
|
||||||
upload()
|
upload()
|
||||||
|
|
||||||
if option in ['install', 'i']:
|
if option in ['install', 'i']:
|
||||||
|
from modules.manager import install
|
||||||
install(app)
|
install(app)
|
||||||
|
|
||||||
if option in ['uninstall', 'un']:
|
if option in ['uninstall', 'un']:
|
||||||
|
from modules.manager import uninstall
|
||||||
uninstall(app)
|
uninstall(app)
|
||||||
|
|
||||||
if option in ['source', 's']:
|
if option in ['source', 's']:
|
||||||
|
from modules.source import get_source
|
||||||
get_source(app)
|
get_source(app)
|
||||||
|
|
||||||
if option in ['search']:
|
if option in ['search']:
|
||||||
|
from modules.search import search
|
||||||
search(app)
|
search(app)
|
||||||
|
|
||||||
if option in ['info']:
|
if option in ['info']:
|
||||||
|
from modules.search import info
|
||||||
info(app)
|
info(app)
|
||||||
|
|
||||||
if option in ['list', 'l']:
|
if option in ['list', 'l']:
|
||||||
|
from modules.manager import apps_list
|
||||||
apps_list()
|
apps_list()
|
||||||
|
|
||||||
if isNoArgs:
|
if isNoArgs:
|
||||||
|
|||||||
19
horsygui.py
19
horsygui.py
@@ -1,6 +1,7 @@
|
|||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import math
|
||||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
import modules.gui as gui
|
import modules.gui as gui
|
||||||
@@ -12,11 +13,6 @@ from modules.source import get_source
|
|||||||
from modules.search import search, info
|
from modules.search import search, info
|
||||||
import modules.vars as horsy_vars
|
import modules.vars as horsy_vars
|
||||||
|
|
||||||
|
|
||||||
# Functions
|
|
||||||
def installed_apps():
|
|
||||||
|
|
||||||
|
|
||||||
# Initialize GUI
|
# Initialize GUI
|
||||||
app = QtWidgets.QApplication(sys.argv)
|
app = QtWidgets.QApplication(sys.argv)
|
||||||
MainWindow = QtWidgets.QMainWindow()
|
MainWindow = QtWidgets.QMainWindow()
|
||||||
@@ -24,6 +20,19 @@ ui = gui.Ui_MainWindow()
|
|||||||
ui.setupUi(MainWindow)
|
ui.setupUi(MainWindow)
|
||||||
MainWindow.show()
|
MainWindow.show()
|
||||||
|
|
||||||
|
|
||||||
|
# Functions
|
||||||
|
def installed_apps():
|
||||||
|
apps = apps_list(True)
|
||||||
|
ui.installed_table.setColumnCount(4)
|
||||||
|
ui.installed_table.setRowCount(math.ceil(len(apps) / 4))
|
||||||
|
for i in range(len(apps)):
|
||||||
|
ui.installed_table.setItem(i // 4, i % 4, QtWidgets.QTableWidgetItem(str(apps[i])))
|
||||||
|
|
||||||
|
|
||||||
|
# Run functions on startup
|
||||||
|
installed_apps()
|
||||||
|
|
||||||
# Binds
|
# Binds
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -584,13 +584,7 @@ class Ui_MainWindow(object):
|
|||||||
self.installed_table.setDragDropOverwriteMode(False)
|
self.installed_table.setDragDropOverwriteMode(False)
|
||||||
self.installed_table.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
|
self.installed_table.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
|
||||||
self.installed_table.setShowGrid(False)
|
self.installed_table.setShowGrid(False)
|
||||||
self.installed_table.setRowCount(1)
|
|
||||||
self.installed_table.setColumnCount(4)
|
|
||||||
self.installed_table.setObjectName("installed_table")
|
self.installed_table.setObjectName("installed_table")
|
||||||
item = QtWidgets.QTableWidgetItem()
|
|
||||||
self.installed_table.setItem(0, 0, item)
|
|
||||||
item = QtWidgets.QTableWidgetItem()
|
|
||||||
self.installed_table.setItem(0, 1, item)
|
|
||||||
self.installed_table.horizontalHeader().setVisible(False)
|
self.installed_table.horizontalHeader().setVisible(False)
|
||||||
self.installed_table.horizontalHeader().setDefaultSectionSize(203)
|
self.installed_table.horizontalHeader().setDefaultSectionSize(203)
|
||||||
self.installed_table.horizontalHeader().setHighlightSections(False)
|
self.installed_table.horizontalHeader().setHighlightSections(False)
|
||||||
|
|||||||
@@ -142,11 +142,12 @@ def uninstall(package, is_gui=False):
|
|||||||
def apps_list(is_gui=False):
|
def apps_list(is_gui=False):
|
||||||
apps = list()
|
apps = list()
|
||||||
if os.path.exists('{0}apps'.format(horsy_vars.horsypath)):
|
if os.path.exists('{0}apps'.format(horsy_vars.horsypath)):
|
||||||
print(f"[green]Installed apps:[/]")
|
if not is_gui:
|
||||||
|
print(f"[green]Installed apps:[/]")
|
||||||
for file in os.listdir('{0}apps'.format(horsy_vars.horsypath)):
|
for file in os.listdir('{0}apps'.format(horsy_vars.horsypath)):
|
||||||
if file.endswith(".bat") and not is_gui:
|
if file.endswith(".bat") and not is_gui:
|
||||||
print(f"{file.split('.')[0]}")
|
print(f"{file.split('.')[0]}")
|
||||||
else:
|
elif file.endswith(".bat"):
|
||||||
apps.append(file.split('.')[0])
|
apps.append(file.split('.')[0])
|
||||||
if is_gui:
|
if is_gui:
|
||||||
return apps
|
return apps
|
||||||
|
|||||||
@@ -6,8 +6,9 @@ import modules.vars as horsy_vars
|
|||||||
import json
|
import json
|
||||||
from rich import print
|
from rich import print
|
||||||
|
|
||||||
|
client = SearchClient.create(
|
||||||
client = SearchClient.create('VBUJO9OW62', '759f6c7986842fd8218e79e3b9ddb964')
|
requests.get('https://raw.githubusercontent.com/BarsTiger/horsy/master/web_vars/search_app').json()['APP_ID'],
|
||||||
|
requests.get('https://raw.githubusercontent.com/BarsTiger/horsy/master/web_vars/search_app').json()['API_KEY'])
|
||||||
index = client.init_index('packages')
|
index = client.init_index('packages')
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user