Browse Source

Merge branch 'master' of https://msdl.uantwerpen.be/git/simon/SCCD

Simon Van Mierlo 6 years ago
parent
commit
d04f09d6e8
1 changed files with 15 additions and 9 deletions
  1. 15 9
      src/python_sccd/python_sccd_runtime/libs/ui.py

+ 15 - 9
src/python_sccd/python_sccd_runtime/libs/ui.py

@@ -1,13 +1,13 @@
 """
  *REALLY* Small framework for creating/manipulating/deleting gui elements in Tkinter.
- 
+
  NOTE: keep this synced with ui.js
- 
+
  Author: Raphael Mannadiar
  Date: 2014/08/21
 """
 
-
+import sys
 try:
     import Tkinter as tk
 except ImportError:
@@ -29,13 +29,19 @@ class ui:
         MOUSE_MOVE =             '<Motion>',
         MOUSE_PRESS =            '<ButtonPress>',
         MOUSE_RELEASE =        '<ButtonRelease>',
-        MOUSE_RIGHT_CLICK =    '<Button-3>',
+        MOUSE_RIGHT_CLICK =    '<Button-2>' if sys.platform == "darwin" else '<Button-3>',
         WINDOW_CLOSE =         'WM_DELETE_WINDOW');
 
-    MOUSE_BUTTONS = utils._bunch(
-        LEFT        = 1,
-        MIDDLE    = 2,
-        RIGHT        = 3);
+    if sys.platform == "darwin":
+        MOUSE_BUTTONS = utils._bunch(
+            LEFT        = 1,
+            MIDDLE    = 3,
+            RIGHT        = 2);
+    else:
+        MOUSE_BUTTONS = utils._bunch(
+            LEFT        = 1,
+            MIDDLE    = 2,
+            RIGHT        = 3);
 
     KEYCODES    = utils._bunch(
         DELETE    = 46);
@@ -74,7 +80,7 @@ class ui:
 
             else :
                 raise Exception('Unsupported event');
-    
+
         if event == ui.EVENTS.WINDOW_CLOSE :
             source.protocol(event, __handle_event)