本文整理汇总了Python中pyjamas.ui.SimplePanel.SimplePanel.setStyleName方法的典型用法代码示例。如果您正苦于以下问题:Python SimplePanel.setStyleName方法的具体用法?Python SimplePanel.setStyleName怎么用?Python SimplePanel.setStyleName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.ui.SimplePanel.SimplePanel
的用法示例。
在下文中一共展示了SimplePanel.setStyleName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SuperScrollPanel
# 需要导入模块: from pyjamas.ui.SimplePanel import SimplePanel [as 别名]
# 或者: from pyjamas.ui.SimplePanel.SimplePanel import setStyleName [as 别名]
class SuperScrollPanel(ScrollPanel):
def __init__(self, panel):
ScrollPanel.__init__(self)
self.setHeight("100%")
self.setStyleName("SuperScrollPanelOuter")
self.inner = SimplePanel(Height="100%")
self.add(self.inner)
self.inner.setStyleName("SuperScrollPanelInner")
self.inner.add(panel)
示例2: Calendar
# 需要导入模块: from pyjamas.ui.SimplePanel import SimplePanel [as 别名]
# 或者: from pyjamas.ui.SimplePanel.SimplePanel import setStyleName [as 别名]
#.........这里部分代码省略.........
# should be called only once when we draw the calendar for
# the first time
self.vp = VerticalPanel()
self.vp.setSpacing(2)
self.vp.addStyleName("calendarbox calendar-module calendar")
self.setWidget(self.vp)
self.setVisible(False)
#
mth = int(month)
yr = int(year)
tp = HorizontalPanel()
tp.addStyleName("calendar-top-panel")
tp.setSpacing(5)
h1 = Hyperlink('<<')
h1.addClickListener(getattr(self, 'onPreviousYear'))
h2 = Hyperlink('<')
h2.addClickListener(getattr(self, 'onPreviousMonth'))
h4 = Hyperlink('>')
h4.addClickListener(getattr(self, 'onNextMonth'))
h5 = Hyperlink('>>')
h5.addClickListener(getattr(self, 'onNextYear'))
tp.add(h1)
tp.add(h2)
# titlePanel can be changed, whenever we draw, so keep the reference
txt = "<b>"
txt += self.getMonthsOfYear()[mth-1] + " " + str(yr)
txt += "</b>"
self.titlePanel = SimplePanel()
self.titlePanel.setWidget(HTML(txt))
self.titlePanel.setStyleName("calendar-center")
tp.add(self.titlePanel)
tp.add(h4)
tp.add(h5)
tvp = VerticalPanel()
tvp.setSpacing(10)
tvp.add(tp)
self.vp.add(tvp)
# done with top panel
self.middlePanel = SimplePanel()
grid = self.drawGrid(mth, yr)
self.middlePanel.setWidget(grid)
self.vp.add(self.middlePanel)
self.defaultGrid = grid
self._gridShortcutsLinks()
self._gridCancelLink()
#
# add code to test another way of doing the layout
#
self.setVisible(True)
return
def _gridShortcutsLinks(self):
#
# some links & handlers
#
bh1 = Hyperlink(self.yesterday)
示例3: __init__
# 需要导入模块: from pyjamas.ui.SimplePanel import SimplePanel [as 别名]
# 或者: from pyjamas.ui.SimplePanel.SimplePanel import setStyleName [as 别名]
def __init__(self, autoHide=None, modal=True, centered=False,
**kwargs):
# Init section
self.dragging = False
self.dragStartX = 0
self.dragStartY = 0
self.child = None
self.panel = FlexTable(
Height="100%",
BorderWidth="0",
CellPadding="0",
CellSpacing="0",
)
cf = self.panel.getCellFormatter()
rf = self.panel.getRowFormatter()
# Arguments section
self.modal = modal
self.caption = HTML()
self.caption.setStyleName("Caption")
self.caption.addMouseListener(self)
# Make the DialogBox a 3x3 table, like GWT does, with
# empty elements with specific style names. These can be
# used with CSS to, for example, create border around the
# dialog box.
self.generate_gwt15 = kwargs.pop('gwt15', False) and True
if not self.generate_gwt15:
cf.setHeight(1, 0, "100%")
cf.setWidth(1, 0, "100%")
cf.setAlignment(
1, 0,
HasHorizontalAlignment.ALIGN_CENTER,
HasVerticalAlignment.ALIGN_MIDDLE,
)
self.panel.setWidget(0, 0, self.caption)
else:
row_labels = ['Top', 'Middle', 'Bottom']
col_labels = ['Left', 'Center', 'Right']
for r in range(3):
rf.setStyleName(r, 'dialog%s' % row_labels[r])
for c in range(3):
cf.setStyleName(r, c, 'dialog%s%s' % (row_labels[r],
col_labels[c]))
sp = SimplePanel()
sp.setStyleName('dialog%s%sInner' % (row_labels[r],
col_labels[c]))
self.panel.setWidget(r, c, sp)
cf.setAlignment(
1, 1,
HasHorizontalAlignment.ALIGN_CENTER,
HasVerticalAlignment.ALIGN_MIDDLE,
)
self.dialog_content = SimplePanel()
self.dialog_content.setStyleName('dialogContent')
self.panel.getWidget(0, 1).add(self.caption)
self.panel.getWidget(1, 1).add(self.dialog_content)
# Finalize
kwargs['StyleName'] = kwargs.get('StyleName', "gwt-DialogBox")
PopupPanel.__init__(self, autoHide, modal, **kwargs)
PopupPanel.setWidget(self, self.panel)
self.centered = centered
示例4: DialogBox
# 需要导入模块: from pyjamas.ui.SimplePanel import SimplePanel [as 别名]
# 或者: from pyjamas.ui.SimplePanel.SimplePanel import setStyleName [as 别名]
class DialogBox(PopupPanel):
_props = [
("caption", "Caption", "HTML", None),
]
def __init__(self, autoHide=None, modal=True, centered=False,
**kwargs):
# Init section
self.dragging = False
self.dragStartX = 0
self.dragStartY = 0
self.child = None
self.panel = FlexTable(
Height="100%",
BorderWidth="0",
CellPadding="0",
CellSpacing="0",
)
cf = self.panel.getCellFormatter()
rf = self.panel.getRowFormatter()
# Arguments section
self.modal = modal
self.caption = HTML()
self.caption.setStyleName("Caption")
self.caption.addMouseListener(self)
# Make the DialogBox a 3x3 table, like GWT does, with
# empty elements with specific style names. These can be
# used with CSS to, for example, create border around the
# dialog box.
self.generate_gwt15 = kwargs.pop('gwt15', False) and True
if not self.generate_gwt15:
cf.setHeight(1, 0, "100%")
cf.setWidth(1, 0, "100%")
cf.setAlignment(
1, 0,
HasHorizontalAlignment.ALIGN_CENTER,
HasVerticalAlignment.ALIGN_MIDDLE,
)
self.panel.setWidget(0, 0, self.caption)
else:
row_labels = ['Top', 'Middle', 'Bottom']
col_labels = ['Left', 'Center', 'Right']
for r in range(3):
rf.setStyleName(r, 'dialog%s' % row_labels[r])
for c in range(3):
cf.setStyleName(r, c, 'dialog%s%s' % (row_labels[r],
col_labels[c]))
sp = SimplePanel()
sp.setStyleName('dialog%s%sInner' % (row_labels[r],
col_labels[c]))
self.panel.setWidget(r, c, sp)
cf.setAlignment(
1, 1,
HasHorizontalAlignment.ALIGN_CENTER,
HasVerticalAlignment.ALIGN_MIDDLE,
)
self.dialog_content = SimplePanel()
self.dialog_content.setStyleName('dialogContent')
self.panel.getWidget(0, 1).add(self.caption)
self.panel.getWidget(1, 1).add(self.dialog_content)
# Finalize
kwargs['StyleName'] = kwargs.get('StyleName', "gwt-DialogBox")
PopupPanel.__init__(self, autoHide, modal, **kwargs)
PopupPanel.setWidget(self, self.panel)
self.centered = centered
def onWindowResized(self, width, height):
super(DialogBox, self).onWindowResized(width, height)
if self.centered:
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)
#.........这里部分代码省略.........