Skip to content

Commit

Permalink
use format parsing to find placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
tobes committed Aug 28, 2018
1 parent 2ccda01 commit 72499df
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions py3status/modules/clock.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,11 @@ def post_config_hook(self):
self.cycle = 0
# find any declared timezones eg {Europe/London}
self._items = {}
matches = re.findall(r'\{([^}]*)\}', ''.join(self.format))
for match in matches:
self._items[match] = self._get_timezone(match)
fmts = set()
for fmt in self.format:
fmts.update(self.py3.get_placeholders_list(fmt))
for fmt in fmts:
self._items[fmt] = self._get_timezone(fmt)

self.multiple_tz = len(self._items) > 1

Expand Down

0 comments on commit 72499df

Please sign in to comment.