@@ -33,11 +33,11 @@ define([
33
33
this . config . checkModules = [ 'pd' ] ;
34
34
35
35
this . state = {
36
+ filter_warning : '' ,
36
37
min_rows : '' ,
37
38
max_rows : '' ,
38
39
max_cols : '' ,
39
40
max_colwidth : '' ,
40
- float_format : '' ,
41
41
precision : '' ,
42
42
chop_threshold : '' ,
43
43
expand_frame_repr : '' ,
@@ -56,10 +56,23 @@ define([
56
56
57
57
if ( checked ) {
58
58
// disable input
59
- $ ( that . wrapSelector ( '.vp-pandas -option-body input' ) ) . prop ( 'disabled' , true ) ;
59
+ $ ( that . wrapSelector ( '.vp-po -option input:not([type="checkbox"]) ' ) ) . prop ( 'disabled' , true ) ;
60
60
} else {
61
61
// enable input
62
- $ ( that . wrapSelector ( '.vp-pandas-option-body input' ) ) . prop ( 'disabled' , false ) ;
62
+ $ ( that . wrapSelector ( '.vp-po-option input:not([type="checkbox"])' ) ) . prop ( 'disabled' , false ) ;
63
+ }
64
+ } ) ;
65
+
66
+ // setting popup - reset warning
67
+ $ ( this . wrapSelector ( '#resetWarning' ) ) . on ( 'change' , function ( ) {
68
+ let checked = $ ( this ) . prop ( 'checked' ) ;
69
+
70
+ if ( checked ) {
71
+ // disable input
72
+ $ ( that . wrapSelector ( '.vp-po-warning input:not([type="checkbox"])' ) ) . prop ( 'disabled' , true ) ;
73
+ } else {
74
+ // enable input
75
+ $ ( that . wrapSelector ( '.vp-po-warning input:not([type="checkbox"])' ) ) . prop ( 'disabled' , false ) ;
63
76
}
64
77
} ) ;
65
78
}
@@ -81,15 +94,22 @@ define([
81
94
let code = [ ] ;
82
95
83
96
let setDefault = $ ( this . wrapSelector ( '#setDefault' ) ) . prop ( 'checked' ) ;
97
+ let resetWarning = $ ( this . wrapSelector ( '#resetWarning' ) ) . prop ( 'checked' ) ;
84
98
if ( setDefault == true ) {
85
99
// Object.keys(this.state).forEach((key) => {
86
100
// code.push(com_util.formatString("pd.reset_option('display.{0}')", key));
87
101
// })
88
102
code . push ( "pd.reset_option('^display')" ) ;
89
- } else {
103
+ } else if ( resetWarning ) {
104
+ code . push ( "import warnings\nwarnings.resetwarnings()" ) ;
105
+ } else {
90
106
Object . keys ( this . state ) . forEach ( ( key ) => {
91
107
if ( that . state [ key ] && that . state [ key ] != '' ) {
92
- code . push ( com_util . formatString ( "pd.set_option('display.{0}', {1})" , key , that . state [ key ] ) ) ;
108
+ if ( key === 'filter_warning' ) {
109
+ code . push ( com_util . formatString ( "import warnings\nwarnings.simplefilter(action='{0}', category=Warning)" , that . state [ key ] ) ) ;
110
+ } else {
111
+ code . push ( com_util . formatString ( "pd.set_option('display.{0}', {1})" , key , that . state [ key ] ) ) ;
112
+ }
93
113
}
94
114
} )
95
115
}
0 commit comments