Improved wizard for initial CuraEngine setup
Added profile is now set as default and UI is a bit more visually pleasing. Next step is to find some way to mark wizard completion as "please ignore"...
This commit is contained in:
parent
f352f8ff29
commit
f8e1e9badf
6 changed files with 84 additions and 52 deletions
|
|
@ -111,8 +111,10 @@ class CuraPlugin(octoprint.plugin.SlicerPlugin,
|
|||
profile_display_name = name
|
||||
profile_description = "Imported from {filename} on {date}".format(filename=filename, date=octoprint.util.get_formatted_datetime(datetime.datetime.now()))
|
||||
profile_allow_overwrite = False
|
||||
profile_make_default = False
|
||||
|
||||
# overrides
|
||||
from octoprint.server.api import valid_boolean_trues
|
||||
if "name" in flask.request.values:
|
||||
profile_name = flask.request.values["name"]
|
||||
if "displayName" in flask.request.values:
|
||||
|
|
@ -120,8 +122,9 @@ class CuraPlugin(octoprint.plugin.SlicerPlugin,
|
|||
if "description" in flask.request.values:
|
||||
profile_description = flask.request.values["description"]
|
||||
if "allowOverwrite" in flask.request.values:
|
||||
from octoprint.server.api import valid_boolean_trues
|
||||
profile_allow_overwrite = flask.request.values["allowOverwrite"] in valid_boolean_trues
|
||||
if "default" in flask.request.values:
|
||||
profile_make_default = flask.request.values["default"] in valid_boolean_trues
|
||||
|
||||
try:
|
||||
self._slicing_manager.save_profile("cura",
|
||||
|
|
@ -134,8 +137,16 @@ class CuraPlugin(octoprint.plugin.SlicerPlugin,
|
|||
self._logger.warn("Profile {profile_name} already exists, aborting".format(**locals()))
|
||||
return flask.make_response("A profile named {profile_name} already exists for slicer cura".format(**locals()), 409)
|
||||
|
||||
if profile_make_default:
|
||||
try:
|
||||
self._slicing_manager.set_default_profile("cura", profile_name)
|
||||
except octoprint.slicing.UnknownProfile:
|
||||
self._logger.warn("Profile {profile_name} could not be set as default, aborting".format(**locals()))
|
||||
return flask.make_response("The profile {profile_name} for slicer cura could not be set as default".format(**locals()), 500)
|
||||
|
||||
result = dict(
|
||||
resource=flask.url_for("api.slicingGetSlicerProfile", slicer="cura", name=profile_name, _external=True),
|
||||
name=profile_name,
|
||||
displayName=profile_display_name,
|
||||
description=profile_description
|
||||
)
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ $(function() {
|
|||
self.profileDisplayName = ko.observable();
|
||||
self.profileDescription = ko.observable();
|
||||
self.profileAllowOverwrite = ko.observable(true);
|
||||
self.profileMakeDefault = ko.observable(false);
|
||||
|
||||
self.unconfiguredCuraEngine = ko.observable();
|
||||
self.unconfiguredSlicingProfile = ko.observable();
|
||||
|
|
@ -96,6 +97,9 @@ $(function() {
|
|||
if (self.profileDescription() !== undefined) {
|
||||
form["description"] = self.profileDescription();
|
||||
}
|
||||
if (self.profileMakeDefault()) {
|
||||
form["default"] = true;
|
||||
}
|
||||
|
||||
data.formData = form;
|
||||
data.submit();
|
||||
|
|
@ -110,6 +114,7 @@ $(function() {
|
|||
self.profileDisplayName(undefined);
|
||||
self.profileDescription(undefined);
|
||||
self.profileAllowOverwrite(true);
|
||||
self.profileMakeDefault(false);
|
||||
|
||||
$("#settings_plugin_cura_import").modal("hide");
|
||||
self.requestData();
|
||||
|
|
@ -163,7 +168,11 @@ $(function() {
|
|||
});
|
||||
};
|
||||
|
||||
self.showImportProfileDialog = function() {
|
||||
self.showImportProfileDialog = function(makeDefault) {
|
||||
if (makeDefault == undefined) {
|
||||
makeDefault = _.filter(self.profiles.items(), function(profile) { profile.isdefault() }).length == 0;
|
||||
}
|
||||
self.profileMakeDefault(makeDefault);
|
||||
$("#settings_plugin_cura_import").modal("show");
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -6,4 +6,6 @@
|
|||
|
||||
{% include "snippets/cura_profiles.jinja2" %}
|
||||
|
||||
<button class="btn pull-right" data-bind="click: function() { $root.showImportProfileDialog() }">{{ _('Import Profile...') }}</button>
|
||||
|
||||
{% include "snippets/cura_profile_importer.jinja2" %}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,9 @@
|
|||
<div class="alert alert-info">{% trans %}
|
||||
<strong>Note:</strong> OctoPrint currently only supports slicing with
|
||||
CuraEngine up to 15.04 and importing Cura profiles from Cura versions
|
||||
<em>up to 15.04</em>.
|
||||
{% endtrans %}</div>
|
||||
|
||||
<div data-bind="visible: unconfiguredCuraEngine">
|
||||
<h3>{{ _('Configure CuraEngine') }}</h3>
|
||||
<p>{% trans %}
|
||||
|
|
@ -12,23 +18,21 @@
|
|||
|
||||
<div data-bind="visible: unconfiguredSlicingProfile">
|
||||
<h3>{{ _('Set up a slicing profile') }}</h3>
|
||||
<p>{% trans %}You don't have imported a slicing profile to use for slicing with CuraEngine
|
||||
<p>{% trans %}You haven't imported a slicing profile to use for slicing with CuraEngine
|
||||
yet. You should do this now.{% endtrans %}</p>
|
||||
|
||||
{% include "snippets/cura_profiles.jinja2" %}
|
||||
<div>
|
||||
{% include "snippets/cura_profiles.jinja2" %}
|
||||
</div>
|
||||
|
||||
<p style="clear: both">{% trans %}
|
||||
<strong>Don't know where to get a profile?</strong> In order to export
|
||||
a slicing profile from the Cura desktop UI, open it, set up your
|
||||
profile, then click on "File" and there on "Save Profile". You can
|
||||
import the .ini-file this creates via the "Import Profile" button.
|
||||
{% endtrans %}</p>
|
||||
<button class="btn btn-block" data-bind="click: function() { $root.showImportProfileDialog() }">{{ _('Import Profile...') }}</button>
|
||||
|
||||
<div style="clear: both; margin-top: 20px;">
|
||||
<small>{% trans %}
|
||||
<strong>Don't know where to get a profile?</strong> In order to export
|
||||
a slicing profile from the Cura desktop UI, open it, set up your
|
||||
profile, then click on "File" and there on "Save Profile". You can
|
||||
import the .ini-file this creates via the "Import Profile" button.
|
||||
{% endtrans %}</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>{% trans %}
|
||||
<strong>Note:</strong> OctoPrint currently only supports slicing with
|
||||
CuraEngine up to 15.04 and importing Cura profiles from Cura versions
|
||||
up to 15.04. Newer Cura releases (e.g. 15.06) do not allow to
|
||||
export the slicing profile anymore and also use a different internal format
|
||||
that will <em>not</em> work with the current version of the Cura Plugin.
|
||||
{% endtrans %}</p>
|
||||
|
|
|
|||
|
|
@ -35,6 +35,13 @@
|
|||
<input type="text" class="input-block-level" data-bind="value: profileDescription, attr: {placeholder: placeholderDescription}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: profileMakeDefault"> {{ _('Make default profile') }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
|
|
|
|||
|
|
@ -1,35 +1,34 @@
|
|||
<div class="pull-right">
|
||||
<small>{{ _('Sort by') }}: <a href="#" data-bind="click: function() { profiles.changeSorting('id'); }">{{ _('Identifier') }} ({{ _('ascending') }})</a> | <a href="#" data-bind="click: function() { profiles.changeSorting('name'); }">{{ _('Name') }} ({{ _('ascending') }})</a></small>
|
||||
<div data-bind="visible: profiles.items().length > 0" style="display: none">
|
||||
<div class="pull-right">
|
||||
<small>{{ _('Sort by') }}: <a href="#" data-bind="click: function() { profiles.changeSorting('id'); }">{{ _('Identifier') }} ({{ _('ascending') }})</a> | <a href="#" data-bind="click: function() { profiles.changeSorting('name'); }">{{ _('Name') }} ({{ _('ascending') }})</a></small>
|
||||
</div>
|
||||
<table class="table table-striped table-hover table-condensed table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="settings_plugin_cura_profiles_key">{{ _('Identifier') }}</th>
|
||||
<th class="settings_plugin_cura_profiles_name">{{ _('Name') }}</th>
|
||||
<th class="settings_plugin_cura_profiles_actions">{{ _('Actions') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody data-bind="foreach: profiles.paginatedItems">
|
||||
<tr data-bind="attr: {title: description}">
|
||||
<td class="settings_plugin_cura_profiles_key"><span class="icon-star" data-bind="invisible: !isdefault()"></span> <span data-bind="text: key"></span></td>
|
||||
<td class="settings_plugin_cura_profiles_name" data-bind="text: name"></td>
|
||||
<td class="settings_plugin_cura_profiles_actions">
|
||||
<a href="#" class="icon-star" title="{{ _('Make default') }}" data-bind="enable: !isdefault(), css: {disabled: isdefault()}, click: function() { if (!$data.isdefault()) { $root.makeProfileDefault($data); } }"></a> | <a href="#" class="icon-trash" title="{{ _('Delete Profile') }}" data-bind="enable: !isdefault(), css: {disabled: isdefault()}, click: function() { if (!$data.isdefault()) { $root.removeProfile($data); } }"></a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="pagination pagination-mini pagination-centered">
|
||||
<ul>
|
||||
<li data-bind="css: {disabled: profiles.currentPage() === 0}"><a href="#" data-bind="click: profiles.prevPage">«</a></li>
|
||||
</ul>
|
||||
<ul data-bind="foreach: profiles.pages">
|
||||
<li data-bind="css: { active: $data.number === $root.profiles.currentPage(), disabled: $data.number === -1 }"><a href="#" data-bind="text: $data.text, click: function() { $root.profiles.changePage($data.number); }"></a></li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li data-bind="css: {disabled: profiles.currentPage() === profiles.lastPage()}"><a href="#" data-bind="click: profiles.nextPage">»</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<table class="table table-striped table-hover table-condensed table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="settings_plugin_cura_profiles_key">{{ _('Identifier') }}</th>
|
||||
<th class="settings_plugin_cura_profiles_name">{{ _('Name') }}</th>
|
||||
<th class="settings_plugin_cura_profiles_actions">{{ _('Actions') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody data-bind="foreach: profiles.paginatedItems">
|
||||
<tr data-bind="attr: {title: description}">
|
||||
<td class="settings_plugin_cura_profiles_key"><span class="icon-star" data-bind="invisible: !isdefault()"></span> <span data-bind="text: key"></span></td>
|
||||
<td class="settings_plugin_cura_profiles_name" data-bind="text: name"></td>
|
||||
<td class="settings_plugin_cura_profiles_actions">
|
||||
<a href="#" class="icon-star" title="{{ _('Make default') }}" data-bind="enable: !isdefault(), css: {disabled: isdefault()}, click: function() { if (!$data.isdefault()) { $root.makeProfileDefault($data); } }"></a> | <a href="#" class="icon-trash" title="{{ _('Delete Profile') }}" data-bind="enable: !isdefault(), css: {disabled: isdefault()}, click: function() { if (!$data.isdefault()) { $root.removeProfile($data); } }"></a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="pagination pagination-mini pagination-centered">
|
||||
<ul>
|
||||
<li data-bind="css: {disabled: profiles.currentPage() === 0}"><a href="#" data-bind="click: profiles.prevPage">«</a></li>
|
||||
</ul>
|
||||
<ul data-bind="foreach: profiles.pages">
|
||||
<li data-bind="css: { active: $data.number === $root.profiles.currentPage(), disabled: $data.number === -1 }"><a href="#" data-bind="text: $data.text, click: function() { $root.profiles.changePage($data.number); }"></a></li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li data-bind="css: {disabled: profiles.currentPage() === profiles.lastPage()}"><a href="#" data-bind="click: profiles.nextPage">»</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<button class="btn pull-right" data-bind="click: function() { $root.showImportProfileDialog() }">{{ _('Import Profile...') }}</button>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue