working area fix. edit fix of default profiles
This commit is contained in:
parent
8237d3c98f
commit
901e63aef9
4 changed files with 12 additions and 15 deletions
|
|
@ -135,7 +135,7 @@ class LaserCutterProfileManager(object):
|
|||
def exists(self, identifier):
|
||||
if identifier is None:
|
||||
return False
|
||||
elif identifier == "_default":
|
||||
elif identifier == "_mrbeam_junior" or identifier == "_mrbeam_senior":
|
||||
return True
|
||||
else:
|
||||
path = self._get_profile_path(identifier)
|
||||
|
|
@ -155,10 +155,8 @@ class LaserCutterProfileManager(object):
|
|||
|
||||
results[identifier] = dict_merge(self._load_default("_mrbeam_junior"), profile)
|
||||
|
||||
if(not results.has_key("_mrbeam_junior")):
|
||||
results["_mrbeam_junior"] = self._load_default("_mrbeam_junior")
|
||||
if(not results.has_key("_mrbeam_senior")):
|
||||
results["_mrbeam_senior"] = self._load_default("_mrbeam_senior")
|
||||
results["_mrbeam_junior"] = self._load_default("_mrbeam_junior")
|
||||
results["_mrbeam_senior"] = self._load_default("_mrbeam_senior")
|
||||
return results
|
||||
|
||||
def _load_all_identifiers(self):
|
||||
|
|
@ -211,7 +209,6 @@ class LaserCutterProfileManager(object):
|
|||
return False
|
||||
|
||||
def _load_default(self, defaultModel = None):
|
||||
default_overrides = self.settings.get([defaultModel])
|
||||
default = copy.deepcopy(self.__class__.default)
|
||||
if(defaultModel is not None and defaultModel == "_mrbeam_senior"):
|
||||
default['volume']['width'] *= 2
|
||||
|
|
@ -219,12 +216,7 @@ class LaserCutterProfileManager(object):
|
|||
default['model'] = "Senior"
|
||||
default['id'] = "_mrbeam_senior"
|
||||
|
||||
if(default_overrides is None):
|
||||
merge = default
|
||||
else:
|
||||
merge = dict_merge(default, default_overrides)
|
||||
|
||||
profile = self._ensure_valid_profile(merge)
|
||||
profile = self._ensure_valid_profile(default)
|
||||
if not profile:
|
||||
self._logger.warn("Invalid default profile after applying overrides")
|
||||
raise InvalidProfileError()
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@ $(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;
|
||||
|
|
@ -207,6 +208,10 @@ $(function() {
|
|||
self.updateProfile(undefined, callback);
|
||||
}
|
||||
};
|
||||
|
||||
self.isReadOnly = function (data){
|
||||
return (data.id === "_mrbeam_senior" || data.id === "_mrbeam_junior");
|
||||
};
|
||||
|
||||
self._editorData = function() {
|
||||
var profile = {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
<td class="settings_printerProfiles_profiles_name"><span class="icon-star" data-bind="invisible: !isdefault()"></span> <span data-bind="text: name"></span></td>
|
||||
<td class="settings_printerProfiles_profiles_model" data-bind="text: model"></td>
|
||||
<td class="settings_printerProfiles_profiles_action">
|
||||
<a href="#" class="icon-star" title="{{ _('Set as default profile') }}" data-bind="click: function() { $root.makeDefault($data); }"></a> | <a href="#" class="icon-pencil" title="{{ _('Edit Profile') }}" data-bind="click: function() { $root.showEditProfileDialog($data); }"></a> | <a href="#" class="icon-trash" title="{{ _('Delete Profile') }}" data-bind="click: function() { $root.removeProfile($data); }"></a>
|
||||
<a href="#" class="icon-star" title="{{ _('Set as default profile') }}" data-bind="click: function() { $root.makeDefault($data); }"></a> | <a href="#" class="icon-pencil" title="{{ _('Edit Profile') }}" data-bind="css: {disabled:$root.isReadOnly}, click: function() { if(!$root.isReadOnly($data)) $root.showEditProfileDialog($data); }"></a> | <a href="#" class="icon-trash" title="{{ _('Delete Profile') }}" data-bind="css: {disabled:$root.isReadOnly}, click: function() { if(!$root.isReadOnly($data)) $root.removeProfile($data); }"></a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@ function WorkingAreaViewModel(params) {
|
|||
self.workingAreaHeightMM = ko.observable(undefined);
|
||||
self.hwRatio = ko.computed(function(){
|
||||
// y/x = 297/216 respectively 594/432
|
||||
var h = self.workingAreaWidthMM();
|
||||
var w = self.workingAreaHeightMM();
|
||||
var w = self.workingAreaWidthMM();
|
||||
var h = self.workingAreaHeightMM();
|
||||
// var h = self.settings.printerProfiles.currentProfileData().volume.depth();
|
||||
// var w = self.settings.printerProfiles.currentProfileData().volume.width();
|
||||
var ratio = h / w;
|
||||
|
|
|
|||
Loading…
Reference in a new issue