summaryrefslogtreecommitdiff
path: root/monitor-menu.py
diff options
context:
space:
mode:
authorOlivier Gayot <olivier.gayot@sigexec.com>2021-12-23 14:25:22 +0100
committerOlivier Gayot <olivier.gayot@sigexec.com>2021-12-23 14:25:22 +0100
commit3285cbf1e9bdba7ea27215df7c194cd98a37767a (patch)
tree154337634b914ffd5429e84dc9eb697d474f2ed3 /monitor-menu.py
parentad93e74cd31941a89ce133f8a97b5b47bf0a0121 (diff)
Get rid of global variable d
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
Diffstat (limited to 'monitor-menu.py')
-rwxr-xr-xmonitor-menu.py8
1 files changed, 5 insertions, 3 deletions
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)]