Statistiques
| Révision :

root / ase / gui / constraints.py @ 20

Historique | Voir | Annoter | Télécharger (1,2 ko)

1
#!/usr/bin/env python
2
from math import sqrt
3

    
4
import gtk
5

    
6
from ase.gui.languages import translate as _
7
from ase.gui.widgets import pack, Help
8

    
9

    
10
class Constraints(gtk.Window):
11
    def __init__(self, gui):
12
        gtk.Window.__init__(self)
13
        self.set_title(_('Constraints'))
14
        vbox = gtk.VBox()
15
        b = pack(vbox, [gtk.Button(_('Constrain')),
16
                        gtk.Label(_(' selected atoms'))])[0]
17
        b.connect('clicked', self.selected)
18
        b = pack(vbox, [gtk.Button(_('Constrain')),
19
                        gtk.Label(_(' immobile atoms:'))])[0]
20
        b.connect('clicked', self.immobile)
21
        b = pack(vbox, gtk.Button('Clear constraints'))
22
        b.connect('clicked', self.clear)
23
        close = pack(vbox, gtk.Button(_('Close')))
24
        close.connect('clicked', lambda widget: self.destroy())
25
        self.add(vbox)
26
        vbox.show()
27
        self.show()
28
        self.gui = gui
29

    
30
    def selected(self, button):
31
        self.gui.images.dynamic = ~self.gui.images.selected
32
        self.gui.draw()
33

    
34
    def immobile(self, button):
35
        self.gui.images.set_dynamic()
36
        self.gui.draw()
37

    
38
    def clear(self, button):
39
        self.gui.images.dynamic[:] = True
40
        self.gui.draw()
41