Skip to content

Commit

Permalink
Added a fullbrowser button
Browse files Browse the repository at this point in the history
  • Loading branch information
sco01 committed Oct 13, 2019
1 parent d8eee2c commit e2b5a44
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 20 deletions.
19 changes: 13 additions & 6 deletions octoprint_dashboard/static/css/dashboard.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

.dashboardGridItem>* {
border: 0px solid rgba(0, 0, 0, 0.8);
padding: 10px;
padding: 5px;
font-size: 20px;
text-align: left;
vertical-align: middle;
Expand All @@ -33,6 +33,13 @@
-webkit-user-drag: none;
}

#fullWindowIcon {
width: auto;
height: 15px;
float: right;
-webkit-user-drag: none;
}

.dashboardButton {
width: 95%;
}
Expand Down Expand Up @@ -213,7 +220,7 @@ svg text {

.dasboardContainer:-moz-full-screen .dashboardGridItem {
text-align: center;
margin-bottom: 20px;
margin-bottom: 15px;
padding-bottom: 0px;
}

Expand Down Expand Up @@ -275,7 +282,7 @@ svg text {

.dasboardContainer:-ms-fullscreen .dashboardGridItem {
text-align: center;
margin-bottom: 20px;
margin-bottom: 15px;
padding-bottom: 0px;
}

Expand Down Expand Up @@ -337,7 +344,7 @@ svg text {

.dasboardContainer:-webkit-full-screen .dashboardGridItem {
text-align: center;
margin-bottom: 20px;
margin-bottom: 15px;
padding-bottom: 0px;
}

Expand Down Expand Up @@ -399,7 +406,7 @@ svg text {

.dasboardContainer:fullscreen .dashboardGridItem {
text-align: center;
margin-bottom: 20px;
margin-bottom: 15px;
padding-bottom: 0px;
}

Expand Down Expand Up @@ -466,7 +473,7 @@ svg text {

.dasboardContainer.dashboard-full .dashboardGridItem {
text-align: center;
margin-bottom: 20px;
margin-bottom: 15px;
padding-bottom: 0px;
}

Expand Down
Binary file modified octoprint_dashboard/static/img/fullscreen-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 11 additions & 4 deletions octoprint_dashboard/static/js/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,29 @@ $(function () {
self.urlParams = new URLSearchParams(window.location.search);
var dashboardIsFull = self.urlParams.has('dashboard') && (self.urlParams.get('dashboard') == 'full');


//Notify user if displaylayerprogress plugin is not installed
self.DisplayLayerProgressAvailable = function () {
if (self.settingsViewModel.settings.plugins.DisplayLayerProgress)
return;
return true;
else {
printerDisplay = new PNotify({
title: 'Dashboard',
type: 'warning',
text: 'Can\'t get stats from <a href="https://plugins.octoprint.org/plugins/DisplayLayerProgress/"" target="_blank">DisplayLayerProgress</a>. This plugin is required and provides GCode parsing for Fan Speed, Layer/Height info and Average layer time. Is it installed, enabled and on the latest version?',
text: 'Can\'t get stats from <a href="https://plugins.octoprint.org/plugins/DisplayLayerProgress/"" target="_blank">DisplayLayerProgress</a>. This plugin is required and provides GCode parsing for Fan Speed, Layer/Height info, Layer Durations and Average layer time. Is it installed, enabled and on the latest version?',
hide: false
});
return "Warning: Can't get stats from <a href='https://plugins.octoprint.org/plugins/DisplayLayerProgress/' target='_blank'>DisplayLayerProgress</a>. Is it installed, enabled and on the latest version?";
return false;
}
};

self.toggleFullBrowserWindow = function () {
if (!dashboardIsFull)
location.href="/?dashboard=full";
else
window.history.back();
}


// Toggle fullscreen
self.fullScreen = function () {
var elem = document.body;
Expand Down
2 changes: 1 addition & 1 deletion octoprint_dashboard/templates/dashboard_settings.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<legend>{{ _('Widget Visibility') }}</legend>
<div class="control-group">
<div >
<label class="checkbox">{{ _('Show Fullscreen Mode Button') }}
<label class="checkbox">{{ _('Show FullScreen & FullBrowser Mode Buttons') }}
<input type="checkbox" data-bind="checked: settings.plugins.dashboard.showFullscreen">
</label>
</div>
Expand Down
25 changes: 16 additions & 9 deletions octoprint_dashboard/templates/dashboard_tab.jinja2
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<div id="dasboardContainer" class="dasboardContainer">
<div class="dasboardFsContainer" data-bind="attr: {id: 'dasboardFsContainer_webcam_' + settingsViewModel.settings.plugins.dashboard.showWebCam()}">

<input class="dashboardIcon" id="fullWindowIcon" title="Full Browser Window" type="image" src="plugin/dashboard/static/img/fullwindow-icon.png" data-bind="click: toggleFullBrowserWindow, visible: settingsViewModel.settings.plugins.dashboard.showFullscreen()" />
<input class="dashboardIcon" id="fullScreenIcon" title="Fullscreen (Esc to cancel)" type="image" src="plugin/dashboard/static/img/fullscreen-icon.png" data-bind="click: fullScreen, visible: settingsViewModel.settings.plugins.dashboard.showFullscreen()" />


<!-- HTML grid-based layout. Set to 3 columns wide in css -->
<div class="dasboardGridContainer">

Expand Down Expand Up @@ -126,11 +129,12 @@
</div>

<!-- Printer Message-->
<br/>
<div class="dashboardGridItem" data-bind="visible: printerStateModel.isPrinting() && settingsViewModel.settings.plugins.dashboard.showPrinterMessage()">
<br/>
<span id="printerMessage" data-bind="attr: { title: 'M117 Printer message' }, html: 'Msg: ' + printerMessage()"></span>
<br/>
</div>
<br/>



<!-- Progress Circle-->
Expand Down Expand Up @@ -160,21 +164,21 @@



<!-- SVG Progress Bar-->
<!-- SVG Job Progress Bar-->
<div class="dashboardGridItem" style="text-align:center;" data-bind="visible: settingsViewModel.settings.plugins.dashboard.gaugetype() == 'bar' && printerStateModel.isPrinting() && settingsViewModel.settings.plugins.dashboard.showProgress()">
<h5 style="display: inline;">Job: </h5>
<span title="Job Progress">Job</span>
<span data-bind="attr: { title: 'Printer status' }, html: printerStateModel.progressBarString()"></span>
<svg preserveAspectRatio="none" width="100%" height="20px" viewBox="0 0 339.292 20">
<svg preserveAspectRatio="none" width="100%" height="15px" viewBox="0 0 339.292 20">
<path class="bg" stroke="#ccc" d="M0 10, 339.292 10"></path>
<path class="dashboardGauge" stroke="#09c" d="M0 10, 339.292 10" stroke-dasharray="339.292" data-bind="attr: { 'stroke-dashoffset': formatProgressOffset(printerStateModel.progressString()) }"></path>
</svg>
</div>

<!-- SVG Layer Progress Bar-->
<div class="dashboardGridItem" style="text-align:center;" data-bind="visible: settingsViewModel.settings.plugins.dashboard.gaugetype() == 'bar' && printerStateModel.isPrinting() && settingsViewModel.settings.plugins.dashboard.showLayerProgress()">
<h5 style="display: inline;">Layer: </h5>
<span title="Layer Progress">Layer</span>
<span data-bind="attr: { title: 'Printer status' }, html: layerProgressBarString()"></span>
<svg preserveAspectRatio="none" width="100%" height="20px" viewBox="0 0 339.292 20">
<svg preserveAspectRatio="none" width="100%" height="15px" viewBox="0 0 339.292 20">
<path class="bg" stroke="#ccc" d="M0 10, 339.292 10"></path>
<path class="dashboardGauge" stroke="#09c" d="M0 10, 339.292 10" stroke-dasharray="339.292" data-bind="attr: { 'stroke-dashoffset': formatProgressOffset(layerProgressString()) }"></path>
</svg>
Expand Down Expand Up @@ -240,8 +244,11 @@
</div>

<!-- Warning if DisplayLayerProgress is not installed -->
<span id="warn" data-bind="attr: { title: 'Warn' }, html: DisplayLayerProgressAvailable()"></span>
<br />
<div class="dashboardGridItem" data-bind="visible: !DisplayLayerProgressAvailable()">
<span class="dashboardSmall" id="warn" style="color: red;">Warning! Can't get stats from <a href='https://plugins.octoprint.org/plugins/DisplayLayerProgress/' target='_blank'>DisplayLayerProgress</a>. Is it installed?</span>
<br/>
</div>

</div>

<!-- Webcam -->
Expand Down

0 comments on commit e2b5a44

Please sign in to comment.