Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1from ase.gui.i18n import _ 

2 

3import ase.gui.ui as ui 

4from ase.utils import rotate, irotate 

5 

6 

7class Rotate: 

8 update = True 

9 

10 def __init__(self, gui): 

11 self.gui = gui 

12 win = ui.Window(_('Rotate')) 

13 win.add(_('Rotation angles:')) 

14 self.rotate = [ui.SpinBox(42.0, -360, 360, 1, self.change) 

15 for i in '123'] 

16 win.add(self.rotate) 

17 win.add(ui.Button(_('Update'), self.update_angles)) 

18 win.add(_('Note:\nYou can rotate freely\n' 

19 'with the mouse, by holding\n' 

20 'down mouse button 2.')) 

21 self.update_angles() 

22 

23 def change(self): 

24 x, y, z = [float(a.value) for a in self.rotate] 

25 self.gui.axes = rotate('%fx,%fy,%fz' % (x, y, z)) 

26 self.gui.set_frame() 

27 

28 def update_angles(self): 

29 angles = irotate(self.gui.axes) 

30 for r, a in zip(self.rotate, angles): 

31 r.value = a