Fix crach if exit with Esc key

This commit is contained in:
Dimitris Zlatanidis 2015-09-15 08:16:06 +03:00
parent e36f29f660
commit 19052236c1
4 changed files with 10 additions and 4 deletions

View file

@ -62,7 +62,7 @@ class DialogUtil(object):
if code == "ok":
self.unicode_to_string()
return self.ununicode
if code == "cancel":
if code in ["cancel", "esc"]:
self.exit()
def buildlist(self, enabled):
@ -84,7 +84,7 @@ class DialogUtil(object):
if code == "ok":
self.unicode_to_string()
return self.ununicode
if code == "cancel":
if code in ["cancel", "esc"]:
self.exit()
def exit(self):

View file

@ -66,7 +66,10 @@ Keys: SPACE select or deselect the highlighted repositories,
text, title, backtitle, status = keys, "Repositories", "", False
self.selected = DialogUtil(self.disabled, text, title, backtitle,
status).buildlist(self.enabled)
self.update_repos()
if self.selected is not None:
self.update_repos()
else:
self.selected = self.enabled
self.clear_screen()
self.reference()

View file

@ -294,9 +294,11 @@ class SBoNetwork(object):
backtitle = "{0} {1}".format(_meta_.__all__, _meta_.__version__)
status = False
pkg = DialogUtil(data, text, title, backtitle, status).checklist()
if len(pkg) > 1:
if pkg and len(pkg) > 1:
print("\nslpkg: error: choose only one package")
raise SystemExit()
if pkg is None:
raise SystemExit()
self.name = "".join(pkg)
os.system("clear")

View file

@ -47,6 +47,7 @@ def choose_upg(packages):
status = True
pkgs = DialogUtil(data, text, title, backtitle,
status).checklist()
pkgs = [] if pkgs is None else pkgs
for pkg in pkgs:
name = split_package(pkg)[0]
if name in packages: