本文整理汇总了Python中pyjamas.ui.Focus类的典型用法代码示例。如果您正苦于以下问题:Python Focus类的具体用法?Python Focus怎么用?Python Focus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Focus类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, min_value, max_value, start_value=None, step=None,
**kwargs):
if not kwargs.has_key("StyleName"): kwargs['StyleName'] = "gwt-VerticalSlider"
if kwargs.has_key('Element'):
# XXX FIXME: Focus.createFocusable is here for a reason...
element = kwargs.pop('Element')
else:
element = Focus.createFocusable()
DOM.setStyleAttribute(element, "position", "relative")
DOM.setStyleAttribute(element, "overflow", "hidden")
self.handle = DOM.createDiv()
DOM.appendChild(element, self.handle)
DOM.setStyleAttribute(self.handle, "border", "1px")
DOM.setStyleAttribute(self.handle, "width", "100%")
DOM.setStyleAttribute(self.handle, "height", "10px")
DOM.setStyleAttribute(self.handle, "backgroundColor", "#808080")
Control.__init__(self, element, min_value, max_value, start_value, step,
**kwargs)
self.addClickListener(self)
self.addFocusListener(self)
self.addMouseListener(self)
示例2: __init__
def __init__(self, width=0, height=0):
Widget.__init__(self)
self.context = None
self.setElement(DOM.createDiv())
canvas = DOM.createElement("canvas")
self.setWidth(width)
self.setHeight(height)
canvas.width=width
canvas.height=height
DOM.appendChild(self.getElement(), canvas)
self.setStyleName("gwt-Canvas")
self.init()
self.context.fillStyle = "black"
self.context.strokeStyle = "black"
self.focusable = None
self.focusable = Focus.createFocusable()
self.focusListeners = []
self.clickListeners = []
self.mouseListeners = []
self.keyboardListeners = []
DOM.appendChild(self.getElement(), self.focusable)
DOM.sinkEvents(canvas, Event.ONCLICK | Event.MOUSEEVENTS | DOM.getEventsSunk(canvas))
DOM.sinkEvents(self.focusable, Event.FOCUSEVENTS | Event.KEYEVENTS)
示例3: __init__
def __init__(self, **ka):
ka['StyleName'] = ka.get('StyleName', "gwt-Tree")
self.root = None
self.childWidgets = Set()
self.curSelection = None
self.focusable = None
self.focusListeners = []
self.mouseListeners = []
self.imageBase = pygwt.getModuleBaseURL()
self.keyboardListeners = []
self.listeners = []
self.lastEventType = ""
element = ka.pop('Element', None) or DOM.createDiv()
self.setElement(element)
DOM.setStyleAttribute(self.getElement(), "position", "relative")
self.focusable = Focus.createFocusable()
# Hide focus outline in Mozilla/Webkit/Opera
DOM.setStyleAttribute(self.focusable, "outline", "0px")
# Hide focus outline in IE 6/7
DOM.setElemAttribute(self.focusable, "hideFocus", "true");
DOM.setStyleAttribute(self.focusable, "fontSize", "0")
DOM.setStyleAttribute(self.focusable, "position", "absolute")
DOM.setIntStyleAttribute(self.focusable, "zIndex", -1)
DOM.appendChild(self.getElement(), self.focusable)
self.root = RootTreeItem()
self.root.setTree(self)
Widget.__init__(self, **ka)
self.sinkEvents(Event.ONMOUSEDOWN | Event.ONCLICK | Event.KEYEVENTS)
DOM.sinkEvents(self.focusable, Event.FOCUSEVENTS)
示例4: __init__
def __init__(self, min_value, max_value,
start_value=None, step=None,
**kwargs):
if not kwargs.has_key("StyleName"):
kwargs['StyleName'] = "gwt-VerticalSlider"
if kwargs.has_key('Element'):
# XXX FIXME: Focus.createFocusable is here for a reason...
element = kwargs.pop('Element')
else:
element = Focus.createFocusable()
DOM.setStyleAttribute(element, "position", "relative")
DOM.setStyleAttribute(element, "overflow", "hidden")
self.handle = DOM.createDiv()
DOM.appendChild(element, self.handle)
self.setHandleStyle("1px", "100%", "10px", "#808080")
# must use DoubleControl; otherwise, this init is = Vertical init,
# plus a change in the handle style
# this should be refactored, so that the AreaSlider
# can be built on VerticalSlider
DoubleControl.__init__(self, element, min_value, max_value,
start_value, step,
**kwargs)
self.addClickListener(self)
self.addFocusListener(self)
self.addMouseListener(self)
#Redefine VDS's styles for handle
self.setHandleStyle("1px", "10px", "10px", "#808080")
示例5: __init__
def __init__(self, **kwargs):
""" pass in Widget={the widget} so that Applier will call setWidget.
"""
SimplePanel.__init__(self, Focus.createFocusable(), **kwargs)
FocusHandler.__init__(self)
KeyboardHandler.__init__(self)
ClickHandler.__init__(self)
MouseHandler.__init__(self)
示例6: __init__
def __init__(self, child=None):
SimplePanel.__init__(self, Focus.createFocusable())
FocusHandler.__init__(self)
KeyboardHandler.__init__(self)
ClickHandler.__init__(self)
MouseHandler.__init__(self)
if child:
self.setWidget(child)
示例7: moveFocus
def moveFocus(self, selection):
focusableWidget = selection.getFocusableWidget()
if focusableWidget is not None:
focusableWidget.setFocus(True)
DOM.scrollIntoView(focusableWidget.getElement())
else:
selectedElem = selection.getContentElem()
containerLeft = self.getAbsoluteLeft()
containerTop = self.getAbsoluteTop()
left = DOM.getAbsoluteLeft(selectedElem) - containerLeft
top = DOM.getAbsoluteTop(selectedElem) - containerTop
width = DOM.getIntAttribute(selectedElem, "offsetWidth")
height = DOM.getIntAttribute(selectedElem, "offsetHeight")
DOM.setIntStyleAttribute(self.focusable, "left", left)
DOM.setIntStyleAttribute(self.focusable, "top", top)
DOM.setIntStyleAttribute(self.focusable, "width", width)
DOM.setIntStyleAttribute(self.focusable, "height", height)
DOM.scrollIntoView(self.focusable)
Focus.focus(self.focusable)
示例8: __init__
def __init__(self, coordX=None, coordY=None, pixelX=None, pixelY=None,
**kwargs):
"""
Creates an SVGCanvas element. Element type is 'svg'
@param coordX the size of the coordinate space in the x direction
@param coordY the size of the coordinate space in the y direction
@param pixelX the CSS width in pixels of the canvas element
@param pixelY the CSS height in pixels of the canvas element
"""
# init default coordinates/size
self.pixelHeight = 150
self.pixelWidth = 300
self.coordHeight = self.pixelHeight
self.coordWidth = self.pixelWidth
focusable = Focus.createFocusable()
self.canvas = self._createElementSVG("svg")
# create an empty defs element
self.defs = self._createElementSVG("defs")
# and add it to the canvas
DOM.appendChild(self.canvas, self.defs)
# now add canvas to container
DOM.appendChild(focusable, self.canvas)
# init base widget (invokes settables)
FocusWidget.__init__(self, focusable, **kwargs)
# since the Applier class provides settable access,
# we only override the dimensions if user actually
# provided them as keyword args
if pixelX is not None:
self.setPixelWidth(pixelX)
if pixelY is not None:
self.setPixelHeight(pixelY)
if coordX is not None:
self.setCoordWidth(coordX)
if coordY is not None:
self.setCoordHeight(coordY)
# init styles context stack
self.ctx_stack = []
# init current context
self._init_context()
# insure we clear/init the canvas
self.clear()
示例9: __init__
def __init__(self, Width=0, Height=0, **kwargs):
if not kwargs.has_key('StyleName'):
kwargs['StyleName'] = 'gwt-Canvas'
kwargs['Width'] = Width
kwargs['Height'] = Height
self.context = None
focusable = Focus.createFocusable()
self.canvas = DOM.createElement("canvas")
DOM.appendChild(focusable, self.canvas)
FocusWidget.__init__(self, focusable, **kwargs)
self.init()
self.context.fillStyle = "black"
self.context.strokeStyle = "black"
示例10: __init__
def __init__(self, coordX=300, coordY=150, pixelX=300, pixelY=150,
**kwargs):
"""
* Impl Instance. Compiler should statify all the methods, so we
* do not end up with duplicate code for each canvas instance.
"""
self.impl = self.getCanvasImpl()
self.coordHeight = 0
self.coordWidth = 0
focusable = Focus.createFocusable()
self.canvas = self.impl.createElement()
DOM.appendChild(focusable, self.canvas)
FocusWidget.__init__(self, focusable, **kwargs)
self.setPixelWidth(pixelX)
self.setPixelHeight(pixelY)
self.setCoordSize(coordX, coordY)
示例11: __init__
def __init__(self, p, child, cDelegate, kDelegate) :
Composite.__init__(self)
self.clickDelegate = cDelegate
self.keyDelegate = kDelegate
self.focusablePanel = SimplePanel(Focus.createFocusable())
self.focusablePanel.setWidget(child)
wrapperWidget = p.createTabTextWrapper()
if wrapperWidget is None:
self.initWidget(self.focusablePanel)
else :
wrapperWidget.setWidget(self.focusablePanel)
self.initWidget(wrapperWidget)
if hasattr(child, "addKeyboardListener"):
child.addKeyboardListener(kDelegate)
self.sinkEvents(Event.ONCLICK | Event.ONKEYDOWN)
示例12: __init__
def __init__(self, min_value, max_value, start_value=None, step=None,
**ka):
ka["StyleName"] = ka.get('StyleName', "gwt-VerticalSlider")
# XXX FIXME: Focus.createFocusable is here for a reason...
element = ka.pop('Element', None) or Focus.createFocusable()
DOM.setStyleAttribute(element, "position", "relative")
DOM.setStyleAttribute(element, "overflow", "hidden")
self.handle = DOM.createDiv()
DOM.appendChild(element, self.handle)
self.setHandleStyle("1px", "100%", "10px", "#808080")
Control.__init__(self, element, min_value, max_value, start_value,
step, **ka)
self.addClickListener(self)
self.addFocusListener(self)
self.addMouseListener(self)
示例13: setFocus
def setFocus(self, focused):
if focused:
Focus.focus(self.inputElem)
else:
Focus.blur(self.inputElem)
示例14: setFocus
def setFocus(self, focused):
if (focused):
Focus.focus(self.focusable)
else:
Focus.blur(self.focusable)
示例15: setTabIndex
def setTabIndex(self, index):
Focus.setTabIndex(self.focusable, index)