Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
b54e372342 | |||
76f706df19 |
@ -170,22 +170,6 @@ class BambuVirtualPrinter:
|
|||||||
def change_state(self, new_state: APrinterState):
|
def change_state(self, new_state: APrinterState):
|
||||||
self._state_change_queue.put(new_state)
|
self._state_change_queue.put(new_state)
|
||||||
|
|
||||||
def _convert2serialize(self, obj):
|
|
||||||
if isinstance(obj, dict):
|
|
||||||
return {k: self._convert2serialize(v) for k, v in obj.items()}
|
|
||||||
elif hasattr(obj, "_ast"):
|
|
||||||
return self._convert2serialize(obj._ast())
|
|
||||||
elif not isinstance(obj, str) and hasattr(obj, "__iter__"):
|
|
||||||
return [self._convert2serialize(v) for v in obj]
|
|
||||||
elif hasattr(obj, "__dict__"):
|
|
||||||
return {
|
|
||||||
k: self._convert2serialize(v)
|
|
||||||
for k, v in obj.__dict__.items()
|
|
||||||
if not callable(v) and not k.startswith('_')
|
|
||||||
}
|
|
||||||
else:
|
|
||||||
return obj
|
|
||||||
|
|
||||||
def new_update(self, event_type):
|
def new_update(self, event_type):
|
||||||
if event_type == "event_hms_errors":
|
if event_type == "event_hms_errors":
|
||||||
self._update_hms_errors()
|
self._update_hms_errors()
|
||||||
@ -196,7 +180,8 @@ class BambuVirtualPrinter:
|
|||||||
device_data = self.bambu_client.get_device()
|
device_data = self.bambu_client.get_device()
|
||||||
print_job_state = device_data.print_job.gcode_state
|
print_job_state = device_data.print_job.gcode_state
|
||||||
temperatures = device_data.temperature
|
temperatures = device_data.temperature
|
||||||
ams_data = self._convert2serialize(device_data.ams.data)
|
# strip out extra data to avoid unneeded settings updates
|
||||||
|
ams_data = [{"tray": asdict(x).pop("tray", None)} for x in device_data.ams.data if x is not None]
|
||||||
|
|
||||||
if self.ams_data != ams_data:
|
if self.ams_data != ams_data:
|
||||||
self._log.debug(f"Recieveid AMS Update: {ams_data}")
|
self._log.debug(f"Recieveid AMS Update: {ams_data}")
|
||||||
|
@ -86,6 +86,10 @@ class CachedFileView:
|
|||||||
file_name = f"{file_name}.3mf"
|
file_name = f"{file_name}.3mf"
|
||||||
elif f"{file_name}.gcode.3mf" in file_list:
|
elif f"{file_name}.gcode.3mf" in file_list:
|
||||||
file_name = f"{file_name}.gcode.3mf"
|
file_name = f"{file_name}.gcode.3mf"
|
||||||
|
elif f"cache/{file_name}.3mf" in file_list:
|
||||||
|
file_name = f"cache/{file_name}.3mf"
|
||||||
|
elif f"cache/{file_name}.gcode.3mf" in file_list:
|
||||||
|
file_name = f"cache/{file_name}.gcode.3mf"
|
||||||
|
|
||||||
file_data = self.get_file_data_cached(file_name)
|
file_data = self.get_file_data_cached(file_name)
|
||||||
if file_data is None:
|
if file_data is None:
|
||||||
|
@ -71,7 +71,7 @@ class PrintingState(APrinterState):
|
|||||||
subtask_name: str = print_job_info.subtask_name
|
subtask_name: str = print_job_info.subtask_name
|
||||||
gcode_file: str = print_job_info.gcode_file
|
gcode_file: str = print_job_info.gcode_file
|
||||||
|
|
||||||
self._log.info(f"update_print_job_info: {print_job_info}")
|
self._log.debug(f"update_print_job_info: {print_job_info}")
|
||||||
|
|
||||||
project_file_info = self._printer.project_files.get_file_by_name(subtask_name) or self._printer.project_files.get_file_by_name(gcode_file)
|
project_file_info = self._printer.project_files.get_file_by_name(subtask_name) or self._printer.project_files.get_file_by_name(gcode_file)
|
||||||
if project_file_info is None:
|
if project_file_info is None:
|
||||||
@ -81,6 +81,8 @@ class PrintingState(APrinterState):
|
|||||||
return
|
return
|
||||||
|
|
||||||
progress = print_job_info.print_percentage
|
progress = print_job_info.print_percentage
|
||||||
|
if print_job_info.gcode_state == "PREPARE" and progress == 100:
|
||||||
|
progress = 0
|
||||||
self._printer.current_print_job = PrintJob(project_file_info, progress, print_job_info.remaining_time, print_job_info.current_layer, print_job_info.total_layers)
|
self._printer.current_print_job = PrintJob(project_file_info, progress, print_job_info.remaining_time, print_job_info.current_layer, print_job_info.total_layers)
|
||||||
self._printer.select_project_file(project_file_info.path.as_posix())
|
self._printer.select_project_file(project_file_info.path.as_posix())
|
||||||
|
|
||||||
|
@ -22,6 +22,10 @@ $(function () {
|
|||||||
|
|
||||||
self.auth_type = ko.observable("");
|
self.auth_type = ko.observable("");
|
||||||
|
|
||||||
|
self.show_password = ko.pureComputed(function(){
|
||||||
|
return self.settingsViewModel.settings.plugins.bambu_printer.auth_token() === '';
|
||||||
|
});
|
||||||
|
|
||||||
self.show_verification = ko.pureComputed(function(){
|
self.show_verification = ko.pureComputed(function(){
|
||||||
return self.auth_type() !== '';
|
return self.auth_type() !== '';
|
||||||
});
|
});
|
||||||
|
@ -43,10 +43,10 @@
|
|||||||
<input type="text" class="input-block-level" data-bind="value: settingsViewModel.settings.plugins.bambu_printer.email" title="{{ _('Registered email address') }}" autocomplete="off"></input>
|
<input type="text" class="input-block-level" data-bind="value: settingsViewModel.settings.plugins.bambu_printer.email" title="{{ _('Registered email address') }}" autocomplete="off"></input>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group" data-bind="visible: !settingsViewModel.settings.plugins.bambu_printer.local_mqtt()">
|
<div class="control-group" data-bind="visible: !settingsViewModel.settings.plugins.bambu_printer.local_mqtt() && show_password()">
|
||||||
<label class="control-label">{{ _('Password') }}</label>
|
<label class="control-label">{{ _('Password') }}</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<div class="input-block-level input-append">
|
<div class="input-block-level input-append" data-bind="css: {'input-append': !show_verification()}">
|
||||||
<input id="bambu_cloud_password" type="password" class="input-text input-block-level" title="{{ _('Password to generate verification code') }}" autocomplete="new-password"></input>
|
<input id="bambu_cloud_password" type="password" class="input-text input-block-level" title="{{ _('Password to generate verification code') }}" autocomplete="new-password"></input>
|
||||||
<span class="btn btn-primary add-on" data-bind="visible: !show_verification(), click: getAuthToken">{{ _('Login') }}</span>
|
<span class="btn btn-primary add-on" data-bind="visible: !show_verification(), click: getAuthToken">{{ _('Login') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
2
setup.py
2
setup.py
@ -14,7 +14,7 @@ plugin_package = "octoprint_bambu_printer"
|
|||||||
plugin_name = "OctoPrint-BambuPrinter"
|
plugin_name = "OctoPrint-BambuPrinter"
|
||||||
|
|
||||||
# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
|
# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
|
||||||
plugin_version = "0.1.8rc8"
|
plugin_version = "0.1.8rc10"
|
||||||
|
|
||||||
# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
|
# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
|
||||||
# module
|
# module
|
||||||
|
Reference in New Issue
Block a user