def tsGetStdioPositionAndSize(self): ''' Return position and size of window used for redirected output. ''' if not self.ts_PyOnDemandStdioWindow: # Establish defaults until attributes finalized theRedirectedPos = wxPoint(-1, -1) theRedirectedSize = wxSize(450, 300) else: try: self.Display = wxDisplay(self) theClientArea = self.Display.theRedirectedStdioArea theRedirectedSize = wxSize(theClientArea.width, theClientArea.height) theRedirectedPos = wxPoint( theClientArea.x, theClientArea.y) except Exception, getError: theRedirectedPos = wxPoint(-1, -1) theRedirectedSize = wxSize(450, 300) self.logger.debug( ' GetStdioPositionAndSize Exception. %s' % getError) msg = 'GetStdioPositionAndSize Exception: %s' % str(getError) raise tse.ProgramException(tse.APPLICATION_TRAP, msg)
def tsInstallTheTerminalAccess(self, indent, theClass, applicationId): ''' Establish those display areas reserved for task bar and stdio redirection. Create links to the internal information needed to monitor and control the physical screen and virtual windows of the Graphical Text User Interface. ''' # Setup display features access if Object.TheDisplay is None: # Start Curses interface. reserveTaskBarAreaFlag = True reserveRedirectAreaFlag = True # Should default be True or False? reserveAreaFlags = { 'ReserveTaskBarArea': reserveTaskBarAreaFlag, 'ReserveRedirectArea': reserveRedirectAreaFlag} try: parent = self self.display = wxDisplay(parent, reserveAreaFlags) fmt = '%s%s.tsInstallTheTerminalAccess ' + \ 'to %s for class %s (%s)' msg = fmt % (indent, __title__, self.display, theClass, applicationId) self.logger.debug(msg) except Exception, e: self.display = None msg = '%s.tsInstallTheTerminalAccess: Exception = %s' % \ (__title__, e) self.logger.error(msg) raise tse.ProgramException(tse.APPLICATION_TRAP, msg) Object.TheDisplay = self.display try: self.terminal = self.display.TheTerminal except AttributeError, e: self.terminal = None msg = 'tsInstallTheTerminalAccess: Exception = %s' % e raise tse.ProgramException(tse.APPLICATION_TRAP, msg)
def main(self): ''' Get a wx App Build the communicate Frame Enter wx main loop ''' print(__header__) myDisplay = wxDisplay(self) try: theDisplayChangeMode = myDisplay.ChangeMode() self.logger.debug( 'ChangeMode: %s' % str(theDisplayChangeMode)) theDisplayClientArea = myDisplay.GetClientArea() self.logger.debug( 'GetClientArea: %s' % str(theDisplayClientArea)) theDisplayCount = myDisplay.GetCount() self.logger.debug( 'GetCount: %s' % str(theDisplayCount)) theDisplayCurrentMode = myDisplay.GetCurrentMode() self.logger.debug( 'GetCurrentMode: %s' % str(theDisplayCurrentMode)) theTopLeftPoint = (theDisplayClientArea.x, theDisplayClientArea.y) theDisplayGetFromTopLeftPoint = myDisplay.GetFromPoint( theTopLeftPoint) self.logger.debug( 'GetFromPoint (Top Left %s: 0 expected): %s' % ( str(theTopLeftPoint), str(theDisplayGetFromTopLeftPoint))) theCenterPoint = ( (theDisplayClientArea.x + theDisplayClientArea.width) // 2, (theDisplayClientArea.y + theDisplayClientArea.height) // 2) theDisplayGetFromCenterPoint = myDisplay.GetFromPoint( theCenterPoint) self.logger.debug( 'GetFromPoint (Center %s: 0 expected): %s' % ( str(theCenterPoint), str(theDisplayGetFromCenterPoint))) theBottomRightPoint = ( (theDisplayClientArea.x + theDisplayClientArea.width), (theDisplayClientArea.y + theDisplayClientArea.height)) theDisplayGetFromBottomRightPoint = myDisplay.GetFromPoint( theBottomRightPoint) self.logger.debug( 'GetFromPoint (Bottom Right %s: 0 expected): %s' % ( str(theBottomRightPoint), str(theDisplayGetFromBottomRightPoint))) theBeyondBottomRightPoint = ( (theDisplayClientArea.x + theDisplayClientArea.width) + 1, (theDisplayClientArea.y + theDisplayClientArea.height) + 1) theDisplayGetFromBeyondBottomRightPoint = myDisplay.GetFromPoint( theBeyondBottomRightPoint) self.logger.debug( 'GetFromPoint (Beyond Bottom Right %s: -1 expected): %s' % ( str(theBeyondBottomRightPoint), str(theDisplayGetFromBeyondBottomRightPoint))) theBeyondTopLeftPoint = ( (theDisplayClientArea.x - 1), (theDisplayClientArea.y - 1)) theDisplayGetFromBeyondTopLeftPoint = myDisplay.GetFromPoint( theBeyondTopLeftPoint) self.logger.debug( 'GetFromPoint (Beyond Top Left %s: -1 expected): %s' % ( str(theBeyondTopLeftPoint), str(theDisplayGetFromBeyondTopLeftPoint))) theWindow = myDisplay self.logger.debug( 'GetFromWindow (window %s: 0 expected) %s' % ( str(theWindow), str(myDisplay.GetFromWindow(theWindow)))) theNonWindow = None self.logger.debug( 'GetFromWindow (window %s: %s expected) %s' % ( str(theNonWindow), str(wx.NOT_FOUND), str(myDisplay.GetFromWindow(theNonWindow)))) self.logger.debug( 'GetGeometry: %s' % myDisplay.GetGeometry()) self.logger.debug( 'GetModes (DefaultVideoMode: %s expected) %s' % ( wx.DefaultVideoMode, myDisplay.GetModes(wx.DefaultVideoMode))) self.logger.debug( 'GetName: %s' % myDisplay.GetName()) self.logger.debug( 'IsOk: %s' % myDisplay.IsOk()) self.logger.debug( 'IsPrimary: %s' % myDisplay.IsPrimary()) self.logger.debug( 'ResetMode: %s' % myDisplay.ResetMode()) self.logger.debug( 'Children: %s' % str(myDisplay.Children)) self.logger.debug( 'stdscr: %s' % str(myDisplay.stdscr)) self.logger.debug( 'theRedirectedStdioArea: %s' % str( myDisplay.theRedirectedStdioArea)) self.logger.debug( 'theScreen: %s' % str(myDisplay.theScreen)) self.logger.debug( 'theTaskArea: %s' % str(myDisplay.theTaskArea)) self.logger.debug( 'theTasks: %s' % str(myDisplay.theTasks)) self.logger.debug( 'ClientArea: %s' % str(myDisplay.ClientArea)) self.logger.debug( 'CurrentMode: %s' % str(myDisplay.CurrentMode)) self.logger.debug( 'Geometry: %s' % str(myDisplay.Geometry)) self.logger.debug( 'HasColors: %s' % str(myDisplay.HasColors)) self.logger.debug( 'Modes: %s' % str(myDisplay.Modes)) self.logger.debug( 'Name: %s' % str(myDisplay.Name)) ## self.logger.debug( ## 'ColorDatabase: %s' % dir(ColorDatabase)) self.logger.debug( 'ColorDataBaseID: %s' % str( tsGTUI.GraphicalTextUserInterface.ColorDataBaseID)) except Exception, errorCode: self.logger.error('testDisplay.main: errorCode=%s' % \ str(errorCode))