本文整理汇总了Python中HTML.HTML.getText方法的典型用法代码示例。如果您正苦于以下问题:Python HTML.getText方法的具体用法?Python HTML.getText怎么用?Python HTML.getText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML.HTML
的用法示例。
在下文中一共展示了HTML.getText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DialogBox
# 需要导入模块: from HTML import HTML [as 别名]
# 或者: from HTML.HTML import getText [as 别名]
class DialogBox(PopupPanel):
def __init__(self, autoHide=None, modal=True, **kwargs):
PopupPanel.__init__(self, autoHide, modal, **kwargs)
self.caption = HTML()
self.child = None
self.dragging = False
self.dragStartX = 0
self.dragStartY = 0
self.panel = FlexTable(Height="100%", BorderWidth="0",
CellPadding="0", CellSpacing="0")
self.panel.setWidget(0, 0, self.caption)
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.caption.addMouseListener(self)
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 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)
if widget is not None:
self.panel.setWidget(1, 0, widget)
self.child = widget