Commit 4e359fde authored by Guillaume Seguin's avatar Guillaume Seguin

Move rotate_shape to Plater

parent 77ca068e
...@@ -118,6 +118,17 @@ class Plater(wx.Frame): ...@@ -118,6 +118,17 @@ class Plater(wx.Frame):
] ]
return True return True
def rotate_shape(self, angle):
"""rotates acive shape
positive angle is clockwise
"""
name = self.l.GetSelection()
if name == wx.NOT_FOUND:
return False
name = self.l.GetString(name)
model = self.models[name]
model.rot += angle
def autoplate(self, event = None): def autoplate(self, event = None):
print _("Autoplating") print _("Autoplating")
separation = 2 separation = 2
......
...@@ -164,17 +164,11 @@ class StlViewPanel(wxGLPanel): ...@@ -164,17 +164,11 @@ class StlViewPanel(wxGLPanel):
elif event.ButtonUp(wx.MOUSE_BTN_RIGHT): elif event.ButtonUp(wx.MOUSE_BTN_RIGHT):
if self.initpos is not None: if self.initpos is not None:
self.initpos = None self.initpos = None
else:
def rotate_shape(self, angle): event.Skip()
"""rotates acive shape return
positive angle is clockwise event.Skip()
""" wx.CallAfter(self.Refresh)
name = self.parent.l.GetSelection()
if name == wx.NOT_FOUND:
return False
name = self.parent.l.GetString(name)
model = self.parent.models[name]
model.rot += angle
def wheel(self, event): def wheel(self, event):
"""react to mouse wheel actions: """react to mouse wheel actions:
...@@ -185,9 +179,9 @@ class StlViewPanel(wxGLPanel): ...@@ -185,9 +179,9 @@ class StlViewPanel(wxGLPanel):
if not event.ShiftDown(): if not event.ShiftDown():
angle = 10 angle = 10
if delta > 0: if delta > 0:
self.rotate_shape(angle / 2) self.parent.rotate_shape(angle / 2)
else: else:
self.rotate_shape(-angle / 2) self.parent.rotate_shape(-angle / 2)
else: else:
factor = 1.05 factor = 1.05
x, y = event.GetPositionTuple() x, y = event.GetPositionTuple()
...@@ -221,10 +215,10 @@ class StlViewPanel(wxGLPanel): ...@@ -221,10 +215,10 @@ class StlViewPanel(wxGLPanel):
self.parent.move_shape((0, -step)) self.parent.move_shape((0, -step))
#[ #[
if keycode == 91: if keycode == 91:
self.rotate_shape(-angle) self.parent.rotate_shape(-angle)
#] #]
if keycode == 93: if keycode == 93:
self.rotate_shape(angle) self.parent.rotate_shape(angle)
event.Skip() event.Skip()
wx.CallAfter(self.Refresh) wx.CallAfter(self.Refresh)
......
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