-
-
Notifications
You must be signed in to change notification settings - Fork 261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
file_status: allow several paths, new format #1369
Changes from 2 commits
3054842
1909b9e
bced76b
eec5c31
1b4c212
d1e5567
e7fd61e
5933dde
4484da1
d76b49d
ef9825e
08b7481
24a5160
c96a435
8fa66b0
e15eedc
fb4c723
67e26e6
b84fda9
fb82b53
0bfe17a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,8 @@ | |
{'color': '#FF0000', 'full_text': u'\u25a0'} | ||
""" | ||
|
||
from os.path import expanduser, exists | ||
from glob import glob | ||
from os.path import exists, expanduser | ||
|
||
ERR_NO_PATH = 'no path given' | ||
|
||
|
@@ -56,10 +57,6 @@ class Meta: | |
], | ||
} | ||
|
||
def post_config_hook(self): | ||
if self.path: | ||
self.path = expanduser(self.path) | ||
|
||
def file_status(self): | ||
if self.path is None: | ||
return { | ||
|
@@ -68,12 +65,18 @@ def file_status(self): | |
'cached_until': self.py3.CACHE_FOREVER, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should move this to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Master Splinter! Or see STRING_NO_PATH = 'missing path' def post_config_hook(self):
if not self.path:
raise Exception(STRING_NO_PATH) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ha ok I was far away |
||
} | ||
|
||
if exists(self.path): | ||
icon = self.icon_available | ||
color = self.py3.COLOR_GOOD | ||
else: | ||
icon = self.icon_unavailable | ||
color = self.py3.COLOR_BAD | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There sure are lot of changes. We might as well see this all the way to finish... by removing colors, make and default This module is useful now because I can use this to print names of custom modules... and globbing. Thank you for working on this. :-) |
||
paths = glob(expanduser(self.path)) | ||
if isinstance(paths, str): | ||
paths = [paths] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When we There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it is not always a list, if there is nothing to glob the return stay a str There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know what to make of this. Consult with the fam. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. weird, will retry
|
||
|
||
icon = self.icon_unavailable | ||
color = self.py3.COLOR_BAD | ||
|
||
for path in paths: | ||
if exists(path): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok for this :) |
||
icon = self.icon_available | ||
color = self.py3.COLOR_GOOD | ||
break | ||
|
||
response = { | ||
'cached_until': self.py3.time_in(self.cache_timeout), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In my example I use |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep this so we can do
expanduser(path)
once instead of every refresh interval.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a doubt about this, refresh is for example when I
py3-cmd resfresh file_status
? I thought this part was only excecuted at the py3status start/restart.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not understand this sorry, could you rephrase? "I'd clear this with the fam first."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have a discussion with tobes and/or ultrabug. They our fam.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry, fam = familly >_>