[core] Add a decorator for never updating a module
This commit is contained in:
parent
06ca5024dc
commit
94ef496ee6
3 changed files with 23 additions and 12 deletions
|
@ -1,5 +1,12 @@
|
|||
import util.format
|
||||
|
||||
def never(init):
|
||||
def call_init(obj, *args, **kwargs):
|
||||
init(obj, *args, **kwargs)
|
||||
if obj.parameter('interval') is None:
|
||||
obj.set('interval', 'never')
|
||||
return call_init
|
||||
|
||||
def every(hours=0, minutes=0, seconds=0):
|
||||
def decorator_init(init):
|
||||
def call_init(obj, *args, **kwargs):
|
||||
|
|
|
@ -172,11 +172,14 @@ class i3(object):
|
|||
if affected_modules and not module.id in affected_modules:
|
||||
continue
|
||||
if not affected_modules and module.next_update:
|
||||
if module.parameter('interval', '') == 'never':
|
||||
continue
|
||||
if now < module.next_update:
|
||||
continue
|
||||
if not redraw_only:
|
||||
module.update_wrapper()
|
||||
module.next_update = now + float(module.parameter('interval', self.__config.interval()))
|
||||
if module.parameter('interval', '') != 'never':
|
||||
module.next_update = now + float(module.parameter('interval', self.__config.interval()))
|
||||
for widget in module.widgets():
|
||||
self.__content[widget] = widget.full_text()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue