本文整理汇总了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)
示例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)
示例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)
示例4: onAttach
def onAttach(self):
FocusWidget.onAttach(self)
JS( '''
var map = this._map;
var onResize = function() { map.invalidateSize(); }
onResize();
$wnd.$(this.getElement()).resize(onResize);
''');
示例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)
示例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)
示例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()
示例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()
示例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)
示例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 = []
示例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()
示例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"
示例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)
示例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)
示例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)