當前位置: 首頁>>代碼示例>>Python>>正文


Python FocusWidget.FocusWidget類代碼示例

本文整理匯總了Python中pyjamas.ui.FocusWidget.FocusWidget的典型用法代碼示例。如果您正苦於以下問題:Python FocusWidget類的具體用法?Python FocusWidget怎麽用?Python FocusWidget使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了FocusWidget類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

 def __init__(self, **kwargs):
     if not kwargs.has_key('StyleName'): kwargs['StyleName']="gwt-ListBox"
     self.changeListeners = []
     self.INSERT_AT_END = -1
     element = kwargs.pop('Element', None) or DOM.createSelect()
     FocusWidget.__init__(self, element, **kwargs)
     self.sinkEvents(Event.ONCHANGE)
開發者ID:anandology,項目名稱:pyjamas,代碼行數:7,代碼來源:ListBox.py

示例2: __init__

    def __init__(self, element, **kwargs):
        self.changeListeners = []
        self.inputListeners = []
        self.currentEvent = None

        FocusWidget.__init__(self, element, **kwargs)
        self.sinkEvents(Event.ONCHANGE | Event.ONINPUT)
開發者ID:anandology,項目名稱:pyjamas,代碼行數:7,代碼來源:TextBoxBase.py

示例3: __init__

    def __init__(self, element, min_value, max_value,
                       start_value_xy=None, step_xy=None, **kwargs):

        self.min_value_x = min_value[0]
        self.min_value_y = min_value[1]

        self.max_value_x = max_value[0]
        self.max_value_y = max_value[1]

        if start_value_xy is None:
            self.start_value_x = self.min_value_x
            self.start_value_y = self.min_value_y
        else:
            self.start_value_x = start_value_xy[0]
            self.start_value_y = start_value_xy[1]

        if step_xy is None:
            self.step_x = (self.max_value_x - self.min_value_x) / 20
            self.step_y = (self.max_value_y - self.min_value_y) / 20
        else:
            self.step_x = step_xy[0]
            self.step_y = step_xy[1]

        self.value_x = self.start_value_x
        self.value_y = self.start_value_y

        self.valuechange_listeners = []
        self.dragging = False
        self.drag_enabled = False

        if not kwargs.has_key("TabIndex"): kwargs['TabIndex'] = 0
        FocusWidget.__init__(self, element, **kwargs)
        MouseHandler.__init__(self)
開發者ID:Afey,項目名稱:pyjs,代碼行數:33,代碼來源:DoubleControl.py

示例4: onAttach

 def onAttach(self):
     FocusWidget.onAttach(self)
     JS( '''
         var map = this._map;
         var onResize = function() { map.invalidateSize(); }
         onResize();
         $wnd.$(this.getElement()).resize(onResize);
         ''');
開發者ID:rjw57,項目名稱:foldbeam,代碼行數:8,代碼來源:Map.py

示例5: onBrowserEvent

 def onBrowserEvent(self, event):
     if DOM.eventGetType(event) == "change":
         for listener in self.changeListeners:
             if hasattr(listener, 'onChange'):
                 listener.onChange(self)
             else:
                 listener(self)
     else:
         FocusWidget.onBrowserEvent(self, event)
開發者ID:anandology,項目名稱:pyjamas,代碼行數:9,代碼來源:ListBox.py

示例6: __init__

 def __init__(self,i,j):
     self.i = i
     self.j = j
     self.light = True
     element = DOM.createDiv()
     #DOM.setInnerHTML(element,'<b>%i%i</b>' % (i,j))
     FocusWidget.__init__(self, element)
     self.redraw()
     self.addClickListener(self)
開發者ID:jaredly,項目名稱:pyjamas,代碼行數:9,代碼來源:lightout.py

示例7: setPixelHeight

    def setPixelHeight(self, height):
        """
        Sets the CSS height of the canvas in pixels.

        @param height the height of the canvas in pixels
        """
        height = int(height)
        self.pixelHeight = height
        FocusWidget.setHeight(self, height)
        DOM.setElemAttribute(self.canvas, "height", str(height))
        self._set_base_transform()
開發者ID:Afey,項目名稱:pyjs,代碼行數:11,代碼來源:SVGCanvas.py

示例8: setPixelWidth

    def setPixelWidth(self, width):
        """
        Sets the CSS width in pixels for the canvas.

        @param width width of the canvas in pixels
        """
        width = int(width)
        self.pixelWidth = width
        FocusWidget.setWidth(self, width)
        DOM.setElemAttribute(self.canvas, "width", str(width))
        self._set_base_transform()
開發者ID:Afey,項目名稱:pyjs,代碼行數:11,代碼來源:SVGCanvas.py

示例9: onBrowserEvent

    def onBrowserEvent(self, event):
        FocusWidget.onBrowserEvent(self, event)

        type = DOM.eventGetType(event)
        if type == "change":
            for listener in self.changeListeners:
                if hasattr(listener, 'onChange'): listener.onChange(self)
                else: listener(self)
        if type == "input":
            for listener in self.inputListeners:
                if hasattr(listener, 'onInput'): listener.onInput(self)
                else: listener(self)
開發者ID:anandology,項目名稱:pyjamas,代碼行數:12,代碼來源:TextBoxBase.py

示例10: __init__

    def __init__(self, options=None, *args, **kwargs):
        element = DOM.createDiv()
        if not 'StyleName' in kwargs:
            kwargs['StyleName'] = 'leaflet-Map'
        FocusWidget.__init__(self, element, *args, **kwargs)

        map_element = DOM.createDiv()
        DOM.setStyleAttribute(map_element, 'width', '100%')
        DOM.setStyleAttribute(map_element, 'height', '100%')
        DOM.appendChild(element, map_element)
        JS('this._map = new $wnd.L.Map(map_element, pyjslib.toJSObjects(options));')

        self._layers = []
開發者ID:rjw57,項目名稱:foldbeam,代碼行數:13,代碼來源:Map.py

示例11: __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()
開發者ID:Afey,項目名稱:pyjs,代碼行數:48,代碼來源:SVGCanvas.py

示例12: __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"
開發者ID:audreyr,項目名稱:pyjs,代碼行數:17,代碼來源:Canvas2D.py

示例13: __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)
開發者ID:Afey,項目名稱:pyjs,代碼行數:19,代碼來源:GWTCanvas.py

示例14: __init__

  def __init__(self, className=None):
    element = DOM.createIFrame()
    FocusWidget.__init__(self,element)

    self.floorplan_file = "floorplan.svg"


    #DOM.setStyleAttribute(element, "position", "relative")
    #DOM.setStyleAttribute(element, "overflow", "hidden")
    #DOM.setStyleAttribute(element, "border", "1px")
    #DOM.setStyleAttribute(element, "width", "100px")
    #DOM.setStyleAttribute(element, "height", "100px")
    #DOM.setStyleAttribute(element, "backgroundColor", "lightblue")

    self.svg_area = element
    self.rot_deg = 0.0
    self.scale = 1.0
    self.x_translate = 0.0
    self.y_translate = 0.0

    self.draw_elements()
    self.svg_area.setAttribute("class", className)
開發者ID:Afey,項目名稱:pyjs,代碼行數:22,代碼來源:svgWindow.py

示例15: __init__

    def __init__(self, element, min_value, max_value,
                       start_value=None, step=None,
                       **kwargs):

        self.min_value = min_value
        self.max_value = max_value
        if start_value is None:
            start_value = min_value
        if step is None:
            step = (self.max_value - self.min_value) / 20
        self.step = step
        self.value = start_value
        self.valuechange_listeners = []
        self.dragging = False
        self.drag_enabled = False

        kwargs['TabIndex'] = kwargs.get("TabIndex", 0)

        FocusWidget.__init__(self, element, **kwargs)
        MouseHandler.__init__(self)
        MouseWheelHandler.__init__(self, True)
        self.addMouseWheelListener(self)
開發者ID:Afey,項目名稱:pyjs,代碼行數:22,代碼來源:Control.py


注:本文中的pyjamas.ui.FocusWidget.FocusWidget類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。