mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-03 17:39:42 +02:00
better tab implementation (not done yet)
This commit is contained in:
@@ -25,7 +25,7 @@ def set_threads(threads):
|
||||
|
||||
|
||||
def aria2server():
|
||||
downloads_dir = os.path.join(os.path.expanduser("~"), "Downloads")
|
||||
downloads_dir = os.path.join("Library")
|
||||
|
||||
cmd = [
|
||||
"aria2c",
|
||||
@@ -41,4 +41,4 @@ def aria2server():
|
||||
|
||||
|
||||
aria2server = subprocess.Popen(cmd)
|
||||
return aria2server
|
||||
return aria2server
|
||||
|
||||
+13
-27
@@ -43,7 +43,14 @@ def pass_aria(aria):
|
||||
global tracker
|
||||
tracker = "rutracker" # default tracker
|
||||
|
||||
|
||||
def create_tab(title, searchbar, software_list, tabs):
|
||||
tab = QWidget()
|
||||
layout = QVBoxLayout()
|
||||
layout.addWidget(searchbar)
|
||||
layout.addWidget(software_list)
|
||||
tab.setLayout(layout)
|
||||
tabs.addTab(tab, title)
|
||||
return tab
|
||||
|
||||
class MainWindow(QtWidgets.QMainWindow, QWidget):
|
||||
def __init__(self):
|
||||
@@ -65,7 +72,7 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
|
||||
|
||||
|
||||
self.searchbar.returnPressed.connect(lambda: self.run_thread(threading.Thread(target=self.return_pressed))) # Triggers scraping function thread on enter
|
||||
self.button = QtWidgets.QPushButton("Download")
|
||||
self.dlbutton = QtWidgets.QPushButton("Download")
|
||||
self.softwareList = QListWidget()
|
||||
|
||||
container = QWidget()
|
||||
@@ -75,9 +82,9 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
|
||||
containerLayout.addWidget(self.softwareList)
|
||||
self.softwareList.addItems(searchresults)
|
||||
|
||||
containerLayout.addWidget(self.button)
|
||||
containerLayout.addWidget(self.dlbutton)
|
||||
# download button triggers
|
||||
self.button.clicked.connect(lambda: self.run_thread(threading.Thread(target=self.download_selected)))
|
||||
self.dlbutton.clicked.connect(lambda: self.run_thread(threading.Thread(target=self.download_selected)))
|
||||
|
||||
container.setLayout(containerLayout)
|
||||
self.setCentralWidget(container)
|
||||
@@ -85,29 +92,8 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
|
||||
# Tabs
|
||||
self.tabs = QTabWidget()
|
||||
|
||||
# Tab 1
|
||||
self.tab1 = QWidget()
|
||||
self.tab1_layout = QVBoxLayout()
|
||||
self.tab1_layout.addWidget(self.searchbar)
|
||||
self.tab1_layout.addWidget(self.softwareList)
|
||||
self.tab1.setLayout(self.tab1_layout)
|
||||
self.tabs.addTab(self.tab1,"Tab 1")
|
||||
|
||||
# Tab 2
|
||||
self.tab2 = QWidget()
|
||||
self.tab2_layout = QVBoxLayout()
|
||||
self.tab2_layout.addWidget(self.searchbar)
|
||||
self.tab2_layout.addWidget(self.softwareList)
|
||||
self.tab2.setLayout(self.tab2_layout)
|
||||
self.tabs.addTab(self.tab2,"Tab 2")
|
||||
|
||||
# Tab 3
|
||||
self.tab3 = QWidget()
|
||||
self.tab3_layout = QVBoxLayout()
|
||||
self.tab3_layout.addWidget(self.searchbar)
|
||||
self.tab3_layout.addWidget(self.softwareList)
|
||||
self.tab3.setLayout(self.tab3_layout)
|
||||
self.tabs.addTab(self.tab3,"Tab 3")
|
||||
self.tab1 = create_tab("Download", self.searchbar, self.softwareList, self.tabs)
|
||||
self.tab2 = create_tab("Library", self.searchbar, self.softwareList, self.tabs)
|
||||
|
||||
containerLayout.addWidget(self.tabs)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user