mirror of
https://github.com/blw1138/Zordon.git
synced 2026-04-25 13:54:55 -05: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:
@@ -108,7 +108,7 @@ class BlenderDownloader(EngineDownloader):
|
||||
minor_versions = [x for x in cls.__get_minor_versions(major_version, system_os, cpu) if x['version'] == version]
|
||||
# we get the URL instead of calculating it ourselves. May change this
|
||||
|
||||
cls.__download_and_extract_app(remote_url=minor_versions[0]['url'], download_location=download_location,
|
||||
cls.download_and_extract_app(remote_url=minor_versions[0]['url'], download_location=download_location,
|
||||
timeout=timeout)
|
||||
except IndexError:
|
||||
logger.error("Cannot find requested engine")
|
||||
|
||||
@@ -31,7 +31,7 @@ class EngineDownloader:
|
||||
raise NotImplementedError # implement this method in your engine subclass
|
||||
|
||||
@classmethod
|
||||
def __download_and_extract_app(cls, remote_url, download_location, timeout=120):
|
||||
def download_and_extract_app(cls, remote_url, download_location, timeout=120):
|
||||
|
||||
# Create a temp download directory
|
||||
temp_download_dir = tempfile.mkdtemp()
|
||||
@@ -154,5 +154,7 @@ def copy_directory_contents(src_dir, dest_dir):
|
||||
# Otherwise, copy the file
|
||||
shutil.copy2(item_path, dest_item_path)
|
||||
|
||||
except PermissionError as ex:
|
||||
logger.error(f"Permissions error: {ex}")
|
||||
except Exception as e:
|
||||
logger.exception(f"Error copying directory contents: {e}")
|
||||
|
||||
@@ -170,14 +170,22 @@ class EngineManager:
|
||||
@classmethod
|
||||
def delete_engine_download(cls, engine, version, system_os=None, cpu=None):
|
||||
logger.info(f"Requested deletion of engine: {engine}-{version}")
|
||||
|
||||
found = cls.is_version_downloaded(engine, version, system_os, cpu)
|
||||
if found:
|
||||
dir_path = os.path.dirname(found['path'])
|
||||
shutil.rmtree(dir_path, ignore_errors=True)
|
||||
if found and found['type'] == 'managed': # don't delete system installs
|
||||
# find the root directory of the engine executable
|
||||
root_dir_name = '-'.join([engine, version, found['system_os'], found['cpu']])
|
||||
remove_path = os.path.join(found['path'].split(root_dir_name)[0], root_dir_name)
|
||||
# delete the file path
|
||||
logger.info(f"Deleting engine at path: {remove_path}")
|
||||
shutil.rmtree(remove_path, ignore_errors=False)
|
||||
logger.info(f"Engine {engine}-{version}-{found['system_os']}-{found['cpu']} successfully deleted")
|
||||
return True
|
||||
elif found: # these are managed by the system / user. Don't delete these.
|
||||
logger.error(f'Cannot delete requested {engine} {version}. Managed externally.')
|
||||
else:
|
||||
logger.error(f"Cannot find engine: {engine}-{version}")
|
||||
return False
|
||||
|
||||
@classmethod
|
||||
def update_all_engines(cls):
|
||||
@@ -233,6 +241,13 @@ class EngineManager:
|
||||
return worker_class(input_path=input_path, output_path=output_path, engine_path=engine_path, args=args,
|
||||
parent=parent, name=name)
|
||||
|
||||
@classmethod
|
||||
def engine_for_project_path(cls, path):
|
||||
name, extension = os.path.splitext(path)
|
||||
for engine in cls.supported_engines():
|
||||
if extension in engine.supported_extensions:
|
||||
return engine
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
||||
|
||||
@@ -162,7 +162,7 @@ class FFMPEGDownloader(EngineDownloader):
|
||||
# Download and extract
|
||||
try:
|
||||
logger.info(f"Requesting download of ffmpeg-{version}-{system_os}-{cpu}")
|
||||
cls.__download_and_extract_app(remote_url=remote_url, download_location=download_location, timeout=timeout)
|
||||
cls.download_and_extract_app(remote_url=remote_url, download_location=download_location, timeout=timeout)
|
||||
|
||||
# naming cleanup to match existing naming convention
|
||||
output_path = os.path.join(download_location, f'ffmpeg-{version}-{system_os}-{cpu}')
|
||||
|
||||
Reference in New Issue
Block a user