本文整理汇总了Python中pyjamas.ui.HTML.HTML.onAttach方法的典型用法代码示例。如果您正苦于以下问题:Python HTML.onAttach方法的具体用法?Python HTML.onAttach怎么用?Python HTML.onAttach使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.ui.HTML.HTML
的用法示例。
在下文中一共展示了HTML.onAttach方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PopupPagina
# 需要导入模块: from pyjamas.ui.HTML import HTML [as 别名]
# 或者: from pyjamas.ui.HTML.HTML import onAttach [as 别名]
#.........这里部分代码省略.........
cm1 = cm1.value
lm2 = DOM.getElementById("lm2")
lm2 = lm2.value
cm2 = DOM.getElementById("cm2")
cm2 = cm2.value
if not lm1 or not lm2:
Window.alert("Informe o numero de linhas da matriz M1 e M2.")
return False
if lm1 != lm2:
Window.alert("A quantidade de linhas da matriz M1 deve ser igual a da matriz M2 para operação de soma.")
return False
if lm1 > "5" or lm2 > "5" or len(lm1) != 1 or len(lm2) != 1:
Window.alert("A quantidade de linhas da matriz M1 e da matriz M2, deve ser menor ou igual a 5.")
return False
if not cm1 or not cm2:
Window.alert("Informe o numero de colunas da matriz M1 e M2.")
return False
if cm1 != cm2:
Window.alert("A quantidade de colunas da matriz M1 deve ser igual a da matriz M2 para operação de soma.")
return False
if cm1 > "7" or cm2 > "7" or len(cm1) != 1 or len(cm2) != 1:
Window.alert("A quantidade de colunas da matriz M1 e da matriz M2, deve ser menor ou igual a 7.")
return False
return True
def getHTML(self):
return self.caption.getHTML()
def getText(self):
return self.caption.getText()
def onEventPreview(self, event):
# preventDefault on mousedown events, outside of the
# dialog, to stop text-selection on dragging
type = DOM.eventGetType(event)
if type == "mousedown":
target = DOM.eventGetTarget(event)
elem = self.caption.getElement()
event_targets_popup = target and DOM.isOrHasChild(elem, target)
if event_targets_popup:
DOM.eventPreventDefault(event)
return PopupPanel.onEventPreview(self, event)
def onMouseDown(self, sender, x, y):
self.dragging = True
DOM.setCapture(self.caption.getElement())
self.dragStartX = x
self.dragStartY = y
def onMouseMove(self, sender, x, y):
if self.dragging:
absX = x + self.getAbsoluteLeft()
absY = y + self.getAbsoluteTop()
self.setPopupPosition(absX - self.dragStartX, absY - self.dragStartY)
def onMouseUp(self, sender, x, y):
self.dragging = False
DOM.releaseCapture(self.caption.getElement())
def onMouseLeave(self, self, x, y):
pass
def onMouseEnter(self, self, x, y):
pass
def remove(self, widget):
if self.child != widget:
return False
self.panel.remove(widget)
self.child = None
return True
def setHTML(self, html):
self.caption.setHTML(html)
def setText(self, text):
self.caption.setText(text)
def doAttachChildren(self):
PopupPanel.doAttachChildren(self)
self.caption.onAttach()
def doDetachChildren(self):
PopupPanel.doDetachChildren(self)
self.caption.onDetach()
def setWidget(self, widget):
if self.child is not None:
self.panel.remove(self.child)
if widget is not None:
self.panel.setWidget(1, 0, widget)
self.child = widget
示例2: DialogBoxModal
# 需要导入模块: from pyjamas.ui.HTML import HTML [as 别名]
# 或者: from pyjamas.ui.HTML.HTML import onAttach [as 别名]
class DialogBoxModal(PopupPanel):
def __init__(self, identifier, autoHide=None, modal=False, rootpanel=None):
PopupPanel.__init__(self, autoHide, modal, rootpanel)
self.identifier = identifier
self.caption = HTML()
self.child = None
self.showing = False
self.dragging = False
self.dragStartX = 0
self.dragStartY = 0
self.panel = FlexTable()
self.closeButton = Image('cancel.png')
self.closeButton.addClickListener(self)
dock = DockPanel()
dock.setSpacing(0)
dock.add(self.closeButton, DockPanel.EAST)
dock.add(self.caption, DockPanel.WEST)
dock.setCellHorizontalAlignment(self.closeButton,
HasAlignment.ALIGN_RIGHT)
dock.setCellHorizontalAlignment(self.caption, HasAlignment.ALIGN_LEFT)
dock.setCellWidth(self.caption, '100%')
dock.setWidth('100%')
self.panel.setWidget(0, 0, dock)
self.panel.setHeight('100%')
self.panel.setBorderWidth(0)
self.panel.setCellPadding(0)
self.panel.setCellSpacing(0)
self.panel.getCellFormatter().setHeight(1, 0, '100%')
self.panel.getCellFormatter().setWidth(1, 0, '100%')
#self.panel.getCellFormatter().setAlignment(1, 0,
# HasHorizontalAlignment.ALIGN_CENTER,
# HasVerticalAlignment.ALIGN_MIDDLE)
PopupPanel.setWidget(self, self.panel)
self.setStyleName('gwt-DialogBox')
self.caption.setStyleName('Caption')
self.closeButton.setStyleName('Close')
dock.setStyleName('Header')
self.caption.addMouseListener(self)
def getHTML(self):
return self.caption.getHTML()
def getText(self):
return self.caption.getText()
def onMouseDown(self, sender, x, y):
self.dragging = True
DOM.setCapture(self.caption.getElement())
self.dragStartX = x
self.dragStartY = y
def onMouseEnter(self, sender):
pass
def onMouseLeave(self, sender):
pass
def onMouseMove(self, sender, x, y):
if self.dragging:
absX = x + self.getAbsoluteLeft()
absY = y + self.getAbsoluteTop()
self.setPopupPosition(absX - self.dragStartX,
absY - self.dragStartY)
def onMouseUp(self, sender, x, y):
self.dragging = False
DOM.releaseCapture(self.caption.getElement())
def remove(self, widget):
if self.child != widget:
return False
self.panel.remove(widget)
self.child = None
return True
def setHTML(self, html):
self.caption.setHTML(html)
def setText(self, text):
self.caption.setText(text)
def doAttachChildren(self):
PopupPanel.doAttachChildren(self)
self.caption.onAttach()
def doDetachChildren(self):
PopupPanel.doDetachChildren(self)
self.caption.onDetach()
def setWidget(self, widget):
if self.child is not None:
self.panel.remove(self.child)
#.........这里部分代码省略.........
示例3: CollapserPanel
# 需要导入模块: from pyjamas.ui.HTML import HTML [as 别名]
# 或者: from pyjamas.ui.HTML.HTML import onAttach [as 别名]
class CollapserPanel(SimplePanel):
def __init__(self, sink):
SimplePanel.__init__(self)
self.sink = sink
self.caption = HTML()
self.child = None
self.showing = False
self.dragging = False
self.dragStartX = 0
self.dragStartY = 0
self.panel = FlexTable()
self.collapse = Image("./images/cancel.png")
self.collapse.addClickListener(self)
dock = DockPanel()
dock.setSpacing(0)
dock.add(self.collapse, DockPanel.EAST)
dock.add(self.caption, DockPanel.WEST)
dock.setCellHorizontalAlignment(self.collapse, HasAlignment.ALIGN_RIGHT)
dock.setCellVerticalAlignment(self.collapse, HasAlignment.ALIGN_TOP)
dock.setCellHorizontalAlignment(self.caption, HasAlignment.ALIGN_LEFT)
dock.setCellWidth(self.caption, "100%")
dock.setWidth("100%")
dock.setHeight("100%")
self.panel.setWidget(0, 0, dock)
self.panel.setHeight("100%")
self.panel.setWidth("100%")
self.panel.setBorderWidth(0)
self.panel.setCellPadding(0)
self.panel.setCellSpacing(0)
self.panel.getCellFormatter().setHeight(1, 0, "100%")
self.panel.getCellFormatter().setWidth(1, 0, "100%")
self.panel.getCellFormatter().setAlignment(1, 0, HasHorizontalAlignment.ALIGN_LEFT, HasVerticalAlignment.ALIGN_TOP)
SimplePanel.setWidget(self, self.panel)
self.setStyleName("gwt-DialogBox")
self.caption.setStyleName("Caption")
self.collapse.setStyleName("Close")
dock.setStyleName("Header")
#self.caption.addMouseListener(self)
self.collapsed = False
self.collapsed_width = "15px"
self.uncollapsed_width = "100%"
def setInitialWidth(self, width):
self.uncollapsed_width = width
SimplePanel.setWidth(self, width)
self.sink.setCollapserWidth(self, width)
def setHeight(self, height):
SimplePanel.setHeight(self, height)
def onClick(self, sender):
if self.collapsed == False:
self.collapse.setUrl("./tree_closed.gif")
self.collapsed = True
self.caption.setVisible(False)
if self.child:
self.child.setVisible(False)
self.setWidth(self.collapsed_width)
self.sink.setCollapserWidth(self, self.collapsed_width)
else:
self.collapse.setUrl("./images/cancel.png")
self.collapsed = False
self.caption.setVisible(True)
if self.child:
self.child.setVisible(True)
self.setWidth(self.uncollapsed_width)
self.sink.setCollapserWidth(self, self.uncollapsed_width)
def setHTML(self, html):
self.caption.setHTML(html)
def setText(self, text):
self.caption.setText(text)
def remove(self, widget):
if self.child != widget:
return False
self.panel.remove(widget)
return True
def doAttachChildren(self):
SimplePanel.doAttachChildren(self)
self.caption.onAttach()
def doDetachChildren(self):
SimplePanel.doDetachChildren(self)
self.caption.onDetach()
def setWidget(self, widget):
if self.child is not None:
self.panel.remove(self.child)
if widget is not None:
#.........这里部分代码省略.........
示例4: DialogBox
# 需要导入模块: from pyjamas.ui.HTML import HTML [as 别名]
# 或者: from pyjamas.ui.HTML.HTML import onAttach [as 别名]
#.........这里部分代码省略.........
self.caption.addMouseListener(self)
# Finalize
kwargs['StyleName'] = kwargs.get('StyleName', "gwt-DialogBox")
PopupPanel.__init__(self, autoHide, modal, **kwargs)
PopupPanel.setWidget(self, self.panel)
@classmethod
def _getProps(self):
return PopupPanel._getProps() + self._props
def onEventPreview(self, event):
# preventDefault on mousedown events, outside of the
# dialog, to stop text-selection on dragging
type = DOM.eventGetType(event)
if type == 'mousedown':
target = DOM.eventGetTarget(event)
elem = self.caption.getElement()
event_targets_popup = target and DOM.isOrHasChild(elem, target)
if event_targets_popup:
DOM.eventPreventDefault(event)
return PopupPanel.onEventPreview(self, event)
def getHTML(self):
return self.caption.getHTML()
def getText(self):
return self.caption.getText()
def setHTML(self, html):
self.caption.setHTML(html)
def setText(self, text):
self.caption.setText(text)
def onMouseDown(self, sender, x, y):
self.dragging = True
GlassWidget.show(self.caption)
self.dragStartX = x
self.dragStartY = y
def onMouseEnter(self, sender):
pass
def onMouseLeave(self, sender):
pass
def onMouseMove(self, sender, x, y):
if not self.dragging:
return
absX = x + self.getAbsoluteLeft()
absY = y + self.getAbsoluteTop()
self.setPopupPosition(absX - self.dragStartX,
absY - self.dragStartY)
def onMouseUp(self, sender, x, y):
self.endDragging()
def onMouseGlassEnter(self, sender):
pass
def onMouseGlassLeave(self, sender):
self.endDragging()
def endDragging(self):
if not self.dragging:
return
self.dragging = False
GlassWidget.hide()
def remove(self, widget):
if self.child != widget:
return False
self.panel.remove(widget)
self.child = None
return True
def doAttachChildren(self):
PopupPanel.doAttachChildren(self)
self.caption.onAttach()
def doDetachChildren(self):
PopupPanel.doDetachChildren(self)
self.caption.onDetach()
def setWidget(self, widget):
if self.child is not None:
self.panel.remove(self.child)
if widget is not None:
self.panel.setWidget(1, 0, widget)
self.child = widget
def onWindowResized(self, width, height):
super(DialogBox, self).onWindowResized(width, height)
def show(self):
super(DialogBox, self).show()
示例5: DialogBox
# 需要导入模块: from pyjamas.ui.HTML import HTML [as 别名]
# 或者: from pyjamas.ui.HTML.HTML import onAttach [as 别名]
#.........这里部分代码省略.........
self.centerBox()
def show(self):
super(DialogBox, self).show()
if self.centered:
self.centerBox()
@classmethod
def _getProps(self):
return PopupPanel._getProps() + self._props
def onEventPreview(self, event):
# preventDefault on mousedown events, outside of the
# dialog, to stop text-selection on dragging
type = DOM.eventGetType(event)
if type == 'mousedown':
target = DOM.eventGetTarget(event)
elem = self.caption.getElement()
event_targets_popup = target and DOM.isOrHasChild(elem, target)
if event_targets_popup:
DOM.eventPreventDefault(event)
return PopupPanel.onEventPreview(self, event)
def getHTML(self):
return self.caption.getHTML()
def getText(self):
return self.caption.getText()
def setHTML(self, html):
self.caption.setHTML(html)
def setText(self, text):
self.caption.setText(text)
def onMouseDown(self, sender, x, y):
self.dragging = True
GlassWidget.show(self.caption)
self.dragStartX = x
self.dragStartY = y
def onMouseEnter(self, sender):
pass
def onMouseLeave(self, sender):
pass
def onMouseMove(self, sender, x, y):
if not self.dragging:
return
absX = x + self.getAbsoluteLeft()
absY = y + self.getAbsoluteTop()
self.setPopupPosition(absX - self.dragStartX,
absY - self.dragStartY)
def onMouseUp(self, sender, x, y):
self.endDragging()
def onMouseGlassEnter(self, sender):
pass
def onMouseGlassLeave(self, sender):
self.endDragging()
def endDragging(self):
if not self.dragging:
return
self.dragging = False
GlassWidget.hide()
def remove(self, widget):
if self.child != widget:
return False
self.panel.remove(widget)
self.child = None
return True
def doAttachChildren(self):
PopupPanel.doAttachChildren(self)
self.caption.onAttach()
def doDetachChildren(self):
PopupPanel.doDetachChildren(self)
self.caption.onDetach()
def setWidget(self, widget):
if self.child is not None:
if not self.generate_gwt15:
self.panel.remove(self.child)
else:
self.dialog_content.remove(self.child)
if widget is not None:
if not self.generate_gwt15:
self.panel.setWidget(1, 0, widget)
else:
self.dialog_content.setWidget(widget)
self.child = widget