コード例 #1
0
    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]))
コード例 #2
0
    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)