From 4c9c3a5c22c79f72a38772d20788d60689c1494a Mon Sep 17 00:00:00 2001 From: Will Bradley Date: Wed, 8 Jan 2014 03:26:53 -0700 Subject: [PATCH] Fixing unresponsive Autostart label Is there a reason for "try with open" over os.path.exists? The issue was separate, but in the course of debugging I switched back to the old style. --- pinger.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pinger.py b/pinger.py index 6a7ffbd..361ab8b 100755 --- a/pinger.py +++ b/pinger.py @@ -4,7 +4,8 @@ # Pinger.py -- A ping tool that sits in your system tray # Copyright 2013 Will Bradley # -# Authors: Will Bradley +# Contributors: Will Bradley +# AltF4 # # This program is free software: you can redistribute it and/or modify it # under the terms of either or both of the following licenses: @@ -203,12 +204,12 @@ class Pinger: self.pause_menu = self.create_menu_item(pause_label, self.toggle_pause) # with autostart option # first, check current autostart state by checking existance of .desktop file - try: - with open(startup_dir): - self.autostart = True - except IOError: + if os.path.exists(startup_path): + self.autostart = True + self.startup_menu = self.create_menu_item(startup_active_label, self.toggle_autostart) + else: self.autostart = False - self.startup_menu = self.create_menu_item(startup_inactive_label, self.toggle_autostart) + self.startup_menu = self.create_menu_item(startup_inactive_label, self.toggle_autostart) # and log display self.log_menu = self.create_menu_item("Ping Log", None) # and exit option