Module progress: added states
This commit is contained in:
parent
56426ee0a6
commit
384f23c34f
2 changed files with 16 additions and 1 deletions
|
@ -40,7 +40,7 @@ class Module(bumblebee.engine.Module):
|
|||
)
|
||||
|
||||
str_format = self.parameter("format", '{bar} {cmd} {arg}')
|
||||
return " " + str_format.format(
|
||||
return str_format.format(
|
||||
bar = bar,
|
||||
pid = widget.get("pid"),
|
||||
cmd = widget.get("cmd"),
|
||||
|
@ -54,6 +54,8 @@ class Module(bumblebee.engine.Module):
|
|||
return self.parameter("placeholder", 'n/a')
|
||||
|
||||
def update_progress_info(self, widget):
|
||||
"""Update widget's informations about the copy"""
|
||||
|
||||
# These regex extracts following groups:
|
||||
# 1. pid
|
||||
# 2. command
|
||||
|
@ -89,3 +91,13 @@ class Module(bumblebee.engine.Module):
|
|||
except Exception:
|
||||
return False
|
||||
|
||||
def state(self, widget):
|
||||
if self._active():
|
||||
return "copying"
|
||||
return "pending"
|
||||
|
||||
def _active(self):
|
||||
"""Checks wether a copy is running or not"""
|
||||
raw = bumblebee.util.execute("progress -q")
|
||||
return bool(raw)
|
||||
|
||||
|
|
|
@ -138,5 +138,8 @@
|
|||
},
|
||||
"taskwarrior": {
|
||||
"prefix": " "
|
||||
},
|
||||
"progress": {
|
||||
"copying": { "prefix": "" }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue