mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-03 17:39:42 +02:00
Adds basic CLI input and output functionality
Introduces a simple command-line interface to capture user input and display it back. Lays groundwork for future command processing and interaction.
This commit is contained in:
@@ -1,2 +0,0 @@
|
||||
commandinput = input("Enter Command: ")
|
||||
print(commandinput)
|
||||
-68
@@ -1,68 +0,0 @@
|
||||
from PySide6 import QtWidgets
|
||||
from PySide6.QtCore import Qt
|
||||
from PySide6.QtWidgets import QLayoutItem, QLineEdit, QWidget, QVBoxLayout, QHBoxLayout, QListWidget, QListWidgetItem, QLabel, QPushButton
|
||||
import sys
|
||||
from uztracker_scraper import scrape_uztracker
|
||||
|
||||
|
||||
class MainWindow(QtWidgets.QMainWindow, QWidget):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
searchresults = []
|
||||
|
||||
self.setWindowTitle("Software Manager")
|
||||
self.setGeometry(100, 100, 800, 600)
|
||||
|
||||
self.controls = QWidget()
|
||||
self.controlsLayout = QVBoxLayout()
|
||||
|
||||
# Widgets
|
||||
self.searchbar = QLineEdit()
|
||||
self.searchbar.setPlaceholderText("Search for software...")
|
||||
self.searchbar.setClearButtonEnabled(True)
|
||||
self.searchbar.setMinimumHeight(30)
|
||||
self.searchbar.returnPressed.connect(self.return_pressed)
|
||||
|
||||
self.button = QtWidgets.QPushButton("Download")
|
||||
self.softwareList = QListWidget()
|
||||
|
||||
container = QWidget()
|
||||
containerLayout = QVBoxLayout()
|
||||
containerLayout.addWidget(self.searchbar)
|
||||
|
||||
containerLayout.addWidget(self.softwareList)
|
||||
self.softwareList.addItems(searchresults)
|
||||
|
||||
|
||||
containerLayout.addWidget(self.button)
|
||||
self.button.clicked.connect(lambda: print(f"Downloading {self.softwareList.currentItem().text()}"), )
|
||||
|
||||
|
||||
container.setLayout(containerLayout)
|
||||
self.setCentralWidget(container)
|
||||
|
||||
containerLayout.setAlignment(Qt.AlignmentFlag.AlignBottom)
|
||||
|
||||
def return_pressed(self):
|
||||
search_text = self.searchbar.text()
|
||||
self.postnames, self.postlinks = scrape_uztracker(search_text)
|
||||
self.softwareList.clear()
|
||||
if self.postnames:
|
||||
self.softwareList.addItems(self.postnames)
|
||||
print("User searched for:", search_text)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def run_gui():
|
||||
app = QtWidgets.QApplication([])
|
||||
|
||||
widget = MainWindow()
|
||||
widget.show()
|
||||
|
||||
sys.exit(app.exec())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run_gui()
|
||||
@@ -91,12 +91,6 @@ def get_magnet_link(post_url):
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
search_input = input("Enter the Name of the Program you want to search for: ")
|
||||
selected = scrape_uztracker(search_input)
|
||||
maintitle = get_post_title(selected)
|
||||
magnetlink = get_magnet_link(selected)
|
||||
print(maintitle)
|
||||
print(magnetlink)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,56 @@
|
||||
from core.gui import run_gui
|
||||
from ui.clinterface import asciititle;
|
||||
from core.uztracker_scraper import scrape_uztracker;
|
||||
import os
|
||||
|
||||
|
||||
|
||||
def search():
|
||||
asciititle()
|
||||
searchquery = input("Enter Search Query: ")
|
||||
result = scrape_uztracker(searchquery)
|
||||
if result is None:
|
||||
clear()
|
||||
asciititle()
|
||||
print("No results found for your Query.\n")
|
||||
return
|
||||
return result
|
||||
|
||||
def select_result(result):
|
||||
resulttitles, resultlinks = result
|
||||
clear()
|
||||
asciititle()
|
||||
for i, title in enumerate(resulttitles, 1):
|
||||
print(f"({i}) {title}")
|
||||
selection = input("\n Enter the Number of the Program you want to download: ")
|
||||
|
||||
|
||||
try:
|
||||
index = int(selection) - 1
|
||||
if 0 <= index < len(resultlinks): # note for myself: py starts counting at 0; check if number is not negative, check if number is not more than list length.
|
||||
selected = "https://uztracker.net/" + resultlinks[index].lstrip("./")
|
||||
post_url = selected
|
||||
return selected
|
||||
else:
|
||||
print("Invalid Selection.")
|
||||
|
||||
except ValueError:
|
||||
print(Exception)
|
||||
return
|
||||
|
||||
|
||||
def clear():
|
||||
os.system('cls' if os.name == 'nt' else 'clear')
|
||||
|
||||
|
||||
|
||||
|
||||
run_gui()
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
clear()
|
||||
results = search()
|
||||
selected = select_result(results)
|
||||
print(selected)
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
def asciititle():
|
||||
print(f"""
|
||||
|
||||
_____ __ _ __ __
|
||||
/ ____| / _| | | \/ |
|
||||
| (___ ___ | |_| |___ ____ _ _ __ ___| \ / | __ _ _ __ __ _ __ _ ___ _ __
|
||||
\___ \ / _ \| _| __\ \ /\ / / _` | '__/ _ \ |\/| |/ _` | '_ \ / _` |/ _` |/ _ \ '__|
|
||||
____) | (_) | | | |_ \ V V / (_| | | | __/ | | | (_| | | | | (_| | (_| | __/ |
|
||||
|_____/ \___/|_| \__| \_/\_/ \__,_|_| \___|_| |_|\__,_|_| |_|\__,_|\__, |\___|_|
|
||||
__/ |
|
||||
|___/
|
||||
|
||||
""")
|
||||
|
||||
Reference in New Issue
Block a user