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.
This commit is contained in:
Will Bradley 2014-01-08 03:26:53 -07:00
parent 6d6b50c3af
commit 4c9c3a5c22

View File

@ -4,7 +4,8 @@
# Pinger.py -- A ping tool that sits in your system tray # Pinger.py -- A ping tool that sits in your system tray
# Copyright 2013 Will Bradley # Copyright 2013 Will Bradley
# #
# Authors: Will Bradley <bradley.will@gmail.com> # Contributors: Will Bradley <bradley.will@gmail.com>
# AltF4 <altf4@phx2600.org>
# #
# This program is free software: you can redistribute it and/or modify it # This program is free software: you can redistribute it and/or modify it
# under the terms of either or both of the following licenses: # under the terms of either or both of the following licenses:
@ -203,10 +204,10 @@ class Pinger:
self.pause_menu = self.create_menu_item(pause_label, self.toggle_pause) self.pause_menu = self.create_menu_item(pause_label, self.toggle_pause)
# with autostart option # with autostart option
# first, check current autostart state by checking existance of .desktop file # first, check current autostart state by checking existance of .desktop file
try: if os.path.exists(startup_path):
with open(startup_dir):
self.autostart = True self.autostart = True
except IOError: self.startup_menu = self.create_menu_item(startup_active_label, self.toggle_autostart)
else:
self.autostart = False 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 # and log display