Python wx.SYS_COLOUR_WINDOW Examples

The following are 13 code examples of wx.SYS_COLOUR_WINDOW(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module wx , or try the search function .
Example #1
Source File: window_dialog.py    From wxGlade with MIT License 6 votes vote down vote up
def on_text(self, event):
        import re
        validation_re = re.compile(r'^[a-zA-Z_]+[\w:.0-9-]*$')
        name = event.GetString()
        OK = bool( validation_re.match( name ) )
        if not OK:
            self.klass.SetBackgroundColour(wx.RED)
            compat.SetToolTip(self.klass, "Class name not valid")
        else:
            #if name in [c.widget.klass for c in common.root.children or []]:
            if self.toplevel and name in self.toplevel_names:
                self.klass.SetBackgroundColour( wx.RED )
                compat.SetToolTip(self.klass, "Class name already in use for toplevel window")
                OK = False
            elif name in self.class_names:
                # if the class name is in use already, indicate in yellow
                self.klass.SetBackgroundColour( wx.Colour(255, 255, 0, 255) )
                compat.SetToolTip(self.klass, "Class name not unique")
                if self.toplevel and name in self.toplevel_names: OK = False
            else:
                self.klass.SetBackgroundColour( compat.wx_SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW) )
                compat.SetToolTip(self.klass, "")
        self.klass.Refresh()
        self.btnOK.Enable(OK)
        event.Skip() 
Example #2
Source File: new_properties.py    From wxGlade with MIT License 6 votes vote down vote up
def _on_text(self, event):
        if self.deactivated or self.blocked: return
        text = event.GetString()
        if not self.validation_re:
            if self.control_re.search(text):
                # strip most ASCII control characters
                self.text.SetValue(self.control_re.sub("", text))
                wx.Bell()
                return
        elif self.check(text):
            self.text.SetBackgroundColour( compat.wx_SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW) )
            self.text.Refresh()
        else:
            self.text.SetBackgroundColour(wx.RED)
            self.text.Refresh()
        event.Skip() 
Example #3
Source File: new_properties.py    From wxGlade with MIT License 6 votes vote down vote up
def _check(self, klass, ctrl=None):
        # called by _on_text and create_text_ctrl to validate and indicate
        if not self.text and not ctrl: return
        if ctrl is None: ctrl = self.text
        if not self.validation_re.match(klass):
            ctrl.SetBackgroundColour(wx.RED)
            compat.SetToolTip(ctrl, "Name is not valid.")
        else:
            msg = self._check_class_uniqueness(klass)
            if not msg:
                ctrl.SetBackgroundColour( compat.wx_SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW) )
                compat.SetToolTip( ctrl, self._find_tooltip() )
            else:
                ctrl.SetBackgroundColour( wx.Colour(255, 255, 0, 255) )  # YELLOW
                compat.SetToolTip(ctrl, msg)
        ctrl.Refresh() 
Example #4
Source File: menubar.py    From wxGlade with MIT License 6 votes vote down vote up
def on_name_edited(self, event):
        value = self.name.GetValue()
        if not value or self.name_re.match(value):
            self.name.SetBackgroundColour( compat.wx_SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW) )
            valid = True
        else:
            self.name.SetBackgroundColour(wx.RED)
            valid = False
        if value and valid and not self._ignore_events:
            # check for double names
            for i in range(self.items.GetItemCount()):
                if i==self.selected_index: continue
                if value == self._get_item_text(i, "name"):
                    valid = False
                    self.name.SetBackgroundColour( wx.Colour(255, 255, 0, 255) )  # YELLOW
                    break
        self.name.Refresh()
        self._on_edited(event, "name", value, valid) 
Example #5
Source File: settings.py    From nuxhash with GNU General Public License v3.0 5 votes vote down vote up
def _OnSetValue(self, event):
        if not check_bc(self.GetValue()):
            self.SetBackgroundColour(INVALID_COLOR)
        else:
            self.SetBackgroundColour(
                wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW))
        event.Skip() 
Example #6
Source File: matplotlib_example.py    From wxGlade with MIT License 5 votes vote down vote up
def _get_float(self, control):
        # returns a float or None if not a valid float
        try:
            ret = float( control.GetValue() )
            colour = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)
            control.SetBackgroundColour(colour)
        except:
            control.SetBackgroundColour(wx.RED)
            wx.Bell()
            ret = None
        control.Refresh()
        return ret

    ####################################################################################################################
    # mouse actions 
Example #7
Source File: new_properties.py    From wxGlade with MIT License 5 votes vote down vote up
def _on_text(self, event):
        if self.deactivated or self.blocked: return
        name = event.GetString()
        match = self.validation_re.match(name)
        if match:
            if self._check_name_uniqueness(name):
                self.text.SetBackgroundColour( compat.wx_SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW) )
            else:
                self.text.SetBackgroundColour( wx.Colour(255, 255, 0, 255) )  # YELLOW
        else:
            self.text.SetBackgroundColour(wx.RED)
        self.text.Refresh()
        event.Skip() 
Example #8
Source File: menubar.py    From wxGlade with MIT License 5 votes vote down vote up
def on_event_handler_edited(self, event):
        value = self.event_handler.GetValue()
        if not value or self.handler_re.match(value):
            self.event_handler.SetBackgroundColour( compat.wx_SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW) )
            valid = True
        else:
            self.event_handler.SetBackgroundColour(wx.RED)
            valid = False
        self.event_handler.Refresh()
        self._on_edited(event, "event_handler", value, valid) 
Example #9
Source File: toolbar.py    From wxGlade with MIT License 5 votes vote down vote up
def _select_item(self, index, force=False):
        item_count = self.items.GetItemCount()
        if index == -1 and item_count: index = 0
        if index >= item_count and item_count: index = item_count-1
        if index==self.selected_index and not force: return
        self.selected_index = index
        if index == -1:
            self._enable_fields(False, clear=True)
            self._enable_buttons()
            return

        self._ignore_events = True
        self.items.Select(index)

        if self._get_item_text(index, "label") != '---':
            # skip if the selected item is a separator
            for i,colname in enumerate(self.columns):
                s = getattr(self, colname)
                coltype = self.coltypes.get(colname,None)
                value = self._get_item_text(index, i)
                if coltype is None:
                    # at this point, the value should be validated already
                    s.SetBackgroundColour( compat.wx_SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW) )
                    s.SetValue(value)
                elif coltype is int:
                    s.SetSelection( int(value) )
            self.label.SetValue(self.label.GetValue().lstrip())
            self._enable_fields(True)
        else:
            self._enable_fields(False, clear=True)
        self._enable_buttons()
        state = wx.LIST_STATE_SELECTED | wx.LIST_STATE_FOCUSED
        self.items.SetItemState(index, state, state)  # fix bug 698071 
Example #10
Source File: toolbar.py    From wxGlade with MIT License 5 votes vote down vote up
def on_event_handler_edited(self, event):
        value = self.handler.GetValue()
        if not value or self.handler_re.match(value):
            self.handler.SetBackgroundColour( compat.wx_SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW) )
            valid = True
        else:
            self.handler.SetBackgroundColour(wx.RED)
            valid = False
        self.handler.Refresh()
        self._on_edited(event, "handler", value, valid) 
Example #11
Source File: RTyyyy_uicore.py    From NXP-MCUBootUtility with Apache License 2.0 4 votes vote down vote up
def setHwCryptoCertColor( self ):
        txt = self.m_choice_enableCertForHwCrypto.GetString(self.m_choice_enableCertForHwCrypto.GetSelection())
        self.toolCommDict['certOptForHwCrypto'] = self.m_choice_enableCertForHwCrypto.GetSelection()
        strMemType, strHasDcd = self._RTyyyy_getImgName()
        imgPath = ""
        strHwCryptoType = ""
        if self.secureBootType == RTyyyy_uidef.kSecureBootType_BeeCrypto:
            strHwCryptoType = 'bee'
        elif self.secureBootType == RTyyyy_uidef.kSecureBootType_OtfadCrypto:
            strHwCryptoType = 'otfad'
        else:
            pass
        if txt == 'No':
            self.isCertEnabledForHwCrypto = False
            self.m_button_genImage.SetLabel(uilang.kMainLanguageContentDict['button_genImage_u'][self.languageIndex])
            imgPath = "../img/RT10yy/nor_image_" + strHasDcd + "unsigned_" + strHwCryptoType + "_encrypted.png"
        elif txt == 'Yes':
            self.isCertEnabledForHwCrypto = True
            self.m_button_genImage.SetLabel(uilang.kMainLanguageContentDict['button_genImage_s'][self.languageIndex])
            imgPath = "../img/RT10yy/nor_image_" + strHasDcd + "signed_" + strHwCryptoType + "_encrypted.png"
        else:
            pass
        self.showImageLayout(imgPath.encode('utf-8'))
        self.m_button_flashImage.SetLabel(uilang.kMainLanguageContentDict['button_flashImage_e'][self.languageIndex])
        self.resetCertificateColor()
        if self.isCertEnabledForHwCrypto:
            activeColor = None
            if self.keyStorageRegion == RTyyyy_uidef.kKeyStorageRegion_FixedOtpmkKey:
                activeColor = uidef.kBootSeqColor_Active
            elif self.keyStorageRegion == RTyyyy_uidef.kKeyStorageRegion_FlexibleUserKeys:
                activeColor = uidef.kBootSeqColor_Optional
            else:
                pass
            self.m_panel_doAuth1_certInput.Enable( True )
            self.m_panel_doAuth1_certInput.SetBackgroundColour( activeColor )
            self.m_textCtrl_serial.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_WINDOW ) )
            self.m_textCtrl_keyPass.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_WINDOW ) )
            self.m_panel_doAuth2_certFmt.Enable( True )
            self.m_panel_doAuth2_certFmt.SetBackgroundColour( activeColor )
            self.m_button_genCert.Enable( True )
            self.m_button_genCert.SetBackgroundColour( activeColor )
            self.m_panel_progSrk1_showSrk.Enable( True )
            self.m_panel_progSrk1_showSrk.SetBackgroundColour( activeColor )
            self.m_button_progSrk.Enable( True )
            self.m_button_progSrk.SetBackgroundColour( activeColor )
        self.Refresh() 
Example #12
Source File: WindowDragFinder.py    From EventGhost with GNU General Public License v2.0 4 votes vote down vote up
def __init__(self, parent, startFunc, endFunc):
        self.startFunc = startFunc
        self.endFunc = endFunc

        self.text = eg.plugins.Window.FindWindow.text
        wx.PyWindow.__init__(self, parent, -1, style=wx.SIMPLE_BORDER)
        self.SetBackgroundColour(
            wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)
        )
        self.lastTarget = None

        # load images
        self.dragBoxBitmap = GetInternalBitmap("findert")
        image = GetInternalImage('findertc')
        image.SetMaskColour(255, 0, 0)

        # since this image didn't come from a .cur file, tell it where the
        # hotspot is
        image.SetOptionInt(wx.IMAGE_OPTION_CUR_HOTSPOT_X, 15)
        image.SetOptionInt(wx.IMAGE_OPTION_CUR_HOTSPOT_Y, 16)

        # make the image into a cursor
        self.cursor = wx.CursorFromImage(image)

        # the image of the drag target
        dragBoxImage = wx.StaticBitmap(self, -1, self.dragBoxBitmap)
        dragBoxImage.SetMinSize(self.dragBoxBitmap.GetSize())
        dragBoxImage.Bind(wx.EVT_LEFT_DOWN, self.OnDragboxClick)
        self.dragBoxImage = dragBoxImage

        # some description for the drag target
        dragBoxText = wx.StaticText(
            self,
            -1,
            self.text.drag2,
            style=wx.ALIGN_CENTRE
        )
        x1, y1 = dragBoxText.GetBestSize()
        dragBoxText.SetLabel(self.text.drag1)
        x2, y2 = dragBoxText.GetBestSize()
        dragBoxText.SetMinSize((max(x1, x2), max(y1, y2)))
        #dragBoxText.Bind(wx.EVT_LEFT_DOWN, self.OnDragboxClick)
        self.dragBoxText = dragBoxText

        self.Bind(wx.EVT_SIZE, self.OnSize)

        # put our drag target together
        sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(dragBoxImage, 0, wx.ALIGN_CENTER_VERTICAL)
        sizer.Add(dragBoxText, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL)
        self.SetSizer(sizer)
        self.SetAutoLayout(True)
        sizer.Fit(self)
        self.SetMinSize(self.GetSize())
        wx.CallAfter(self.dragBoxImage.SetBitmap, self.dragBoxBitmap) 
Example #13
Source File: HeaderBox.py    From EventGhost with GNU General Public License v2.0 4 votes vote down vote up
def __init__(self, parent, name="", text="", icon=None, url = None):
        text = REPLACE_BR_TAG.sub('\n', text)
        text = REMOVE_HTML_PATTERN.sub('', text).strip()
        if text == name:
            text = ""
        self.parent = parent
        wx.PyWindow.__init__(self, parent, -1)
        self.SetBackgroundColour(
            wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)
        )

        nameBox = wx.StaticText(self, -1, name)
        font = wx.Font(8, wx.SWISS, wx.NORMAL, wx.FONTWEIGHT_BOLD)
        nameBox.SetFont(font)

        self.text = '<html><body bgcolor="%s" text="%s">%s</body></html>' % (
            self.GetBackgroundColour().GetAsString(wx.C2S_HTML_SYNTAX),
            self.GetForegroundColour().GetAsString(wx.C2S_HTML_SYNTAX),
            text
        )
        if url:
            self.text = eg.Utils.AppUrl(self.text, url)
        descBox = eg.HtmlWindow(self, style=wx.html.HW_NO_SELECTION)
        descBox.SetBorders(1)
        descBox.SetFonts("Arial", "Times New Roman", [8, 8, 8, 8, 8, 8, 8])
        descBox.Bind(wx.html.EVT_HTML_LINK_CLICKED, self.OnLinkClicked)
        self.descBox = descBox

        staticBitmap = wx.StaticBitmap(self)
        staticBitmap.SetIcon(icon.GetWxIcon())

        mainSizer = eg.HBoxSizer(
            ((4, 4)),
            (staticBitmap, 0, wx.TOP, 5),
            ((4, 4)),
            (eg.VBoxSizer(
                ((4, 4)),
                (eg.HBoxSizer(
                    (nameBox, 1, wx.EXPAND | wx.ALIGN_BOTTOM),
                ), 0, wx.EXPAND | wx.TOP, 2),
                (descBox, 1, wx.EXPAND | wx.LEFT | wx.RIGHT, 8),
            ), 1, wx.EXPAND),
        )
        # odd sequence to setup the window, but all other ways seem
        # to wrap the text wrong
        self.SetSizer(mainSizer)
        self.SetAutoLayout(True)
        mainSizer.Fit(self)
        mainSizer.Layout()
        self.Layout()
        self.Bind(wx.EVT_SIZE, self.OnSize)