Skip to content

Commit

Permalink
Wrappers changes
Browse files Browse the repository at this point in the history
  • Loading branch information
HugoCLSC committed Jul 13, 2021
1 parent 4579f3f commit a6102fd
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 278 deletions.
24 changes: 3 additions & 21 deletions octoprint_BLOCKS/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,29 +45,12 @@ def on_after_startup(self):
def get_settings_defaults(self):
return {
# put your plugin's default settings here
"rows" : [
{
"#sidebar_plugin_firmware_check_wrapper": True,
"#files_wrapper": True,
"#connection_wrapper": True

},

{
"div.BLOCKSUImainTabs": True
},
{
"#state_wrapper": True,
"#connection_wrapper": True,
"#sidebar_plugin_action_command_notification_wrapper": True
}

],
"widths" : [3,6,3],

"fluidLayout" : True,

"fixedHeader" : True,
"hideGraphBackground" : True

"blocksFooterInfo" : True
}


Expand Down Expand Up @@ -114,7 +97,6 @@ def get_template_configs(self):

return[
dict(type="settings", custom_bindings=False)

]

##~~ Softwareupdate hook
Expand Down
10 changes: 9 additions & 1 deletion octoprint_BLOCKS/static/css/BLOCKS.css
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@
display: flex ;
align-items: flex-start;
flex-wrap:nowrap;

}

.BotRow{
display: flex ;
margin-top: 10px;
align-items: flex-start;
flex-wrap:nowrap;

Expand Down Expand Up @@ -75,7 +77,7 @@

.BLOCKCol1, .BLOCKCol2, .BLOCKCol3 {

border: 1px solid #e5e5e5;
/* border: 1px solid #e5e5e5;*/
border-radius: 4px;
position: static;
display: flex;
Expand All @@ -91,6 +93,12 @@
background-image: url(../img/Blocks_Logo.png);
background-size: 100%;
}

#tabs{
border-radius: 4px;
border: 1px solid #e5e5e5;

}
#temperature-graph{
background-image: url(../img/Blocks_Logo.png);
background-position: center;
Expand Down
43 changes: 17 additions & 26 deletions octoprint_BLOCKS/static/js/BLOCKS.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,9 @@ $(function() {
self.debug = false;

// assign the injected parameters, e.g.:
// self.loginStateViewModel = parameters[0];
self.settings = parameters[0];
self.connection = parameters[0];
// TODO: Implement your plugin's view model here.

//max column width
self.maxCWidth = 12;
// Quick debug
self.logToConsole = function(msg){
if (!self.debug){
Expand All @@ -33,17 +29,12 @@ $(function() {
}
//~~----------------------------------------------------
self.onAllBound = function(){
//~~ Set names

//Html can have mulitple classes so
//Html can have mulitple classes
$('#tabs').parent().addClass('BLOCKSMainTabs');

//Adds a class name for the class="container octoprint-container BLOCKSUICol1"
//On the side bar i add another class name

$('#sidebar').addClass('BLOCKSUICol1');

//adds another class name for the octoprint-container i can now calle it BLOCKSUIMainContainer
//adds another class name for the octoprint-container i can now call it by BLOCKSMainContainer
$('div.octoprint-container').addClass('BLOCKSMainContainer');


Expand All @@ -64,22 +55,20 @@ $(function() {

self.logToConsole('Updating layout');

$('#sidebar').removeClass('span4');


self.set_fixedHeader(settingsPlugin.fixedHeader());

self.set_fluidLayout(settingsPlugin.fluidLayout());

self.set_hideGraphBackground(settingsPlugin.hideGraphBackground());
self.set_blocksFooterInfo(settingsPlugin.blocksFooterInfo());
//Builds the main layout
self.set_mainLayout(settingsPlugin);

}


//---------------------------------------------------
self.set_fixedHeader = function(enable){
// Took from UICustumizer
self.set_fixedHeader = function(enable) {
if(enable){
$('body').addClass('BLOCKSUIfixedHeader');
$('#navbar').removeClass('navbar-static-top').addClass('navbar-fixed-top');
Expand All @@ -91,18 +80,22 @@ $(function() {
}
}

//--------------------------------------------------
self.set_hideGraphBackground = function(enable){
//-------------------------------------------------
self.set_fixedFooter = function(enable) {
if(enable){
$('#temperature-graph').addClass('BLOCKSnoBackground');
}else{
$('#temperature-graph').removeClass('BLOCKSUInoBackground');

}
}
//------------------------------------------------
self.set_blocksFooterInfo = function(enable) {
if(enable){
$('#footer_links').prepend('<li><a href="https://www.blockstec.com/" target="_blank" rel="noreferrer noopener"> BLOCKS </a></li>');
}
}

//-------------------------------------------------
// In this function where i can change the layout of the main container
self.set_mainLayout = function(settingsPlugin){
self.set_mainLayout = function(settingsPlugin) {
//What i want to do here is just create a matrix 3x3
$('div.BLOCKSMainContainer > div.row').removeClass('row').addClass('row-fluid').addClass('TopRow');

Expand Down Expand Up @@ -151,6 +144,7 @@ $(function() {

//------------------------------------------------------------
// Fix fluid layout
// Took from UICustomizer
self.set_fluidLayout = function(enabled){
if (enabled){
$('#navbar > div.navbar-inner > div:first').removeClass("container").addClass("container-fluid").removeAttr("style","");
Expand Down Expand Up @@ -193,9 +187,6 @@ $(function() {






}


Expand All @@ -206,7 +197,7 @@ $(function() {
OCTOPRINT_VIEWMODELS.push({
construct: BlocksViewModel,
// ViewModels your plugin depends on, e.g. loginStateViewModel, settingsViewModel, ...
dependencies: ["settingsViewModel","connectionViewModel"],
dependencies: ["settingsViewModel"],
// Elements to bind to, e.g. #settings_plugin_BLOCKS, #tab_plugin_BLOCKS, ...
elements: []
});
Expand Down
24 changes: 0 additions & 24 deletions octoprint_BLOCKS/templates/BLOCKSUI_index.jinja2

This file was deleted.

76 changes: 0 additions & 76 deletions octoprint_BLOCKS/templates/login.jinja2

This file was deleted.

Loading

0 comments on commit a6102fd

Please sign in to comment.