本文整理汇总了Python中pyjamas.ui.Grid.Grid.getRowFormatter方法的典型用法代码示例。如果您正苦于以下问题:Python Grid.getRowFormatter方法的具体用法?Python Grid.getRowFormatter怎么用?Python Grid.getRowFormatter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.ui.Grid.Grid
的用法示例。
在下文中一共展示了Grid.getRowFormatter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pyjamas.ui.Grid import Grid [as 别名]
# 或者: from pyjamas.ui.Grid.Grid import getRowFormatter [as 别名]
def __init__(self):
# layed out in a grid with odd rows a different color for
# visual separation
#lucky = Grid(9,10, CellPadding=25, CellSpacing=1, BorderWidth=1)
lucky = Grid()
lucky.resize(9,10)
lucky.setBorderWidth(1)
lucky.setCellPadding(25)
lucky.setCellSpacing(1)
val = 0
for x in range(0,9):
for y in range(0,10):
val += 1
lucky.setText(x,y,val)
grid = Grid(1,3,CellPadding=20,CellSpacing=0)
rf = grid.getRowFormatter()
rf.setStyleName(0, 'oddrow')
# popup timer buttons
ptb = PopupTimerButton(1)
grid.setWidget(0, 0, CaptionPanel('Start the Lucky Number Countdown', ptb, StyleName='left'))
grid.setWidget(0, 1, CaptionPanel('Current Lucky Number',ptb.box))
grid.setWidget(0, 2, lucky)
# add it all to the root panel
RootPanel().add(grid, lucky)
示例2: AccountListSink
# 需要导入模块: from pyjamas.ui.Grid import Grid [as 别名]
# 或者: from pyjamas.ui.Grid.Grid import getRowFormatter [as 别名]
class AccountListSink(VerticalPanel):
def __init__(self, hendler = None):
VerticalPanel.__init__(self,
#HorizontalAlignment=HasAlignment.ALIGN_CENTER,
#VerticalAlignment=HasAlignment.ALIGN_MIDDLE,
Width="100%",
#Height="100%",
Spacing=5)
self.remote = DataService(['getaccounts'])
self.grid = Grid(1, 3,
BorderWidth=1,
CellPadding=4,
CellSpacing=1,
StyleName="grid")
self.grid.setText(0, 0, u"Number")
self.grid.setText(0, 1, u"Type")
self.grid.setText(0, 2, u"Balance")
formatter = self.grid.getRowFormatter()
formatter.setStyleName(0, "grid-header")
self.add(Label(u"Accounts"))
self.add(self.grid)
def updateGrid(self, accounts):
rows = len(accounts)
if rows > 0:
self.grid.resize(rows+1, 3)
for row in range(rows):
link = PseudoLink(accounts[row]['number'],
self.onClick,
ID=accounts[row]['number'])
self.grid.setWidget(row+1, 0, link)
self.grid.setText(row+1, 1, accounts[row]['type'])
self.grid.setText(row+1, 2, accounts[row]['balance'])
def onShow(self):
self.remote.getaccounts(self)
def onClick(self, sender):
Window.alert(sender.getID())
def onRemoteResponse(self, response, request_info):
'''
Called when a response is received from a RPC.
'''
if request_info.method == 'getaccounts':
#TODO
self.updateGrid(response)
else:
Window.alert('Unrecognized JSONRPC method.')
def onRemoteError(self, code, message, request_info):
Window.alert(message)
示例3: __init__
# 需要导入模块: from pyjamas.ui.Grid import Grid [as 别名]
# 或者: from pyjamas.ui.Grid.Grid import getRowFormatter [as 别名]
def __init__(self):
# layed out in a grid with odd rows a different color for
# visual separation
grid = Grid(4,3,CellPadding=50,CellSpacing=0)
rf = grid.getRowFormatter()
rf.setStyleName(1, 'oddrow')
rf.setStyleName(3, 'oddrow')
# the clock
clock = Clock()
grid.setWidget(0, 0, CaptionPanel('Using notify()', clock.button, StyleName='left'))
grid.setWidget(0, 1, clock.datelabel)
grid.setWidget(0, 2, HTML(Clock.__doc__, StyleName='desc'))
# popup timer buttons
ptb = PopupTimerButton(5)
grid.setWidget(1, 0, CaptionPanel('Subclassing Timer()', ptb, StyleName='left'))
grid.setWidget(1, 1, ptb.box)
grid.setWidget(1, 2, HTML(PopupTimerButton.__doc__, StyleName='desc'))
# the second instance
ptb = PopupTimerButton(15)
grid.setWidget(2, 0, CaptionPanel('Subclassing Timer() (<em>again</em>)',
ptb, StyleName='left'))
grid.setWidget(2, 1, ptb.box)
grid.setWidget(2, 2, HTML('''This is the same as the previous
example and is here to demonstrate
creating multiple timers (each with
their own state) which is difficult
to do without sublcassing''', StyleName='desc'))
# random color
randomcolor = RandomColor()
grid.setWidget(3, 0, CaptionPanel('Using onTimer()', randomcolor.hpanel, StyleName='left'))
grid.setWidget(3, 1, randomcolor.colorpanel)
grid.setWidget(3, 2, HTML(RandomColor.__doc__, StyleName='desc'))
# add it all to the root panel
RootPanel().add(grid)
# kickstart the slider handle (see above concerning a
# potential bug)
randomcolor.initialize()