Skip to content

Commit

Permalink
naming fix and default values
Browse files Browse the repository at this point in the history
  • Loading branch information
MoonshineSG committed Jan 4, 2016
1 parent 2aa5282 commit 81857b4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
16 changes: 12 additions & 4 deletions octoprint_multi_colors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,27 @@ def inject_gcode(self, file, layers, find_string, gcode):
return False

def load_regex(self):
return self._load_data(self.regex_file)
data = self._load_data(self.regex_file)
if data == "__default__":
return "layer {layer},.*?\n"
return data

def save_regex(self, data):
self._save_data(self.regex_file, data)

def load_gcode(self):
return self._load_data(self.gcode_file)
data = self._load_data(self.gcode_file)
if data == "__default__":
return """M117 Change filament
M300 @change
M0"""
return data

def save_gcode(self, data):
self._save_data(self.gcode_file, data)

def _load_data(self, data_file):
data = ""
data = "__default__"
if os.path.isfile(data_file):
with open(data_file, 'r') as f:
data = f.read()
Expand Down Expand Up @@ -119,7 +127,7 @@ def get_update_information(self):

def __plugin_load__():
global __plugin_implementation__
__plugin_implementation__ = ColorsPlugin()
__plugin_implementation__ = MultiColorsPlugin()

global __plugin_hooks__
__plugin_hooks__ = {
Expand Down
4 changes: 2 additions & 2 deletions octoprint_multi_colors/static/js/multi_colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ $(function() {
}

self._sendData = function(data, callback) {
OctoPrint.postJson("api/plugin/multicolors", data)
OctoPrint.postJson("api/plugin/multi_colors", data)
.done(function(data) {
if (callback) callback(data);
});
Expand Down Expand Up @@ -87,7 +87,7 @@ $(function() {
OCTOPRINT_VIEWMODELS.push([
multiColorViewModel,
["loginStateViewModel", "printerStateViewModel"],
["#color_layer"]
["#multi_color_layer"]
]);

});

0 comments on commit 81857b4

Please sign in to comment.