本文整理汇总了Python中pyjamas.ui.VerticalPanel.VerticalPanel.setID方法的典型用法代码示例。如果您正苦于以下问题:Python VerticalPanel.setID方法的具体用法?Python VerticalPanel.setID怎么用?Python VerticalPanel.setID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.ui.VerticalPanel.VerticalPanel
的用法示例。
在下文中一共展示了VerticalPanel.setID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: themesPanel
# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import setID [as 别名]
def themesPanel(self, themes=None):
themes = None
if not themes: themes=['0','1', 'cms', 'pypress']
vPanel = VerticalPanel()
vPanel.setID('themes')
for i in range(len(themes)):
a=Button('theme %s' % themes[i], Index.toTheme, StyleName='link')
a.setID(themes[i])
vPanel.add(a)
return vPanel
示例2: __init__
# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import setID [as 别名]
class Application:
def __init__(self):
#set some vars
self.title = "last.fm"
#this is where we build the ui
self.statusPanel = VerticalPanel()
self.statusPanel.setID('status_panel')
#make a few Labels to hold station, artist, track, album info
self.stationLabel = Label()
self.artistLabel = Label()
self.trackLabel = Label()
self.albumLabel = Label()
self.timeLabel = Label()
self.infoTable = FlexTable()
i=0
self.stationLabel = Label()
self.infoTable.setWidget(i,0,Label("Station:") )
self.infoTable.setWidget(i,1,self.stationLabel)
i+=1
self.infoTable.setWidget(i,0,Label("Artist:") )
self.infoTable.setWidget(i,1,self.artistLabel)
i+=1
self.infoTable.setWidget(i,0,Label("Track:") )
self.infoTable.setWidget(i,1,self.trackLabel)
i+=1
self.infoTable.setWidget(i,0,Label("Album:") )
self.infoTable.setWidget(i,1,self.albumLabel)
self.statusPanel.add(self.infoTable)
self.statusPanel.add(self.timeLabel)
#make the time bar
timebarWrapperPanel = SimplePanel()
timebarWrapperPanel.setID("timebar_wrapper")
#timebarWrapperPanel.setStyleName('timebar_wrapper')
self.timebarPanel = SimplePanel()
self.timebarPanel.setID("timebar")
#self.timebarPanel.setStyleName('timebar')
timebarWrapperPanel.add(self.timebarPanel)
self.statusPanel.add(timebarWrapperPanel)
#make some shit for buttons
self.buttonHPanel = HorizontalPanel()
self.skipButton = Button("Skip", self.clicked_skip )
self.buttonHPanel.add(self.skipButton)
loveButton = Button("Love", self.clicked_love )
self.buttonHPanel.add(loveButton)
pauseButton = Button("Pause", self.clicked_pause )
self.buttonHPanel.add(pauseButton)
banButton = Button("Ban", self.clicked_ban )
self.buttonHPanel.add(banButton)
#control the volume
self.volumePanel = HorizontalPanel()
self.volumeLabel = Label("Volume:")
self.volumePanel.add(self.volumeLabel)
volupButton = Button("+", self.clicked_volume_up, 5)
self.volumePanel.add(volupButton)
voldownButton = Button("-", self.clicked_volume_down, 5)
self.volumePanel.add(voldownButton)
#make buttons and shit to create a new station
self.setStationHPanel = HorizontalPanel()
self.setStationTypeListBox = ListBox()
self.setStationTypeListBox.setVisibleItemCount(0)
self.setStationTypeListBox.addItem("Similar Artists", "artist/%s/similarartists")
self.setStationTypeListBox.addItem("Top Fans", "artist/%s/fans")
self.setStationTypeListBox.addItem("Library", "user/%s/library")
self.setStationTypeListBox.addItem("Mix", "user/%s/mix")
self.setStationTypeListBox.addItem("Recommended", "user/%s/recommended")
self.setStationTypeListBox.addItem("Neighbours", "user/%s/neighbours")
self.setStationTypeListBox.addItem("Global Tag", "globaltags/%s")
self.setStationHPanel.add(self.setStationTypeListBox)
self.setStationTextBox = TextBox()
self.setStationTextBox.setVisibleLength(10)
self.setStationTextBox.setMaxLength(50)
self.setStationHPanel.add(self.setStationTextBox)
self.setStationButton = Button("Play", self.clicked_set_station)
self.setStationHPanel.add(self.setStationButton)
#make an error place to display data
self.infoHTML = HTML()
RootPanel().add(self.statusPanel)
RootPanel().add(self.buttonHPanel)
RootPanel().add(self.volumePanel)
RootPanel().add(self.setStationHPanel)
RootPanel().add(self.infoHTML)
def run(self):
self.get_track_info()
def get_track_info(self):
HTTPRequest().asyncGet("/track_info", TrackInfoHandler(self))
Timer(5000,self.get_track_info)
def clicked_skip(self):
self.skipButton.setEnabled(False)
HTTPRequest().asyncGet("/skip",ButtonInfoHandler(self,self.skipButton) )
#.........这里部分代码省略.........