本文整理汇总了Python中pyjamas.ui.Image.Image._user方法的典型用法代码示例。如果您正苦于以下问题:Python Image._user方法的具体用法?Python Image._user怎么用?Python Image._user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.ui.Image.Image
的用法示例。
在下文中一共展示了Image._user方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUsers
# 需要导入模块: from pyjamas.ui.Image import Image [as 别名]
# 或者: from pyjamas.ui.Image.Image import _user [as 别名]
def setUsers(self, title, users, kwargs):
self.users = users
self.nUsers = len(users)
self.title = title
self.resultPanel = HorizontalPanel(StyleName='result-panel')
self.add(self.resultPanel)
self.leftPanel = VerticalPanel(StyleName='results-left-panel',
Width=self.leftPanelWidth)
self.resultPanel.add(self.leftPanel)
if not users:
self.iconPanel = None
self.leftPanel.add(HTML(title, StyleName='result-title'))
else:
# Set a display order that will show everything for now.
self.displayOrder = range(self.nUsers)
self.largeAvatar = LargeAvatar(self, self.tabPanel, self.topPanel)
self.leftPanel.add(self.largeAvatar)
resultPanelBottomLeft = VerticalPanel(
StyleName='results-left-panel-bottom-left')
self.resultLink = HTML(StyleName='result-detail')
self.updateResultLink()
resultPanelBottomLeft.add(self.resultLink)
self.iconSizePanel = HorizontalPanel()
self.iconSizePanel.add(
HTML('Icons: ', StyleName='result-detail'))
self.iconSizeLb = lb = ListBox()
i = 0
for text, key in _iconData:
lb.addItem(text, key)
if key == _iconSize:
lb.setSelectedIndex(i)
i += 1
lb.addChangeListener(IconSizeChanger(self))
self.iconSizePanel.add(lb)
resultPanelBottomLeft.add(self.iconSizePanel)
if self.nUsers > 1:
self.sortPanel = HorizontalPanel()
self.sortPanel.add(
HTML('Sort: ', StyleName='result-detail'))
self.lb = lb = ListBox()
i = 0
for text, key in _sortKeyData:
lb.addItem(text, key)
if key == _sortKey:
lb.setSelectedIndex(i)
i += 1
lb.addChangeListener(self)
self.sortPanel.add(lb)
resultPanelBottomLeft.add(self.sortPanel)
self.filterPanel = HorizontalPanel()
resultPanelBottomLeft.add(self.filterPanel)
self.addFilterWidgets()
if self.topPanel.loggedIn():
if 'screennames' in kwargs:
resultPanelBottomLeft.add(tweet.SimpleTweetPanel(
kwargs['screennames'], len(self.users), self.topPanel))
elif 'query' in kwargs:
resultPanelBottomLeft.add(tweet.PrepareTweetButton(
kwargs['query'], len(self.users),
self.tabPanel.tabName, self.topPanel))
self.leftPanel.add(resultPanelBottomLeft)
self.iconPanel = VerticalPanel(StyleName='icon-outer-panel')
self.resultPanel.add(self.iconPanel)
self.images = []
for u in users:
url = u['profile_image_url']
i = Image(url, StyleName='avatar-' + _iconSize)
# Does calling prefetch actually help?
i.prefetch(url)
i._user = u
i._selected = False
i.addMouseListener(self)
self.images.append(i)
self.showUsers()