当前位置: 首页>>代码示例>>Python>>正文


Python Focus.createFocusable方法代码示例

本文整理汇总了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)
开发者ID:emk,项目名称:pyjamas,代码行数:29,代码来源:Controls.py

示例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)
开发者ID:anandology,项目名称:pyjamas,代码行数:37,代码来源:Tree.py

示例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")
开发者ID:anandology,项目名称:pyjamas,代码行数:36,代码来源:AreaSlider.py

示例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)
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:33,代码来源:Canvas2D.py

示例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)
开发者ID:anandology,项目名称:pyjamas,代码行数:11,代码来源:FocusPanel.py

示例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)
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:13,代码来源:FocusPanel.py

示例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()
开发者ID:Afey,项目名称:pyjs,代码行数:50,代码来源:SVGCanvas.py

示例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"
开发者ID:audreyr,项目名称:pyjs,代码行数:19,代码来源:Canvas2D.py

示例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)
开发者ID:Afey,项目名称:pyjs,代码行数:21,代码来源:GWTCanvas.py

示例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)
开发者ID:Afey,项目名称:pyjs,代码行数:22,代码来源:ClickDelegatePanel.py

示例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)
开发者ID:Afey,项目名称:pyjs,代码行数:23,代码来源:VerticalSlider.py

示例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)
开发者ID:Afey,项目名称:pyjs,代码行数:76,代码来源:CustomButton.py


注:本文中的pyjamas.ui.Focus.createFocusable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。