1 from Tkinter import *
2 import Pmw
3 from teamwork.math.KeyedVector import TrueRow
4 from teamwork.math.KeyedTree import KeyedPlane
5 from MatrixEditor import MatrixEditor
6
9 self.entity = entity
10 optiondefs = (
11 ('plane', KeyedPlane(TrueRow(),-.1), self.setPlane),
12 )
13 self.defineoptions(kw, optiondefs)
14 Pmw.Dialog.__init__(self,parent)
15 self.createcomponent('attribute',(),None,Label,
16 (self.component('dialogchildsite'),),
17 height=3,wraplength=300,
18 ).pack(side='top',expand='yes')
19
20 states = {}
21 for key in self.entity.getBeliefKeys():
22 states[str(key)] = key
23 self.createcomponent('selector',(),None,MatrixEditor,
24 (self.component('dialogchildsite'),),
25 states=states,
26 ).pack(side='top',fill='both',expand='yes')
27 self.component('selector_type').configure(entry_width=32,
28 selectioncommand=self.setBranch)
29 self.component('selector').displayBranch(self['plane'])
30 for name in self.component('selector').components():
31 if self.component('selector').componentgroup(name) == 'feature':
32 self.component('selector_%s' % (name)).configure(selectioncommand=self.updatePlane)
33 self.initialiseoptions()
34
36 self.component('attribute').configure(text=self['plane'].simpleText())
37
41
43 self['plane'] = self.component('selector').getBranch()
44