本文整理汇总了Python中pyjamas.ui.HTML.HTML.setHTML方法的典型用法代码示例。如果您正苦于以下问题:Python HTML.setHTML方法的具体用法?Python HTML.setHTML怎么用?Python HTML.setHTML使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.ui.HTML.HTML
的用法示例。
在下文中一共展示了HTML.setHTML方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: YChanger
# 需要导入模块: from pyjamas.ui.HTML import HTML [as 别名]
# 或者: from pyjamas.ui.HTML.HTML import setHTML [as 别名]
class YChanger (HorizontalPanel):
def __init__(self, chart):
self.chart = chart
HorizontalPanel.__init__(self)
# y-changing, x,y coordinate displaying, widget
self.incrementY = Button("Increment Y")
self.coordinates = HTML(""); # x,y of selected point
self.decrementY = Button("Decrement Y")
self.incrementY.addClickListener(self)
self.decrementY.addClickListener(self)
self.add(self.incrementY)
self.add(self.coordinates)
self.add(self.decrementY)
def onClick(self, sender):
if sender == self.incrementY:
self.chart.getTouchedPoint().setY(
self.chart.getTouchedPoint().getY() + 1)
else:
self.chart.getTouchedPoint().setY(
self.chart.getTouchedPoint().getY() - 1)
self.chart.update()
# The 2 HoverUpdateable interface methods:
def hoverCleanup(self, hoveredAwayFrom):
pass
def hoverUpdate(self, hoveredOver):
# update (x,y) display when they click point
self.coordinates.setHTML(hoveredOver.getHovertext())
示例2: BulkDirectAdd
# 需要导入模块: from pyjamas.ui.HTML import HTML [as 别名]
# 或者: from pyjamas.ui.HTML.HTML import setHTML [as 别名]
class BulkDirectAdd(HorizontalPanel):
def __init__(self):
HorizontalPanel.__init__(self, Spacing=4)
self.add(Label('Directly add in bulk:', StyleName='section'))
self.names = TextArea(VisibleLines=5)
self.add(self.names)
self.update = Button('Add', self)
self.add(self.update)
self.err = HTML()
self.add(self.err)
def onClick(self, sender):
self.err.setHTML('')
names = self.names.getText().strip()
if names == '':
return
else:
self.update.setEnabled(False)
remote = server.AdminService()
id = remote.bulkAddUsers(names, self)
if id < 0:
self.err.setText('oops: could not add')
def onRemoteResponse(self, result, request_info):
self.update.setEnabled(True)
self.err.setText('OK, adding.')
def onRemoteError(self, code, message, request_info):
self.update.setEnabled(True)
self.err.setHTML('Errors:<br/>' +
'<br/>'.join(message['data']['message']))
示例3: GettextExample
# 需要导入模块: from pyjamas.ui.HTML import HTML [as 别名]
# 或者: from pyjamas.ui.HTML.HTML import setHTML [as 别名]
class GettextExample(object):
def __init__(self):
self.b = Button(_("Click me"), self.greet, StyleName='teststyle')
self.h = HTML(_("<b>Hello World</b> (html)"), StyleName='teststyle')
self.l = Label(_("Hello World (label)"), StyleName='teststyle')
self.base = HTML(_("Hello from %s") % pygwt.getModuleBaseURL(),
StyleName='teststyle')
RootPanel().add(self.b)
RootPanel().add(self.h)
RootPanel().add(self.l)
RootPanel().add(self.base)
def change_texts(self, text):
self.b.setText(_("Click me"))
self.h.setHTML(_("<b>Hello World</b> (html)"))
self.l.setText(_("Hello World (label)"))
text = [_("Hello from %s") % pygwt.getModuleBaseURL()]
for i in range(4):
text.append(ngettext('%(num)d single', '%(num)d plural', i) % dict(num=i))
text = '<br />'.join(text)
self.base.setHTML(text)
def greet(self, fred):
fred.setText(_("No, really click me!"))
Window.alert(_("Hello, there!"))
i18n.load(lang=lang[0], onCompletion=self.change_texts)
lang.append(lang.pop(0))
示例4: onCompletion
# 需要导入模块: from pyjamas.ui.HTML import HTML [as 别名]
# 或者: from pyjamas.ui.HTML.HTML import setHTML [as 别名]
def onCompletion(self, response):
'''This method is called when asyncGet returns. If we know parameters of the
repsponse we may process differently for various cases. For example we may setup
data in the form if we call it from Populate Form button.
'''
self.view.root.remove(self.view.panel)
html = HTML()
html.setHTML(response)
self.view.root.add(html)
示例5: RightPanel
# 需要导入模块: from pyjamas.ui.HTML import HTML [as 别名]
# 或者: from pyjamas.ui.HTML.HTML import setHTML [as 别名]
class RightPanel(DockPanel):
def __init__(self):
DockPanel.__init__(self)
self.grids = {}
self.g = Grid()
self.g.setCellSpacing("0px")
self.g.setCellPadding("8px")
self.title = HTML(" ")
self.title.setStyleName("rightpanel-title")
self.add(self.title, DockPanel.NORTH)
self.setCellWidth(self.title, "100%")
self.setCellHorizontalAlignment(self.title,
HasHorizontalAlignment.ALIGN_LEFT)
self.add(self.g, DockPanel.CENTER)
def setTitle(self, title):
self.title.setHTML(title)
def clear_items(self):
for i in range(len(self.grids)):
g = self.grids[i]
if hasattr(g, "clear_items"):
g.clear_items()
self.grids = {}
self.g.resize(0, 0)
def setup_panels(self, datasets):
self.grids = {}
self.data = {}
self.names = {}
self.loaded = {}
size = len(datasets)
self.g.resize(size, 1)
#for i in range(size):
# item = datasets[i]
# fname = item[0]
# self.grids[i] = RightGrid(fname)
# self.g.setWidget(i, 0, self.grids[i])
def add_html(self, html, name, index):
self.data[index] = html
self.names[index] = name
self.grids[index] = HTML(html)
self.g.setWidget(index, 0, self.grids[index])
def add_items(self, items, name, index):
self.data[index] = items
self.names[index] = name
self.grids[index] = RightGrid("")
self.grids[index].set_items(items)
self.g.setWidget(index, 0, self.grids[index])
示例6: onModuleLoad
# 需要导入模块: from pyjamas.ui.HTML import HTML [as 别名]
# 或者: from pyjamas.ui.HTML.HTML import setHTML [as 别名]
class Slideshow:
def onModuleLoad(self):
self.slide = HTML()
RootPanel().add(self.slide)
HTTPRequest().asyncPost("test_slide.txt", "", SlideLoader(self))
def setSlide(self, content):
self.slide.setHTML("<pre>%s</pre>" % content)
def onError(self, text, code):
self.slide.setHTML(text + "<br />" + code)
示例7: SimpleTweetPanel
# 需要导入模块: from pyjamas.ui.HTML import HTML [as 别名]
# 或者: from pyjamas.ui.HTML.HTML import setHTML [as 别名]
class SimpleTweetPanel(HorizontalPanel):
def __init__(self, screennames, nUsers, topPanel):
HorizontalPanel.__init__(self)
self.screennames = screennames
self.nUsers = nUsers
self.topPanel = topPanel
self.add(HTML(_title, StyleName='result-detail'))
self.withButton = Button(_withAtText, self, StyleName='with-at-button')
self.add(self.withButton)
self.withoutButton = Button(_withoutAtText, self,
StyleName='without-at-button')
self.add(self.withoutButton)
self.link = HTML()
self.add(self.link)
def onClick(self, sender):
self.link.setText('')
if sender == self.withButton:
self.withButton.setEnabled(False)
useAts = True
else:
self.withoutButton.setEnabled(False)
useAts = False
remote = server.TickeryService()
id = remote.simpleTweet(
self.topPanel.loginPanel.oauthCookie, self.screennames,
self.nUsers, userlist._sortKey, useAts, self)
if id < 0:
self.link.setText('Oops!')
def onRemoteResponse(self, response, request_info):
self.withButton.setEnabled(True)
self.withoutButton.setEnabled(True)
if response['result']:
self.link.setHTML('<a href="%s">%s</a>' %
(response['URL'], _doneText))
else:
self.link.setText('Oops: %r' % response)
def onRemoteError(self, code, message, request_info):
self.withButton.setEnabled(True)
self.withoutButton.setEnabled(True)
self.link.setText('Server Err or Invalid Response: ERROR %d - %s' %
(code, message))
示例8: MailDetail
# 需要导入模块: from pyjamas.ui.HTML import HTML [as 别名]
# 或者: from pyjamas.ui.HTML.HTML import setHTML [as 别名]
class MailDetail(Composite):
def __init__(self):
Composite.__init__(self)
panel = VerticalPanel()
headerPanel = VerticalPanel()
self.subject = HTML()
self.sender = HTML()
self.recipient = HTML()
self.body = HTML()
self.scroller = ScrollPanel(self.body)
self.body.setWordWrap(True)
headerPanel.add(self.subject)
headerPanel.add(self.sender)
headerPanel.add(self.recipient)
headerPanel.setWidth("100%")
innerPanel = DockPanel()
innerPanel.add(headerPanel, DockPanel.NORTH)
innerPanel.add(self.scroller, DockPanel.CENTER)
innerPanel.setCellHeight(self.scroller, "100%")
panel.add(innerPanel)
innerPanel.setSize("100%", "100%")
self.scroller.setSize("100%", "100%")
self.initWidget(panel)
self.setStyleName("mail-Detail")
headerPanel.setStyleName("mail-DetailHeader")
innerPanel.setStyleName("mail-DetailInner")
self.subject.setStyleName("mail-DetailSubject")
self.sender.setStyleName("mail-DetailSender")
self.recipient.setStyleName("mail-DetailRecipient")
self.body.setStyleName("mail-DetailBody")
Logger("Mail detail", " ")
def setItem(self, item):
self.scroller.setScrollPosition(0)
self.scroller.setHorizontalScrollPosition(0)
self.subject.setHTML(item.subject)
self.sender.setHTML("<b>From:</b> " + item.sender)
self.recipient.setHTML("<b>To:</b> [email protected]")
self.body.setHTML(item.body)
def adjustSize(self, windowWidth, windowHeight):
scrollWidth = windowWidth - self.scroller.getAbsoluteLeft() - 9
if (scrollWidth < 1):
scrollWidth = 1
scrollHeight = windowHeight - self.scroller.getAbsoluteTop() - 9
if (scrollHeight < 1):
scrollHeight = 1
self.scroller.setSize("%dpx" % scrollWidth, "%dpx" % scrollHeight)
示例9: ControlButton
# 需要导入模块: from pyjamas.ui.HTML import HTML [as 别名]
# 或者: from pyjamas.ui.HTML.HTML import setHTML [as 别名]
class ControlButton(Composite):
def __init__(self, up_url, down_url, up_msg, down_msg):
Composite.__init__(self)
self.state = "up"
self.up_url = up_url
self.down_url = down_url
self.up_msg = up_msg
self.down_msg = down_msg
self.control = VerticalPanel()
self.image = Image(up_url)
self.image.setStyleName("gwt-Image-Cell")
self.text = HTML(up_msg)
self.image.base = self
self.text.base = self
self.text.horzAlign = "center"
self.control.add(self.image)
self.control.add(self.text)
self.initWidget(self.control)
def toggleImage(self):
if self.state == "up":
new_url = self.down_url
new_msg = self.down_msg
self.state = "down"
elif self.state == "down":
new_url = self.up_url
new_msg = self.up_msg
self.state = "up"
self.image.setUrl(new_url)
self.text.setHTML(new_msg)
def toggleTimer(self):
self.base.base.display_panel.timer.toggle()
def addMouseListener(self, listner):
self.image.addMouseListener(listner)
示例10: CalsIFACE
# 需要导入模块: from pyjamas.ui.HTML import HTML [as 别名]
# 或者: from pyjamas.ui.HTML.HTML import setHTML [as 别名]
class CalsIFACE(RecipeSystemIFACE.PanelIFACE):
def __init__(self):
self.calsPanel = VerticalPanel(Size=("50%", ""))
self.info = HTML("", Width="100%")
self.calsPanel.add(self.info)
self.localcalreport = HTML("", True, )
self.globalcalreport = HTML("", True, )
self.calsPanel.add(self.localcalreport)
self.calsPanel.add(self.globalcalreport)
self.panel = self.calsPanel
def onTreeItemSelected(self, item):
pathdict = self.pathdict
tfile = item.getText()
msg = repr(pathdict)
#JS("alert(msg)")
#check if already in
self.info.setHTML("""
<h1>Filename: %(tfile)s</h1>
""" % {"tfile":tfile})
parms = {"caltype":"all",
"filename":tfile}
self.localcalreport.setHTML('<span style="text-color:red">Waiting for Local Calibration Result</span>')
self.globalcalreport.setHTML('<span style="text-color:red">Waiting for Global Calibration Result</span>')
HTTPRequest().asyncGet(
"calsearch.xml?caltype=%(caltype)s&filename=%(filename)s"
% parms,
CalibrationLoader(self, local=True))
HTTPRequest().asyncGet(
"globalcalsearch.xml?caltype=%(caltype)s&filename=%(filename)s"
% parms,
CalibrationLoader(self, local=False))
return
示例11: loadChapters
# 需要导入模块: from pyjamas.ui.HTML import HTML [as 别名]
# 或者: from pyjamas.ui.HTML.HTML import setHTML [as 别名]
def loadChapters(self):
self.curInfo = ''
self.curSink = None
self.description = HTML()
self.sink_list = SinkList()
self.panel = DockPanel()
self.loadSinks()
self.sinkContainer = DockPanel()
self.sinkContainer.setStyleName("ks-Sink")
#self.nf = NamedFrame("section")
#self.nf.setWidth("100%")
#self.nf.setHeight("10000")
self.sp = ScrollPanel(self.sinkContainer)
#self.sp = VerticalSplitPanel()
self.sp.setWidth("100%")
self.sp.setHeight("100%")
#self.sp.setTopWidget(self.sinkContainer)
#self.sp.setBottomWidget(self.nf)
#self.sp.setSplitPosition(10000) # deliberately high - max out.
vp = VerticalPanel()
vp.setWidth("99%")
vp.setHeight("100%")
vp.add(self.description)
vp.add(self.sp)
authors = [
("2008, 2009", "Kenneth Casson Leighton", "[email protected]")
]
for years, name, email in authors:
authors_html = \
'© %s <a href="mailto:%s">%s</a><br />' %\
(years, email, name)
authors_panel = HTML()
authors_panel.setStyleName("ks-Authors")
authors_panel.setHTML(authors_html[:-6])
left_panel = DockPanel(Height="100%")
left_panel.add(self.sink_list, DockPanel.NORTH)
left_panel.add(authors_panel, DockPanel.SOUTH)
self.description.setStyleName("ks-Intro")
self.panel.add(left_panel, DockPanel.WEST)
self.panel.add(vp, DockPanel.CENTER)
self.panel.setCellVerticalAlignment(self.sink_list,
HasAlignment.ALIGN_TOP)
self.panel.setCellWidth(vp, "100%")
self.panel.setCellHeight(vp, "100%")
Window.addWindowResizeListener(self)
History.addHistoryListener(self)
RootPanel().add(self.panel)
self.onWindowResized(Window.getClientWidth(), Window.getClientHeight())
示例12: EditDialogWindow
# 需要导入模块: from pyjamas.ui.HTML import HTML [as 别名]
# 或者: from pyjamas.ui.HTML.HTML import setHTML [as 别名]
class EditDialogWindow(DialogWindow):
def __init__(self, app):
self.app = app
DialogWindow.__init__(
self, modal=False,
minimize=True, maximize=True, close=True,
)
self.closeButton = Button("Close", self)
self.saveButton = Button("Save", self)
self.setText("Sample DialogWindow with embedded image")
self.msg = HTML("", True)
global _editor_id
_editor_id += 1
editor_id = "editor%d" % _editor_id
#self.ht = HTML("", ID=editor_id)
self.txt = TextArea(Text="", VisibleLines=30, CharacterWidth=80,
ID=editor_id)
dock = DockPanel()
dock.setSpacing(4)
hp = HorizontalPanel(Spacing="5")
hp.add(self.saveButton)
hp.add(self.closeButton)
dock.add(hp, DockPanel.SOUTH)
dock.add(self.msg, DockPanel.NORTH)
dock.add(self.txt, DockPanel.CENTER)
dock.setCellHorizontalAlignment(hp, HasAlignment.ALIGN_RIGHT)
dock.setCellWidth(self.txt, "100%")
dock.setWidth("100%")
self.setWidget(dock)
self.editor_id = editor_id
self.editor_created = False
def add_tinymce(self):
# for storing the results when available
iframe = DOM.createElement("iframe")
DOM.setElemAttribute(iframe, "id", "__edit_%s" % self.editor_id)
DOM.setElemAttribute(iframe, "style", "display:none")
doc().body.appendChild(iframe)
# activate tinymce
new_script = DOM.createElement("script")
new_script.innerHTML = """
tinyMCE.init({
// General options
mode : "textareas",
theme : "simple",
// Theme options
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,|,table,removeformat",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
theme_advanced_buttons4 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
});
"""
ih = """
var ed = new tinymce.Editor('%s',{
mode : "none",
theme : "advanced",
plugins : "inlinepopups",
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,|,table,image,removeformat",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
theme_advanced_buttons4 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true
});
ed.render();
ed.load();
tinymce.add(ed);
""" % self.editor_id
print new_script.innerHTML
DOM.setElemAttribute(new_script, "type", "text/javascript")
doc().body.appendChild(new_script)
def load(self, token, fname, data):
left = 50 # self.fDialogButton.getAbsoluteLeft() + 10
top = 50 # self.fDialogButton.getAbsoluteTop() + 10
self.setPopupPosition(left, top)
self.show()
self.token = token
self.fname = fname
self.msg.setHTML("<center>This is an example of a standard dialog box component.<br> You can put pretty much anything you like into it,<br>such as the following image '%s':</center>" % fname)
#.........这里部分代码省略.........
示例13: onHistoryChanged
# 需要导入模块: from pyjamas.ui.HTML import HTML [as 别名]
# 或者: from pyjamas.ui.HTML.HTML import setHTML [as 别名]
class Bookreader:
def onHistoryChanged(self, token):
info = self.sink_list.find(token)
if info:
self.show(info, False)
else:
self.showInfo()
def onModuleLoad(self):
section = Window.getLocation().getSearchVar("section")
if not section:
self.loadChapters()
else:
loadSection(section)
def loadChapters(self):
self.curInfo = ''
self.curSink = None
self.description = HTML()
self.sink_list = SinkList()
self.panel = DockPanel()
self.loadSinks()
self.sinkContainer = DockPanel()
self.sinkContainer.setStyleName("ks-Sink")
#self.nf = NamedFrame("section")
#self.nf.setWidth("100%")
#self.nf.setHeight("10000")
self.sp = ScrollPanel(self.sinkContainer)
#self.sp = VerticalSplitPanel()
self.sp.setWidth("100%")
self.sp.setHeight("100%")
#self.sp.setTopWidget(self.sinkContainer)
#self.sp.setBottomWidget(self.nf)
#self.sp.setSplitPosition(10000) # deliberately high - max out.
vp = VerticalPanel()
vp.setWidth("99%")
vp.setHeight("100%")
vp.add(self.description)
vp.add(self.sp)
authors = [
("2008, 2009", "Kenneth Casson Leighton", "[email protected]")
]
for years, name, email in authors:
authors_html = \
'© %s <a href="mailto:%s">%s</a><br />' %\
(years, email, name)
authors_panel = HTML()
authors_panel.setStyleName("ks-Authors")
authors_panel.setHTML(authors_html[:-6])
left_panel = DockPanel(Height="100%")
left_panel.add(self.sink_list, DockPanel.NORTH)
left_panel.add(authors_panel, DockPanel.SOUTH)
self.description.setStyleName("ks-Intro")
self.panel.add(left_panel, DockPanel.WEST)
self.panel.add(vp, DockPanel.CENTER)
self.panel.setCellVerticalAlignment(self.sink_list,
HasAlignment.ALIGN_TOP)
self.panel.setCellWidth(vp, "100%")
self.panel.setCellHeight(vp, "100%")
Window.addWindowResizeListener(self)
History.addHistoryListener(self)
RootPanel().add(self.panel)
self.onWindowResized(Window.getClientWidth(), Window.getClientHeight())
def onWindowResized(self, width, height):
self.panel.setWidth(width-20)
self.sink_list.resize(width-20, height-130)
self.sp.setHeight("%dpx" % (height-130))
def show(self, info, affectHistory):
if info == self.curInfo:
return
self.curInfo = info
#Logger.write("showing " + info.getName())
if self.curSink is not None:
self.curSink.onHide()
#Logger.write("removing " + self.curSink)
self.sinkContainer.remove(self.curSink)
self.curSink = info.getInstance()
self.sink_list.setSinkSelection(info.getName())
self.sink_list.sp.setScrollPosition(0)
self.sink_list.sp.setHorizontalScrollPosition(0)
self.description.setHTML(info.getDescription())
#.........这里部分代码省略.........
示例14: Photos
# 需要导入模块: from pyjamas.ui.HTML import HTML [as 别名]
# 或者: from pyjamas.ui.HTML.HTML import setHTML [as 别名]
#.........这里部分代码省略.........
gridcols = self.grid.getColumnCount()
self.pos =row+col+(row*(gridcols-1))
photo = self.photos[self.pos]
self.vp.clear()
self.fullsize = HTML('<img src="' + photo["full"] + '"/>')
hp = HorizontalPanel()
hp.add(self.up)
hp.add(self.prev)
hp.add(self.next)
hp.setSpacing(8)
self.vp.add(hp)
self.vp.add(self.fullsize)
def onClick(self, sender):
if sender == self.IDButton:
self.userid = self.IDBox.getText()
if self.userid == "" or self.userid.isdigit():
return
self.drill = 0
self.album_url = "http://picasaweb.google.com/data/feed/base/user/" + self.userid + "?alt=json-in-script&kind=album&hl=en_US&callback=restCb"
self.grid.clear()
self.doRESTQuery(self.album_url, self.timer)
else:
if self.drill == 2:
if sender == self.up:
self.drill=1
self.vp.clear()
self.vp.add(self.up)
self.vp.add(self.grid)
self.fillGrid(self.photos, "photos")
else:
if sender == self.next:
if self.pos >= len(self.photos):
return
self.pos +=1
elif sender == self.prev:
if self.pos < 1:
return
self.pos -=1
photo = self.photos[self.pos]
self.fullsize.setHTML('<img src="' + photo["full"] + '"/>')
elif self.drill == 1:
self.drill=0
self.vp.clear()
self.vp.add(self.IDPanel)
self.vp.add(self.disclosure)
self.vp.add(self.grid)
self.fillGrid(self.albums, "albums")
def onTimer(self, timer):
receiver = JS("$wnd.receiver")
if receiver == 'wait':
self.timer.schedule(1000)
return
JS("$wnd.receiver = 'wait'")
if self.drill == 0:
self.parseAlbums(receiver)
self.fillGrid(self.albums, "albums")
elif self.drill == 1:
self.parsePhotos(receiver)
self.fillGrid(self.photos, "photos")
def fillGrid(self, items, type):
self.grid.clear()
cols = self.grid.getColumnCount()
self.grid.resizeRows((len(items)/cols)+1)
rows = self.grid.getRowCount()
for i in range(len(items)):
vp = VerticalPanel()
if type == 'photos':
vp.add(items[i]['thumb'])
else:
vp.add(items[i]['thumb'])
vp.add(items[i]['title'])
self.grid.setWidget(int(i/cols), i%cols, vp)
def parsePhotos(self, items):
photo_list = JSONParser().jsObjectToPyObject(items)
self.photos = []
for i in range(len(photo_list)):
index = "%s" % i
aphoto = {}
aphoto['thumb'] = HTML('<img src="' + photo_list[index]["media$group"]["media$thumbnail"]["1"]["url"] + '"/>')
aphoto['full'] = photo_list[index]["media$group"]["media$content"]["0"]["url"]
self.photos.append(aphoto)
def parseAlbums(self, items):
album_list = JSONParser().jsObjectToPyObject(items)
self.albums = []
for i in range(len(album_list)):
index = "%s" % i
analbum = {}
analbum['title'] = HTML(album_list[index]["title"]["$t"])
analbum['thumb'] = HTML('<img src="' + album_list[index]["media$group"]["media$thumbnail"]["0"]["url"] + '"/>')
url = album_list[index]["id"]["$t"]
analbum['id'] = url.split('albumid/')[1].split('?alt')[0]
self.albums.append(analbum)
示例15: PopupPagina
# 需要导入模块: from pyjamas.ui.HTML import HTML [as 别名]
# 或者: from pyjamas.ui.HTML.HTML import setHTML [as 别名]
class PopupPagina(PopupPanel):
def __init__(self, autoHide=None, modal=True, **kwargs):
PopupPanel.__init__(self, autoHide, modal, **kwargs)
datasource = None
id = None
if kwargs.has_key("datasrc"):
datasource = kwargs["datasrc"]
if kwargs.has_key("id"):
id = kwargs["id"]
self.setSize(Window.getClientWidth() - 50, Window.getClientHeight() - 50)
self.setPopupPosition(20, 0)
DOM.setAttribute(self, "align", "center")
# self.dbProxInstrucao = DialogBox()
# self.dbProxInstrucao.setHTML("Alow")
# botton = Button("Ok")
# botton.addClickListener(self.onCloseDialog)
# self.dbProxInstrucao.setWidget(botton)
self.caption = HTML()
self.child = None
self.setHTML("<b>Soma de Matrizes.</b>")
self.dragging = False
self.dragStartX = 0
self.dragStartY = 0
self.imageFechar = Image("images/fechar.gif", Size=("32px", "32px"), StyleName="gwt-ImageButton")
self.imgbtnDesfazer = Image("images/previous-arrow.png", Size=("32px", "20px"), StyleName="gwt-ImageButton")
self.imgbtnFazer = Image("images/next-arrow.png", Size=("32px", "20px"), StyleName="gwt-ImageButton")
# self.imgbtnDesfazer.addClickListener(desfazerProxOperacao)
# self.imgbtnFazer.addClickListener(fazerProxOperacao)
self.btnAutomatic = Button("Automático", self.onIniciarAnimacaoAutomatica)
self.btnInterativo = Button("Interativo")
if id == "escalar":
self.btnStepByStep = Button("Passo a passo", IniciarAnimacaoPassoAPasso)
else:
self.btnStepByStep = Button("Passo a passo", self.onIniciarAnimacaoPassoAPasso)
self.btnFazer = Button("fazer >>", fazerProxOperacao)
# self.btnFazer.setEnabled(False);
self.btnDesfazer = Button("<< desfazer", desfazerProxOperacao)
# self.btnDesfazer.setEnabled(False);
self.btnFechar = PushButton(imageFechar, imageFechar)
self.btnTestarResposta = Button("Testar Solução")
self.lbVelocidade = ListBox()
self.lbVelocidade.setID("lbseg")
self.lbVelocidade.addItem("0.5 segundo", value=2)
self.lbVelocidade.addItem("1 segundo", value=1)
self.lbVelocidade.addItem("2 segundos", value=0.5)
self.lbVelocidade.addItem("3 segundos", value=1 / 3)
self.lbVelocidade.addItem("4 segundos", value=0.25)
self.lbVelocidade.addItem("5 segundos", value=0.20)
self.lbVelocidade.addItem("6 segundos", value=0.167)
self.lbVelocidade.addItem("7 segundos", value=0.143)
self.lbVelocidade.addItem("8 segundos", value=0.125)
self.lbVelocidade.addItem("10 segundos", value=0.1)
lblinha1 = ListBox()
lblinha1.setID("lm1")
lblinha1.addItem("1", value=1)
lblinha1.addItem("2", value=2)
lblinha1.addItem("3", value=3)
lblinha1.addItem("4", value=4)
lblinha1.addItem("5", value=5)
lblinha2 = ListBox()
lblinha2.setID("lm2")
lblinha2.addItem("1", value=1)
lblinha2.addItem("2", value=2)
lblinha2.addItem("3", value=3)
lblinha2.addItem("4", value=4)
lblinha2.addItem("5", value=5)
lbcoluna1 = ListBox()
lbcoluna1.setID("cm1")
lbcoluna1.addItem("1", value=1)
lbcoluna1.addItem("2", value=2)
lbcoluna1.addItem("3", value=3)
lbcoluna1.addItem("4", value=4)
lbcoluna1.addItem("5", value=5)
lbcoluna1.addItem("6", value=6)
lbcoluna1.addItem("7", value=7)
lbcoluna2 = ListBox()
lbcoluna2.setID("cm2")
lbcoluna2.addItem("1", value=1)
lbcoluna2.addItem("2", value=2)
lbcoluna2.addItem("3", value=3)
lbcoluna2.addItem("4", value=4)
lbcoluna2.addItem("5", value=5)
lbcoluna2.addItem("6", value=6)
lbcoluna2.addItem("7", value=7)
self.lblStatus = Label("Label para Status")
#.........这里部分代码省略.........