本文整理汇总了Python中pyjamas.ui.SimplePanel.SimplePanel.setWidth方法的典型用法代码示例。如果您正苦于以下问题:Python SimplePanel.setWidth方法的具体用法?Python SimplePanel.setWidth怎么用?Python SimplePanel.setWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.ui.SimplePanel.SimplePanel
的用法示例。
在下文中一共展示了SimplePanel.setWidth方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pyjamas.ui.SimplePanel import SimplePanel [as 别名]
# 或者: from pyjamas.ui.SimplePanel.SimplePanel import setWidth [as 别名]
def __init__(self, c):
PopupPanel.__init__(self, True)
p = SimplePanel()
p.add(c)
c.show(10, 10)
p.setWidth("100%")
self.setWidget(p)
示例2: setInitialWidth
# 需要导入模块: from pyjamas.ui.SimplePanel import SimplePanel [as 别名]
# 或者: from pyjamas.ui.SimplePanel.SimplePanel import setWidth [as 别名]
def setInitialWidth(self, width):
self.uncollapsed_width = width
SimplePanel.setWidth(self, width)
self.sink.setCollapserWidth(self, width)
示例3: __init__
# 需要导入模块: from pyjamas.ui.SimplePanel import SimplePanel [as 别名]
# 或者: from pyjamas.ui.SimplePanel.SimplePanel import setWidth [as 别名]
#.........这里部分代码省略.........
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) )
def clicked_volume_down(self):
HTTPRequest().asyncGet("/volume/down",NullInfoHandler(self) )
def clicked_volume_up(self):
HTTPRequest().asyncGet("/volume/up",NullInfoHandler(self) )
def clicked_love(self):
HTTPRequest().asyncGet("/love",NullInfoHandler(self) )
def clicked_ban(self):
result = Window.confirm("Really ban this song?")
if result:
HTTPRequest().asyncGet("/ban",NullInfoHandler(self) )
def clicked_pause(self):
HTTPRequest().asyncGet("/pause",NullInfoHandler(self) )
def clicked_set_station(self):
type = self.setStationTypeListBox.getSelectedValues()[0]
text = self.setStationTextBox.getText().strip()
if len(text) > 0 :
#clear the text
self.setStationTextBox.setText("")
station = type % text
HTTPRequest().asyncGet("/station/%s" % station,NullInfoHandler(self) )
def set_error(self, content):
self.infoHTML.setHTML("<pre>%s</pre>" % content)
def onTimeout(self,text):
self.infoHTML.setHTML("timeout: "+text)
def onError(self, text, code):
self.infoHTML.setHTML(text + "<br />" + str(code))
def process_track_info(self,text):
#explode the text at ::
#%a::%t::%l::%d::%R::%s::%v::%r
data = text.split("::")
artist = data[0]
track = data[1]
album = data[2]
duration = data[3]
played = int(duration)-int(data[4])
percent = int( played/int(duration)*100 )
self.artistLabel.setText( artist )
self.trackLabel.setText( track )
self.albumLabel.setText( album )
#format time
t = "%s : %d %d" % (duration,played,percent)
self.timeLabel.setText(data[7])
#update the timebarwidth
self.timebarPanel.setWidth("%d%" % (percent) )
#set the station
self.stationLabel.setText(data[5])
#display the volume
self.volumeLabel.setText("Volume: "+data[6])
Window.setTitle(self.title+": "+artist+" - "+track)