本文整理汇总了Python中HTML.HTML.setStyleName方法的典型用法代码示例。如果您正苦于以下问题:Python HTML.setStyleName方法的具体用法?Python HTML.setStyleName怎么用?Python HTML.setStyleName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML.HTML
的用法示例。
在下文中一共展示了HTML.setStyleName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from HTML import HTML [as 别名]
# 或者: from HTML.HTML import setStyleName [as 别名]
def __init__(self, **kwargs):
if not kwargs.has_key('StyleName'): kwargs['StyleName']="gwt-TabBar"
# this is awkward: HorizontalPanel is the composite,
# so we either the element here, and pass it in to HorizontalPanel.
element = None
if kwargs.has_key('Element'):
element = kwargs.pop('Element')
self.panel = HorizontalPanel(Element=element)
self.selectedTab = None
self.tabListeners = []
self.panel.setVerticalAlignment(HasAlignment.ALIGN_BOTTOM)
first = HTML(" ", True)
rest = HTML(" ", True)
first.setStyleName("gwt-TabBarFirst")
rest.setStyleName("gwt-TabBarRest")
first.setHeight("100%")
rest.setHeight("100%")
self.panel.add(first)
self.panel.add(rest)
first.setHeight("100%")
self.panel.setCellHeight(first, "100%")
self.panel.setCellWidth(rest, "100%")
Composite.__init__(self, self.panel, **kwargs)
self.sinkEvents(Event.ONCLICK)
示例2: insertTab
# 需要导入模块: from HTML import HTML [as 别名]
# 或者: from HTML.HTML import setStyleName [as 别名]
def insertTab(self, text, asHTML, beforeIndex=None):
""" 1st arg can, instead of being 'text', be a widget.
1st arg can also be None, which results in a blank
space between tabs. Use this to push subsequent
tabs out to the right hand end of the TabBar.
(the "blank" tab, by not being focussable, is not
clickable).
"""
if beforeIndex is None:
beforeIndex = asHTML
asHTML = False
if (beforeIndex < 0) or (beforeIndex > self.getTabCount()):
#throw new IndexOutOfBoundsException();
pass
if text is None:
text = HTML(" ", True)
text.setWidth("100%")
text.setStyleName("gwt-TabBarRest")
self.panel.insert(text, beforeIndex + 1)
self.panel.setCellWidth(text, "100%")
return
try:
istext = isinstance(text, str) or isinstance(text, unicode)
except:
istext = isinstance(text, str)
if istext:
if asHTML:
item = HTML(text)
else:
item = Label(text)
item.setWordWrap(False)
else:
# passing in a widget, it's expected to have its own style
item = text
self.insertTabWidget(item, beforeIndex)
示例3: DialogBox
# 需要导入模块: from HTML import HTML [as 别名]
# 或者: from HTML.HTML import setStyleName [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