Skip to content

Commit

Permalink
Added Job Cotrol Buttons for #87
Browse files Browse the repository at this point in the history
  • Loading branch information
sco01 committed Oct 12, 2019
1 parent e61a2a7 commit aa144c0
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
3 changes: 2 additions & 1 deletion octoprint_dashboard/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ def get_settings_defaults(self):
showFilament=True,
showLayerGraph=False,
showPrinterMessage=False,
showSensorInfo=False
showSensorInfo=False,
showJobControlButtons=False
)

def on_settings_save(self, data):
Expand Down
4 changes: 4 additions & 0 deletions octoprint_dashboard/static/css/dashboard.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
-webkit-user-drag: none;
}

.dashboardButton {
width: 95%;
}

.dashboardSmall {
color: #08c;
font-size: 15px;
Expand Down
5 changes: 5 additions & 0 deletions octoprint_dashboard/templates/dashboard_settings.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@
<input type="checkbox" data-bind="checked: settings.plugins.dashboard.showSystemInfo">
</label>
</div>
<div >
<label class="checkbox">{{ _('Show Job Control Buttons') }}
<input type="checkbox" data-bind="checked: settings.plugins.dashboard.showJobControlButtons">
</label>
</div>
<div >
<label class="checkbox">{{ _('Show Fan Gauge') }}
<input type="checkbox" data-bind="checked: settings.plugins.dashboard.showFan">
Expand Down
12 changes: 12 additions & 0 deletions octoprint_dashboard/templates/dashboard_tab.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@
<span id="stateInfo" data-bind="attr: { title: 'Printer status' }, html: printerStateModel.stateString()"></span>
</div>

<!-- Job Control -->
<div class="dashboardGridItem" data-bind="visible: settingsViewModel.settings.plugins.dashboard.showJobControlButtons()">
<button class="btn btn-primary dashboardButton" style="width: 95%;" data-bind="click: printerStateModel.print, enable: printerStateModel.enablePrint, css: {'btn-danger': printerStateModel.isPaused()}, attr: {title: printerStateModel.titlePrintButton}" id="job_print"><i class="fa" data-bind="css: {'fa-print': !printerStateModel.isPaused(), 'fa-undo': printerStateModel.isPaused()}"></i> <span data-bind="text: (printerStateModel.isPaused() ? '{{ _('Restart') }}' : '{{ _('Print') }}')">{{ _('Print') }}</span></button>
</div>

<div class="dashboardGridItem" data-bind="visible: settingsViewModel.settings.plugins.dashboard.showJobControlButtons()">
<button class="btn dashboardButton" id="job_pause" data-bind="click: function() { printerStateModel.isPaused() ? printerStateModel.onlyResume() : printerStateModel.onlyPause(); }, enable: printerStateModel.enablePause, css: {active: printerStateModel.isPaused()}, attr: {title: printerStateModel.titlePauseButton}"><i class="fa" data-bind="css: {'fa-pause': !printerStateModel.isPaused(), 'fa-play': printerStateModel.isPaused()}"></i> <span data-bind="visible: !printerStateModel.isPaused()">{{ _('Pause') }}</span><span data-bind="visible: printerStateModel.isPaused()">{{ _('Resume') }}</span></button>
</div>
<div class="dashboardGridItem" data-bind="visible: settingsViewModel.settings.plugins.dashboard.showJobControlButtons()">
<button class="btn dashboardButton" id="job_cancel" data-bind="click: printerStateModel.cancel, enable: printerStateModel.enableCancel" title="{{ _('Cancels the print job') }}"><i class="fa fa-stop"></i> {{ _('Cancel') }}</button>
</div>


<!-- Temps and Fan -->

Expand Down

0 comments on commit aa144c0

Please sign in to comment.