Fix padding of widgets.

This commit is contained in:
Jonathan Frederic 2014-12-08 17:05:58 -08:00
parent 8160308bb2
commit cb12229480
9 changed files with 55 additions and 33 deletions

View File

@ -1403,7 +1403,7 @@ h6:hover .anchor-link {
.widget-text { .widget-text {
/* String Textbox - used for TextBoxView and TextAreaView */ /* String Textbox - used for TextBoxView and TextAreaView */
width: 350px; width: 350px;
margin: 0px !important; margin: 0px;
} }
.widget-listbox { .widget-listbox {
/* Listbox */ /* Listbox */
@ -1413,7 +1413,7 @@ h6:hover .anchor-link {
.widget-numeric-text { .widget-numeric-text {
/* Single Line Textbox - used for IntTextView and FloatTextView */ /* Single Line Textbox - used for IntTextView and FloatTextView */
width: 150px; width: 150px;
margin: 0px !important; margin: 0px;
} }
.widget-progress { .widget-progress {
/* Progress Bar */ /* Progress Bar */
@ -1451,10 +1451,6 @@ h6:hover .anchor-link {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: stretch; align-items: stretch;
margin-top: 0px !important;
margin-bottom: 0px !important;
margin-right: 5px;
margin-left: 5px;
} }
.widget-hbox input[type="checkbox"] { .widget-hbox input[type="checkbox"] {
margin-top: 9px; margin-top: 9px;

View File

@ -7752,9 +7752,6 @@ div#header {
/* Initially hidden to prevent FLOUC */ /* Initially hidden to prevent FLOUC */
display: none; display: none;
background-color: #ffffff; background-color: #ffffff;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
/* Display over codemirror */ /* Display over codemirror */
z-index: 100; z-index: 100;
} }
@ -9246,7 +9243,7 @@ h6:hover .anchor-link {
.widget-text { .widget-text {
/* String Textbox - used for TextBoxView and TextAreaView */ /* String Textbox - used for TextBoxView and TextAreaView */
width: 350px; width: 350px;
margin: 0px !important; margin: 0px;
} }
.widget-listbox { .widget-listbox {
/* Listbox */ /* Listbox */
@ -9256,7 +9253,7 @@ h6:hover .anchor-link {
.widget-numeric-text { .widget-numeric-text {
/* Single Line Textbox - used for IntTextView and FloatTextView */ /* Single Line Textbox - used for IntTextView and FloatTextView */
width: 150px; width: 150px;
margin: 0px !important; margin: 0px;
} }
.widget-progress { .widget-progress {
/* Progress Bar */ /* Progress Bar */
@ -9294,10 +9291,6 @@ h6:hover .anchor-link {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: stretch; align-items: stretch;
margin-top: 0px !important;
margin-bottom: 0px !important;
margin-right: 5px;
margin-left: 5px;
} }
.widget-hbox input[type="checkbox"] { .widget-hbox input[type="checkbox"] {
margin-top: 9px; margin-top: 9px;
@ -9681,7 +9674,6 @@ fieldset[disabled] #kernel_selector_widget > button.active {
margin-top: 0px; margin-top: 0px;
} }
#menubar { #menubar {
margin-top: 0px;
box-sizing: border-box; box-sizing: border-box;
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;

View File

@ -30,7 +30,11 @@ define([
/** /**
* Set a css attr of the widget view. * Set a css attr of the widget view.
*/ */
this.$checkbox.css(name, value); if (name == 'padding' || name == 'margin') {
this.$el.css(name, value);
} else {
this.$checkbox.css(name, value);
}
}, },
handle_click: function() { handle_click: function() {

View File

@ -57,6 +57,8 @@ define([
this.$slider_container.css(name, value); this.$slider_container.css(name, value);
} else if (name == 'width' || name == 'height' || name == 'background') { } else if (name == 'width' || name == 'height' || name == 'background') {
this.$slider_container.css(name, value); this.$slider_container.css(name, value);
} else if (name == 'padding' || name == 'margin') {
this.$el.css(name, value);
} else { } else {
this.$slider.css(name, value); this.$slider.css(name, value);
} }
@ -333,7 +335,11 @@ define([
/** /**
* Set a css attr of the widget view. * Set a css attr of the widget view.
*/ */
this.$textbox.css(name, value); if (name == 'padding' || name == 'margin') {
this.$el.css(name, value);
} else {
this.$textbox.css(name, value);
}
}, },
events: { events: {
@ -468,6 +474,8 @@ define([
this.$progress.css(name, value); this.$progress.css(name, value);
} else if (name == 'color') { } else if (name == 'color') {
this.$bar.css('background', value); this.$bar.css('background', value);
} else if (name == 'padding' || name == 'margin') {
this.$el.css(name, value);
} else { } else {
this.$bar.css(name, value); this.$bar.css(name, value);
} }

View File

@ -135,6 +135,8 @@ define([
} else if (name == 'height') { } else if (name == 'height') {
this.$droplabel.css(name, value); this.$droplabel.css(name, value);
this.$dropbutton.css(name, value); this.$dropbutton.css(name, value);
} else if (name == 'padding' || name == 'margin') {
this.$el.css(name, value);
} else { } else {
this.$droplist.css(name, value); this.$droplist.css(name, value);
this.$droplabel.css(name, value); this.$droplabel.css(name, value);
@ -241,7 +243,11 @@ define([
/** /**
* Set a css attr of the widget view. * Set a css attr of the widget view.
*/ */
this.$container.css(name, value); if (name == 'padding' || name == 'margin') {
this.$el.css(name, value);
} else {
this.$container.css(name, value);
}
}, },
handle_click: function (e) { handle_click: function (e) {
@ -356,8 +362,12 @@ define([
/** /**
* Set a css attr of the widget view. * Set a css attr of the widget view.
*/ */
this._css_state[name] = value; if (name == 'padding' || name == 'margin') {
this.update_style_traits(); this.$el.css(name, value);
} else {
this._css_state[name] = value;
this.update_style_traits();
}
}, },
update_style_traits: function(button) { update_style_traits: function(button) {
@ -478,7 +488,11 @@ define([
/** /**
* Set a css attr of the widget view. * Set a css attr of the widget view.
*/ */
this.$listbox.css(name, value); if (name == 'padding' || name == 'margin') {
this.$el.css(name, value);
} else {
this.$listbox.css(name, value);
}
}, },
handle_click: function (e) { handle_click: function (e) {

View File

@ -184,7 +184,11 @@ define([
/** /**
* Set a css attr of the widget view. * Set a css attr of the widget view.
*/ */
this.$tabs.css(name, value); if (name == 'padding' || name == 'margin') {
this.$el.css(name, value);
} else {
this.$tabs.css(name, value);
}
}, },
remove_child_view: function(view) { remove_child_view: function(view) {

View File

@ -125,7 +125,11 @@ define([
/** /**
* Set a css attr of the widget view. * Set a css attr of the widget view.
*/ */
this.$textbox.css(name, value); if (name == 'padding' || name == 'margin') {
this.$el.css(name, value);
} else {
this.$textbox.css(name, value);
}
}, },
events: { events: {
@ -208,7 +212,11 @@ define([
/** /**
* Set a css attr of the widget view. * Set a css attr of the widget view.
*/ */
this.$textbox.css(name, value); if (name == 'padding' || name == 'margin') {
this.$el.css(name, value);
} else {
this.$textbox.css(name, value);
}
}, },
events: { events: {

View File

@ -145,8 +145,8 @@
.widget-text { .widget-text {
/* String Textbox - used for TextBoxView and TextAreaView */ /* String Textbox - used for TextBoxView and TextAreaView */
width : 350px; width : 350px;
margin : 0px !important; margin : 0px;
} }
.widget-listbox { .widget-listbox {
@ -158,7 +158,7 @@
.widget-numeric-text { .widget-numeric-text {
/* Single Line Textbox - used for IntTextView and FloatTextView */ /* Single Line Textbox - used for IntTextView and FloatTextView */
width : 150px; width : 150px;
margin : 0px !important; margin : 0px;
} }
.widget-progress { .widget-progress {
@ -188,10 +188,6 @@
.widget-hbox { .widget-hbox {
/* Horizontal widgets */ /* Horizontal widgets */
.hbox(); .hbox();
margin-top: 0px !important;
margin-bottom: 0px !important;
margin-right: 5px;
margin-left: 5px;
input[type="checkbox"] { input[type="checkbox"] {
margin-top: 9px; margin-top: 9px;

View File

@ -427,7 +427,7 @@ class DOMWidget(Widget):
width = CUnicode(sync=True) width = CUnicode(sync=True)
height = CUnicode(sync=True) height = CUnicode(sync=True)
padding = CUnicode(sync=True) padding = CUnicode(2.5, sync=True)
margin = CUnicode(sync=True) margin = CUnicode(sync=True)
color = Unicode(sync=True) color = Unicode(sync=True)