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

1import ase.gui.ui as ui 

2from ase.gui.i18n import _ 

3 

4 

5class Repeat: 

6 def __init__(self, gui): 

7 win = ui.Window(_('Repeat'), wmtype='utility') 

8 win.add(_('Repeat atoms:')) 

9 self.repeat = [ui.SpinBox(r, 1, 9, 1, self.change) 

10 for r in gui.images.repeat] 

11 win.add(self.repeat) 

12 win.add(ui.Button(_('Set unit cell'), self.set_unit_cell)) 

13 

14 for sb, vec in zip(self.repeat, gui.atoms.cell): 

15 if not vec.any(): 

16 sb.active = False 

17 

18 self.gui = gui 

19 

20 def change(self): 

21 repeat = [int(r.value) for r in self.repeat] 

22 self.gui.images.repeat_images(repeat) 

23 self.gui.set_frame() 

24 

25 def set_unit_cell(self): 

26 self.gui.images.repeat_unit_cell() 

27 for r in self.repeat: 

28 r.value = 1 

29 self.gui.set_frame()