1 from Tkinter import *
2 import tkMessageBox
3 import Pmw
4
5 from teamwork.action.PsychActions import ActionCondition
6
8 """Class for specifying L{ActionCondition}s
9 """
11 optiondefs = (
12 ('actions', [], None),
13 ('activatecommand', self.setActions, None),
14 )
15 self.defineoptions(kw, optiondefs)
16 Pmw.Dialog.__init__(self,parent)
17 self.createcomponent('label',(),None,Label,(self.interior(),),
18 bd=2,relief='ridge')
19 self.component('label').grid(row=0,column=0,sticky='ew',padx=10,pady=10)
20 self.createcomponent('options',(),None,Pmw.RadioSelect,
21 (self.interior(),),orient='vertical',
22 buttontype='checkbutton')
23 self.component('options').add('only',text='No other actions can occur')
24 self.component('options').grid(row=1,column=0,sticky='ew',
25 padx=10,pady=10)
26 self.createcomponent('actions',(),None,Pmw.ScrolledListBox,
27 (self.interior(),),
28 selectioncommand=self.selectAction,
29 listbox_exportselection=0,
30 listbox_selectmode='multiple')
31 self.component('actions').grid(row=2,column=0,sticky='ewns',
32 padx=10,pady=10)
33 self.initialiseoptions(ActionDialog)
34
36 self.component('actions').setlist(self['actions'])
37 self.selectAction()
38
40 """Callback when clicking on the action selection box
41 """
42 actions = list(self.component('actions').getvalue())
43 actions.sort()
44 if len(actions) > 0:
45 self.component('label').configure(text=', '.join(actions))
46 else:
47 self.component('label').configure(text='Any action')
48
58