mirror of
https://github.com/blw1138/Zordon.git
synced 2025-12-17 08:48:13 +00:00
Network password settings WIP
This commit is contained in:
@@ -31,9 +31,6 @@ class SettingsWindow(QMainWindow):
|
||||
os.path.join(os.path.join(os.path.expanduser(Config.upload_folder),
|
||||
'engines')))
|
||||
|
||||
# declare objects we need to store settings
|
||||
# todo: add all here
|
||||
|
||||
self.installed_engines_table = None
|
||||
|
||||
self.setWindowTitle("Settings")
|
||||
@@ -56,7 +53,7 @@ class SettingsWindow(QMainWindow):
|
||||
# Add items with icons to the sidebar
|
||||
resources_dir = os.path.join(Path(__file__).resolve().parent.parent.parent, 'resources')
|
||||
self.add_sidebar_item("General", os.path.join(resources_dir, "Gear.png"))
|
||||
self.add_sidebar_item("Network", os.path.join(resources_dir, "Server.png"))
|
||||
self.add_sidebar_item("Server", os.path.join(resources_dir, "Server.png"))
|
||||
self.add_sidebar_item("Engines", os.path.join(resources_dir, "Blender.png"))
|
||||
self.sidebar.setCurrentRow(0)
|
||||
|
||||
@@ -163,22 +160,58 @@ class SettingsWindow(QMainWindow):
|
||||
page = QWidget()
|
||||
layout = QVBoxLayout()
|
||||
|
||||
# Proxy Settings Group
|
||||
proxy_group = QGroupBox("Proxy Settings")
|
||||
proxy_layout = QVBoxLayout()
|
||||
proxy_layout.addWidget(QCheckBox("Use Proxy"))
|
||||
proxy_layout.addWidget(QLabel("Proxy Address"))
|
||||
proxy_layout.addWidget(QLineEdit())
|
||||
proxy_layout.addWidget(QLabel("Proxy Port"))
|
||||
proxy_layout.addWidget(QLineEdit())
|
||||
proxy_group.setLayout(proxy_layout)
|
||||
# Sharing Settings Group
|
||||
sharing_group = QGroupBox("Sharing Settings")
|
||||
sharing_layout = QVBoxLayout()
|
||||
|
||||
layout.addWidget(proxy_group)
|
||||
enable_sharing_checkbox = QCheckBox("Enable other computers on the network to render to this machine")
|
||||
enable_sharing_checkbox.setChecked(settings.value("enable_network_sharing", False))
|
||||
enable_sharing_checkbox.stateChanged.connect(self.toggle_render_sharing)
|
||||
sharing_layout.addWidget(enable_sharing_checkbox)
|
||||
|
||||
password_layout = QHBoxLayout()
|
||||
password_layout.setContentsMargins(0, 0, 0, 0)
|
||||
self.enable_network_password_checkbox = QCheckBox("Enable network password:")
|
||||
self.enable_network_password_checkbox.setChecked(settings.value("enable_network_password", False))
|
||||
self.enable_network_password_checkbox.stateChanged.connect(self.enable_network_password_changed)
|
||||
sharing_layout.addWidget(self.enable_network_password_checkbox)
|
||||
self.network_password_line = QLineEdit()
|
||||
self.network_password_line.setPlaceholderText("Enter a password")
|
||||
self.network_password_line.setEchoMode(QLineEdit.EchoMode.Password)
|
||||
self.network_password_line.setEnabled(settings.value("enable_network_password", False))
|
||||
password_layout.addWidget(self.network_password_line)
|
||||
self.show_password_button = QPushButton("Show")
|
||||
self.show_password_button.setEnabled(settings.value("enable_network_password", False))
|
||||
self.show_password_button.clicked.connect(self.show_password_button_pressed)
|
||||
password_layout.addWidget(self.show_password_button)
|
||||
sharing_layout.addLayout(password_layout)
|
||||
|
||||
sharing_group.setLayout(sharing_layout)
|
||||
|
||||
layout.addWidget(sharing_group)
|
||||
|
||||
layout.addStretch() # Add a stretch to push content to the top
|
||||
page.setLayout(layout)
|
||||
return page
|
||||
|
||||
def toggle_render_sharing(self, enable_sharing):
|
||||
settings.setValue("enable_network_sharing", enable_sharing)
|
||||
self.enable_network_password_checkbox.setEnabled(enable_sharing)
|
||||
enable_password = enable_sharing and settings.value("enable_network_password", False)
|
||||
self.network_password_line.setEnabled(enable_password)
|
||||
self.show_password_button.setEnabled(enable_password)
|
||||
|
||||
def enable_network_password_changed(self, new_value):
|
||||
settings.setValue("enable_network_password", new_value)
|
||||
self.network_password_line.setEnabled(new_value)
|
||||
self.show_password_button.setEnabled(new_value)
|
||||
|
||||
def show_password_button_pressed(self):
|
||||
# toggle showing / hiding the password
|
||||
show_pass = self.show_password_button.text() == "Show"
|
||||
self.show_password_button.setText("Hide" if show_pass else "Show")
|
||||
self.network_password_line.setEchoMode(QLineEdit.EchoMode.Normal if show_pass else QLineEdit.EchoMode.Normal)
|
||||
|
||||
def create_engines_page(self):
|
||||
"""Create the Engines settings page."""
|
||||
page = QWidget()
|
||||
@@ -261,7 +294,6 @@ class SettingsWindow(QMainWindow):
|
||||
settings.setValue("engines_ignore_system_installs", bool(value))
|
||||
self.installed_engines_table.update_table()
|
||||
|
||||
|
||||
def update_last_checked_label(self):
|
||||
"""Retrieve the last check timestamp and return a human-friendly string."""
|
||||
last_checked_str = settings.value("engines_last_update_time", None)
|
||||
@@ -322,8 +354,6 @@ class SettingsWindow(QMainWindow):
|
||||
self.launch_engine_button.setEnabled(False)
|
||||
self.delete_engine_button.setEnabled(False)
|
||||
|
||||
|
||||
|
||||
def check_for_new_engines(self):
|
||||
|
||||
ignore_system = settings.value("engines_ignore_system_installs", False)
|
||||
@@ -381,6 +411,8 @@ class EngineTableWidget(QWidget):
|
||||
self.table.selectionModel().selectionChanged.connect(self.on_selection_changed)
|
||||
|
||||
layout = QVBoxLayout(self)
|
||||
layout.setContentsMargins(0, 0, 0, 0)
|
||||
layout.setSpacing(0)
|
||||
layout.addWidget(self.table)
|
||||
|
||||
self.raw_server_data = None
|
||||
|
||||
Reference in New Issue
Block a user