[gtk-vnc] gvncviewer.py: fix TypeError in GtkVnc.Display.send_keys()



commit dcb6bc0b6969bc63aef73106b269484db9d18b3e
Author: Dr. Matthias St. Pierre <matthias st pierre ncp-e com>
Date:   Thu Oct 22 23:28:51 2020 +0200

    gvncviewer.py: fix TypeError in GtkVnc.Display.send_keys()
    
    GtkVnc.Display.send_keys() now expects X11 key value constants
    instead of strings, which resulted in a TypeError:
    
      Traceback (most recent call last):
        File ".../gtk-vnc/examples/gvncviewer.py", line 93, in send_caf1
          vnc.send_keys(["Control_L", "Alt_L", "F1"])
      TypeError: Item 0: Must be number, not str

 examples/gvncviewer.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/examples/gvncviewer.py b/examples/gvncviewer.py
index 3eab1b2..a82b0cf 100755
--- a/examples/gvncviewer.py
+++ b/examples/gvncviewer.py
@@ -77,19 +77,19 @@ def vnc_disconnected(src):
 
 def send_caf1(src, vnc):
     print("Send Ctrl+Alt+F1")
-    vnc.send_keys(["Control_L", "Alt_L", "F1"])
+    vnc.send_keys([Gdk.KEY_Control_L, Gdk.KEY_Alt_L, Gdk.KEY_F1])
 
 def send_caf7(src, vnc):
     print("Send Ctrl+Alt+F7")
-    vnc.send_keys(["Control_L", "Alt_L", "F7"])
+    vnc.send_keys([Gdk.KEY_Control_L, Gdk.KEY_Alt_L, Gdk.KEY_F7])
 
 def send_cad(src, vnc):
     print("Send Ctrl+Alt+Del")
-    vnc.send_keys(["Control_L", "Alt_L", "Del"])
+    vnc.send_keys([Gdk.KEY_Control_L, Gdk.KEY_Alt_L, Gdk.KEY_Delete])
 
 def send_cab(src, vnc):
     print("Send Ctrl+Alt+BackSpace")
-    vnc.send_keys(["Control_L", "Alt_L", "BackSpace"])
+    vnc.send_keys([Gdk.KEY_Control_L, Gdk.KEY_Alt_L, Gdk.KEY_BackSpace])
 
 def vnc_auth_cred(src, credList):
     prompt = 0


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]