Run formatter.
This commit is contained in:
parent
0785202860
commit
b1bb0fe690
1 changed files with 21 additions and 15 deletions
|
@ -13,28 +13,28 @@ import core.widget
|
||||||
class Module(core.module.Module):
|
class Module(core.module.Module):
|
||||||
def __init__(self, config, theme):
|
def __init__(self, config, theme):
|
||||||
super().__init__(config, theme, core.widget.Widget(self.output))
|
super().__init__(config, theme, core.widget.Widget(self.output))
|
||||||
self.__logfile = self.parameter(
|
self.__logfile = self.parameter("logfile", "/var/log/emerge.log")
|
||||||
"logfile", "/var/log/emerge.log")
|
|
||||||
self.clear()
|
self.clear()
|
||||||
|
|
||||||
|
|
||||||
def clear(self):
|
def clear(self):
|
||||||
self.__action = ""
|
self.__action = ""
|
||||||
self.__package = ""
|
self.__package = ""
|
||||||
self.__status = ""
|
self.__status = ""
|
||||||
|
|
||||||
|
|
||||||
def output(self, widget):
|
def output(self, widget):
|
||||||
return " ".join([atom for atom in
|
return " ".join(
|
||||||
(self.__action, self.__package, self.__status) if atom != ""])
|
[
|
||||||
|
atom
|
||||||
|
for atom in (self.__action, self.__package, self.__status)
|
||||||
|
if atom != ""
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
def state(self, widgets):
|
def state(self, widgets):
|
||||||
if self.__action == "":
|
if self.__action == "":
|
||||||
return "idle"
|
return "idle"
|
||||||
return "active"
|
return "active"
|
||||||
|
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
try:
|
try:
|
||||||
with open(self.__logfile, "rb") as f:
|
with open(self.__logfile, "rb") as f:
|
||||||
|
@ -47,17 +47,23 @@ class Module(core.module.Module):
|
||||||
self.__action = "Unmerging"
|
self.__action = "Unmerging"
|
||||||
package_beg = last_line.find("(") + 1
|
package_beg = last_line.find("(") + 1
|
||||||
package_end = last_line.find("-", last_line.find("/")) - 1
|
package_end = last_line.find("-", last_line.find("/")) - 1
|
||||||
self.__package = last_line[package_beg:package_end+1]
|
self.__package = last_line[package_beg : package_end + 1]
|
||||||
else: # merging
|
else: # merging
|
||||||
status_beg = last_line.find("(")
|
status_beg = last_line.find("(")
|
||||||
status_end = last_line.find(")")
|
status_end = last_line.find(")")
|
||||||
self.__status = last_line[status_beg:status_end+1]
|
self.__status = last_line[status_beg : status_end + 1]
|
||||||
package_beg = last_line.find('(', status_end) + 1
|
package_beg = last_line.find("(", status_end) + 1
|
||||||
package_end = package_beg + last_line[package_beg:].find("-", last_line[package_beg:].find("/")) - 1
|
package_end = (
|
||||||
self.__package = last_line[package_beg:package_end+1]
|
package_beg
|
||||||
|
+ last_line[package_beg:].find(
|
||||||
|
"-", last_line[package_beg:].find("/")
|
||||||
|
)
|
||||||
|
- 1
|
||||||
|
)
|
||||||
|
self.__package = last_line[package_beg : package_end + 1]
|
||||||
action_beg = status_end + 2
|
action_beg = status_end + 2
|
||||||
action_end = package_beg - 3
|
action_end = package_beg - 3
|
||||||
self.__action = last_line[action_beg:action_end+1]
|
self.__action = last_line[action_beg : action_end + 1]
|
||||||
else:
|
else:
|
||||||
self.clear()
|
self.clear()
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|
Loading…
Reference in a new issue