Changeset 3049

Show
Ignore:
Timestamp:
04/10/2007 03:50:56 PM (1 year ago)
Author:
nate
Message:

Modified the test classes to use the same dApp and dForm fixture. In other words, they won't be torn down each time we test a new widget.

Here is implementation 1 of dSearchBox. It works and the functionality is there. However, I still need to address the following:

1)I still need to work with the list class some to autogenerate the menu from a list and tie the menu event into a search event.

2) The CancelButtonVisible? property is half broken. I will fix it in dabo. If you set the property to True in initProperties, wx reports a memory leak. However, in afterInit and beyond it is ok. I will override the property and fix it.

3) Need to look into the SearchButtonVisible? property because it ain't working for me on windows. The search button is always visible. Guess it's not too much of an issue, but I would like to know why it is happening.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/NateBranch/dabo/dEvents.py

    r2976 r3049  
    190190 
    191191 
     192class SearchEvent(dEvent): 
     193    def appliesToClass(eventClass, objectClass): 
     194        return issubclass(objectClass, dabo.ui.dSearchBox) 
     195    appliesToClass = classmethod(appliesToClass) 
     196 
     197 
     198 
    192199class CalendarEvent(dEvent): 
    193200    def appliesToClass(eventClass, objectClass): 
     
    511518 
    512519 
     520class SearchButtonClicked(SearchEvent): 
     521    """Occurs when a user clicks the search button in a dSearchBox control.""" 
     522    pass 
     523 
     524class SearchCancelButtonClicked(SearchEvent): 
     525    """Occurs when a user clicks the cancel button in a dSearchBox control.""" 
     526    pass 
     527 
     528 
    513529class CalendarDateChanged(CalendarEvent): 
    514530    """Occurs when the date on a calendar is changed.""" 
  • branches/NateBranch/dabo/ui/uiwx/__init__.py

    r3011 r3049  
    122122from dPageFrameNoTabs import dPageFrameNoTabs 
    123123from dPage import dPage 
     124from dSearchBox import dSearchBox 
    124125from dSizer import dSizer 
    125126from dBorderSizer import dBorderSizer 
  • branches/NateBranch/dabo/ui/uiwx/dTextBox.py

    r3047 r3049  
    1 import re 
    2 import datetime 
    31import wx 
    4 import dabo.lib.dates 
    5  
    6 try: 
    7     import decimal 
    8 except ImportError: 
    9     # decimal is only in Python 2.4 or greater 
    10     decimal = None 
    112 
    123import dabo, dabo.ui 
     
    156 
    167import dTextBoxMixin as tbm 
    17 from dabo.dLocalize import _ 
    18 import dabo.dEvents as dEvents 
    19 from dabo.ui import makeDynamicProperty 
    20  
    218 
    229class dTextBox(tbm.dTextBoxMixin, wx.TextCtrl): 
     
    2815        tbm.dTextBoxMixin.__init__(self, preClass, parent, properties, attProperties,  
    2916                *args, **kwargs) 
    30      
    31      
     17 
    3218 
    3319 
     
    3925if __name__ == "__main__": 
    4026    import test 
     27    import datetime 
    4128 
    4229    # This test sets up several textboxes, each editing different data types.    
  • branches/NateBranch/tests/unitTests/ui/UIwx/Test_dTextBox.py

    r3048 r3049  
    2222#NOTE:  It would be really good if we could extract all of this out so we don't have 
    2323#       to do it for every single widget test 
    24 App = dabo.dApp() 
    25 App.setup() 
    26  
    27 testForm = dabo.ui.dForm() 
     24App = None 
     25testForm = None 
    2826 
    2927#Set up a base class that handle the set up and tear down of a semi-persistant test fixture 
  • branches/NateBranch/tests/unitTests/ui/UIwx/__init__.py

    r3047 r3049  
    44 
    55import unittest 
     6import dabo 
     7dabo.ui.loadUI('wx') 
     8 
     9#We want the dApp and mainForm to persist through the settings for speed sake 
     10#NOTE:  It would be really good if we could extract all of this out so we don't have 
     11#       to do it for every single widget test 
     12App = dabo.dApp() 
     13App.setup() 
     14 
     15testForm = dabo.ui.dForm() 
     16 
    617 
    718#suiteList should contain all of the suite that are recieved from the modules and TestCases 
     
    1425import Test_dTextBox 
    1526suiteList.append(unittest.TestLoader().loadTestsFromModule(Test_dTextBox)) 
     27Test_dTextBox.App = App 
     28Test_dTextBox.testForm = testForm 
     29 
    1630#import Test_dSearchBox 
    1731#suiteList.append(unittest.TestLoader().loadTestsFromModule(Test_dSearchBox)) 
     32#Test_dSearchBox.App = App 
     33#Test_dSearchBox.testForm = testForm 
    1834 
    1935#setup a suite and return it