本文整理汇总了Python中pyjamas.ui.Image.Image.addMouseListener方法的典型用法代码示例。如果您正苦于以下问题:Python Image.addMouseListener方法的具体用法?Python Image.addMouseListener怎么用?Python Image.addMouseListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.ui.Image.Image
的用法示例。
在下文中一共展示了Image.addMouseListener方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onRemoteResponse
# 需要导入模块: from pyjamas.ui.Image import Image [as 别名]
# 或者: from pyjamas.ui.Image.Image import addMouseListener [as 别名]
def onRemoteResponse(self, result, request_info):
if result['result']:
self.sender.screenname = screenname = result['screen_name']
h = HTML('%s ' % utils.screennameToTwitterLink(screenname),
StyleName='logged-in-text')
self.sender.setWidget(0, 0, h)
logout = Image('logout.gif', StyleName='logout-image')
logout.addMouseListener(self)
self.sender.setWidget(0, 1, logout)
remote = server.TickeryService()
id = remote.friendsIds(self.sender.oauthCookie,
screenname, SetFriends(screenname, self.sender))
if id < 0:
self.sender.setWidget(
0, 1, Label("Oops: Couldn't fetch friends."))
else:
self.sender.notLoggedIn()
示例2: notLoggedIn
# 需要导入模块: from pyjamas.ui.Image import Image [as 别名]
# 或者: from pyjamas.ui.Image.Image import addMouseListener [as 别名]
def notLoggedIn(self):
if self.oauthCookie:
_deleteCookie()
self.oauthCookie = None
self.clear()
self.loggedIn = False
self.screenname = None
self.friendsIds = None
loginImage = Image('login.png', StyleName='login-image')
loginImage.addMouseListener(self)
self.setWidget(0, 0, loginImage)
why = Button(WHY_BUTTON_TEXT, self, StyleName='why-button')
self.setWidget(0, 1, why)
self.instructions = HTML(WHY_TEXT,
StyleName='instructions-popup',
HorizontalAlignment=HasAlignment.ALIGN_LEFT)
self.popup = tickerytab.InstructionBox(
self.__class__.__name__, self.instructions)
self.popup.setText(WHY_TITLE)
示例3: __init__
# 需要导入模块: from pyjamas.ui.Image import Image [as 别名]
# 或者: from pyjamas.ui.Image.Image import addMouseListener [as 别名]
def __init__(self):
Sink.__init__(self)
img = Image("images/num1.png")
img.addMouseListener(TooltipListener("An image: " + img.getUrl()))
img2 = Image("images/num2.png")
img2.addMouseListener(TooltipListener("An image: " + img2.getUrl()))
html = HTML("Some <i>HTML</i> text.")
html.addMouseListener(TooltipListener("An HTML component."))
panel_h = HorizontalPanel()
panel_h.add(img)
panel_h.add(img2)
panel_h.setSpacing(8)
panel = VerticalPanel()
panel.add(panel_h)
panel.add(html)
panel.setSpacing(8)
self.setWidget(panel)
示例4: ControlButton
# 需要导入模块: from pyjamas.ui.Image import Image [as 别名]
# 或者: from pyjamas.ui.Image.Image import addMouseListener [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)
示例5: setUsers
# 需要导入模块: from pyjamas.ui.Image import Image [as 别名]
# 或者: from pyjamas.ui.Image.Image import addMouseListener [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()