Skip to content

Commit 3ecaa48

Browse files
authored
0.1.0 (#33)
* fixed scanning recursion
1 parent aa9696c commit 3ecaa48

File tree

4 files changed

+4
-21
lines changed

4 files changed

+4
-21
lines changed

octoprint_prusaslicerthumbnails/__init__.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,6 @@ def _process_gcode(self, gcode_file, results=[]):
101101
children = gcode_file["children"]
102102
for key, file in children.items():
103103
self._process_gcode(children[key], results)
104-
elif gcode_file.get("type") == "folder" and gcode_file.get("children") == None:
105-
results["warning"] = True
106104
return results
107105

108106
def get_api_commands(self):
@@ -117,21 +115,12 @@ def on_api_command(self, command, data):
117115

118116
if command == "crawl_files":
119117
self._logger.debug("Crawling Files")
120-
FileList = self._file_manager.list_files()
118+
FileList = self._file_manager.list_files(recursive=True)
119+
self._logger.info(FileList)
121120
LocalFiles = FileList["local"]
122121
results = dict(no_thumbnail=[],no_thumbnail_src=[])
123122
for key, file in LocalFiles.items():
124123
results = self._process_gcode(LocalFiles[key], results)
125-
# if LocalFiles[key].get("children") == None:
126-
# # self._logger.debug(LocalFiles[key].get("thumbnail"))
127-
# if LocalFiles[key].get("thumbnail") == None:
128-
# # self._logger.debug("No Thumbnail for %s, attempting extraction" % file["path"])
129-
# results["no_thumbnail"].append(file["path"])
130-
# self.on_event("FileAdded", dict(path=file["path"],storage="local",type=["gcode"]))
131-
# elif "prusaslicerthumbnails" in LocalFiles[key].get("thumbnail") and not LocalFiles[key].get("thumbnail_src"):
132-
# # self._logger.debug("No Thumbnail source for %s, adding" % file["path"])
133-
# results["no_thumbnail_src"].append(file["path"])
134-
# self._file_manager.set_additional_metadata("local", file["path"], "thumbnail_src", self._identifier, overwrite=True)
135124
return flask.jsonify(results)
136125

137126
##~~ Routes hook

octoprint_prusaslicerthumbnails/static/js/prusaslicerthumbnails.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ $(function() {
1717
self.inline_thumbnail = ko.observable();
1818
self.crawling_files = ko.observable(false);
1919
self.crawl_results = ko.observableArray([]);
20-
self.show_crawl_warning = ko.observable(false);
2120

2221
self.filesViewModel.prusaslicerthumbnails_open_thumbnail = function(data) {
2322
if(data.name.indexOf('.gcode') > 0){
@@ -46,15 +45,11 @@ $(function() {
4645
}),
4746
contentType: "application/json; charset=UTF-8"
4847
}).done(function(data){
49-
self.show_crawl_warning(false);
5048
for (key in data) {
51-
if(data[key].length && data[key] !== 'warning'){
49+
if(data[key].length){
5250
self.crawl_results.push({name: ko.observable(key), files: ko.observableArray(data[key])});
53-
} else if(key == 'warning'){
54-
self.show_crawl_warning(true);
5551
}
5652
}
57-
console.log(data);
5853
if(self.crawl_results().length == 0){
5954
self.crawl_results.push({name: ko.observable('No convertible files found'), files: ko.observableArray([])});
6055
}

octoprint_prusaslicerthumbnails/templates/prusaslicerthumbnails_settings.jinja2

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
<div id="crawl_files_results" class="row-fluid" data-bind="if: crawl_results().length > 0">
4545
<div class="alert alert-block">
4646
<h4>Scan Results</h4>
47-
<div class="muted" data-bind="if: show_crawl_warning()"><small><span class="label label-important">Warning: </span> Currently the scan is only able to process the root folder and first level of sub-folders.</small></div>
4847
<ul class="unstyled" data-bind="foreach: { data: crawl_results, as: 'category', noChildContext: true }">
4948
<!-- ko if:category.files().length == 0 -->
5049
<li><span data-bind="text: category.name" class="label label-success"></span></li>

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
plugin_name = "PrusaSlicer Thumbnails"
1515

1616
# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
17-
plugin_version = "0.0.9"
17+
plugin_version = "0.1.0"
1818

1919
# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
2020
# module

0 commit comments

Comments
 (0)