本文整理汇总了Python中BaseWidget.BaseWidget类的典型用法代码示例。如果您正苦于以下问题:Python BaseWidget类的具体用法?Python BaseWidget怎么用?Python BaseWidget使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BaseWidget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: set_focus
def set_focus (self, focus=True):
"""E.set_focus (...) -> bool
Sets the input and action focus of the Editable.
Sets the input and action focus of the Editable and returns True
upon success or False, if the focus could not be set.
Note: This method only works as supposed using
a render loop, which supports the Renderer class specification.
"""
if not self.sensitive:
return False
BaseWidget.set_focus (self, focus)
if focus:
# Save the text after activation and reset the caret blink
# effects.
self._caret_visible = True
self._temp = self.text
self._caret_visible = True
self._counter = 0
self.state = STATE_ACTIVE
elif self._temp != self.text:
# If the Editable looses its input focus _and_ has changed text,
# it will be validated by default.
if base.debug: print "Editable.INPUT"
self._temp = self.text
self.state = STATE_NORMAL
self.run_signal_handlers (SIG_INPUT)
else:
# The Editable looses its input focus without any change.
self.state = STATE_NORMAL
self._caret = 0
return True
示例2: update
def update(self, **kwargs):
"""C.update (...) -> None
Updates the Container and refreshes its image and rect content.
Updates the Container and causes its parent to update itself on
demand.
"""
children = kwargs.get("children", {})
resize = kwargs.get("resize", False)
# We have to check for possible size changes here!
if resize:
self.dirty = True
elif self.locked:
return
else:
# Get the intersections with other overlapping children and add
# them to the update list.
items = children.items()
ch = self.children
for w, rect in items:
for widget in ch:
if w == widget:
continue
intersect = widget.rect.clip(rect)
if intersect.size != (0, 0):
children[widget] = intersect
BaseWidget.update(self, children=children, resize=resize)
示例3: __init__
def __init__(self, checked_text, unchecked_text, height, width, y, x, attr=None):
BaseWidget.__init__(self, height, width, y, x, attr)
self.CheckedText = "< " + checked_text + " >"
self.UncheckedText = "< " + unchecked_text + " >"
self.Text = self.UncheckedText
self.Checked = False
self.UpdateDisplay()
示例4: __init__
def __init__(self, lines, characters, y, x, resultsObj=None, colWidth=7, rowHeight=1, delimiter=" | "):
BaseWidget.__init__(self, lines, characters, y, x)
# position of the selector in DataTable
self.PosY = 0 # row
self.PosX = 0 # col
# DataTable UI Settings independent of Results Object
# Can update these as we choose for each DataTable Widget
if colWidth < 4:
self.ColWidth = 4
else:
self.ColWidth = colWidth # Width of each column, update as desired
if rowHeight < 1:
self.RowHeight = 1
else:
self.RowHeight = rowHeight # Height of each row, update as desired
if delimiter == "":
self.ColumnDelimiter = " | "
else:
self.ColumnDelimiter = delimiter # Delimiter string between each column's data, update as desired
# variables that govern table data
# these are base values to show an empty data table
# LoadResultsObject() will overwrite these with resultsObj data
self.Rows = 10
self.Columns = 10
self.RowLabelWidth = 2
# load data from resultsObj to be displayed
self.LoadResultsObject(resultsObj) # must be called upon init to set graphics for widget
self.UpdateDisplay()
示例5: __init__
def __init__( self, parent ):
BaseWidget.__init__ ( self, parent )
self.m_mainSizer = wx.BoxSizer( wx.VERTICAL )
m_errorMsgSizer = wx.BoxSizer( wx.VERTICAL )
self.m_errorLabel = wx.StaticText( self, wx.ID_ANY, u"Error Message", wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_errorLabel.Wrap( -1 )
m_errorMsgSizer.Add( self.m_errorLabel, 0, wx.TOP|wx.RIGHT|wx.LEFT, 5 )
self.m_errorMsgCtrl = wx.richtext.RichTextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0|wx.VSCROLL|wx.HSCROLL|wx.NO_BORDER|wx.WANTS_CHARS )
m_errorMsgSizer.Add( self.m_errorMsgCtrl, 1, wx.EXPAND |wx.ALL, 5 )
self.m_mainSizer.Add( m_errorMsgSizer, 1, wx.EXPAND, 5 )
m_diagnosticSizer = wx.BoxSizer( wx.VERTICAL )
self.m_diagnosticLabel = wx.StaticText( self, wx.ID_ANY, u"Diagnostics", wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_diagnosticLabel.Wrap( -1 )
m_diagnosticSizer.Add( self.m_diagnosticLabel, 0, wx.TOP|wx.RIGHT|wx.LEFT, 5 )
self.m_diagnosticCtrl = wx.richtext.RichTextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0|wx.VSCROLL|wx.HSCROLL|wx.NO_BORDER|wx.WANTS_CHARS )
m_diagnosticSizer.Add( self.m_diagnosticCtrl, 1, wx.EXPAND |wx.ALL, 5 )
self.m_mainSizer.Add( m_diagnosticSizer, 2, wx.EXPAND, 5 )
self.initButtons( [Globals.ButtonTypes.NETWORK_LOG] )
self.SetSizer( self.m_mainSizer )
self.Layout()
示例6: notify
def notify (self, event):
"""E.notify (...) -> None
Notifies the Editable about an event.
"""
if not self.sensitive:
return
# The next few events are only available, if the entry is focused.
if self.focus:
# Blinking caret.
# TODO: TICK events are not the best idea to use here.
if event.signal == SIG_TICK:
if self._counter == 50:
self._caret_visible = not self._caret_visible
self._counter = 0
self.dirty = True
self._counter += 1
elif event.signal == SIG_KEYDOWN:
if base.debug: print "Editable.KEYDOWN"
self.run_signal_handlers (SIG_KEYDOWN, event.data)
self._input (event.data)
self._counter = 0
self._caret_visible= True
BaseWidget.notify (self, event)
示例7: __init__
def __init__ (self, image):
BaseWidget.__init__ (self)
self._padding = 2
self._border = BORDER_NONE
self._picture = None
self._path = None
self.set_picture (image)
示例8: set_sensitive
def set_sensitive (self, sensitive=True):
"""B.set_sensitive (...) -> None
Sets the sensitivity of the Bin and its child.
"""
BaseWidget.set_sensitive (self, sensitive)
if self.child:
self.child.set_sensitive (sensitive)
示例9: set_sensitive
def set_sensitive(self, sensitive=True):
"""C.set_sensitive (...) -> None
Sets the sensitivity of the Container and its children.
"""
BaseWidget.set_sensitive(self, sensitive)
for child in self.children:
child.set_sensitive(sensitive)
示例10: __init__
def __init__(self, height, width, y, x, attr=None):
BaseWidget.__init__(self, height, width, y, x, attr)
self.Type = "TextBox"
self.Text = ""
self.DisplayText = ' ' * (width - 1)
self.DisplayMode = "STANDARD"
self.IsActive = False
self.UpdateDisplay()
示例11: __init__
def __init__ (self, scrolledlist):
BaseWidget.__init__ (self)
self._itemcollection = None
self.itemcollection = ListItemCollection ()
self.scrolledlist = scrolledlist
self._spacing = 2
self._signals[SIG_MOUSEDOWN] = []
self._signals[SIG_KEYDOWN] = None # Dummy for keyboard activation.
示例12: draw
def draw (self):
"""I.draw () -> None
Draws the ImageMap surface and places its picture on it.
"""
BaseWidget.draw (self)
rect = self.picture.get_rect ()
rect.center = self.image.get_rect ().center
self.image.blit (self.picture, rect)
示例13: __init__
def __init__ (self):
BaseWidget.__init__ (self)
self.size = 104, 24 # Use a fixed size.
# The current value, max is 100 (%), min is 0 (%) and step range.
self._value = 0
self._step = 0.1
self._text = None
self._signals[SIG_VALCHANGE] = []
示例14: set_indexable
def set_indexable (self, indexable):
"""B.set_indexable (...) -> None
Sets the indexable of the Bin.
Adds the Bin to an IIndexable implementation and causes its child
to be added to the same, too.
"""
BaseWidget.set_indexable (self, indexable)
if self.child:
self.child.set_indexable (indexable)
示例15: set_event_manager
def set_event_manager(self, manager):
"""C.set_event_manager (...) -> None
Sets the event manager of the Container.
Adds the Container to an event manager and causes its children
to be added to the same, too.
"""
BaseWidget.set_event_manager(self, manager)
for child in self.children:
child.set_event_manager(manager)