本文整理汇总了Python中py3status.module_test.module_test函数的典型用法代码示例。如果您正苦于以下问题:Python module_test函数的具体用法?Python module_test怎么用?Python module_test使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了module_test函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: dict
vnstat_data = self.py3.command_output("vnstat --oneline b")
values = vnstat_data.splitlines()[0].split(";")[self.slice]
stat = dict(zip(["down", "up", "total"], map(int, values)))
response = {"cached_until": self.py3.time_in(self.cache_timeout)}
if self.coloring:
response["color"] = self.py3.threshold_get_color(stat["total"])
for x in self.thresholds_init:
if x in stat:
self.py3.threshold_get_color(stat[x], x)
response["full_text"] = self.py3.safe_format(
self.format,
dict(
total=self._divide_and_format(stat["total"]),
up=self._divide_and_format(stat["up"]),
down=self._divide_and_format(stat["down"]),
),
)
return response
if __name__ == "__main__":
"""
Run module in test mode.
"""
from py3status.module_test import module_test
module_test(Py3status)
开发者ID:ultrabug,项目名称:py3status,代码行数:30,代码来源:vnstat.py
示例2: window_title
conn.on('workspace::focus', clear_title)
# clears the title when the last window on ws was closed
conn.on("window::close", clear_title)
# listens for events which can trigger the title update
conn.on("window::title", update_title)
conn.on("window::focus", update_title)
conn.on("binding", update_title)
conn.main() # run the event loop
def window_title(self):
resp = {
'cached_until': self.py3.CACHE_FOREVER,
'full_text': self.title,
}
return resp
if __name__ == "__main__":
"""
Run module in test mode.
"""
config = {
'always_show': True,
}
from py3status.module_test import module_test
module_test(Py3status, config=config)
开发者ID:tjaartvdwalt,项目名称:py3status,代码行数:30,代码来源:window_title_async.py
示例3: module_test
]
)
module_test(
Py3status,
config={
"api_key": os.getenv("OWM_API_KEY"),
# Select icons
"icons": {"200": "☔", "230_232": "
|
请发表评论