Title: [commits] (john) [16043] refactored some code while reviewing bug #9442: Recorded script quick entry creation of an item with apostrophe in title generates invalid python r=dans
Revision
16043
Author
john
Date
2007-12-04 13:32:21 -0800 (Tue, 04 Dec 2007)

Log Message

refactored some code while reviewing bug #9442: Recorded script quick entry creation of an item with apostrophe in title generates invalid python r=dans

Modified Paths

Diff

Modified: trunk/chandler/parcels/osaf/framework/blocks/MenusAndToolbars.py (16042 => 16043)

--- trunk/chandler/parcels/osaf/framework/blocks/MenusAndToolbars.py	2007-12-04 19:51:30 UTC (rev 16042)
+++ trunk/chandler/parcels/osaf/framework/blocks/MenusAndToolbars.py	2007-12-04 21:32:21 UTC (rev 16043)
@@ -327,7 +327,12 @@
             control = wxQuickEntry (self.parentBlock.widget,
                                     self.getWidgetID(),
                                     style = wx.TE_PROCESS_ENTER)
-            control.SetName (self.blockName)
+            # On platforms other than macintosh the text control is a child of the wxSearchCtrl.
+            if wx.Platform == '__WXMAC__':
+                textCtrl = control
+            else:
+                textCtrl = control.GetChildren() [0]
+            textCtrl.SetName (self.blockName)
             # Apparently on Macintosh the selection starts out random, which causes it to crash
             # when setting text because it trys to delete characters that don't exist
             control.SetSelection (0, 0)

Modified: trunk/chandler/parcels/osaf/framework/script_recording/__init__.py (16042 => 16043)

--- trunk/chandler/parcels/osaf/framework/script_recording/__init__.py	2007-12-04 19:51:30 UTC (rev 16042)
+++ trunk/chandler/parcels/osaf/framework/script_recording/__init__.py	2007-12-04 21:32:21 UTC (rev 16043)
@@ -348,7 +348,7 @@
                                 (widget.GetLabel(), self.lineNumber, os.linesep)
                 
                     elif eventType == "wx.EVT_LEFT_DOWN":
-                        self.comments += "        Left Mouse Down in " + sentToName + os.linesep
+                        self.comments += "        Left Mouse Down in %s (%d)%s" % (sentToName, self.lineNumber, os.linesep)
                     elif eventType == "wx.EVT_LEFT_DCLICK":
                         self.comments += "        Left Mouse Double Click in " + sentToName + os.linesep
 
@@ -398,13 +398,6 @@
 
                         focusWindow = wx.Window_FindFocus()
                         
-                        if wx.Platform != "__WXMAC__":
-                            # On platforms other than mac the focus window is a wx.TextCtrl
-                            # whose parent is the wx.SearchCtrl
-                            parentWidget = focusWindow.GetParent()
-                            if isinstance (parentWidget, wx.SearchCtrl):
-                                focusWindow = parentWidget
-
                         # Record the focus for verification on playback only for certain
                         # types of events
                         if (eventType in checkFocusEventTypes):

Modified: trunk/chandler/parcels/osaf/framework/script_recording/script_lib.py (16042 => 16043)

--- trunk/chandler/parcels/osaf/framework/script_recording/script_lib.py	2007-12-04 19:51:30 UTC (rev 16042)
+++ trunk/chandler/parcels/osaf/framework/script_recording/script_lib.py	2007-12-04 21:32:21 UTC (rev 16043)
@@ -65,11 +65,6 @@
     if isinstance (sentToWidget, wx.ToolBarTool):
         assert sentToWidget.IsControl()
         sentToWidget = sentToWidget.GetControl()
-        # On platforms other than mac wx.SearchCtrl's child is the wx.TextCtrl
-        # rather than the wx.SearchCtrl itself.
-        if wx.Platform != "__WXMAC__":
-            if isinstance (sentToWidget, wx.SearchCtrl):
-                sentToWidget = sentToWidget.GetChildren()[0]
 
     elif isinstance (sentToWidget, wx.MenuItem):
         assert sentToWidget.IsSubMenu()
@@ -143,20 +138,6 @@
             recordedFocusWindowClass = properties["recordedFocusWindowClass"]
             focusWindow = wx.Window_FindFocus()
             
-            if wx.Platform != "__WXMAC__" and focusWindow is not None:
-                # On platforms other than mac the focus window is a wx.TextCtrl
-                # whose parent is the wx.SearchCtrl. Go dig out the toolbar item
-                # corresponding to the wx.SearchCtrl.
-                parentWidget = focusWindow.GetParent()
-                if isinstance (parentWidget, wx.SearchCtrl):
-                    focusWindow = parentWidget
-
-            # Rarely, a block has more than one widget associated with it, e.g. a toolBarItem
-            # with a wx.SearchCtrl. If we get the widget associated with out block, we'll always
-            # get the same widget in the case of multiple widgets per blocks.
-            if hasattr (focusWindow, "blockItem"):
-                focusWindow = focusWindow.blockItem.widget
-
             # On Macintosh there is a setting under SystemPreferences>Keyboar&Mouse>KeyboardShortcuts
             # neare the bottom of the page titled "Full Keyboard Access" that defaults to
             # not letting you set the focus to certain controls, e.g. CheckBoxes. So we




_______________________________________________
Commits mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/commits

Reply via email to