Change default mode to standalone=True
This commit is contained in:
parent
8e3857ccd0
commit
58ca67109c
@ -26,6 +26,7 @@ master branch
|
||||
* Server used for checking internet connectivity is now an option (``internet_check`` of :py:class:`.Status`)
|
||||
* Added double click support for click events
|
||||
* Formatter data is now available with most modules for program callbacks
|
||||
* Changed default mode to standalone mode
|
||||
* ``self`` is not passed anymore by default to external Python callbacks (see :py:func:`.get_module`)
|
||||
* :py:mod:`.dota2wins`: Now accepts usernames in place of a Steam ID
|
||||
* dota2wins: Changed win percentage to be a float
|
||||
|
@ -13,7 +13,7 @@ example):
|
||||
|
||||
from i3pystatus import Status
|
||||
|
||||
status = Status(standalone=True)
|
||||
status = Status()
|
||||
|
||||
# Displays clock like this:
|
||||
# Tue 30 Jul 11:59:46 PM KW31
|
||||
@ -470,9 +470,10 @@ Or make two modules look like one.
|
||||
Refreshing the bar
|
||||
------------------
|
||||
|
||||
The whole bar can be refreshed by sending SIGUSR1 signal to i3pystatus process.
|
||||
This feature is available only in standalone operation (:py:class:`.Status` was
|
||||
created with ``standalone=True`` parameter).
|
||||
The whole bar can be refreshed by sending SIGUSR1 signal to i3pystatus
|
||||
process. This feature is not available in chained mode
|
||||
(:py:class:`.Status` was created with ``standalone=False`` parameter
|
||||
and gets it's input from ``i3status`` or a similar program).
|
||||
|
||||
To find the PID of the i3pystatus process look for the ``status_command`` you
|
||||
use in your i3 config file.
|
||||
|
@ -28,6 +28,6 @@ logger.setLevel(logging.CRITICAL)
|
||||
def main():
|
||||
from i3pystatus.clock import Clock
|
||||
|
||||
status = Status(standalone=True)
|
||||
status = Status()
|
||||
status.register(Clock())
|
||||
status.run()
|
||||
|
@ -48,20 +48,20 @@ class Status:
|
||||
:param tuple internet_check: Address of server that will be used to check for internet connection by :py:class:`.internet`.
|
||||
"""
|
||||
|
||||
def __init__(self, standalone=False, **kwargs):
|
||||
def __init__(self, standalone=True, click_events=True, interval=1,
|
||||
input_stream=None, logfile=None, internet_check=None):
|
||||
self.standalone = standalone
|
||||
self.click_events = kwargs.get("click_events", True if standalone else False)
|
||||
interval = kwargs.get("interval", 1)
|
||||
input_stream = kwargs.get("input_stream", sys.stdin)
|
||||
if "logfile" in kwargs:
|
||||
self.click_events = standalone and click_events
|
||||
input_stream = input_stream or sys.stdin
|
||||
if logfile:
|
||||
logger = logging.getLogger("i3pystatus")
|
||||
for handler in logger.handlers:
|
||||
logger.removeHandler(handler)
|
||||
handler = logging.FileHandler(kwargs["logfile"], delay=True)
|
||||
handler = logging.FileHandler(logfile, delay=True)
|
||||
logger.addHandler(handler)
|
||||
logger.setLevel(logging.CRITICAL)
|
||||
if "internet_check" in kwargs:
|
||||
util.internet.address = kwargs["internet_check"]
|
||||
if internet_check:
|
||||
util.internet.address = internet_check
|
||||
|
||||
self.modules = util.ModuleList(self, ClassFinder(Module))
|
||||
if self.standalone:
|
||||
|
@ -33,7 +33,7 @@ class Updates(Module):
|
||||
from i3pystatus import Status
|
||||
from i3pystatus.updates import pacman, cower
|
||||
|
||||
status = Status(standalone=True)
|
||||
status = Status()
|
||||
|
||||
status.register("updates",
|
||||
format = "Updates: {count}",
|
||||
|
Loading…
Reference in New Issue
Block a user