mirror of
https://github.com/blw1138/Zordon.git
synced 2026-06-09 13:39:24 -05:00
Windows path fixes (#129)
* Change uses of os.path to use Pathlib * Add return types and type hints * Add more docstrings * Add missing import to api_server
This commit is contained in:
+13
-12
@@ -1,5 +1,5 @@
|
||||
import os.path
|
||||
import socket
|
||||
from pathlib import Path
|
||||
|
||||
import psutil
|
||||
from PyQt6.QtCore import QThread, pyqtSignal, Qt, pyqtSlot
|
||||
@@ -12,8 +12,8 @@ from PyQt6.QtWidgets import (
|
||||
from src.api.server_proxy import RenderServerProxy
|
||||
from src.engines.engine_manager import EngineManager
|
||||
from src.ui.engine_help_window import EngineHelpViewer
|
||||
from src.utilities.zeroconf_server import ZeroconfServer
|
||||
from src.utilities.misc_helper import COMMON_RESOLUTIONS, COMMON_FRAME_RATES
|
||||
from src.utilities.zeroconf_server import ZeroconfServer
|
||||
|
||||
|
||||
class NewRenderJobForm(QWidget):
|
||||
@@ -305,13 +305,15 @@ class NewRenderJobForm(QWidget):
|
||||
self.tabs.setCurrentIndex(0)
|
||||
|
||||
def update_job_count(self, changed_item=None):
|
||||
checked = 0
|
||||
total = self.cameras_list.count()
|
||||
checked = 1
|
||||
if self.cameras_group.enabled:
|
||||
checked = 0
|
||||
total = self.cameras_list.count()
|
||||
|
||||
for i in range(total):
|
||||
item = self.cameras_list.item(i)
|
||||
if item.checkState() == Qt.CheckState.Checked:
|
||||
checked += 1
|
||||
for i in range(total):
|
||||
item = self.cameras_list.item(i)
|
||||
if item.checkState() == Qt.CheckState.Checked:
|
||||
checked += 1
|
||||
|
||||
message = f"Submit {checked} Jobs" if checked > 1 else "Submit Job"
|
||||
self.submit_button.setText(message)
|
||||
@@ -365,8 +367,7 @@ class NewRenderJobForm(QWidget):
|
||||
self.process_label.setHidden(False)
|
||||
self.toggle_engine_enablement(False)
|
||||
|
||||
output_name, _ = os.path.splitext(os.path.basename(self.scene_file_input.text()))
|
||||
output_name = output_name.replace(' ', '_')
|
||||
output_name = Path(self.scene_file_input.text()).stem.replace(' ', '_')
|
||||
self.job_name_input.setText(output_name)
|
||||
file_name = self.scene_file_input.text()
|
||||
|
||||
@@ -601,13 +602,13 @@ class SubmitWorker(QThread):
|
||||
# presubmission tasks - use local installs
|
||||
engine_class = EngineManager.engine_class_with_name(self.window.engine_type.currentText().lower())
|
||||
latest_engine = EngineManager.get_latest_engine_instance(engine_class)
|
||||
input_path = latest_engine.perform_presubmission_tasks(input_path)
|
||||
input_path = Path(latest_engine.perform_presubmission_tasks(input_path))
|
||||
# submit
|
||||
err_msg = ""
|
||||
result = self.window.server_proxy.post_job_to_server(file_path=input_path, job_data=job_json,
|
||||
callback=create_callback)
|
||||
if not (result and result.ok):
|
||||
err_msg = f"Error posting job to server: {result.message}"
|
||||
err_msg = f"Error posting job to server: {result.text}"
|
||||
|
||||
self.message_signal.emit(err_msg)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user