Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vmj-qt
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
vmj-qt
Commits
63d4c850
Commit
63d4c850
authored
Jun 19, 2013
by
Dan Pascu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Provide visual hint of which contact icon is used by disabling menu entry
parent
5690f59c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
labels.py
blink/widgets/labels.py
+11
-4
No files found.
blink/widgets/labels.py
View file @
63d4c850
...
@@ -16,6 +16,10 @@ from blink.widgets.color import ColorHelperMixin
...
@@ -16,6 +16,10 @@ from blink.widgets.color import ColorHelperMixin
from
blink.widgets.util
import
QtDynamicProperty
from
blink.widgets.util
import
QtDynamicProperty
class
ContextMenuActions
(
object
):
pass
class
IconSelector
(
QLabel
):
class
IconSelector
(
QLabel
):
default_icon
=
QtDynamicProperty
(
'default_icon'
,
QIcon
)
default_icon
=
QtDynamicProperty
(
'default_icon'
,
QIcon
)
icon_size
=
QtDynamicProperty
(
'icon_size'
,
int
)
icon_size
=
QtDynamicProperty
(
'icon_size'
,
int
)
...
@@ -24,8 +28,9 @@ class IconSelector(QLabel):
...
@@ -24,8 +28,9 @@ class IconSelector(QLabel):
def
__init__
(
self
,
parent
=
None
):
def
__init__
(
self
,
parent
=
None
):
super
(
IconSelector
,
self
)
.
__init__
(
parent
)
super
(
IconSelector
,
self
)
.
__init__
(
parent
)
self
.
addAction
(
QAction
(
u'Select icon...'
,
self
,
triggered
=
self
.
_SH_ChangeIconActionTriggered
))
self
.
actions
=
ContextMenuActions
()
self
.
addAction
(
QAction
(
u'Use contact provided icon'
,
self
,
triggered
=
self
.
_SH_ClearIconActionTriggered
))
self
.
actions
.
select_icon
=
QAction
(
u'Select icon...'
,
self
,
triggered
=
self
.
_SH_ChangeIconActionTriggered
)
self
.
actions
.
remove_icon
=
QAction
(
u'Use contact provided icon'
,
self
,
triggered
=
self
.
_SH_RemoveIconActionTriggered
)
self
.
icon_size
=
48
self
.
icon_size
=
48
self
.
default_icon
=
None
self
.
default_icon
=
None
self
.
contact_icon
=
None
self
.
contact_icon
=
None
...
@@ -96,8 +101,10 @@ class IconSelector(QLabel):
...
@@ -96,8 +101,10 @@ class IconSelector(QLabel):
def
mouseReleaseEvent
(
self
,
event
):
def
mouseReleaseEvent
(
self
,
event
):
if
event
.
button
()
==
Qt
.
LeftButton
and
self
.
rect
()
.
contains
(
event
.
pos
()):
if
event
.
button
()
==
Qt
.
LeftButton
and
self
.
rect
()
.
contains
(
event
.
pos
()):
self
.
actions
.
remove_icon
.
setEnabled
(
self
.
icon
is
not
self
.
contact_icon
)
menu
=
QMenu
(
self
)
menu
=
QMenu
(
self
)
menu
.
addActions
(
self
.
actions
())
menu
.
addAction
(
self
.
actions
.
select_icon
)
menu
.
addAction
(
self
.
actions
.
remove_icon
)
menu
.
exec_
(
self
.
mapToGlobal
(
self
.
rect
()
.
translated
(
0
,
2
)
.
bottomLeft
()))
menu
.
exec_
(
self
.
mapToGlobal
(
self
.
rect
()
.
translated
(
0
,
2
)
.
bottomLeft
()))
super
(
IconSelector
,
self
)
.
mouseReleaseEvent
(
event
)
super
(
IconSelector
,
self
)
.
mouseReleaseEvent
(
event
)
...
@@ -106,7 +113,7 @@ class IconSelector(QLabel):
...
@@ -106,7 +113,7 @@ class IconSelector(QLabel):
if
filename
:
if
filename
:
self
.
filename
=
filename
self
.
filename
=
filename
def
_SH_
Clear
IconActionTriggered
(
self
):
def
_SH_
Remove
IconActionTriggered
(
self
):
self
.
filename
=
None
self
.
filename
=
None
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment