fixed some bugs in the experimental zenity code
authorConstantin <commit.suicide.enormator@xoxy.net>
Tue, 16 Oct 2012 21:47:01 +0000 (23:47 +0200)
committerConstantin <commit.suicide.enormator@xoxy.net>
Tue, 16 Oct 2012 21:47:01 +0000 (23:47 +0200)
zenity_dialogue.py

index 8cba4d9dff7b7dc351308b362c9baacc3e4c3a60..33f31778583f3349a7a2432e2c9d35d6d43d2bcc 100644 (file)
@@ -21,9 +21,9 @@ from dsl import RelativeScreenPosition, ScreenSetup, res2user
 def userChoose (title, choices, returns):
        assert len(choices) == len(returns)
        p = subprocess.Popen(["zenity", "--list", "--text="+title, "--column="]+choices, stdout=subprocess.PIPE)
 def userChoose (title, choices, returns):
        assert len(choices) == len(returns)
        p = subprocess.Popen(["zenity", "--list", "--text="+title, "--column="]+choices, stdout=subprocess.PIPE)
-       switch = zip (choices,returns)
+       switch = dict (zip (choices,returns))
        for line in p.stdout:
        for line in p.stdout:
-               return switch.get(line, None)
+               return switch.get(line.strip(), None)
 
 def run (internalResolutions, externalResolutions):
        relpos = userChoose ("Position of external screen", ["Left of internal screen", "Right of internal screen", "Use external screen only"], [RelativeScreenPosition.LEFT, RelativeScreenPosition.RIGHT, RelativeScreenPosition.EXTERNAL_ONLY])
 
 def run (internalResolutions, externalResolutions):
        relpos = userChoose ("Position of external screen", ["Left of internal screen", "Right of internal screen", "Use external screen only"], [RelativeScreenPosition.LEFT, RelativeScreenPosition.RIGHT, RelativeScreenPosition.EXTERNAL_ONLY])