本文整理汇总了Python中pyjamas.Window.getScrollLeft方法的典型用法代码示例。如果您正苦于以下问题:Python Window.getScrollLeft方法的具体用法?Python Window.getScrollLeft怎么用?Python Window.getScrollLeft使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.Window
的用法示例。
在下文中一共展示了Window.getScrollLeft方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getScrollLeft [as 别名]
def __init__(self, key, title, content):
AbsolutePanel.__init__(self)
self.edit_header = Label("Edit a Post", StyleName="header_label")
self.edit_title_label = Label("Title:")
self.edit_title = TextBox()
self.edit_title.setMaxLength(255)
self.edit_content = TextArea()
self.edit_content.setVisibleLines(2)
self.edit_button = Button("Save")
self.edit_cancel_button = Button("Cancel")
self.edit_hidden_key = Hidden()
self.error_message_label = Label("", StyleName="error_message_label")
edit_contents = VerticalPanel(StyleName="Contents", Spacing=4)
edit_contents.add(self.edit_header)
edit_contents.add(self.edit_title_label)
edit_contents.add(self.edit_title)
edit_contents.add(self.edit_content)
edit_contents.add(self.edit_button)
edit_contents.add(self.edit_cancel_button)
edit_contents.add(self.error_message_label)
edit_contents.add(self.edit_hidden_key)
self.edit_dialog = DialogBox(glass=True)
self.edit_dialog.setHTML('<b>Blog Post Form</b>')
self.edit_dialog.setWidget(edit_contents)
left = (Window.getClientWidth() - 900) / 2 + Window.getScrollLeft()
top = (Window.getClientHeight() - 600) / 2 + Window.getScrollTop()
self.edit_dialog.setPopupPosition(left, top)
self.edit_dialog.hide()
示例2: onDrop
# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getScrollLeft [as 别名]
def onDrop(self, event):
dt = event.dataTransfer
text = dt.getData('text')
package = json.decode(text)
x = DOM.eventGetClientX(event)
y = DOM.eventGetClientY(event)
scrollY = Window.getScrollTop()
scrollX = Window.getScrollLeft()
offsetX = int(package['offsetX'])
offsetY = int(package['offsetY'])
at = self.getAbsoluteTop()
al = self.getAbsoluteLeft()
posX, posY = x - (al - scrollX), y - (at - scrollY)
w = DragWidget6(package['text'])
self.add(w)
makeDraggable(w)
# firefox seems to be off-by-one in x.
# firefox-specific code?
#w.setStyleAttribute('left', posX - offsetX -1)
w.setStyleAttribute('left', posX - offsetX)
w.setStyleAttribute('top', posY - offsetY)
w.removeStyleName('invisible')
self.addMessage(
"top:%s, left:%s, cy:%s cx:%s, sy:%s sx:%s dropy:%s dropx:%s" % (
at, al, y, x, scrollY, scrollX, posY, posX))
DOM.eventPreventDefault(event)
示例3: onMouseDown
# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getScrollLeft [as 别名]
def onMouseDown(self, sender, x, y):
rx = x + Window.getScrollLeft()
ry = y + Window.getScrollTop()
if self.classify:
self.PointList.append( Point(rx, ry, -1 ) )
else:
self.PointList.append( Point(rx, ry, len(self.color)-1) )
示例4: onClick
# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getScrollLeft [as 别名]
def onClick(self, sender=None):
self.setFocus(True);
# work out the relative position of cursor
event = DOM.eventGetCurrentEvent()
mouse_x = DOM.eventGetClientX(event) + Window.getScrollLeft()
mouse_y = DOM.eventGetClientY(event) + Window.getScrollTop()
self.moveControl(mouse_x - self.getAbsoluteLeft(),
mouse_y - self.getAbsoluteTop())
示例5: onMouseDown
# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getScrollLeft [as 别名]
def onMouseDown(self, sender, x, y):
# regardless of drag_enabled, onMouseDown must prevent
# default, in order to avoid losing focus.
DOM.eventPreventDefault(DOM.eventGetCurrentEvent());
if not self.drag_enabled:
return
self.dragging = True
DOM.setCapture(self.getElement())
self.moveControl(x + Window.getScrollLeft(), y + Window.getScrollTop())
示例6: onMouseDown
# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getScrollLeft [as 别名]
def onMouseDown(self, sender, x, y):
# regardless of drag_enabled, onMouseDown must prevent
# default, in order to avoid losing focus.
self.setFocus(True)
DOM.eventPreventDefault(DOM.eventGetCurrentEvent())
if not self.drag_enabled:
return
self.dragging = True
GlassWidget.show(self)
self.moveControl(x + Window.getScrollLeft(), y + Window.getScrollTop(),
True)
示例7: __init__
# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getScrollLeft [as 别名]
def __init__(self, message, messageTitle="Error"):
self.dialog = DialogBox(glass=True)
self.dialog.setHTML("<b>" + messageTitle + "</b>")
dialogContents = VerticalPanel(StyleName="Contents", Spacing=4)
dialogContents.add(HTML(message))
dialogContents.add(Button("Close", getattr(self, "onClose")))
self.dialog.setWidget(dialogContents)
left = (Window.getClientWidth() - 200) / 2 + Window.getScrollLeft()
top = (Window.getClientHeight() - 100) / 2 + Window.getScrollTop()
self.dialog.setPopupPosition(left, top)
self.dialog.show()
示例8: setGlassPosition
# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getScrollLeft [as 别名]
def setGlassPosition(self):
top = Window.getScrollTop()
left = Window.getScrollLeft()
height = Window.getClientHeight()
width = Window.getClientWidth()
DOM.setStyleAttribute(self.glass, "position", "absolute")
DOM.setStyleAttribute(self.glass, "left", "%s" % \
left if left == 0 else "%spx" % left)
DOM.setStyleAttribute(self.glass, "top", "%s" % \
top if top == 0 else "%spx" % top)
DOM.setStyleAttribute(self.glass, "height", "%spx" % (top + height))
DOM.setStyleAttribute(self.glass, "width", "%spx" % (left + width))
示例9: showDialog
# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getScrollLeft [as 别名]
def showDialog(self, event):
contents = VerticalPanel(StyleName="Contents",
Spacing=4)
contents.add(HTML('You can place any contents you like in a dialog box.'))
contents.add(Button("Close", getattr(self, "onClose")))
self._dialog = DialogBox(glass=True)
self._dialog.setHTML('<b>Welcome to the dialog box</b>')
self._dialog.setWidget(contents)
left = (Window.getClientWidth() - 200) / 2 + Window.getScrollLeft()
top = (Window.getClientHeight() - 100) / 2 + Window.getScrollTop()
self._dialog.setPopupPosition(left, top)
self._dialog.show()
示例10: onDragStart
# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getScrollLeft [as 别名]
def onDragStart(self, event):
dt = event.dataTransfer
target = DOM.eventGetTarget(event)
clientX = event.clientX
clientY = event.clientY
absx = clientX + Window.getScrollLeft()
absy = clientY + Window.getScrollTop()
package = json.encode({"text": DOM.getInnerText(target),
"offsetX": absx - DOM.getAbsoluteLeft(target),
"offsetY": absy - DOM.getAbsoluteTop(target)})
dt.setData('text', package)
# using "copy" here because Windows Chrome does not like "move"
dt.allowedEffects = 'copy'
self.movingWidget = None
for widget in self.children:
if target == widget.getElement():
self.movingWidget = widget
示例11: onClickDefault
# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getScrollLeft [as 别名]
def onClickDefault(self, sender):
# don't shown property editor if they clicked on nothing
if None == self.chart.getTouchedPoint():
return
event = DOM.eventGetCurrentEvent()
# load properties of clicked-on slice into form
self.copyChartPropertiesIntoForm(self.chart.getTouchedPoint())
if self.isFirstTime:
# initially put upper left corner wherever they clicked...
self.setPopupPosition(
Window.getScrollLeft()+ DOM.eventGetClientX(event),
Window.getScrollTop() + DOM.eventGetClientX(event))
self.show()
self.isFirstTime = False
else:
# ...thereafter, just stay whereever they dragged it to
self.show()
示例12: setGlassPosition
# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getScrollLeft [as 别名]
def setGlassPosition(self):
top = Window.getScrollTop()
left = Window.getScrollLeft()
height = Window.getClientHeight()
width = Window.getClientWidth()
el = self.getElement()
DOM.setStyleAttribute(el, "position", "absolute")
DOM.setStyleAttribute(el, "left",
"%s" % left if left == 0 else "%spx" % left)
DOM.setStyleAttribute(el, "top",
"%s" % top if top == 0 else "%spx" % top)
DOM.setStyleAttribute(el, "height", "%spx" % (top + height))
DOM.setStyleAttribute(el, "width", "%spx" % (left + width))
# under pyjd glasswidget cannot be transparent,
# otherwise it drops the mousecapture, so we have
# to give it a 1% opaque background color
if pyjd.is_desktop:
# pyjd uses IE style opacity
DOM.setStyleAttribute(el, "filter", "alpha(opacity=1)")
# this is the Moz form of transparency
DOM.setStyleAttribute(el, "background", "rgba(255,255,255,0.1)")
示例13: onMouseMove
# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getScrollLeft [as 别名]
def onMouseMove(self, sender, x, y):
if not self.dragging:
return
self.moveControl(x + Window.getScrollLeft(), y + Window.getScrollTop())