diff --git a/core/interface/gui.py b/core/interface/gui.py index c19ccd6..2baf406 100644 --- a/core/interface/gui.py +++ b/core/interface/gui.py @@ -58,6 +58,7 @@ class MainWindow(QtWidgets.QMainWindow, QWidget): self.dlbutton = QtWidgets.QPushButton("Download") self.softwareList = QListWidget() + self.post_author_list = QListWidget() self.libraryList = QListWidget() self.downloadList = QListWidget() self.emptyLibrary = QLabel("No items in library.") @@ -69,6 +70,7 @@ class MainWindow(QtWidgets.QMainWindow, QWidget): containerLayout.addWidget(self.searchbar) containerLayout.addWidget(self.softwareList) + containerLayout.addWidget(self.post_author_list) self.softwareList.addItems(searchresults) # download button triggers @@ -83,9 +85,12 @@ class MainWindow(QtWidgets.QMainWindow, QWidget): # Tab 1 self.searchtab = QWidget() self.searchtab_layout = QVBoxLayout() + self.horizontal_layout = QHBoxLayout() + self.horizontal_layout.addWidget(self.softwareList, stretch=3) + self.horizontal_layout.addWidget(self.post_author_list) self.searchtab_layout.addWidget(self.searchbar) - self.searchtab_layout.addWidget(self.softwareList) self.searchtab_layout.addWidget(self.dlbutton) + self.searchtab_layout.addLayout(self.horizontal_layout) self.searchtab.setLayout(self.searchtab_layout) self.tabs.addTab(self.searchtab,"Search") @@ -252,9 +257,12 @@ class MainWindow(QtWidgets.QMainWindow, QWidget): self.softwareList.clear() if state.post_titles: self.softwareList.addItems(state.post_titles) + self.post_author_list.addItems(state.post_author) if state.tracker == "rutracker": _, state.posts, _, _ = split_data(response) - state.post_titles, _ = format_data(state.posts) + state.post_titles, _, state.post_author = format_data(state.posts) + self.post_author_list.clear() + self.post_author_list.addItems(state.post_author) self.softwareList.clear() self.softwareList.addItems(state.post_titles) if not response: @@ -266,4 +274,4 @@ class MainWindow(QtWidgets.QMainWindow, QWidget): def update_progress(self): progress = dlprogress() - self.progressbar.setValue(progress) \ No newline at end of file + self.progressbar.setValue(progress) diff --git a/core/utils/data/state.py b/core/utils/data/state.py index 28ac600..6dd989d 100644 --- a/core/utils/data/state.py +++ b/core/utils/data/state.py @@ -7,6 +7,7 @@ class AppState: posts: List[Dict[str, Any]] post_titles: List[str] post_urls: List[str] + post_author: List[str] debug: bool = False tracker: str = "rutracker" api_url: str = "https://api.michijackson.xyz" @@ -16,4 +17,4 @@ class AppState: aria2: Optional[Any] = None aria2_threads: int = 4 -state = AppState(posts=[], post_titles=[], post_urls=[], download_path="") +state = AppState(posts=[], post_titles=[], post_urls=[], post_author=[], download_path="") diff --git a/core/utils/network/jsonhandler.py b/core/utils/network/jsonhandler.py index a6b2a5d..23ca59f 100644 --- a/core/utils/network/jsonhandler.py +++ b/core/utils/network/jsonhandler.py @@ -11,10 +11,11 @@ def split_data(data): return count, posts, query, success def format_data(data): + post_author = [post["author"] for post in data] post_titles = [post["title"] for post in data] post_links = [post["url"] for post in data] - return post_titles, post_links + return post_titles, post_links, post_author