From 05687b16997283a6a7e57b90f0e46fe37b0a2c77 Mon Sep 17 00:00:00 2001 From: Teja Date: Mon, 26 Jan 2015 16:13:57 +0100 Subject: [PATCH] fixed z-axis setting --- .../plugins/lasercutterprofiles/__init__.py | 6 ++-- .../static/js/lasercutterprofiles.js | 13 +++++--- .../plugins/svgtogcode/static/css/mrbeam.css | 5 +++ .../svgtogcode/static/js/working_area.js | 1 - .../templates/override_index.jinja2 | 33 +++++++++---------- 5 files changed, 34 insertions(+), 24 deletions(-) diff --git a/src/octoprint/plugins/lasercutterprofiles/__init__.py b/src/octoprint/plugins/lasercutterprofiles/__init__.py index 8b0ad5ee..421d3e95 100644 --- a/src/octoprint/plugins/lasercutterprofiles/__init__.py +++ b/src/octoprint/plugins/lasercutterprofiles/__init__.py @@ -199,9 +199,11 @@ class LaserCutterProfilesPlugin(octoprint.plugin.SettingsPlugin, ##~~ TemplatePlugin API def get_template_vars(self): - return dict( - _settings_menu_entry="Laser cutter profile" + selectedProfile = laserCutterProfileManager.get_current_or_default() + d = dict( + settings_menu_entry="Laser cutter profiles", ) + return d def get_template_folder(self): import os diff --git a/src/octoprint/plugins/lasercutterprofiles/static/js/lasercutterprofiles.js b/src/octoprint/plugins/lasercutterprofiles/static/js/lasercutterprofiles.js index 17efbc44..0e00424b 100644 --- a/src/octoprint/plugins/lasercutterprofiles/static/js/lasercutterprofiles.js +++ b/src/octoprint/plugins/lasercutterprofiles/static/js/lasercutterprofiles.js @@ -4,6 +4,7 @@ $(function() { var self = this; self.workingarea = params[0]; + self.control = params[1]; self._cleanProfile = function() { return { @@ -89,7 +90,6 @@ $(function() { var defaultProfile = undefined; var currentProfile = undefined; var currentProfileData = undefined; - console.log("lasercutterprofiles", data.profiles); _.each(data.profiles, function(entry) { if (entry.default) { defaultProfile = entry.id; @@ -109,6 +109,8 @@ $(function() { self.workingarea.workingAreaWidthMM(self.currentProfileData().volume.width()); self.workingarea.workingAreaHeightMM(self.currentProfileData().volume.depth()); +// self.control.currentProfile(self.currentProfileData()); +// console.log("lasercutterprofiles from_response", self.control.currentProfile()); }; self.addProfile = function(callback) { @@ -142,8 +144,6 @@ $(function() { profile = self._editorData(); } - console.log("updateProfile", profile); - $.ajax({ url: BASEURL + "plugin/lasercutterprofiles/profiles/" + profile.id, type: "PATCH", @@ -247,13 +247,18 @@ $(function() { self.onSettingsShown = self.requestData; self.onStartup = function(){ self.requestData(); + self.control.showZAxis = ko.computed(function(){ + var has = self.currentProfileData()['zAxis'](); + return has; + }); // dependency injection }; + } // view model class, identifier, parameters for constructor, container to bind to ADDITIONAL_VIEWMODELS.push([LaserCutterProfilesViewModel, "laserCutterProfilesViewModel", - ["workingAreaViewModel"], + ["workingAreaViewModel", "controlViewModel"], document.getElementById("laserCutterProfiles")]); }); diff --git a/src/octoprint/plugins/svgtogcode/static/css/mrbeam.css b/src/octoprint/plugins/svgtogcode/static/css/mrbeam.css index aa4c2b00..7658d5b5 100644 --- a/src/octoprint/plugins/svgtogcode/static/css/mrbeam.css +++ b/src/octoprint/plugins/svgtogcode/static/css/mrbeam.css @@ -1150,6 +1150,11 @@ ul.dropdown-menu li a { display:inline-block; width: 80px; } +#control_zaxis_focus { + display:inline-block; + width: 80px; + margin: 12px 0; +} #control_xyaxis { display:inline-block; margin: 1em auto 0; diff --git a/src/octoprint/plugins/svgtogcode/static/js/working_area.js b/src/octoprint/plugins/svgtogcode/static/js/working_area.js index 5e462b85..de16cc9e 100644 --- a/src/octoprint/plugins/svgtogcode/static/js/working_area.js +++ b/src/octoprint/plugins/svgtogcode/static/js/working_area.js @@ -165,7 +165,6 @@ function WorkingAreaViewModel(params) { }; self.onStartup = function(){ - console.log("working_area_onstartup"); self.files.workingArea = self; $(window).resize(function(){ self.trigger_resize(); diff --git a/src/octoprint/plugins/svgtogcode/templates/override_index.jinja2 b/src/octoprint/plugins/svgtogcode/templates/override_index.jinja2 index 6e777023..3bcd0959 100644 --- a/src/octoprint/plugins/svgtogcode/templates/override_index.jinja2 +++ b/src/octoprint/plugins/svgtogcode/templates/override_index.jinja2 @@ -119,14 +119,14 @@
- {% if hasZAxis %} - Z-Axis -
- - - +
+ Z-Axis +
+ + + +
- {% endif %}
@@ -370,18 +370,17 @@
- {% if hasZAxis %} -
-
- - Z-Axis -
- - + +
+
+ + Z-Axis +
+ + +
-
- {% endif %}