@@ -162,28 +162,13 @@ def on_after_startup(self):
162
162
##~~ SettingsPlugin mixin
163
163
164
164
def get_settings_defaults (self ):
165
- return dict (
166
- debug_logging = False ,
167
- arrSmartplugs = [],
168
- pollingInterval = 15 ,
169
- pollingEnabled = False ,
170
- thermal_runaway_monitoring = False ,
171
- thermal_runaway_max_bed = 0 ,
172
- thermal_runaway_max_extruder = 0 ,
173
- event_on_error_monitoring = False ,
174
- event_on_disconnect_monitoring = False ,
175
- event_on_upload_monitoring = False ,
176
- event_on_upload_monitoring_always = False ,
177
- event_on_startup_monitoring = False ,
178
- event_on_shutdown_monitoring = False ,
179
- cost_rate = 0 ,
180
- abortTimeout = 30 ,
181
- powerOffWhenIdle = False ,
182
- idleTimeout = 30 ,
183
- idleIgnoreCommands = 'M105' ,
184
- idleTimeoutWaitTemp = 50 ,
185
- progress_polling = False
186
- )
165
+ return {'debug_logging' : False , 'arrSmartplugs' : [], 'pollingInterval' : 15 , 'pollingEnabled' : False ,
166
+ 'thermal_runaway_monitoring' : False , 'thermal_runaway_max_bed' : 0 , 'thermal_runaway_max_extruder' : 0 ,
167
+ 'event_on_error_monitoring' : False , 'event_on_disconnect_monitoring' : False ,
168
+ 'event_on_upload_monitoring' : False , 'event_on_upload_monitoring_always' : False ,
169
+ 'event_on_startup_monitoring' : False , 'event_on_shutdown_monitoring' : False , 'cost_rate' : 0 ,
170
+ 'abortTimeout' : 30 , 'powerOffWhenIdle' : False , 'idleTimeout' : 30 , 'idleIgnoreCommands' : 'M105' ,
171
+ 'idleTimeoutWaitTemp' : 50 , 'progress_polling' : False , 'useDropDown' : False }
187
172
188
173
def on_settings_save (self , data ):
189
174
old_debug_logging = self ._settings .get_boolean (["debug_logging" ])
@@ -353,13 +338,14 @@ def get_assets(self):
353
338
##~~ TemplatePlugin mixin
354
339
355
340
def get_template_configs (self ):
356
- templates_to_load = [dict (type = "navbar" , custom_bindings = True ), dict (type = "settings" , custom_bindings = True ),
357
- dict (type = "sidebar" , icon = "plug" , custom_bindings = True ,
358
- data_bind = "visible: arrSmartplugs().length > 0" ,
359
- template = "tplinksmartplug_sidebar.jinja2" ,
360
- template_header = "tplinksmartplug_sidebar_header.jinja2" ),
361
- dict (type = "tab" , custom_bindings = True , data_bind = "visible: show_sidebar()" ,
362
- template = "tplinksmartplug_tab.jinja2" )]
341
+ templates_to_load = [{'type' : "navbar" , 'custom_bindings' : True , 'classes' : ["dropdown" ]},
342
+ {'type' : "settings" , 'custom_bindings' : True },
343
+ {'type' : "sidebar" , 'icon' : "plug" , 'custom_bindings' : True ,
344
+ 'data_bind' : "visible: arrSmartplugs().length > 0" ,
345
+ 'template' : "tplinksmartplug_sidebar.jinja2" ,
346
+ 'template_header' : "tplinksmartplug_sidebar_header.jinja2" },
347
+ {'type' : "tab" , 'custom_bindings' : True , 'data_bind' : "visible: show_sidebar()" ,
348
+ 'template' : "tplinksmartplug_tab.jinja2" }]
363
349
return templates_to_load
364
350
365
351
##~~ ProgressPlugin mixin
@@ -760,7 +746,8 @@ def on_event(self, event, payload):
760
746
self ._autostart_file = None
761
747
# File Uploaded Event
762
748
if event == Events .UPLOAD and self ._settings .get_boolean (["event_on_upload_monitoring" ]):
763
- if payload .get ("print" , False ) or self ._settings .get_boolean (["event_on_upload_monitoring_always" ]): # implemented in OctoPrint version 1.4.1
749
+ if payload .get ("print" , False ) or self ._settings .get_boolean (
750
+ ["event_on_upload_monitoring_always" ]): # implemented in OctoPrint version 1.4.1
764
751
self ._tplinksmartplug_logger .debug (
765
752
"File uploaded: %s. Turning enabled plugs on." % payload .get ("name" , "" ))
766
753
self ._tplinksmartplug_logger .debug (payload )
0 commit comments