From 6dbc2c78e5ef78c49a29ab1e3dc2f5f77d0c3d6e Mon Sep 17 00:00:00 2001 From: Arvedui Date: Sun, 1 Mar 2015 14:51:52 +0100 Subject: [PATCH 1/5] remove the module specific and hard coded interval in cpu_usage --- i3pystatus/cpu_usage.py | 1 - 1 file changed, 1 deletion(-) diff --git a/i3pystatus/cpu_usage.py b/i3pystatus/cpu_usage.py index 8897c22..0f353bb 100644 --- a/i3pystatus/cpu_usage.py +++ b/i3pystatus/cpu_usage.py @@ -40,7 +40,6 @@ class CpuUsage(IntervalModule): def init(self): self.prev_total = defaultdict(int) self.prev_busy = defaultdict(int) - self.interval = 1 self.formatter = Formatter() def get_cpu_timings(self): From efd1c5f09ffd25912408873579618d04627dcc39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Mand=C3=A1k?= Date: Sat, 7 Mar 2015 12:47:20 +0100 Subject: [PATCH 2/5] fixed #177 --- i3pystatus/clock.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/i3pystatus/clock.py b/i3pystatus/clock.py index 67a8fa7..61c9de4 100644 --- a/i3pystatus/clock.py +++ b/i3pystatus/clock.py @@ -32,13 +32,24 @@ class Clock(IntervalModule): on_downscroll = ["scroll_format", -1] def init(self): - lang, enc = os.environ.get('LANG', None).split('.', 1) - if lang != locale.getlocale(locale.LC_TIME)[0]: + env_lang = os.environ.get('LC_TIME', None) + if env_lang is None: + env_lang = os.environ.get('LANG', None) + + if env_lang is not None: + if env_lang.find('.') != -1: + lang = tuple(env_lang.split('.', 1)) + else: + lang = (env_lang, None) + else: + lang = (None, None) + + if lang != locale.getlocale(locale.LC_TIME): # affects datetime.time.strftime() in whole program - locale.setlocale(locale.LC_TIME, (lang, enc)) + locale.setlocale(locale.LC_TIME, lang) if self.format is None: - if lang == 'en_US': + if lang[0] == 'en_US': # MDY format - United States of America self.format = ["%a %b %-d %X"] else: From 013b15ffd4319dfec47bbd6fbda8c9713d01e86d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Mand=C3=A1k?= Date: Sat, 7 Mar 2015 12:47:42 +0100 Subject: [PATCH 3/5] Fixed dbus error when not using player autodetection. --- i3pystatus/now_playing.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/i3pystatus/now_playing.py b/i3pystatus/now_playing.py index b75104c..acb0784 100644 --- a/i3pystatus/now_playing.py +++ b/i3pystatus/now_playing.py @@ -80,9 +80,13 @@ class NowPlaying(IntervalModule): def get_player(self): if self.player: player = "org.mpris.MediaPlayer2." + self.player + try: + return dbus.SessionBus().get_object(player, "/org/mpris/MediaPlayer2") + except dbus.exceptions.DBusException: + raise NoPlayerException() else: player = self.find_player() - return dbus.SessionBus().get_object(player, "/org/mpris/MediaPlayer2") + return dbus.SessionBus().get_object(player, "/org/mpris/MediaPlayer2") def run(self): try: From 4209d7046c255a683df8fd3442402eb13533f62b Mon Sep 17 00:00:00 2001 From: facetoe Date: Sun, 8 Mar 2015 08:38:08 +0800 Subject: [PATCH 4/5] Fixed bug that prevented color_up being shown if the user is not using network_traffic. --- i3pystatus/network.py | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/i3pystatus/network.py b/i3pystatus/network.py index afb9ddb..8857df2 100644 --- a/i3pystatus/network.py +++ b/i3pystatus/network.py @@ -337,7 +337,6 @@ class Network(IntervalModule, ColorRangeModule): format_values = dict(kbs="", network_graph="", bytes_sent="", bytes_recv="", packets_sent="", packets_recv="", interface="", v4="", v4mask="", v4cidr="", v6="", v6mask="", v6cidr="", mac="", essid="", freq="", quality="", quality_bar="") - color = None if self.network_traffic: network_usage = self.network_traffic.get_usage(self.interface) format_values.update(network_usage) @@ -351,22 +350,22 @@ class Network(IntervalModule, ColorRangeModule): format_values['network_graph'] = self.get_network_graph(kbs) format_values['kbs'] = "{0:.1f}".format(round(kbs, 2)).rjust(6) color = self.get_gradient(kbs, self.colors, self.upper_limit) + else: + color = None + + if sysfs_interface_up(self.interface, self.unknown_up): + if not color: + color = self.color_up + format_str = self.format_up + else: + color = self.color_down + format_str = self.format_down network_info = self.network_info.get_info(self.interface) format_values.update(network_info) - format_values['interface'] = self.interface - if sysfs_interface_up(self.interface, self.unknown_up): - if not self.dynamic_color: - color = self.color_up - self.output = { - "full_text": self.format_up.format(**format_values), - 'color': color, - } - else: - color = self.color_down - self.output = { - "full_text": self.format_down.format(**format_values), - 'color': color, - } + self.output = { + "full_text": format_str.format(**format_values), + 'color': color, + } From 194fc29e0214b51462b678796c8fa9c548a9eac9 Mon Sep 17 00:00:00 2001 From: Arvedui Date: Thu, 12 Mar 2015 20:42:15 +0100 Subject: [PATCH 5/5] readded default intervall 1 but in the right way this time --- i3pystatus/cpu_usage.py | 1 + 1 file changed, 1 insertion(+) diff --git a/i3pystatus/cpu_usage.py b/i3pystatus/cpu_usage.py index 0f353bb..a131850 100644 --- a/i3pystatus/cpu_usage.py +++ b/i3pystatus/cpu_usage.py @@ -29,6 +29,7 @@ class CpuUsage(IntervalModule): format = "{usage:02}%" format_all = "{core}:{usage:02}%" exclude_average = False + interval = 1 settings = ( ("format", "format string."), ("format_all", ("format string used for {usage_all} per core. "