Commit 56f6e132 authored by sumpfralle's avatar sumpfralle

fixed handling of "shift" key state (rotation) for non-us keyboard layouts

 * this patch was contributed by "imyrek"
 * http://sourceforge.net/tracker/?func=detail&aid=3054257&group_id=237831&atid=1104178


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@656 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 2d92c19c
...@@ -386,7 +386,7 @@ class ModelViewWindowGL: ...@@ -386,7 +386,7 @@ class ModelViewWindowGL:
self._paint_ignore_busy() self._paint_ignore_busy()
elif keyval in move_keys_dict.keys(): elif keyval in move_keys_dict.keys():
move_x, move_y = move_keys_dict[keyval] move_x, move_y = move_keys_dict[keyval]
if get_state() == gtk.gdk.SHIFT_MASK: if get_state() & gtk.gdk.SHIFT_MASK:
# shift key pressed -> rotation # shift key pressed -> rotation
base = 0 base = 0
factor = 10 factor = 10
...@@ -514,8 +514,8 @@ class ModelViewWindowGL: ...@@ -514,8 +514,8 @@ class ModelViewWindowGL:
last_timestamp = self.mouse["timestamp"] last_timestamp = self.mouse["timestamp"]
x, y, state = event.x, event.y, event.state x, y, state = event.x, event.y, event.state
if self.mouse["button"] is None: if self.mouse["button"] is None:
if (state == BUTTON_ZOOM) or (state == BUTTON_ROTATE) \ if (state & BUTTON_ZOOM) or (state & BUTTON_ROTATE) \
or (state == BUTTON_MOVE): or (state & BUTTON_MOVE):
self.mouse["button"] = state self.mouse["button"] = state
self.mouse["start_pos"] = [x, y] self.mouse["start_pos"] = [x, y]
else: else:
...@@ -524,7 +524,7 @@ class ModelViewWindowGL: ...@@ -524,7 +524,7 @@ class ModelViewWindowGL:
if time.time() - last_timestamp < 0.04: if time.time() - last_timestamp < 0.04:
return return
# a button was pressed before # a button was pressed before
if state == self.mouse["button"] == BUTTON_ZOOM: if state & self.mouse["button"] & BUTTON_ZOOM:
# the start button is still active: update the view # the start button is still active: update the view
start_x, start_y = self.mouse["start_pos"] start_x, start_y = self.mouse["start_pos"]
self.mouse["start_pos"] = [x, y] self.mouse["start_pos"] = [x, y]
...@@ -539,11 +539,11 @@ class ModelViewWindowGL: ...@@ -539,11 +539,11 @@ class ModelViewWindowGL:
scale = 100 scale = 100
self.camera.scale_distance(scale) self.camera.scale_distance(scale)
self._paint_ignore_busy() self._paint_ignore_busy()
elif (state == self.mouse["button"] == BUTTON_MOVE) \ elif (state & self.mouse["button"] & BUTTON_MOVE) \
or (state == self.mouse["button"] == BUTTON_ROTATE): or (state & self.mouse["button"] & BUTTON_ROTATE):
start_x, start_y = self.mouse["start_pos"] start_x, start_y = self.mouse["start_pos"]
self.mouse["start_pos"] = [x, y] self.mouse["start_pos"] = [x, y]
if (state == BUTTON_MOVE): if (state & BUTTON_MOVE):
# Determine the biggest dimension (x/y/z) for moving the # Determine the biggest dimension (x/y/z) for moving the
# screen's center in relation to this value. # screen's center in relation to this value.
obj_dim = [] obj_dim = []
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment