diff --git a/core/gui.py b/core/gui.py index df546ae..b00d3e9 100644 --- a/core/gui.py +++ b/core/gui.py @@ -1,9 +1,9 @@ from PySide6 import QtWidgets from PySide6.QtCore import Qt -from PySide6.QtWidgets import QLineEdit, QWidget, QVBoxLayout +from PySide6.QtWidgets import QLayoutItem, QLineEdit, QWidget, QVBoxLayout, QHBoxLayout, QListWidget, QListWidgetItem, QLabel, QPushButton import sys -class MainWindow(QtWidgets.QMainWindow): +class MainWindow(QtWidgets.QMainWindow, QWidget): def __init__(self): super().__init__() self.setWindowTitle("Software Manager") @@ -12,17 +12,34 @@ class MainWindow(QtWidgets.QMainWindow): self.controls = QWidget() self.controlsLayout = QVBoxLayout() - # Searchbar + # 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(["Software A", "Software B", "Software C", "Software D"]) + + 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.AlignTop) + containerLayout.setAlignment(Qt.AlignmentFlag.AlignBottom) + + def return_pressed(self): + search_text = self.searchbar.text() + print("User searched for:", search_text) if __name__ == "__main__": app = QtWidgets.QApplication([]) diff --git a/core/uztracker_scraper.py b/core/uztracker_scraper.py index ed7fd07..3738b8b 100644 --- a/core/uztracker_scraper.py +++ b/core/uztracker_scraper.py @@ -1,7 +1,6 @@ import requests from bs4 import BeautifulSoup - search = input("Enter the name of the program you want to search for: ") url = "https://uztracker.net/tracker.php?nm=" # placeholder url for now response = requests.get(url) # get da content from da url @@ -30,11 +29,10 @@ def scrape_uztracker(): return None def get_post_title(post_url): - response = requests.get(post_url) soup = BeautifulSoup(response.text, 'html.parser') maintitle = soup.find(class_='tt-text') if maintitle: - print("Program found:", maintitle.text) + print(maintitle.text) else: print("Program not found") diff --git a/main.py b/main.py index fe09473..f09621b 100644 --- a/main.py +++ b/main.py @@ -1,3 +1 @@ -import core.download as download import core.gui as gui -import core.scraper as scraper