Skip to content

Commit

Permalink
add resolution threshold in horizontal mode, #12
Browse files Browse the repository at this point in the history
more fixes for themeify, #5
  • Loading branch information
jneilliii committed Nov 21, 2020
1 parent 5f36fa3 commit 643e93a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion octoprint_consolidate_temp_control/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class ConsolidateTempControlPlugin(octoprint.plugin.TemplatePlugin,

##-- Settings mixin
def get_settings_defaults(self):
return dict(tab_order=[dict(name="Temperature",selector="#temp"),dict(name="Control",selector="#control")], layout="horizontal", resize_navbar=True)
return dict(tab_order=[dict(name="Temperature",selector="#temp"),dict(name="Control",selector="#control")], layout="horizontal", resize_navbar=True, resolution_threshold=0)

##-- Template mixin
def get_template_configs(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ $(function() {
});
$('#temp_link, #control_link').remove();

if(self.settings.settings.plugins.consolidate_temp_control.layout() == 'horizontal'){
if(self.settings.settings.plugins.consolidate_temp_control.layout() == 'horizontal' && (screen.width >= parseInt(self.settings.settings.plugins.consolidate_temp_control.resolution_threshold(), 10) && self.settings.settings.plugins.consolidate_temp_control.resolution_threshold() >= 0)){
// page container adjustments
$('div.page-container').css({'min-width':'1900px'});

Expand All @@ -44,7 +44,9 @@ $(function() {

// sidebar adjustments
if (!self.dragonorder) {
$('div.container.octoprint-container > div.row > div.accordion.span4').removeClass('span4').addClass('span2');
if($('div#settings_plugin_themeify').length == 0){
$('div.container.octoprint-container > div.row > div.accordion.span4').removeClass('span4').addClass('span2');
}
$('#files div.row-fluid.upload-buttons > span.btn.btn-primary.fileinput-button.span6:nth-child(2) > span').text('Upload SD');
}

Expand Down Expand Up @@ -129,7 +131,7 @@ $(function() {
self.temperatureViewModel.updatePlot();
}
self.temperatureViewModel.onAfterTabChange("#temp", previous);
}
}
}
}

Expand All @@ -139,4 +141,4 @@ $(function() {
optional: ["touchUIViewModel", "dragon_orderViewModel", "WebcamTabViewModel"],
elements: ["#consolidate_temp_control_settings_form"]
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,20 @@
</div>
<div class="row-fluid"><h5><u>{{ _('Layout') }}</u></h5></div>
<div class="row-fluid">
<div class="span4">
<div class="span4" title="{{ _('How the consolidated tabs are placed.') }}">
<select data-bind="value: settings.settings.plugins.consolidate_temp_control.layout">
<option value="horizontal">Horizontal</option>
<option value="vertical">Vertical</option>
</select>
</div>
<div class="span4" style="padding-top: 3px;" data-bind="visible: settings.settings.plugins.consolidate_temp_control.layout() == 'horizontal'">
<div class="span3" style="padding-top: 3px;" title="{{ _('Make navbar full width of browser.') }}" data-bind="visible: settings.settings.plugins.consolidate_temp_control.layout() == 'horizontal'">
<label class="checkbox">
<input type="checkbox" data-bind="checked: settings.settings.plugins.consolidate_temp_control.resize_navbar" /> {{ _('Resize Navbar') }}
<input type="checkbox" data-bind="checked: settings.settings.plugins.consolidate_temp_control.resize_navbar" /> {{ _('Resize Navbar') }}
</label>
</div>
<div class="span5 input-prepend" title="{{ _('When window size is smaller than this threshold vertical mode will be enforced, enter 0 to always use horizontal mode.') }}" data-bind="visible: settings.settings.plugins.consolidate_temp_control.layout() == 'horizontal'">
<label class="input add-on">{{ _('Resolution Threshold') }}</label>
<input class="input-mini" type="number" min="0" data-bind="value: settings.settings.plugins.consolidate_temp_control.resolution_threshold" />
</div>
</div>
</form>
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
plugin_name = "Consolidate Temp Control"

# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
plugin_version = "0.1.8"
plugin_version = "0.1.8rc2"

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

0 comments on commit 643e93a

Please sign in to comment.