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