From ef2e4d10da555aad9c5d22f281d91c2aef5303bb Mon Sep 17 00:00:00 2001 From: Huluti Date: Sun, 4 Dec 2016 19:10:33 +0100 Subject: [PATCH] Make get_lsb_information out of class --- src/manjaro-hello.py | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/manjaro-hello.py b/src/manjaro-hello.py index 3ffd7d8..a7766c9 100644 --- a/src/manjaro-hello.py +++ b/src/manjaro-hello.py @@ -58,26 +58,8 @@ class ManjaroHello(Gtk.Window): self.window.show() - def get_lsb_information(self): - lsb = {} - try: - with open("/etc/lsb-release") as lsb_file: - for line in lsb_file: - if "=" in line: - var, arg = line.rstrip().split("=") - if var.startswith("DISTRIB_"): - var = var[8:] - if arg.startswith("\"") and arg.endswith("\""): - arg = arg[1:-1] - if arg: - lsb[var] = arg - except (IOError, OSError) as msg: - print(msg) - - return lsb - def get_infos(self): - lsb = self.get_lsb_information() + lsb = get_lsb_information() infos = {} infos["codename"] = lsb.get("CODENAME", 0) infos["release"] = lsb.get("RELEASE", 0) @@ -152,5 +134,23 @@ class ManjaroHello(Gtk.Window): def on_delete_window(self, *args): Gtk.main_quit(*args) +def get_lsb_information(): + lsb = {} + try: + with open("/etc/lsb-release") as lsb_file: + for line in lsb_file: + if "=" in line: + var, arg = line.rstrip().split("=") + if var.startswith("DISTRIB_"): + var = var[8:] + if arg.startswith("\"") and arg.endswith("\""): + arg = arg[1:-1] + if arg: + lsb[var] = arg + except (IOError, OSError) as msg: + print(msg) + + return lsb + win = ManjaroHello() Gtk.main()