preparation for 1.5.1
This commit is contained in:
+36
-3
@@ -9,14 +9,16 @@ License: GPL-3.0
|
||||
from PySide6.QtWidgets import QWidget, QVBoxLayout, QTextEdit, QLineEdit
|
||||
from PySide6.QtCore import Qt
|
||||
|
||||
from src.shared.shareddata import APP_NAME, CURRENT_VERSION
|
||||
from src.shared.shareddata import API_URL, API_URL_SECONDARY, APP_NAME, CURRENT_VERSION, PLATFORM_NAME
|
||||
from src.window.about import AboutWindow
|
||||
from updater import LocalPendingUpdateCheckThread, UpdateManager
|
||||
|
||||
|
||||
class TerminalWindow(QWidget):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent, Qt.WindowType.Window)
|
||||
self.setWindowTitle(f"Terminal - {APP_NAME.upper()}")
|
||||
|
||||
self.resize(320, 180)
|
||||
self.output_area = QTextEdit()
|
||||
self.output_area.setReadOnly(True)
|
||||
|
||||
@@ -32,8 +34,16 @@ class TerminalWindow(QWidget):
|
||||
"hello": self.cmd_hello,
|
||||
"help": self.cmd_help,
|
||||
"version": self.cmd_version,
|
||||
"about": self.cmd_about,
|
||||
"update": self.cmd_update,
|
||||
}
|
||||
|
||||
self.output_area.append(f"Welcome to {APP_NAME.upper()}. You are running version {CURRENT_VERSION}.")
|
||||
self.output_area.append("Type 'help' for a list of available commands.\n")
|
||||
|
||||
self.input_line.setFocus()
|
||||
|
||||
|
||||
def handle_command(self):
|
||||
command_text = self.input_line.text()
|
||||
self.input_line.clear()
|
||||
@@ -65,4 +75,27 @@ class TerminalWindow(QWidget):
|
||||
return f"Available commands: {', '.join(self.commands.keys())}"
|
||||
|
||||
def cmd_version(self, *args):
|
||||
return f"{CURRENT_VERSION}"
|
||||
return f"{APP_NAME.upper()} is running version {CURRENT_VERSION}."
|
||||
|
||||
def cmd_about(self, *args):
|
||||
self.about = AboutWindow(self)
|
||||
self.about.show()
|
||||
|
||||
def cmd_update(self, *args):
|
||||
main_win = self.parent()
|
||||
if main_win is None:
|
||||
return "[Error] Main window context not found."
|
||||
|
||||
self.updater = UpdateManager(
|
||||
main_window=main_win,
|
||||
api_url=API_URL,
|
||||
api_url_sec=API_URL_SECONDARY,
|
||||
current_version=CURRENT_VERSION,
|
||||
platform_name=PLATFORM_NAME,
|
||||
platform_suffix="-" + PLATFORM_NAME,
|
||||
app_name=APP_NAME
|
||||
)
|
||||
self.output_area.append("Checking for updates...")
|
||||
|
||||
self.updater.manual_check_for_updates()
|
||||
return "See status bar for update information."
|
||||
Reference in New Issue
Block a user