mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-03 06:56:44 +01:00
Fix crach if exit with Esc key
This commit is contained in:
parent
e36f29f660
commit
19052236c1
4 changed files with 10 additions and 4 deletions
|
@ -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):
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue