1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
"""
__version__ = "$Revision: 1.1 $"
__date__ = "$Date: 2004/05/25 19:47:08 $"
"""
import sys
from PythonCard import model
import threading
import wx
class Runtime( threading.Thread ) :
def __init__( self, path, clazz ) :
threading.Thread.__init__( self )
sys.argv = [ path ]
self._clazz = clazz
self._running = False
self.start()
def run( self ) :
self._app = model.Application( self._clazz )
self._running = True
self._app.MainLoop()
def getApplication( self ) :
while not self._running :
pass
return self._app
class User( object ) :
def __init__( self, window ) :
"""
Create a test proxy to a PythonCard window.
"""
self._window = window
def click( self, path ) :
"""
Generate a mouse down event for the button
identified by 'path'.
Path example: myPanel.myButton
"""
button = self._window.getComponent( path )
event = wx.CommandEvent( wx.wxEVT_COMMAND_BUTTON_CLICKED, button.GetId() )
wx.PostEvent( button, event )
def type( self, path, text ) :
"""
Type the 'text', character by character, into
the TextField or TextArea identified by 'path'
Path example: myPanel.myField
"""
field = self._window.getComponent( path )
field.SetValue( text )
#event = wx.CommandEvent( wx.wxEVT_COMMAND_TEXT_ENTER, field.GetId() )
#wx.PostEvent( field, event )
def select( self, path, value ) :
"""
Set the selected value of the component
identified by path to 'value'. This method
can be used for popop menus, and single selection lists.
Path example: myPanel.myMenu
"""
pass
|