mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-03 17:39:42 +02:00
readded print selected software function
and also returns the selected software
This commit is contained in:
+16
-2
@@ -36,13 +36,28 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
|
|||||||
self.softwareList.addItems(searchresults)
|
self.softwareList.addItems(searchresults)
|
||||||
|
|
||||||
containerLayout.addWidget(self.button)
|
containerLayout.addWidget(self.button)
|
||||||
self.button.clicked.connect(lambda: function())
|
self.button.clicked.connect(lambda: self.download_selected())
|
||||||
|
self.button.clicked.connect(lambda: self.get_selected_item())
|
||||||
|
|
||||||
container.setLayout(containerLayout)
|
container.setLayout(containerLayout)
|
||||||
self.setCentralWidget(container)
|
self.setCentralWidget(container)
|
||||||
|
|
||||||
containerLayout.setAlignment(Qt.AlignmentFlag.AlignBottom)
|
containerLayout.setAlignment(Qt.AlignmentFlag.AlignBottom)
|
||||||
|
|
||||||
|
def download_selected(self):
|
||||||
|
item = self.softwareList.currentItem()
|
||||||
|
if item is not None:
|
||||||
|
print(f"Downloading {self.softwareList.currentItem().text()}")
|
||||||
|
else:
|
||||||
|
print("No item selected for download.")
|
||||||
|
|
||||||
|
|
||||||
|
def get_selected_item(self):
|
||||||
|
item = self.softwareList.currentItem()
|
||||||
|
if item is not None:
|
||||||
|
return item.text()
|
||||||
|
return ""
|
||||||
|
|
||||||
def return_pressed(self):
|
def return_pressed(self):
|
||||||
search_text = self.searchbar.text()
|
search_text = self.searchbar.text()
|
||||||
self.postnames, self.postlinks = scrape_uztracker(search_text)
|
self.postnames, self.postlinks = scrape_uztracker(search_text)
|
||||||
@@ -51,7 +66,6 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
|
|||||||
self.softwareList.addItems(self.postnames)
|
self.softwareList.addItems(self.postnames)
|
||||||
print("User searched for:", search_text)
|
print("User searched for:", search_text)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user