This repository has been archived by the owner on Oct 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathavatar_menu.py
48 lines (39 loc) · 1.69 KB
/
avatar_menu.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from PyQt4 import uic
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import avatar_prechooser
import cyemussa
ym = cyemussa.CyEmussa.Instance()
class AvatarMenu(QObject):
def __init__(self, app):
QObject.__init__(app)
super(AvatarMenu, self).__init__()
self.app = app
self.widget = uic.loadUi('ui/avatar_menu.ui')
self.widget.setWindowFlags(self.widget.windowFlags() | Qt.Popup)
self.widget.setWindowTitle(self.app.me.yahoo_id)
self.widget.avatarHolder.setPixmap(QPixmap(self.app.me.avatar.image))
self.widget.label_displayImage.linkActivated.connect(self._openLink)
self.widget.label_contactDetails.linkActivated.connect(self._openLink)
self.widget.label_accountInfo.linkActivated.connect(self._openLink)
self.widget.label_manageUpdates.linkActivated.connect(self._openLink)
self.widget.label_myProfile.linkActivated.connect(self._openLink)
self.widget.setFocus(Qt.MouseFocusReason)
self.widget.focusOutEvent = self._focusOutEvent
def _focusOutEvent(self, event):
if not self.widget.findChild(QLabel,
self.widget.focusWidget().objectName()):
self.widget.hide()
self.setParent(None)
def _openLink(self, link_url):
url = QUrl(link_url)
if url.scheme() == 'cyuf':
if url.host() == 'choose-avatar':
self.avatarPrechooser = avatar_prechooser.AvatarPrechooser(
self.app
)
self.avatarPrechooser.widget.show()
self.widget.hide()
self.setParent(None)
else:
QDesktopServices.openUrl(url)