Example #1
0
 def isAvailable():
     try:
         processOutputIt("zenity", "--version")
         return True
     except FileNotFoundError:
         return False
     except PermissionError:
         return False
Example #2
0
 def isAvailable():
     try:
         processOutputIt("zenity", "--version")
         return True
     except FileNotFoundError:
         return False
     except PermissionError:
         return False
Example #3
0
 def userChoose(self, title, choices, returns, fallback):
     assert len(choices) == len(returns)
     args = ["zenity", "--list", "--text=" + title, "--column="] + list(choices)
     switch = dict(list(zip(choices, returns)))
     try:
         for line in processOutputIt(*args):
             return switch.get(line.strip(), fallback)
     except Exception:
         # on user cancel, the return code of zenity is nonzero
         return fallback
     # if the output was empty
     return fallback
Example #4
0
 def userChoose(self, title, choices, returns, fallback):
     assert len(choices) == len(returns)
     args = ["zenity", "--list", "--text=" + title, "--column="
             ] + list(choices)
     switch = dict(list(zip(choices, returns)))
     try:
         for line in processOutputIt(*args):
             return switch.get(line.strip(), fallback)
     except Exception:
         # on user cancel, the return code of zenity is nonzero
         return fallback
     # if the output was empty
     return fallback