def screenTest(self): ''' ''' if screenTestEnabled: text = [] text.append('screenTest: enabled=%s' % screenTestEnabled) try: from tsWxScreen import Screen as wxScreen myScreen = wxScreen( None, id=nextWindowId(), title='ScreenTest', pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE, name='My Screen') text.append( 'screenTest: name="%s"; rect=%s; clientRect=%s' % ( myScreen.TermName, myScreen.Rect, myScreen.ClientRect)) for child in myScreen.Children: text.append( 'screenTest: child="%s"; rect=%s; clientRect=%s' % ( child.GetLabel(), child.Rect, child.ClientRect)) except Exception as e: text.append('screenTest: exception=%s' % str(e)) row = 32 col = 1 for aline in text: try: myScreen.tsCursesAddStr( col, row, aline, attr=None, pixels=False) self.stdscr.refresh() except Exception as e: print(aline) row += 1
def __init__(self): ''' Create a new application object, starting the bootstrap process. ''' theClass = 'PyApp' wx.RegisterFirstCallerClassName(self, theClass) # Initiate bootstrap process EvtHandler.__init__(self) applicationId = wx.ID_ANY self.tsBeginClassRegistration(theClass, applicationId) self.ts_theTerminal = tsGTUI.GraphicalTextUserInterface(theClass) try: if True: PyApp._TheGeometry = self.ts_theTerminal.StdscrGeometryPixels else: (theScreenX, theScreenY, theScreenWidth, theScreenHeight) = self.ts_theTerminal.StdscrGeometry PyApp._TheGeometry = wxRect( theScreenX * wx.pixelWidthPerCharacter, theScreenY * wx.pixelHeightPerCharacter, theScreenWidth * wx.pixelWidthPerCharacter, theScreenHeight * wx.pixelHeightPerCharacter) except AttributeError: PyApp._TheGeometry = wxRect(-1, -1, -1, -1) self.ts_Active = True self.ts_AppName = None self.ts_AssertMode = False self.ts_ClassName = theClass self.ts_EventLoop = None self.ts_Exit = False self.ts_ExitMainLoop = False self.ts_ExitOnFrameDelete = True self.ts_IdleEvents = False self.ts_IsActive = False self.ts_LayoutDirection = wx.Layout_Default self.ts_PrintMode = wx.UseDefaultValue ## self.ts_thisown = None # Create a Frame that encompasses entire curses screen (stdscr). # It is the default for handling mouse clicks outside of those # top-level windows (frames and dialogs), and their children, # that do not fully occupy the curses screen. theParent = None self.ts_TheTopUserWindow = None self.ts_TheTopWindow = wxScreen( theParent, id=wx.ID_ANY, title='Screen', pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE, name=wx.ScreenNameStr) # Set default Window that will receive Keyboard Text Entry Input. # Must bypass use of self.tsRegisterKeyboardInputOrder() try: tsWxGTUI_DataBase.KeyboardInputRecipients[ 'lifoList'] = self.ts_TheTopWindow except Exception, errorCode: msg = 'txWxPyApp.__init__: errorCode=""%s"' % str(errorCode) self.logger.error(msg) print('ERROR: %s\n' % msg) raise tse.ProgramException(tse.APPLICATION_TRAP, msg)