changed error handling
This commit is contained in:
parent
be62ddb4bf
commit
bacde53401
|
@ -21,7 +21,7 @@ else:
|
||||||
try:
|
try:
|
||||||
f = open(config)
|
f = open(config)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
print("No config file found\n")
|
print("Error: No config file found\n")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
conf = yaml.load(f,yaml.FullLoader)
|
conf = yaml.load(f,yaml.FullLoader)
|
||||||
term = str(conf['terminal'])
|
term = str(conf['terminal'])
|
||||||
|
@ -56,21 +56,28 @@ match icn:
|
||||||
# Sets the menu options, list and count in proper spots
|
# Sets the menu options, list and count in proper spots
|
||||||
def count():
|
def count():
|
||||||
cmd = ['checkupdates']
|
cmd = ['checkupdates']
|
||||||
p1 = subprocess.Popen(cmd,stdout=subprocess.PIPE)
|
try:
|
||||||
outputList = ((p1.communicate()[0]).decode()).rstrip('\n')
|
p1 = subprocess.Popen(cmd,stdout=subprocess.PIPE)
|
||||||
outputCount = len(outputList.splitlines())
|
outputList = ((p1.communicate()[0]).decode()).rstrip('\n')
|
||||||
if outputCount == 0:
|
outputCount = len(outputList.splitlines())
|
||||||
|
if outputCount == 0:
|
||||||
|
tray.setVisible(False)
|
||||||
|
else:
|
||||||
|
menu.clear()
|
||||||
|
menu.addAction(readNews)
|
||||||
|
menu.addAction(runUpdate)
|
||||||
|
menu.addAction(quit)
|
||||||
|
for i in outputList.splitlines():
|
||||||
|
menu.addAction(i, partial(infos, i))
|
||||||
|
avail = str(outputCount)+" Updates"
|
||||||
|
tray.setToolTip(avail)
|
||||||
|
tray.setVisible(True)
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
tray.setVisible(False)
|
tray.setVisible(False)
|
||||||
else:
|
wait = 1800000
|
||||||
menu.clear()
|
updateTimer.killTimer
|
||||||
menu.addAction(readNews)
|
updateTimer.start(wait)
|
||||||
menu.addAction(runUpdate)
|
print("Error: \'checkupdates\' command unable to retrieve updates\nSetting timer to 30mins\n")
|
||||||
menu.addAction(quit)
|
|
||||||
for i in outputList.splitlines():
|
|
||||||
menu.addAction(i, partial(infos, i))
|
|
||||||
avail = str(outputCount)+" Updates"
|
|
||||||
tray.setToolTip(avail)
|
|
||||||
tray.setVisible(True)
|
|
||||||
|
|
||||||
# Read the News
|
# Read the News
|
||||||
def news():
|
def news():
|
||||||
|
|
Loading…
Reference in New Issue