mirror of
https://github.com/blw1138/Zordon.git
synced 2025-12-17 16:58:12 +00:00
New UI Redesign in pyqt6 (#56)
* Initial commit for new UI * Initial commit for new UI * WIP * Status bar updates and has an icon for online / offline * Add log_viewer.py * Use JSON for delete_engine_download API * Fix class issue with Downloaders * Move Config class to new ui * Add engine_browser.py * Add a close event handler to the main window * Fix issue with engine manager not deleting engines properly * Rearrange all the files * Add icons and resources * Cache system info in RenderServerProxy * Toolbar polish * Fix resource path in status bar * Add config_dir to misc_helper.py * Add try block to zeroconf setup * Add add_job.py * Add raw args to add_job.py
This commit is contained in:
@@ -123,3 +123,15 @@ def current_system_os_version():
|
||||
def current_system_cpu():
|
||||
# convert all x86 64 to "x64"
|
||||
return platform.machine().lower().replace('amd64', 'x64').replace('x86_64', 'x64')
|
||||
|
||||
|
||||
def resources_dir():
|
||||
resources_directory = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))),
|
||||
'resources')
|
||||
return resources_directory
|
||||
|
||||
|
||||
def config_dir():
|
||||
config_directory = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))),
|
||||
'config')
|
||||
return config_directory
|
||||
|
||||
@@ -35,19 +35,22 @@ class ZeroconfServer:
|
||||
|
||||
@classmethod
|
||||
def _register_service(cls):
|
||||
cls.server_ip = socket.gethostbyname(socket.gethostname())
|
||||
try:
|
||||
cls.server_ip = socket.gethostbyname(socket.gethostname())
|
||||
|
||||
info = ServiceInfo(
|
||||
cls.service_type,
|
||||
f"{cls.server_name}.{cls.service_type}",
|
||||
addresses=[socket.inet_aton(cls.server_ip)],
|
||||
port=cls.server_port,
|
||||
properties=cls.properties,
|
||||
)
|
||||
info = ServiceInfo(
|
||||
cls.service_type,
|
||||
f"{cls.server_name}.{cls.service_type}",
|
||||
addresses=[socket.inet_aton(cls.server_ip)],
|
||||
port=cls.server_port,
|
||||
properties=cls.properties,
|
||||
)
|
||||
|
||||
cls.service_info = info
|
||||
cls.zeroconf.register_service(info)
|
||||
logger.info(f"Registered zeroconf service: {cls.service_info.name}")
|
||||
cls.service_info = info
|
||||
cls.zeroconf.register_service(info)
|
||||
logger.info(f"Registered zeroconf service: {cls.service_info.name}")
|
||||
except socket.gaierror as e:
|
||||
logger.error(f"Error starting zeroconf service: {e}")
|
||||
|
||||
@classmethod
|
||||
def _unregister_service(cls):
|
||||
@@ -73,7 +76,17 @@ class ZeroconfServer:
|
||||
|
||||
@classmethod
|
||||
def found_clients(cls):
|
||||
return [x.split(f'.{cls.service_type}')[0] for x in cls.client_cache.keys()]
|
||||
|
||||
fetched_hostnames = [x.split(f'.{cls.service_type}')[0] for x in cls.client_cache.keys()]
|
||||
local_hostname = socket.gethostname()
|
||||
# Define a sort key function
|
||||
def sort_key(hostname):
|
||||
# Return 0 if it's the local hostname so it comes first, else return 1
|
||||
return 0 if hostname == local_hostname else 1
|
||||
|
||||
# Sort the list with the local hostname first
|
||||
sorted_hostnames = sorted(fetched_hostnames, key=sort_key)
|
||||
return sorted_hostnames
|
||||
|
||||
|
||||
# Example usage:
|
||||
|
||||
Reference in New Issue
Block a user