本文整理汇总了Python中pyjamas.ui.Focus.createFocusable方法的典型用法代码示例。如果您正苦于以下问题:Python Focus.createFocusable方法的具体用法?Python Focus.createFocusable怎么用?Python Focus.createFocusable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.ui.Focus
的用法示例。
在下文中一共展示了Focus.createFocusable方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pyjamas.ui import Focus [as 别名]
# 或者: from pyjamas.ui.Focus import createFocusable [as 别名]
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__
# 需要导入模块: from pyjamas.ui import Focus [as 别名]
# 或者: from pyjamas.ui.Focus import createFocusable [as 别名]
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)
示例3: __init__
# 需要导入模块: from pyjamas.ui import Focus [as 别名]
# 或者: from pyjamas.ui.Focus import createFocusable [as 别名]
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")
示例4: __init__
# 需要导入模块: from pyjamas.ui import Focus [as 别名]
# 或者: from pyjamas.ui.Focus import createFocusable [as 别名]
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)
示例5: __init__
# 需要导入模块: from pyjamas.ui import Focus [as 别名]
# 或者: from pyjamas.ui.Focus import createFocusable [as 别名]
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__
# 需要导入模块: from pyjamas.ui import Focus [as 别名]
# 或者: from pyjamas.ui.Focus import createFocusable [as 别名]
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: __init__
# 需要导入模块: from pyjamas.ui import Focus [as 别名]
# 或者: from pyjamas.ui.Focus import createFocusable [as 别名]
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()
示例8: __init__
# 需要导入模块: from pyjamas.ui import Focus [as 别名]
# 或者: from pyjamas.ui.Focus import createFocusable [as 别名]
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"
示例9: __init__
# 需要导入模块: from pyjamas.ui import Focus [as 别名]
# 或者: from pyjamas.ui.Focus import createFocusable [as 别名]
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)
示例10: __init__
# 需要导入模块: from pyjamas.ui import Focus [as 别名]
# 或者: from pyjamas.ui.Focus import createFocusable [as 别名]
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)
示例11: __init__
# 需要导入模块: from pyjamas.ui import Focus [as 别名]
# 或者: from pyjamas.ui.Focus import createFocusable [as 别名]
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)
示例12: __init__
# 需要导入模块: from pyjamas.ui import Focus [as 别名]
# 或者: from pyjamas.ui.Focus import createFocusable [as 别名]
def __init__(self, upImageText=None, downImageText=None, listener=None,
**kwargs):
"""Constructor for CustomButton."""
if not kwargs.has_key('StyleName'):
kwargs['StyleName']=self.STYLENAME_DEFAULT
if kwargs.has_key('Element'):
# XXX FIXME: createFocusable is used for a reason...
element = kwargs.pop('Element')
else:
element = Focus.createFocusable()
ButtonBase.__init__(self, element, **kwargs)
self.curFace = None # The button's current face.
self.curFaceElement = None # No "undefined" anymore
self.up = None # Face for up.
self.down = None # Face for down.
self.downHovering = None # Face for downHover.
self.upHovering = None # Face for upHover.
self.upDisabled = None # Face for upDisabled.
self.downDisabled = None # Face for downDisabled.
self.isCapturing = False # If True, this widget is capturing with
# the mouse held down.
self.isFocusing = False # If True, widget has focus with space down.
self.allowClick = False # Used to decide whether to allow clicks to
# propagate up to the superclass or container
# elements.
self.setUpFace(self.createFace(None, "up", self.UP))
#self.getUpFace().setText("Not initialized yet:)")
#self.setCurrentFace(self.getUpFace())
# Add a11y role "button"
# XXX: TODO Accessibility
# TODO: pyjslib.isinstance
if downImageText is None and listener is None:
listener = upImageText
upImageText = None
if upImageText and isinstance(upImageText, basestring):
upText = upImageText
upImage = None
else:
upImage = upImageText
upText = None
if downImageText and isinstance(downImageText, basestring):
downText = downImageText
downImage = None
else:
downImage = downImageText
downText = None
#self.getUpFace().setText("Just a test")
if upImage is not None:
self.getUpFace().setImage(upImage)
if upText is not None:
self.getUpFace().setText(upText)
if downImage is not None:
self.getDownFace().setImage(downImage)
if downText is not None:
self.getDownFace().setText(downText)
# set the face DOWN
#self.setCurrentFace(self.getDownFace())
# set the face UP
#self.setCurrentFace(self.getUpFace())
self.sinkEvents(Event.ONCLICK | Event.MOUSEEVENTS | Event.FOCUSEVENTS
| Event.KEYEVENTS)
if listener is not None:
self.addClickListener(listener)