Skip to content

Commit ff86a6e

Browse files
authored
Merge pull request #156 from LazeMSS/develop
Develop
2 parents 8064745 + 7653b63 commit ff86a6e

File tree

6 files changed

+40
-19
lines changed

6 files changed

+40
-19
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ dist
88
.DS_Store
99
*.zip
1010
__pycache__
11-
octoprint_uicustomizer/static/themes/css/active.css
11+
octoprint_uicustomizer/static/themes/*

octoprint_uicustomizer/__init__.py

+6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import requests
1212

1313
from flask import send_file
14+
from flask import url_for
1415

1516
class UICustomizerPlugin(octoprint.plugin.StartupPlugin,
1617
octoprint.plugin.SettingsPlugin,
@@ -92,6 +93,10 @@ def getRemoteThemeVersion(self):
9293
return jsonVersion['tag_name']
9394
return False
9495

96+
def loginui_theming(self):
97+
return [url_for("plugin.uicustomizer.static", filename="themes/css/active.css")]
98+
99+
95100
# Check for new versions on login
96101
def on_event(self,event,payload):
97102
if event == "UserLoggedIn":
@@ -208,5 +213,6 @@ def __plugin_load__():
208213

209214
global __plugin_hooks__
210215
__plugin_hooks__ = {
216+
"octoprint.theming.login": __plugin_implementation__.loginui_theming,
211217
"octoprint.plugin.softwareupdate.check_config": __plugin_implementation__.get_update_information
212218
}

octoprint_uicustomizer/static/css/uicustomizer.css

+8-5
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@
162162
body.UICResponsiveMode #files .gcode_files .scroll-wrapper.UICFullHeight{
163163
height: 100%;
164164
max-height: 75vh;
165+
resize: vertical;
165166
}
166167
}
167168

@@ -352,6 +353,7 @@ html:not(.themeify) #tabs_content{
352353
height: 100%;
353354
max-height: 80vh;
354355
min-height: 70px;
356+
resize: vertical;
355357
}
356358

357359
/* search in settings fix*/
@@ -1130,11 +1132,6 @@ body.inlineFullscreen .UICWebCamClick{
11301132
border-radius: 3px;
11311133
}
11321134

1133-
/*OctoPrint-CameraSettings fixes - not perfect but the flexbox stuff and old bootstrap does not mix*/
1134-
body.UICResponsiveMode #settings_plugin_camerasettings div.camera-settings-outer > div:nth-child(4){
1135-
max-height: 45vh;
1136-
}
1137-
11381135
/* themify hacks :/*/
11391136
.themeify.dyl #navbar{
11401137
position: absolute !important;
@@ -1206,5 +1203,11 @@ html.themeify #UICsetMenuShow{
12061203
}
12071204

12081205

1206+
#term .terminal pre.UICResizeAble{
1207+
height: 600px;
1208+
resize: vertical;
1209+
max-height: inherit;
1210+
}
1211+
12091212
/* UICustomizer END */
12101213

octoprint_uicustomizer/static/js/uicustomizer.js

+23-11
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ $('head').prepend('<meta id="UICViewport" name="viewport" content="width=device-
88

99
// Set theme onload
1010
var UICPreLoadTheme = "default";
11+
var UICThemeV = 0;
1112
if (Modernizr.localstorage){
1213
if (window.location.pathname != "/"){
1314
UICPreLoadTheme = localStorage['plugin.uicustomizer.'+window.location.pathname+'theme'];
@@ -17,9 +18,13 @@ if (Modernizr.localstorage){
1718
if (UICPreLoadTheme == undefined || UICPreLoadTheme == "" || UICPreLoadTheme == null){
1819
UICPreLoadTheme = "default";
1920
}
21+
UICThemeV = localStorage['plugin.uicustomizer.themeversion'];
22+
if (UICThemeV == undefined){
23+
UICThemeV = 0;
24+
}
2025
}
21-
$('body').append('<link class="UICThemeCSS" rel="stylesheet" href="./plugin/uicustomizer/static/themes/css/active.css?theme='+UICPreLoadTheme+'">');
22-
delete UICPreLoadTheme;
26+
$('body').append('<link class="UICThemeCSS" rel="stylesheet" href="./plugin/uicustomizer/static/themes/css/active.css?theme='+UICPreLoadTheme+'&v='+UICThemeV+'">');
27+
delete UICPreLoadTheme,UICThemeV;
2328
// we will remove it again if user has opted out - this will just make it more clean on showing the UI
2429
$('body').append('<link class="UICBSResp" rel="stylesheet" href="./plugin/uicustomizer/static/css/bootstrap-responsive.css">');
2530

@@ -136,6 +141,14 @@ $(function() {
136141
// Load from storage
137142
self.curTheme = self.getStorage('theme');
138143

144+
// Set theme version
145+
var curVersion = self.settings.settings.plugins.uicustomizer.themeVersion();
146+
var curVersionStor = self.getStorage('themeversion');
147+
if (curVersion != curVersionStor && curVersionStor != undefined){
148+
new PNotify({title:"UICustomizer themes...", type: "info","text":"UI Customizer themes has been updated: <a href=\"https://github.com/LazeMSS/OctoPrint-UICustomizerThemes/releases/\">Read the release notes</a>","hide":false});
149+
self.setStorage('themeversion',self.settings.settings.plugins.uicustomizer.themeVersion());
150+
}
151+
139152
// Store WebCam
140153
self.onWebCamOrg = OctoPrint.coreui.viewmodels.controlViewModel.onWebcamLoaded;
141154
self.onWebCamErrorOrg = OctoPrint.coreui.viewmodels.controlViewModel.onWebcamErrored;
@@ -173,14 +186,6 @@ $(function() {
173186
$('div#tabs_content div.tab-pane:not("#tab_plugin_consolidate_temp_control") > div.span6').children().unwrap();
174187
}
175188

176-
177-
// Spool manager until its patched: https://github.com/OllisGit/OctoPrint-SpoolManager/issues/142
178-
if ('spoolManagerViewModel' in OctoPrint.coreui.viewmodels && $('body').hasClass('UICResponsiveMode')){
179-
$('#spool-form input[type="hidden"]').prependTo($('#spool-form'));
180-
$('#spool-form > div.row:first').addClass('row-fluid').removeClass('row');
181-
$('#spool-note-editor').closest('div.span6').addClass('span12').removeClass('span6');
182-
}
183-
184189
// Rewrite the tab selector for settings - https://github.com/LazeMSS/OctoPrint-UICustomizer/issues/95
185190
var prevTab = OctoPrint.coreui.viewmodels.settingsViewModel.selectTab;
186191
OctoPrint.coreui.viewmodels.settingsViewModel.selectTab = function(tab){
@@ -425,12 +430,17 @@ $(function() {
425430
// Remove the current css to trigger reload
426431
$('link.UICThemeCSS').remove();
427432

428-
var themeURL = self.ThemesBaseURL+"css/"+themeName+'.css?theme='+themeName;
433+
var themeversion = "0";
434+
if('themeVersion' in self.settings.settings.plugins.uicustomizer){
435+
themeversion = self.settings.settings.plugins.uicustomizer.themeVersion();
436+
}
437+
var themeURL = self.ThemesBaseURL+"css/"+themeName+'.css?theme='+themeName+'&v='+themeversion;
429438

430439
// Preview or for real?
431440
if (!preview){
432441
// Store it for easier loading
433442
self.setStorage('theme',themeName);
443+
self.setStorage('themeversion',themeversion);
434444
}
435445

436446
// Load style sheet
@@ -781,9 +791,11 @@ $(function() {
781791

782792
self.set_filesFullHeight = function(enable){
783793
if (enable){
794+
$('#term .terminal pre').addClass('UICResizeAble')
784795
$('#files .gcode_files .scroll-wrapper').addClass('UICFullHeight');
785796
}else{
786797
$('#files .gcode_files .scroll-wrapper').removeClass('UICFullHeight');
798+
$('#term .terminal pre').addClass('UICResizeAble')
787799
}
788800
}
789801

octoprint_uicustomizer/templates/uicustomizer_settings.jinja2

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<label class="checkbox" title="Maximize the main gcode viewer to take up as much space as possible"><input data-bind="checked: settings.plugins.uicustomizer.gcodeFullWidth" data-settingtype="gcodeFullWidth" data-previewtab="gcode_link" type="checkbox"> {{ _('Gcode full-size') }}</label>
4343
</div>
4444
<div class="controls">
45-
<label class="checkbox" title="Maximize the files selector to show as many files as possible"><input data-bind="checked: settings.plugins.uicustomizer.filesFullHeight" data-settingtype="filesFullHeight" data-previewtab="gcode_link" type="checkbox"> {{ _('Maximize Files height') }}</label>
45+
<label class="checkbox" title="Maximize the files selector to show as many files as possible"><input data-bind="checked: settings.plugins.uicustomizer.filesFullHeight" data-settingtype="filesFullHeight" data-previewtab="gcode_link" type="checkbox"> {{ _('Resizable Files+Terminal') }}</label>
4646
</div>
4747
</div>
4848
<div class="span6">

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
plugin_name = "UI Customizer"
1515

1616
# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
17-
plugin_version = "0.1.5.8"
17+
plugin_version = "0.1.5.9"
1818

1919
# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
2020
# module

0 commit comments

Comments
 (0)