Merge branch 'master' of github.com:enkore/i3pystatus
This commit is contained in:
commit
0e90cbfceb
@ -14,7 +14,7 @@ For examples how it works, take a look at the __main__.py.dist file with some ex
|
|||||||
To install it, follow these steps:
|
To install it, follow these steps:
|
||||||
|
|
||||||
cd ~/.config/i3status/
|
cd ~/.config/i3status/
|
||||||
git clone git@github.com:janoliver/i3pystatus contrib
|
git clone git@github.com:enkore/i3pystatus contrib
|
||||||
cd contrib/i3pystatus
|
cd contrib/i3pystatus
|
||||||
cp __main__.py.dist __main__.py
|
cp __main__.py.dist __main__.py
|
||||||
|
|
||||||
@ -371,4 +371,3 @@ a python class that can be registered with the `I3statusHandler` class. Also don
|
|||||||
forget to add yourself to the LICENSE file.
|
forget to add yourself to the LICENSE file.
|
||||||
|
|
||||||
**Patches and pull requests are very welcome :-)**
|
**Patches and pull requests are very welcome :-)**
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ For examples how it works, take a look at the __main__.py.dist file with some ex
|
|||||||
To install it, follow these steps:
|
To install it, follow these steps:
|
||||||
|
|
||||||
cd ~/.config/i3status/
|
cd ~/.config/i3status/
|
||||||
git clone git@github.com:janoliver/i3pystatus contrib
|
git clone git@github.com:enkore/i3pystatus contrib
|
||||||
cd contrib/i3pystatus
|
cd contrib/i3pystatus
|
||||||
cp __main__.py.dist __main__.py
|
cp __main__.py.dist __main__.py
|
||||||
|
|
||||||
|
@ -23,7 +23,9 @@ class Status:
|
|||||||
"""Register a new module."""
|
"""Register a new module."""
|
||||||
|
|
||||||
if module:
|
if module:
|
||||||
self.modules.append(module, *args, **kwargs)
|
return self.modules.append(module, *args, **kwargs)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
def run_command_endpoint(self):
|
def run_command_endpoint(self):
|
||||||
for command in io.JSONIO(io=io.IOHandler(sys.stdin, open(os.devnull,"w")), skiplines=1).read():
|
for command in io.JSONIO(io=io.IOHandler(sys.stdin, open(os.devnull,"w")), skiplines=1).read():
|
||||||
|
@ -3,6 +3,7 @@ import time
|
|||||||
|
|
||||||
from .settings import SettingsBase
|
from .settings import SettingsBase
|
||||||
from .threading import Manager
|
from .threading import Manager
|
||||||
|
from .util import convert_position
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"Module", "AsyncModule", "IntervalModule",
|
"Module", "AsyncModule", "IntervalModule",
|
||||||
@ -10,6 +11,7 @@ __all__ = [
|
|||||||
|
|
||||||
class Module(SettingsBase):
|
class Module(SettingsBase):
|
||||||
output = None
|
output = None
|
||||||
|
position = 0
|
||||||
|
|
||||||
def registered(self, status_handler):
|
def registered(self, status_handler):
|
||||||
"""Called when this module is registered with a status handler"""
|
"""Called when this module is registered with a status handler"""
|
||||||
@ -19,7 +21,7 @@ class Module(SettingsBase):
|
|||||||
if "name" not in self.output:
|
if "name" not in self.output:
|
||||||
self.output["name"] = self.__name__
|
self.output["name"] = self.__name__
|
||||||
self.output["instance"] = str(id(self))
|
self.output["instance"] = str(id(self))
|
||||||
json.insert(0, self.output)
|
json.insert(convert_position(self.position, json), self.output)
|
||||||
|
|
||||||
def test(self):
|
def test(self):
|
||||||
"""
|
"""
|
||||||
@ -36,6 +38,9 @@ class Module(SettingsBase):
|
|||||||
elif button == 3: # Right mouse button
|
elif button == 3: # Right mouse button
|
||||||
self.on_rightclick()
|
self.on_rightclick()
|
||||||
|
|
||||||
|
def move(self, position):
|
||||||
|
self.position = position
|
||||||
|
|
||||||
def on_leftclick(self):
|
def on_leftclick(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -46,6 +46,7 @@ class ModuleList(collections.UserList):
|
|||||||
module = self.finder.instanciate_class_from_module(module, *args, **kwargs)
|
module = self.finder.instanciate_class_from_module(module, *args, **kwargs)
|
||||||
module.registered(self.status_handler)
|
module.registered(self.status_handler)
|
||||||
super().append(module)
|
super().append(module)
|
||||||
|
return module
|
||||||
|
|
||||||
def get_by_id(self, find_id):
|
def get_by_id(self, find_id):
|
||||||
find_id = int(find_id)
|
find_id = int(find_id)
|
||||||
@ -94,3 +95,8 @@ class KeyConstraintDict(collections.UserDict):
|
|||||||
|
|
||||||
def missing(self):
|
def missing(self):
|
||||||
return self.required_keys - (self.seen_keys & self.required_keys)
|
return self.required_keys - (self.seen_keys & self.required_keys)
|
||||||
|
|
||||||
|
def convert_position(pos, json):
|
||||||
|
if pos < 0:
|
||||||
|
pos = len(json) + (pos+1)
|
||||||
|
return pos
|
||||||
|
@ -20,8 +20,8 @@ class IMAP(Backend):
|
|||||||
)
|
)
|
||||||
required = ("host", "username", "password")
|
required = ("host", "username", "password")
|
||||||
|
|
||||||
port = 143
|
port = 993
|
||||||
ssl = False
|
ssl = True
|
||||||
|
|
||||||
imap_class = imaplib.IMAP4
|
imap_class = imaplib.IMAP4
|
||||||
connection = None
|
connection = None
|
||||||
@ -51,3 +51,5 @@ class IMAP(Backend):
|
|||||||
conn = self.get_connection()
|
conn = self.get_connection()
|
||||||
if conn:
|
if conn:
|
||||||
return len(conn.search(None,"UnSeen")[1][0].split())
|
return len(conn.search(None,"UnSeen")[1][0].split())
|
||||||
|
else:
|
||||||
|
sys.stderr.write("no connection")
|
||||||
|
Loading…
Reference in New Issue
Block a user