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


Python Window.getScrollLeft方法代码示例

本文整理汇总了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()
开发者ID:Afey,项目名称:pyjs,代码行数:30,代码来源:components.py

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

示例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) )
开发者ID:victormatheus,项目名称:opf-gui,代码行数:9,代码来源:opf-gui.py

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

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

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

示例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()
开发者ID:BristolHEP-CBC-Testing,项目名称:cbcanalysis,代码行数:13,代码来源:ErrorMessage.py

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

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

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

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

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

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


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