def CreateOutputWindow(self, st): ''' Create frame and text control. Append st (text) to output. Show the frame and bind the frame OnCloseButtton to the event. ''' # TBD - Under Construction. The class wxTextCtrl is not available. if not (self.ts_Frame is None): return try: self.ts_Frame = wxFrame( self.ts_Parent, id=-1, title=self.ts_Title, pos=wxPoint(self.ts_Rect.x, self.ts_Rect.y), size=wxSize(self.ts_Rect.width, self.ts_Rect.height), style=self.ts_Style, name=self.ts_Name) except Exception as frameError: self.logger.error( ' CreateOutputWindow: frameError. %s' % frameError) msg = 'CreateOutputWindow Frame Error: %s' % str(frameError) raise tse.ProgramException(tse.APPLICATION_TRAP, msg) if self.ts_Frame.display.HasColors: self.ts_Markup = wx.ThemeToUse['Stdio']['Markup']['DEFAULT'] else: self.ts_Markup = None try: self.ts_Text = wxTextCtrl( self.ts_Frame, id=-1, value=wx.EmptyString, pos=wxPoint( self.ts_ClientRect.x + self.ts_Margin.width, self.ts_ClientRect.y + self.ts_Margin.height), size=wxSize( self.ts_ClientRect.width - 2 * self.ts_Margin.width, self.ts_ClientRect.height - 2 * self.ts_Margin.height), style=0, # wx.TE_MULTILINE |wx.TE_READONLY, validator=wx.DefaultValidator, name=wx.TextCtrlNameStr) except Exception as textCtrError: self.logger.error( ' CreateOutputWindow: textCtlError. %s' % textCtrError) msg = 'CreateOutputWindow textCtr Error: %s' % str(textCtrError) raise tse.ProgramException(tse.APPLICATION_TRAP, msg) # Skip this since text has been pre-cached in self.write # before invocation of self.CreateOutputWindow. if False: self.ts_Text.AppendText(st) self.ts_Frame.Show(True)
def _tsCreateStatusText(self): ''' Create each Status Bar Field. Set label to empty string until application defines a real value.. ''' number = self.ts_nFields # self.GetFieldsCount() parent = self for index in range(number): theText = wxTextCtrl( parent, id=wx.ID_ANY, value=wx.EmptyString, pos=(self.ts_FieldRect[index].x + \ wx.pixelWidthPerCharacter, self.ts_FieldRect[index].y + \ wx.pixelHeightPerCharacter), size=(self.ts_FieldRect[index].width - \ 0 * wx.pixelWidthPerCharacter, self.ts_FieldRect[index].height - \ 0 * wx.pixelHeightPerCharacter), style=wx.DEFAULT_STATUSBAR_STYLE, validator=wx.DefaultValidator, name='%s(%d)' % (self.ts_Name, index)) if DEBUG: print('_tsCreateStatusText: index=%s; rect=%s' % ( index, self.ts_FieldRect[index])) try: self.ts_Fields[index] = theText except IndexError: self.ts_Fields.append(theText) self.logger.debug( '_tsCreateStatusText: self.ts_Fields[%d]: %s' % ( index, self.ts_Fields[index]))
def __init__(self, parent, id=wx.ID_ANY, bitmap=None, splashStyle=0, milliseconds=0, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_SPLASHSCREEN_STYLE): ''' Construct class. ''' theClass = 'SplashScreen' # Capture initial caller parametsrs before they are changed self.caller_bitmap = bitmap self.caller_splashStyle = splashStyle self.caller_milliseconds = milliseconds self.caller_parent = parent self.caller_id = id self.caller_pos = pos self.caller_size = size self.caller_style = style wx.RegisterFirstCallerClassName(self, theClass) TopLevelWindow.__init__(self) self.tsBeginClassRegistration(theClass, id) ## size = wxSize(500, 300) Frame.__init__( self, parent, id=wx.ID_ANY, title=wx.EmptyString, pos=pos, size=size, style=wx.BORDER_SIMPLE, #wx.DEFAULT_SPLASHSCREEN_STYLE, name=wx.SplashScreenNameStr) splashWindow = self splashWindow.ts_ForegroundColour = wx.COLOR_RED splashWindow.ts_BackgroundColour = wx.COLOR_WHITE self.ts_SplashStyle = splashStyle self.ts_SplashWindow = splashWindow self.ts_SplashTimeout = milliseconds self.ts_bitmap = wxTextCtrl( splashWindow, id=-1, value=wx.EmptyString, pos=wxPoint( splashWindow.ts_ClientRect.x + wx.pixelWidthPerCharacter, splashWindow.ts_ClientRect.y + wx.pixelHeightPerCharacter), size=wxSize( splashWindow.ts_ClientRect.width - ( 2 * wx.pixelWidthPerCharacter), splashWindow.ts_ClientRect.height -( 2 * wx.pixelHeightPerCharacter)), style=0, # wx.TE_MULTILINE |wx.TE_READONLY, validator=wx.DefaultValidator, name=wx.TextCtrlNameStr) self.ts_bitmap.AppendText(bitmap) self.ts_bitmap.Show() self.SetFocus() ## print('SplashScreen: Show') ## self.Show() ## print('SplashScreen: Sleep(%d)' % self.ts_SplashTimeout) ## time.sleep(self.ts_SplashTimeout / 1000) ## print('SplashScreen: Hide') ## self.Hide() self.tsEndClassRegistration(theClass)