|
1 | 1 | import pathlib |
| 2 | +import sys |
| 3 | + |
2 | 4 | import libWiiPy |
3 | 5 | import tempfile |
4 | 6 | import bsdiff4 |
|
11 | 13 | QProgressBar, |
12 | 14 | QVBoxLayout, |
13 | 15 | QWizard, |
| 16 | + QTextEdit, |
| 17 | + QPushButton, |
14 | 18 | ) |
15 | 19 |
|
| 20 | +from modules.widgets import ConsoleOutput |
16 | 21 | from .enums import * |
17 | 22 | from .download import ( |
18 | 23 | download_patch, |
@@ -178,6 +183,21 @@ def __init__(self, patches_json: dict, parent=None): |
178 | 183 | layout.addSpacing(10) |
179 | 184 | layout.addWidget(self.news_box) |
180 | 185 |
|
| 186 | + self.console = QTextEdit() |
| 187 | + self.console.setReadOnly(True) |
| 188 | + self.console.setHidden(True) |
| 189 | + |
| 190 | + # Redirect outputs to the console |
| 191 | + sys.stdout = ConsoleOutput(self.console, sys.__stdout__) |
| 192 | + sys.stderr = ConsoleOutput(self.console, sys.__stderr__) |
| 193 | + |
| 194 | + layout.addWidget(self.console) |
| 195 | + |
| 196 | + self.toggle_console_button = QPushButton(self.tr("Toggle Console")) |
| 197 | + self.toggle_console_button.clicked.connect(self.toggle_console) |
| 198 | + |
| 199 | + layout.addWidget(self.toggle_console_button) |
| 200 | + |
181 | 201 | self.setLayout(layout) |
182 | 202 |
|
183 | 203 | QTimer.singleShot(0, lambda: NewsRenderer.getNews(self, self.news_box)) |
@@ -259,6 +279,10 @@ def handle_error(self, error: str): |
259 | 279 | f"An exception was encountered while patching.<br><br>Exception:<br>{error}<br><br>Please report this issue in the WiiLink Discord Server (<a href='https://discord.gg/wiilink'>discord.gg/wiilink</a>).", |
260 | 280 | ) |
261 | 281 |
|
| 282 | + def toggle_console(self): |
| 283 | + self.console.setHidden(self.console.isVisible()) |
| 284 | + self.news_box.setHidden(self.news_box.isVisible()) |
| 285 | + |
262 | 286 |
|
263 | 287 | class PatchingWorker(QObject): |
264 | 288 | platform: Platforms |
@@ -288,7 +312,6 @@ def patching_functions(self): |
288 | 312 | for channel_key in self.selected_channels: |
289 | 313 | channel_indexes = channel_key.split("_") |
290 | 314 | try: |
291 | | - raise ValueError("penis 2") |
292 | 315 | category_index = int(channel_indexes[0]) |
293 | 316 | channel_index = int(channel_indexes[1]) |
294 | 317 | channel_category = self.find_category(category_index) |
|
0 commit comments