本文整理汇总了Python中wx.Bell方法的典型用法代码示例。如果您正苦于以下问题:Python wx.Bell方法的具体用法?Python wx.Bell怎么用?Python wx.Bell使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wx
的用法示例。
在下文中一共展示了wx.Bell方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OnChar
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Bell [as 别名]
def OnChar(self, event):
key = event.GetKeyCode()
if wx.WXK_SPACE == key or chr(key) in string.hexdigits:
value = event.GetEventObject().GetValue() + chr(key)
if apduregexp.match(value):
event.Skip()
return
if key < wx.WXK_SPACE or key == wx.WXK_DELETE or key > 255:
event.Skip()
return
if not wx.Validator_IsSilent():
wx.Bell()
return
示例2: _on_text
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Bell [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: move_item_left
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Bell [as 别名]
def move_item_left(self, event=None, index=None):
"""moves the selected menu item one level up in the hierarchy, i.e.
shifts its label 4 spaces left in self.menu_items"""
if index is None:
index = self.selected_index
if index <= 0:
wx.Bell()
return
level = self.item_level(index)
if level==0 or ( index+1 < self.items.GetItemCount() and (level < self.item_level(index+1)) ):
wx.Bell()
return
level -= 1
label = self._get_item_text(index, "label")
self._set_item_string(index, "label", label[4:])
self._set_item_string(index, "level", level)
self.items.SetItemState(index, wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED)
self._enable_buttons()
示例4: move_item_right
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Bell [as 别名]
def move_item_right(self, event):
"""moves the selected menu item one level down in the hierarchy, i.e.
shifts its label 4 spaces right in self.menu_items"""
index = self.selected_index
if index <= 0:
wx.Bell()
return
level = self.item_level(index)
if level > self.item_level(index-1):
wx.Bell()
return
level += 1
label = self._get_item_text(index, "label")
self._set_item_string(index, "label", misc.wxstr(" "*4) + label)
self._set_item_string(index, "level", level)
self.items.SetItemState(index, wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED)
self._enable_buttons()
示例5: OnChar
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Bell [as 别名]
def OnChar(self, event):
key = event.GetKeyCode()
if key < wx.WXK_SPACE or key == wx.WXK_DELETE or key > 255:
event.Skip()
return
if chr(key) in string.digits:
event.Skip()
return
if not wx.Validator_IsSilent():
wx.Bell()
# Returning without calling event.Skip eats the event before it
# gets to the text control
return
示例6: _TimeCtrl__IncrementValue
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Bell [as 别名]
def _TimeCtrl__IncrementValue(self, key, pos):
text = self.GetValue()
field = self._FindField(pos)
start, end = field._extent
slice = text[start:end]
if slice == 'A':
newslice = 'P'
elif slice == 'P':
newslice = 'A'
else:
top = 24 if field._index == 0 else 60
increment = 1 if key == wx.WXK_UP else -1
newslice = "%02d" % ((int(slice) + increment) % top)
newvalue = text[:start] + newslice + text[end:]
try:
self._SetValue(newvalue)
except ValueError: # must not be in bounds:
if not wx.Validator_IsSilent():
wx.Bell()
示例7: OnChar
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Bell [as 别名]
def OnChar(self, event):
"""Process values as they are entered into the control
@param event: event that called this handler
"""
key = event.GetKeyCode()
if event.CmdDown() or key < wx.WXK_SPACE or key == wx.WXK_DELETE or \
key > 255 or chr(key) in Util.HEXCHARS:
event.Skip()
return
if not wx.Validator_IsSilent():
wx.Bell()
return
示例8: _get_float
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Bell [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
示例9: on_char
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Bell [as 别名]
def on_char(self, event):
key = (event.GetKeyCode(), event.GetModifiers()) # modifiers: 1,2,4 for Alt, Ctrl, Shift
focused = self.FindFocus()
if not focused or not focused.Id in self._id_to_coordinate:
return event.Skip()
row, col = self._id_to_coordinate[focused.Id]
new_row = new_col = None
if key[0]==wx.WXK_UP:
if row>0: new_row = row-1
elif key[0]==wx.WXK_DOWN:
if row < len(self._ids_by_row)-1: new_row = row+1
elif key[0]==wx.WXK_LEFT:
if col>0: new_col = col-1
elif key[0]==wx.WXK_RIGHT:
if col < len(self._ids_by_row[row])-1: new_col = col+1
elif key[0]==wx.WXK_HOME:
new_col = 0
elif key[0]==wx.WXK_END:
new_col = len(self._ids_by_row[row])-1
elif key[0]==wx.WXK_PAGEUP:
new_row = 0
elif key[0]==wx.WXK_PAGEDOWN:
new_row = len(self._ids_by_row)-1
elif (ord("A") <= key[0] <= ord("Z")) and chr(key[0]) in misc.palette_hotkeys:
section = misc.palette_hotkeys[chr(key[0])]
new_row = self._section_to_row[section]
new_col = 0
else:
return event.Skip()
if new_row is None and new_col is None:
# limits hit
wx.Bell()
else:
if new_col is None: new_col = min(col, len(self._ids_by_row[new_row])-1)
if new_row is None: new_row = row
focus = self.FindWindowById(self._ids_by_row[new_row][new_col])
if focus: focus.SetFocus()
示例10: paste
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Bell [as 别名]
def paste(widget):
"""Copies a widget (and all its children) from the clipboard to the given
destination (parent, sizer and position inside the sizer). Returns True on success."""
error = None
if not wx.TheClipboard.Open():
misc.error_message( "Clipboard can't be opened." )
return False
try:
data_object = None
for fmt in [widget_data_format, sizer_data_format, window_data_format,
menubar_data_format, toolbar_data_format]:
if wx.TheClipboard.IsSupported(fmt):
data_object = wx.CustomDataObject(fmt)
break
if data_object is None:
misc.info_message( "The clipboard doesn't contain wxGlade widget data." )
return False
if not wx.TheClipboard.GetData(data_object):
misc.error_message( "Data can't be copied from clipboard." )
return False
finally:
wx.TheClipboard.Close()
format_name = data_object.GetFormat().GetId().split(".")[1] # e.g. 'wxglade.widget' -> 'widget'
compatible, message = widget.check_compatibility(None, format_name)
if not compatible:
wx.Bell()
if message:
misc.error_message(message)
return False
if not widget.clipboard_paste(data_object.GetData()):
misc.error_message("Paste failed")
示例11: _can_remove
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Bell [as 别名]
def _can_remove():
global focused_widget
if focused_widget is None or not hasattr(focused_widget, "remove"): return False
if focused_widget.IS_SLOT:
# XXX change this later on, to remove e.g. notebook pages, but not when parent.CHILDREN is an int
if focused_widget.parent.CHILDREN == -1: return True
if focused_widget.parent.WX_CLASS in ("wxNotebook",): return True
if not focused_widget.parent.IS_SIZER or focused_widget.sizer._IS_GRIDBAG:
wx.Bell()
return False
return True
示例12: _cut
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Bell [as 别名]
def _cut():
global focused_widget
if not _can_remove():
wx.Bell()
return
clipboard.cut(focused_widget)
#focused_widget = None
示例13: _paste
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Bell [as 别名]
def _paste():
if focused_widget is None: return
if not hasattr(focused_widget, "clipboard_paste"):
wx.Bell()
return
clipboard.paste(focused_widget)
示例14: drop
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Bell [as 别名]
def drop():
global focused_widget
method = None
if not focused_widget: return
if not focused_widget.check_drop_compatibility():
wx.Bell()
return
if focused_widget.IS_SLOT:
method = getattr(focused_widget, "on_drop_widget", None)
elif common.adding_sizer:
method = getattr(focused_widget, "drop_sizer", None)
#if not method:
#if not hasattr(focused_widget, "sizer"): return
#method = getattr(focused_widget.sizer, "add_slot", None)
if method: method(None, False) # don't reset, but continue adding
示例15: _check_for_user_modification
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Bell [as 别名]
def _check_for_user_modification(self, new_value=None, force=False, activate=False):
if new_value is None:
new_value = self._convert_from_text(self.text.GetValue())
if new_value is None: # e.g. validation failed
wx.Bell()
self.text.SetValue( self._convert_to_text(self.value))
return
self.previous_value = self.value
return Property._check_for_user_modification(self, new_value, force, activate)