From 3285cbf1e9bdba7ea27215df7c194cd98a37767a Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Thu, 23 Dec 2021 14:25:22 +0100 Subject: Get rid of global variable d Signed-off-by: Olivier Gayot --- monitor-menu.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'monitor-menu.py') diff --git a/monitor-menu.py b/monitor-menu.py index 6e07155..64a6753 100755 --- a/monitor-menu.py +++ b/monitor-menu.py @@ -18,12 +18,12 @@ import subprocess import dialog import docopt -d = dialog.Dialog() class MonitorMenu(): def __init__(self, config_file='~/.config/monitor-profiles.json'): with open(expanduser(config_file)) as fh: self.profiles = json.load(fh) + self.d = dialog.Dialog() def run(self, profile_idx=None): choices = [] @@ -34,9 +34,11 @@ class MonitorMenu(): choices.append((str(i), p['name'])) i += 1 - code, profile_idx = d.menu('Select the profile you want to use.', choices=choices) + code, profile_idx = self.d.menu( + 'Select the profile you want to use.', + choices=choices) - if code in (d.ESC, d.CANCEL): + if code in (self.d.ESC, self.d.CANCEL): return profile = self.profiles[int(profile_idx)] -- cgit v1.2.3