PEP8
This commit is contained in:
parent
14d9427ac8
commit
f06a76ad52
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
from pkgutil import extend_path
|
from pkgutil import extend_path
|
||||||
|
|
||||||
from i3pystatus.core import Status
|
from i3pystatus.core import Status
|
||||||
|
@ -4,7 +4,6 @@ from i3pystatus import IntervalModule
|
|||||||
|
|
||||||
|
|
||||||
class ALSA(IntervalModule):
|
class ALSA(IntervalModule):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Shows volume of ALSA mixer. You can also use this for inputs, btw.
|
Shows volume of ALSA mixer. You can also use this for inputs, btw.
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ from i3pystatus.file import File
|
|||||||
|
|
||||||
|
|
||||||
class Backlight(File):
|
class Backlight(File):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Screen backlight info
|
Screen backlight info
|
||||||
|
|
||||||
|
@ -73,7 +73,8 @@ class BatteryCharge(Battery):
|
|||||||
else:
|
else:
|
||||||
return -1
|
return -1
|
||||||
else:
|
else:
|
||||||
return (self.battery_info["CHARGE_FULL"] - self.battery_info["CHARGE_NOW"]) / self.battery_info["CURRENT_NOW"] * 60
|
return (self.battery_info["CHARGE_FULL"] - self.battery_info["CHARGE_NOW"]) / self.battery_info[
|
||||||
|
"CURRENT_NOW"] * 60
|
||||||
|
|
||||||
|
|
||||||
class BatteryEnergy(Battery):
|
class BatteryEnergy(Battery):
|
||||||
@ -88,7 +89,8 @@ class BatteryEnergy(Battery):
|
|||||||
# Wh / W = h * 60 min = min
|
# Wh / W = h * 60 min = min
|
||||||
return self.battery_info["ENERGY_NOW"] / self.battery_info["POWER_NOW"] * 60
|
return self.battery_info["ENERGY_NOW"] / self.battery_info["POWER_NOW"] * 60
|
||||||
else:
|
else:
|
||||||
return (self.battery_info["ENERGY_FULL"] - self.battery_info["ENERGY_NOW"]) / self.battery_info["POWER_NOW"] * 60
|
return (self.battery_info["ENERGY_FULL"] - self.battery_info["ENERGY_NOW"]) / self.battery_info[
|
||||||
|
"POWER_NOW"] * 60
|
||||||
|
|
||||||
|
|
||||||
class BatteryChecker(IntervalModule):
|
class BatteryChecker(IntervalModule):
|
||||||
|
@ -9,7 +9,6 @@ from i3pystatus import IntervalModule
|
|||||||
|
|
||||||
|
|
||||||
class Clock(IntervalModule):
|
class Clock(IntervalModule):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
This class shows a clock
|
This class shows a clock
|
||||||
"""
|
"""
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
@ -75,8 +74,8 @@ class Status:
|
|||||||
raise import_error
|
raise import_error
|
||||||
except ConfigError as configuration_error:
|
except ConfigError as configuration_error:
|
||||||
return self.modules.append(Text(
|
return self.modules.append(Text(
|
||||||
color="#FF0000",
|
color="#FF0000",
|
||||||
text=configuration_error.message))
|
text=configuration_error.message))
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.command_endpoint.start()
|
self.command_endpoint.start()
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
class BaseDesktopNotification:
|
class BaseDesktopNotification:
|
||||||
"""
|
"""
|
||||||
Class to display a desktop notification
|
Class to display a desktop notification
|
||||||
@ -25,9 +24,11 @@ class BaseDesktopNotification:
|
|||||||
"""
|
"""
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
class DesktopNotification(BaseDesktopNotification):
|
class DesktopNotification(BaseDesktopNotification):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from gi.repository import Notify
|
from gi.repository import Notify
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
class ConfigError(Exception):
|
class ConfigError(Exception):
|
||||||
"""ABC for configuration exceptions"""
|
"""ABC for configuration exceptions"""
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ class ClassFinder:
|
|||||||
issubclass(obj, self.baseclass) and
|
issubclass(obj, self.baseclass) and
|
||||||
obj.__module__ == module.__name__
|
obj.__module__ == module.__name__
|
||||||
)
|
)
|
||||||
|
|
||||||
return predicate
|
return predicate
|
||||||
|
|
||||||
def get_matching_classes(self, module):
|
def get_matching_classes(self, module):
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import time
|
import time
|
||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
@ -6,7 +5,6 @@ from contextlib import contextmanager
|
|||||||
|
|
||||||
|
|
||||||
class IOHandler:
|
class IOHandler:
|
||||||
|
|
||||||
def __init__(self, inp=sys.stdin, out=sys.stdout):
|
def __init__(self, inp=sys.stdin, out=sys.stdout):
|
||||||
self.inp = inp
|
self.inp = inp
|
||||||
self.out = out
|
self.out = out
|
||||||
@ -45,7 +43,6 @@ class IOHandler:
|
|||||||
|
|
||||||
|
|
||||||
class StandaloneIO(IOHandler):
|
class StandaloneIO(IOHandler):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
I/O handler for standalone usage of i3pystatus (w/o i3status)
|
I/O handler for standalone usage of i3pystatus (w/o i3status)
|
||||||
|
|
||||||
@ -76,7 +73,6 @@ class StandaloneIO(IOHandler):
|
|||||||
|
|
||||||
|
|
||||||
class JSONIO:
|
class JSONIO:
|
||||||
|
|
||||||
def __init__(self, io, skiplines=2):
|
def __init__(self, io, skiplines=2):
|
||||||
self.io = io
|
self.io = io
|
||||||
for i in range(skiplines):
|
for i in range(skiplines):
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
from i3pystatus.core.settings import SettingsBase
|
from i3pystatus.core.settings import SettingsBase
|
||||||
from i3pystatus.core.threading import Manager
|
from i3pystatus.core.threading import Manager
|
||||||
from i3pystatus.core.util import convert_position
|
from i3pystatus.core.util import convert_position
|
||||||
@ -45,7 +44,7 @@ class IntervalModuleMeta(type):
|
|||||||
super(IntervalModuleMeta, cls).__init__(name, bases, namespace)
|
super(IntervalModuleMeta, cls).__init__(name, bases, namespace)
|
||||||
if not hasattr(cls, 'settings'):
|
if not hasattr(cls, 'settings'):
|
||||||
cls.settings = tuple()
|
cls.settings = tuple()
|
||||||
if not 'interval' in SettingsBase.flatten_settings(cls.settings):
|
if 'interval' not in SettingsBase.flatten_settings(cls.settings):
|
||||||
cls.settings += ('interval', )
|
cls.settings += ('interval', )
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@ from i3pystatus.core.exceptions import ConfigKeyError, ConfigMissingError
|
|||||||
|
|
||||||
|
|
||||||
class SettingsBase:
|
class SettingsBase:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Support class for providing a nice and flexible settings interface
|
Support class for providing a nice and flexible settings interface
|
||||||
|
|
||||||
@ -64,4 +63,5 @@ class SettingsBase:
|
|||||||
def flatten_settings(settings):
|
def flatten_settings(settings):
|
||||||
def flatten_setting(setting):
|
def flatten_setting(setting):
|
||||||
return setting[0] if isinstance(setting, tuple) else setting
|
return setting[0] if isinstance(setting, tuple) else setting
|
||||||
|
|
||||||
return tuple(flatten_setting(setting) for setting in settings)
|
return tuple(flatten_setting(setting) for setting in settings)
|
||||||
|
@ -8,7 +8,6 @@ timer = time.perf_counter if hasattr(time, "perf_counter") else time.clock
|
|||||||
|
|
||||||
|
|
||||||
class Thread(threading.Thread):
|
class Thread(threading.Thread):
|
||||||
|
|
||||||
def __init__(self, target_interval, workloads=None, start_barrier=1):
|
def __init__(self, target_interval, workloads=None, start_barrier=1):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.workloads = workloads or []
|
self.workloads = workloads or []
|
||||||
@ -56,7 +55,6 @@ class Thread(threading.Thread):
|
|||||||
|
|
||||||
|
|
||||||
class Wrapper:
|
class Wrapper:
|
||||||
|
|
||||||
def __init__(self, workload):
|
def __init__(self, workload):
|
||||||
self.workload = workload
|
self.workload = workload
|
||||||
|
|
||||||
@ -65,7 +63,6 @@ class Wrapper:
|
|||||||
|
|
||||||
|
|
||||||
class ExceptionWrapper(Wrapper):
|
class ExceptionWrapper(Wrapper):
|
||||||
|
|
||||||
def __call__(self):
|
def __call__(self):
|
||||||
try:
|
try:
|
||||||
self.workload()
|
self.workload()
|
||||||
@ -88,7 +85,6 @@ class WorkloadWrapper(Wrapper):
|
|||||||
|
|
||||||
|
|
||||||
class Manager:
|
class Manager:
|
||||||
|
|
||||||
def __init__(self, target_interval):
|
def __init__(self, target_interval):
|
||||||
self.target_interval = target_interval
|
self.target_interval = target_interval
|
||||||
self.upper_bound = target_interval * 1.1
|
self.upper_bound = target_interval * 1.1
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import collections
|
import collections
|
||||||
import functools
|
import functools
|
||||||
import re
|
import re
|
||||||
@ -177,6 +176,7 @@ def formatp(string, **kwargs):
|
|||||||
They also have a string property containing associated text (empty for
|
They also have a string property containing associated text (empty for
|
||||||
all tokens but String tokens).
|
all tokens but String tokens).
|
||||||
"""
|
"""
|
||||||
|
|
||||||
class Token:
|
class Token:
|
||||||
string = ""
|
string = ""
|
||||||
|
|
||||||
@ -333,13 +333,16 @@ def require(predicate):
|
|||||||
:py:func:`internet`
|
:py:func:`internet`
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def decorator(method):
|
def decorator(method):
|
||||||
@functools.wraps(method)
|
@functools.wraps(method)
|
||||||
def wrapper(*args, **kwargs):
|
def wrapper(*args, **kwargs):
|
||||||
if predicate():
|
if predicate():
|
||||||
return method(*args, **kwargs)
|
return method(*args, **kwargs)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
return decorator
|
return decorator
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,19 +15,16 @@ class CpuUsage(IntervalModule):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
format = "{usage:02}%"
|
format = "{usage:02}%"
|
||||||
settings = (
|
settings = (
|
||||||
("format", "format string"),
|
("format", "format string"),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def init(self):
|
def init(self):
|
||||||
self.prev_idle = 0
|
self.prev_idle = 0
|
||||||
self.prev_busy = 0
|
self.prev_busy = 0
|
||||||
self.interval = 1
|
self.interval = 1
|
||||||
|
|
||||||
|
|
||||||
def get_usage(self):
|
def get_usage(self):
|
||||||
"""
|
"""
|
||||||
parses /proc/stat and calcualtes total and busy time
|
parses /proc/stat and calcualtes total and busy time
|
||||||
@ -43,7 +40,6 @@ class CpuUsage(IntervalModule):
|
|||||||
|
|
||||||
return cpu_total, cpu_busy
|
return cpu_total, cpu_busy
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
cpu_total, cpu_busy = self.get_usage()
|
cpu_total, cpu_busy = self.get_usage()
|
||||||
|
|
||||||
@ -58,7 +54,5 @@ class CpuUsage(IntervalModule):
|
|||||||
self.output = {
|
self.output = {
|
||||||
"full_text": self.format.format(
|
"full_text": self.format.format(
|
||||||
usage=cpu_busy_percentage
|
usage=cpu_busy_percentage
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ from .core.util import round_dict
|
|||||||
|
|
||||||
|
|
||||||
class Disk(IntervalModule):
|
class Disk(IntervalModule):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Gets ``{used}``, ``{free}``, ``{available}`` and ``{total}`` amount of bytes on the given mounted filesystem.
|
Gets ``{used}``, ``{free}``, ``{available}`` and ``{total}`` amount of bytes on the given mounted filesystem.
|
||||||
|
|
||||||
|
@ -4,12 +4,11 @@ from i3pystatus import IntervalModule
|
|||||||
|
|
||||||
|
|
||||||
class File(IntervalModule):
|
class File(IntervalModule):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Rip information from text files
|
Rip information from text files
|
||||||
|
|
||||||
components is a dict of pairs of the form:
|
components is a dict of pairs of the form:
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
name => (callable, file)
|
name => (callable, file)
|
||||||
|
@ -2,7 +2,6 @@ from i3pystatus import IntervalModule
|
|||||||
|
|
||||||
|
|
||||||
class Load(IntervalModule):
|
class Load(IntervalModule):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Shows system load
|
Shows system load
|
||||||
"""
|
"""
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from i3pystatus import SettingsBase, IntervalModule
|
from i3pystatus import SettingsBase, IntervalModule
|
||||||
|
|
||||||
|
|
||||||
class Backend(SettingsBase):
|
class Backend(SettingsBase):
|
||||||
|
|
||||||
"""Handles the details of checking for mail"""
|
"""Handles the details of checking for mail"""
|
||||||
|
|
||||||
unread = 0
|
unread = 0
|
||||||
@ -15,7 +13,6 @@ class Backend(SettingsBase):
|
|||||||
|
|
||||||
|
|
||||||
class Mail(IntervalModule):
|
class Mail(IntervalModule):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Generic mail checker
|
Generic mail checker
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@ from i3pystatus.mail import Backend
|
|||||||
|
|
||||||
|
|
||||||
class IMAP(Backend):
|
class IMAP(Backend):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Checks for mail on a IMAP server
|
Checks for mail on a IMAP server
|
||||||
"""
|
"""
|
||||||
@ -56,4 +55,5 @@ class IMAP(Backend):
|
|||||||
else:
|
else:
|
||||||
sys.stderr.write("no connection")
|
sys.stderr.write("no connection")
|
||||||
|
|
||||||
|
|
||||||
Backend = IMAP
|
Backend = IMAP
|
||||||
|
@ -5,23 +5,25 @@ import sys
|
|||||||
from i3pystatus.mail import Backend
|
from i3pystatus.mail import Backend
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
class MaildirMail(Backend):
|
class MaildirMail(Backend):
|
||||||
"""
|
"""
|
||||||
Checks for local mail in Maildir
|
Checks for local mail in Maildir
|
||||||
"""
|
"""
|
||||||
|
|
||||||
settings = (
|
settings = (
|
||||||
"directory",
|
"directory",
|
||||||
)
|
)
|
||||||
required = ("directory",)
|
required = ("directory",)
|
||||||
|
|
||||||
directory=""
|
directory = ""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def unread(self):
|
def unread(self):
|
||||||
p = subprocess.Popen(['ls','-l',self.directory+'/new'], stdout=subprocess.PIPE)
|
p = subprocess.Popen(['ls', '-l', self.directory + '/new'], stdout=subprocess.PIPE)
|
||||||
stdout, stderr = p.communicate()
|
stdout, stderr = p.communicate()
|
||||||
stdout=stdout.decode('utf8')
|
stdout = stdout.decode('utf8')
|
||||||
return len(stdout.split('\n'))-2
|
return len(stdout.split('\n')) - 2
|
||||||
|
|
||||||
|
|
||||||
Backend = MaildirMail
|
Backend = MaildirMail
|
||||||
|
@ -5,6 +5,7 @@ import sys
|
|||||||
from i3pystatus.mail import Backend
|
from i3pystatus.mail import Backend
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
class MboxMail(Backend):
|
class MboxMail(Backend):
|
||||||
"""
|
"""
|
||||||
Checks for local mail in mbox
|
Checks for local mail in mbox
|
||||||
@ -22,4 +23,5 @@ class MboxMail(Backend):
|
|||||||
s_stuff, message_number = stdout.strip().rsplit(':', 1)
|
s_stuff, message_number = stdout.strip().rsplit(':', 1)
|
||||||
return int(message_number.strip())
|
return int(message_number.strip())
|
||||||
|
|
||||||
|
|
||||||
Backend = MboxMail
|
Backend = MboxMail
|
||||||
|
@ -9,7 +9,6 @@ from i3pystatus.mail import Backend
|
|||||||
|
|
||||||
|
|
||||||
class Notmuch(Backend):
|
class Notmuch(Backend):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
This class uses the notmuch python bindings to check for the
|
This class uses the notmuch python bindings to check for the
|
||||||
number of messages in the notmuch database with the tags "inbox"
|
number of messages in the notmuch database with the tags "inbox"
|
||||||
@ -25,4 +24,5 @@ class Notmuch(Backend):
|
|||||||
def unread(self):
|
def unread(self):
|
||||||
return notmuch.Query(self.db, "tag:unread and tag:inbox").count_messages()
|
return notmuch.Query(self.db, "tag:unread and tag:inbox").count_messages()
|
||||||
|
|
||||||
|
|
||||||
Backend = Notmuch
|
Backend = Notmuch
|
||||||
|
@ -17,7 +17,6 @@ from i3pystatus.mail import Backend
|
|||||||
|
|
||||||
|
|
||||||
class Thunderbird(Backend):
|
class Thunderbird(Backend):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
This class listens for dbus signals emitted by
|
This class listens for dbus signals emitted by
|
||||||
the dbus-sender extension for thunderbird.
|
the dbus-sender extension for thunderbird.
|
||||||
@ -55,4 +54,5 @@ class Thunderbird(Backend):
|
|||||||
self.run()
|
self.run()
|
||||||
return len(self._unread)
|
return len(self._unread)
|
||||||
|
|
||||||
|
|
||||||
Backend = Thunderbird
|
Backend = Thunderbird
|
||||||
|
@ -27,14 +27,14 @@ class Mem(IntervalModule):
|
|||||||
settings = (
|
settings = (
|
||||||
("format", "format string used for output."),
|
("format", "format string used for output."),
|
||||||
("divisor",
|
("divisor",
|
||||||
"divide all byte values by this value, default 1024**2(mebibytes"),
|
"divide all byte values by this value, default 1024**2(mebibytes"),
|
||||||
("warn_percentage", "minimal percentage for warn state"),
|
("warn_percentage", "minimal percentage for warn state"),
|
||||||
("alert_percentage", "minimal percentage for alert state"),
|
("alert_percentage", "minimal percentage for alert state"),
|
||||||
("color", "standard color"),
|
("color", "standard color"),
|
||||||
("warn_color",
|
("warn_color",
|
||||||
"defines the color used wann warn percentage ist exceeded"),
|
"defines the color used wann warn percentage ist exceeded"),
|
||||||
("alert_color",
|
("alert_color",
|
||||||
"defines the color used when alert percentage is exceeded"),
|
"defines the color used when alert percentage is exceeded"),
|
||||||
)
|
)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
@ -55,5 +55,5 @@ class Mem(IntervalModule):
|
|||||||
avail_mem=memory_usage.available / self.divisor,
|
avail_mem=memory_usage.available / self.divisor,
|
||||||
total_mem=memory_usage.total / self.divisor,
|
total_mem=memory_usage.total / self.divisor,
|
||||||
percent_used_mem=memory_usage.percent),
|
percent_used_mem=memory_usage.percent),
|
||||||
"color":color
|
"color": color
|
||||||
}
|
}
|
||||||
|
@ -126,6 +126,7 @@ def get_all(module_path, heading, finder=None, ignore=None):
|
|||||||
def generate_doc_for_module(module_path, heading="+", finder=None, ignore=None):
|
def generate_doc_for_module(module_path, heading="+", finder=None, ignore=None):
|
||||||
return "".join(map(str, get_all(module_path, heading, finder, ignore or [])))
|
return "".join(map(str, get_all(module_path, heading, finder, ignore or [])))
|
||||||
|
|
||||||
|
|
||||||
with open("README.tpl.rst", "r") as template:
|
with open("README.tpl.rst", "r") as template:
|
||||||
tpl = template.read()
|
tpl = template.read()
|
||||||
tpl = tpl.replace(
|
tpl = tpl.replace(
|
||||||
|
@ -12,7 +12,6 @@ from i3pystatus import IntervalModule
|
|||||||
|
|
||||||
|
|
||||||
class ModsDeChecker(IntervalModule):
|
class ModsDeChecker(IntervalModule):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
This class returns i3status parsable output of the number of
|
This class returns i3status parsable output of the number of
|
||||||
unread posts in any bookmark in the mods.de forums.
|
unread posts in any bookmark in the mods.de forums.
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import socket
|
import socket
|
||||||
|
|
||||||
from i3pystatus import IntervalModule, formatp
|
from i3pystatus import IntervalModule, formatp
|
||||||
@ -10,7 +9,6 @@ def format_time(seconds):
|
|||||||
|
|
||||||
|
|
||||||
class MPD(IntervalModule):
|
class MPD(IntervalModule):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Displays various information from MPD (the music player daemon)
|
Displays various information from MPD (the music player daemon)
|
||||||
|
|
||||||
@ -101,7 +99,7 @@ class MPD(IntervalModule):
|
|||||||
def on_leftclick(self):
|
def on_leftclick(self):
|
||||||
try:
|
try:
|
||||||
self._mpd_command(self.s, "pause %i" %
|
self._mpd_command(self.s, "pause %i" %
|
||||||
(0 if self._mpd_command(self.s, "status")["state"] == "pause" else 1))
|
(0 if self._mpd_command(self.s, "status")["state"] == "pause" else 1))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ from i3pystatus import IntervalModule
|
|||||||
|
|
||||||
def count_bits(integer):
|
def count_bits(integer):
|
||||||
bits = 0
|
bits = 0
|
||||||
while(integer):
|
while (integer):
|
||||||
integer &= integer - 1
|
integer &= integer - 1
|
||||||
bits += 1
|
bits += 1
|
||||||
return bits
|
return bits
|
||||||
@ -47,7 +47,6 @@ def cidr4(addr, mask):
|
|||||||
|
|
||||||
|
|
||||||
class Network(IntervalModule):
|
class Network(IntervalModule):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Display network information about a interface.
|
Display network information about a interface.
|
||||||
|
|
||||||
@ -122,7 +121,7 @@ class Network(IntervalModule):
|
|||||||
fdict["v6"] = v6["addr"]
|
fdict["v6"] = v6["addr"]
|
||||||
fdict["v6mask"] = v6["netmask"]
|
fdict["v6mask"] = v6["netmask"]
|
||||||
fdict["v6cidr"] = cidr6(v6["addr"], v6["netmask"])
|
fdict["v6cidr"] = cidr6(v6["addr"], v6["netmask"])
|
||||||
if not v6["addr"].startswith("fe80::"): # prefer non link-local addresses
|
if not v6["addr"].startswith("fe80::"): # prefer non link-local addresses
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
format = self.format_down
|
format = self.format_down
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
from urllib.request import urlopen
|
from urllib.request import urlopen
|
||||||
import webbrowser
|
import webbrowser
|
||||||
|
|
||||||
@ -10,7 +9,6 @@ from i3pystatus.core.util import internet, require
|
|||||||
|
|
||||||
|
|
||||||
class TrackerAPI:
|
class TrackerAPI:
|
||||||
|
|
||||||
def __init__(self, idcode):
|
def __init__(self, idcode):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -41,7 +39,7 @@ class DHL(TrackerAPI):
|
|||||||
if 'active' in picture_link:
|
if 'active' in picture_link:
|
||||||
status = ''.join(element.xpath('./img/@alt'))
|
status = ''.join(element.xpath('./img/@alt'))
|
||||||
|
|
||||||
progress = '%i' % (i/len(elements)*100)
|
progress = '%i' % (i / len(elements) * 100)
|
||||||
|
|
||||||
elif 'default' in picture_link:
|
elif 'default' in picture_link:
|
||||||
break
|
break
|
||||||
@ -51,7 +49,6 @@ class DHL(TrackerAPI):
|
|||||||
def status(self):
|
def status(self):
|
||||||
ret = {}
|
ret = {}
|
||||||
with urlopen(self.url) as page:
|
with urlopen(self.url) as page:
|
||||||
#with open('/home/marcel/ownCloud/dhl_site/paketzentrum/DHL Sendungsverfolgung.htm', 'r') as page:
|
|
||||||
page = lxml.html.fromstring(page.read())
|
page = lxml.html.fromstring(page.read())
|
||||||
|
|
||||||
if not self.error(page):
|
if not self.error(page):
|
||||||
|
@ -4,7 +4,6 @@ from i3pystatus import Module
|
|||||||
|
|
||||||
|
|
||||||
class PulseAudio(Module):
|
class PulseAudio(Module):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Shows volume of default PulseAudio sink (output).
|
Shows volume of default PulseAudio sink (output).
|
||||||
|
|
||||||
@ -107,4 +106,5 @@ class PulseAudio(Module):
|
|||||||
|
|
||||||
def on_leftclick(self):
|
def on_leftclick(self):
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
subprocess.Popen(["pavucontrol"])
|
subprocess.Popen(["pavucontrol"])
|
||||||
|
@ -31,6 +31,8 @@ class pa_format_info(Structure):
|
|||||||
|
|
||||||
class pa_context(Structure):
|
class pa_context(Structure):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
pa_context._fields_ = [
|
pa_context._fields_ = [
|
||||||
]
|
]
|
||||||
pa_context_notify_cb_t = CFUNCTYPE(None, POINTER(pa_context), c_void_p)
|
pa_context_notify_cb_t = CFUNCTYPE(None, POINTER(pa_context), c_void_p)
|
||||||
@ -39,12 +41,16 @@ pa_context_success_cb_t = CFUNCTYPE(None, POINTER(pa_context), c_int, c_void_p)
|
|||||||
|
|
||||||
class pa_proplist(Structure):
|
class pa_proplist(Structure):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
pa_context_event_cb_t = CFUNCTYPE(
|
pa_context_event_cb_t = CFUNCTYPE(
|
||||||
None, POINTER(pa_context), STRING, POINTER(pa_proplist), c_void_p)
|
None, POINTER(pa_context), STRING, POINTER(pa_proplist), c_void_p)
|
||||||
|
|
||||||
|
|
||||||
class pa_mainloop_api(Structure):
|
class pa_mainloop_api(Structure):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
pa_context_new = _libraries['libpulse.so.0'].pa_context_new
|
pa_context_new = _libraries['libpulse.so.0'].pa_context_new
|
||||||
pa_context_new.restype = POINTER(pa_context)
|
pa_context_new.restype = POINTER(pa_context)
|
||||||
pa_context_new.argtypes = [POINTER(pa_mainloop_api), STRING]
|
pa_context_new.argtypes = [POINTER(pa_mainloop_api), STRING]
|
||||||
@ -85,6 +91,7 @@ class pa_spawn_api(Structure):
|
|||||||
('atfork', CFUNCTYPE(None)),
|
('atfork', CFUNCTYPE(None)),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
pa_context_connect = _libraries['libpulse.so.0'].pa_context_connect
|
pa_context_connect = _libraries['libpulse.so.0'].pa_context_connect
|
||||||
pa_context_connect.restype = c_int
|
pa_context_connect.restype = c_int
|
||||||
pa_context_connect.argtypes = [
|
pa_context_connect.argtypes = [
|
||||||
@ -155,6 +162,8 @@ class pa_channel_map(Structure):
|
|||||||
('channels', c_uint8),
|
('channels', c_uint8),
|
||||||
('map', pa_channel_position_t * 32),
|
('map', pa_channel_position_t * 32),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
pa_sink_info._fields_ = [
|
pa_sink_info._fields_ = [
|
||||||
('name', STRING),
|
('name', STRING),
|
||||||
('index', c_uint32),
|
('index', c_uint32),
|
||||||
@ -202,6 +211,8 @@ pa_context_get_sink_info_list.argtypes = [
|
|||||||
|
|
||||||
class pa_server_info(Structure):
|
class pa_server_info(Structure):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
pa_server_info._fields_ = [
|
pa_server_info._fields_ = [
|
||||||
('user_name', STRING),
|
('user_name', STRING),
|
||||||
('host_name', STRING),
|
('host_name', STRING),
|
||||||
@ -224,6 +235,8 @@ pa_context_get_server_info.argtypes = [
|
|||||||
|
|
||||||
class pa_threaded_mainloop(Structure):
|
class pa_threaded_mainloop(Structure):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
pa_threaded_mainloop._fields_ = [
|
pa_threaded_mainloop._fields_ = [
|
||||||
]
|
]
|
||||||
pa_threaded_mainloop_new = _libraries['libpulse.so.0'].pa_threaded_mainloop_new
|
pa_threaded_mainloop_new = _libraries['libpulse.so.0'].pa_threaded_mainloop_new
|
||||||
@ -278,7 +291,6 @@ pa_sw_volume_to_dB = _libraries['libpulse.so.0'].pa_sw_volume_to_dB
|
|||||||
pa_sw_volume_to_dB.restype = c_double
|
pa_sw_volume_to_dB.restype = c_double
|
||||||
pa_sw_volume_to_dB.argtypes = [pa_volume_t]
|
pa_sw_volume_to_dB.argtypes = [pa_volume_t]
|
||||||
|
|
||||||
|
|
||||||
pa_operation_unref = _libraries['libpulse.so.0'].pa_operation_unref
|
pa_operation_unref = _libraries['libpulse.so.0'].pa_operation_unref
|
||||||
pa_operation_unref.restype = None
|
pa_operation_unref.restype = None
|
||||||
pa_operation_unref.argtypes = [POINTER(pa_operation)]
|
pa_operation_unref.argtypes = [POINTER(pa_operation)]
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import urllib.request
|
import urllib.request
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
import urllib.error
|
import urllib.error
|
||||||
@ -10,7 +9,6 @@ from i3pystatus import IntervalModule
|
|||||||
|
|
||||||
|
|
||||||
class pyLoad(IntervalModule):
|
class pyLoad(IntervalModule):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Shows pyLoad status
|
Shows pyLoad status
|
||||||
|
|
||||||
@ -46,7 +44,8 @@ class pyLoad(IntervalModule):
|
|||||||
if not data:
|
if not data:
|
||||||
data = {}
|
data = {}
|
||||||
urlencoded = urllib.parse.urlencode(data).encode("ascii")
|
urlencoded = urllib.parse.urlencode(data).encode("ascii")
|
||||||
return json.loads(self.opener.open("{address}/api/{method}/".format(address=self.address, method=method), urlencoded).read().decode("utf-8"))
|
return json.loads(self.opener.open("{address}/api/{method}/".format(address=self.address, method=method),
|
||||||
|
urlencoded).read().decode("utf-8"))
|
||||||
|
|
||||||
def init(self):
|
def init(self):
|
||||||
self.cj = http.cookiejar.CookieJar()
|
self.cj = http.cookiejar.CookieJar()
|
||||||
|
@ -4,7 +4,6 @@ from i3pystatus import IntervalModule
|
|||||||
|
|
||||||
|
|
||||||
class Regex(IntervalModule):
|
class Regex(IntervalModule):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Simple regex file watcher
|
Simple regex file watcher
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ from i3pystatus import IntervalModule
|
|||||||
|
|
||||||
|
|
||||||
class RunWatch(IntervalModule):
|
class RunWatch(IntervalModule):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Expands the given path using glob to a pidfile and checks
|
Expands the given path using glob to a pidfile and checks
|
||||||
if the process ID found inside is valid
|
if the process ID found inside is valid
|
||||||
|
@ -6,7 +6,6 @@ from gi.repository import Playerctl, GLib
|
|||||||
|
|
||||||
|
|
||||||
class Spotify(Module):
|
class Spotify(Module):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
This class shows information from Spotify.
|
This class shows information from Spotify.
|
||||||
|
|
||||||
@ -39,7 +38,7 @@ class Spotify(Module):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.output = {
|
self.output = {
|
||||||
"full_text": "Error creating new thread!",
|
"full_text": "Error creating new thread!",
|
||||||
"color" : "#FF0000"
|
"color": "#FF0000"
|
||||||
}
|
}
|
||||||
|
|
||||||
def on_track_change(self, player, e):
|
def on_track_change(self, player, e):
|
||||||
|
@ -5,7 +5,6 @@ from i3pystatus import IntervalModule
|
|||||||
|
|
||||||
|
|
||||||
class Temperature(IntervalModule):
|
class Temperature(IntervalModule):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Shows CPU temperature of Intel processors
|
Shows CPU temperature of Intel processors
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ from i3pystatus import Module
|
|||||||
|
|
||||||
|
|
||||||
class Text(Module):
|
class Text(Module):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Display static, colored text.
|
Display static, colored text.
|
||||||
"""
|
"""
|
||||||
|
@ -4,7 +4,6 @@ from i3pystatus.core.util import internet, require
|
|||||||
|
|
||||||
|
|
||||||
class Weather(IntervalModule):
|
class Weather(IntervalModule):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
This module gets the weather from weather.com using pywapi module
|
This module gets the weather from weather.com using pywapi module
|
||||||
First, you need to get the code for the location from the www.weather.com
|
First, you need to get the code for the location from the www.weather.com
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
|
|
||||||
import basiciw
|
import basiciw
|
||||||
|
|
||||||
from i3pystatus.network import Network
|
from i3pystatus.network import Network
|
||||||
|
|
||||||
|
|
||||||
class Wireless(Network):
|
class Wireless(Network):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Display network information about a interface.
|
Display network information about a interface.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user