-
- def setup(self, internalResolutions, externalResolutions):
- from zenity_dialogue import run
- run(internalResolutions, externalResolutions)
-
- @staticmethod
+ def userChoose (self, title, choices, returns, fallback):
+ assert len(choices) == len(returns)
+ args = ["zenity", "--list", "--text="+title, "--column="]+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