本文整理汇总了Python中wx.SYS_COLOUR_WINDOW属性的典型用法代码示例。如果您正苦于以下问题:Python wx.SYS_COLOUR_WINDOW属性的具体用法?Python wx.SYS_COLOUR_WINDOW怎么用?Python wx.SYS_COLOUR_WINDOW使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类wx
的用法示例。
在下文中一共展示了wx.SYS_COLOUR_WINDOW属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_text
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SYS_COLOUR_WINDOW [as 别名]
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()
示例2: _on_text
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SYS_COLOUR_WINDOW [as 别名]
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()
示例3: _check
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SYS_COLOUR_WINDOW [as 别名]
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()
示例4: on_name_edited
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SYS_COLOUR_WINDOW [as 别名]
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)
示例5: _OnSetValue
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SYS_COLOUR_WINDOW [as 别名]
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()
示例6: _get_float
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SYS_COLOUR_WINDOW [as 别名]
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
示例7: on_event_handler_edited
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SYS_COLOUR_WINDOW [as 别名]
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)
示例8: _select_item
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SYS_COLOUR_WINDOW [as 别名]
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
示例9: on_event_handler_edited
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SYS_COLOUR_WINDOW [as 别名]
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)
示例10: setHwCryptoCertColor
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SYS_COLOUR_WINDOW [as 别名]
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()
示例11: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SYS_COLOUR_WINDOW [as 别名]
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)
示例12: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SYS_COLOUR_WINDOW [as 别名]
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)