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
15a6f098
Commit
15a6f098
authored
Feb 25, 2014
by
Dan Pascu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added type property to contacts
parent
d82735fa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
22 deletions
+54
-22
contacts.py
blink/contacts.py
+53
-19
sessions.py
blink/sessions.py
+1
-3
No files found.
blink/contacts.py
View file @
15a6f098
...
@@ -995,11 +995,11 @@ class Contact(object):
...
@@ -995,11 +995,11 @@ class Contact(object):
size_hint
=
QSize
(
200
,
36
)
size_hint
=
QSize
(
200
,
36
)
native
=
property
(
lambda
self
:
isinstance
(
self
.
settings
,
addressbook
.
Contact
)
)
native
=
property
(
lambda
self
:
self
.
type
==
'addressbook'
)
movable
=
property
(
lambda
self
:
isinstance
(
self
.
settings
,
addressbook
.
Contact
)
)
movable
=
property
(
lambda
self
:
self
.
type
==
'addressbook'
)
editable
=
property
(
lambda
self
:
isinstance
(
self
.
settings
,
addressbook
.
Contact
)
)
editable
=
property
(
lambda
self
:
self
.
type
==
'addressbook'
)
deletable
=
property
(
lambda
self
:
isinstance
(
self
.
settings
,
addressbook
.
Contact
)
)
deletable
=
property
(
lambda
self
:
self
.
type
==
'addressbook'
)
default_user_icon
=
ContactIconDescriptor
(
Resources
.
get
(
'icons/default-avatar.png'
))
default_user_icon
=
ContactIconDescriptor
(
Resources
.
get
(
'icons/default-avatar.png'
))
...
@@ -1053,18 +1053,35 @@ class Contact(object):
...
@@ -1053,18 +1053,35 @@ class Contact(object):
def
__unicode__
(
self
):
def
__unicode__
(
self
):
return
self
.
name
or
u''
return
self
.
name
or
u''
@
property
def
type
(
self
):
try
:
return
self
.
__dict__
[
'type'
]
except
KeyError
:
if
isinstance
(
self
.
settings
,
addressbook
.
Contact
):
type
=
'addressbook'
elif
isinstance
(
self
.
settings
,
BonjourNeighbour
):
type
=
'bonjour'
elif
isinstance
(
self
.
settings
,
GoogleContact
):
type
=
'google'
elif
isinstance
(
self
.
settings
,
DummyContact
):
type
=
'dummy'
else
:
type
=
'unknown'
return
self
.
__dict__
.
setdefault
(
'type'
,
type
)
@
property
@
property
def
name
(
self
):
def
name
(
self
):
if
isinstance
(
self
.
settings
,
BonjourNeighbour
)
:
if
self
.
type
==
'bonjour'
:
return
'
%
s (
%
s)'
%
(
self
.
settings
.
name
,
self
.
settings
.
hostname
)
return
'
%
s (
%
s)'
%
(
self
.
settings
.
name
,
self
.
settings
.
hostname
)
elif
isinstance
(
self
.
settings
,
GoogleContact
)
:
elif
self
.
type
==
'google'
:
return
self
.
settings
.
name
or
self
.
settings
.
company
or
u''
return
self
.
settings
.
name
or
self
.
settings
.
company
or
u''
else
:
else
:
return
self
.
settings
.
name
return
self
.
settings
.
name
@
property
@
property
def
location
(
self
):
def
location
(
self
):
if
isinstance
(
self
.
settings
,
BonjourNeighbour
)
:
if
self
.
type
==
'bonjour'
:
return
self
.
settings
.
hostname
return
self
.
settings
.
hostname
else
:
else
:
return
None
return
None
...
@@ -1072,7 +1089,7 @@ class Contact(object):
...
@@ -1072,7 +1089,7 @@ class Contact(object):
@
property
@
property
def
info
(
self
):
def
info
(
self
):
try
:
try
:
return
self
.
note
or
(
'@'
+
self
.
uri
.
uri
.
host
if
isinstance
(
self
.
settings
,
BonjourNeighbour
)
else
self
.
uri
.
uri
)
return
self
.
note
or
(
'@'
+
self
.
uri
.
uri
.
host
if
self
.
type
==
'bonjour'
else
self
.
uri
.
uri
)
except
AttributeError
:
except
AttributeError
:
return
u''
return
u''
...
@@ -1104,10 +1121,10 @@ class Contact(object):
...
@@ -1104,10 +1121,10 @@ class Contact(object):
try
:
try
:
return
self
.
__dict__
[
'icon'
]
return
self
.
__dict__
[
'icon'
]
except
KeyError
:
except
KeyError
:
if
isinstance
(
self
.
settings
,
addressbook
.
Contact
)
:
if
self
.
type
==
'addressbook'
:
icon_manager
=
IconManager
()
icon_manager
=
IconManager
()
icon
=
icon_manager
.
get
(
self
.
settings
.
id
+
'_alt'
)
or
icon_manager
.
get
(
self
.
settings
.
id
)
or
self
.
default_user_icon
icon
=
icon_manager
.
get
(
self
.
settings
.
id
+
'_alt'
)
or
icon_manager
.
get
(
self
.
settings
.
id
)
or
self
.
default_user_icon
elif
isinstance
(
self
.
settings
,
GoogleContact
)
:
elif
self
.
type
==
'google'
:
pixmap
=
QPixmap
()
pixmap
=
QPixmap
()
if
pixmap
.
loadFromData
(
self
.
settings
.
icon
.
data
):
if
pixmap
.
loadFromData
(
self
.
settings
.
icon
.
data
):
icon
=
QIcon
(
pixmap
)
icon
=
QIcon
(
pixmap
)
...
@@ -1160,10 +1177,10 @@ class ContactDetail(object):
...
@@ -1160,10 +1177,10 @@ class ContactDetail(object):
size_hint
=
QSize
(
200
,
36
)
size_hint
=
QSize
(
200
,
36
)
native
=
property
(
lambda
self
:
isinstance
(
self
.
settings
,
addressbook
.
Contact
)
)
native
=
property
(
lambda
self
:
self
.
type
==
'addressbook'
)
editable
=
property
(
lambda
self
:
isinstance
(
self
.
settings
,
addressbook
.
Contact
)
)
editable
=
property
(
lambda
self
:
self
.
type
==
'addressbook'
)
deletable
=
property
(
lambda
self
:
isinstance
(
self
.
settings
,
addressbook
.
Contact
)
)
deletable
=
property
(
lambda
self
:
self
.
type
==
'addressbook'
)
default_user_icon
=
ContactIconDescriptor
(
Resources
.
get
(
'icons/default-avatar.png'
))
default_user_icon
=
ContactIconDescriptor
(
Resources
.
get
(
'icons/default-avatar.png'
))
...
@@ -1196,18 +1213,35 @@ class ContactDetail(object):
...
@@ -1196,18 +1213,35 @@ class ContactDetail(object):
def
__unicode__
(
self
):
def
__unicode__
(
self
):
return
self
.
name
or
u''
return
self
.
name
or
u''
@
property
def
type
(
self
):
try
:
return
self
.
__dict__
[
'type'
]
except
KeyError
:
if
isinstance
(
self
.
settings
,
addressbook
.
Contact
):
type
=
'addressbook'
elif
isinstance
(
self
.
settings
,
BonjourNeighbour
):
type
=
'bonjour'
elif
isinstance
(
self
.
settings
,
GoogleContact
):
type
=
'google'
elif
isinstance
(
self
.
settings
,
DummyContact
):
type
=
'dummy'
else
:
type
=
'unknown'
return
self
.
__dict__
.
setdefault
(
'type'
,
type
)
@
property
@
property
def
name
(
self
):
def
name
(
self
):
if
isinstance
(
self
.
settings
,
BonjourNeighbour
)
:
if
self
.
type
==
'bonjour'
:
return
'
%
s (
%
s)'
%
(
self
.
settings
.
name
,
self
.
settings
.
hostname
)
return
'
%
s (
%
s)'
%
(
self
.
settings
.
name
,
self
.
settings
.
hostname
)
elif
isinstance
(
self
.
settings
,
GoogleContact
)
:
elif
self
.
type
==
'google'
:
return
self
.
settings
.
name
or
self
.
settings
.
company
return
self
.
settings
.
name
or
self
.
settings
.
company
else
:
else
:
return
self
.
settings
.
name
return
self
.
settings
.
name
@
property
@
property
def
location
(
self
):
def
location
(
self
):
if
isinstance
(
self
.
settings
,
BonjourNeighbour
)
:
if
self
.
type
==
'bonjour'
:
return
self
.
settings
.
hostname
return
self
.
settings
.
hostname
else
:
else
:
return
None
return
None
...
@@ -1215,7 +1249,7 @@ class ContactDetail(object):
...
@@ -1215,7 +1249,7 @@ class ContactDetail(object):
@
property
@
property
def
info
(
self
):
def
info
(
self
):
try
:
try
:
return
self
.
note
or
(
'@'
+
self
.
uri
.
uri
.
host
if
isinstance
(
self
.
settings
,
BonjourNeighbour
)
else
self
.
uri
.
uri
)
return
self
.
note
or
(
'@'
+
self
.
uri
.
uri
.
host
if
self
.
type
==
'bonjour'
else
self
.
uri
.
uri
)
except
AttributeError
:
except
AttributeError
:
return
u''
return
u''
...
@@ -1247,10 +1281,10 @@ class ContactDetail(object):
...
@@ -1247,10 +1281,10 @@ class ContactDetail(object):
try
:
try
:
return
self
.
__dict__
[
'icon'
]
return
self
.
__dict__
[
'icon'
]
except
KeyError
:
except
KeyError
:
if
isinstance
(
self
.
settings
,
addressbook
.
Contact
)
:
if
self
.
type
==
'addressbook'
:
icon_manager
=
IconManager
()
icon_manager
=
IconManager
()
icon
=
icon_manager
.
get
(
self
.
settings
.
id
+
'_alt'
)
or
icon_manager
.
get
(
self
.
settings
.
id
)
or
self
.
default_user_icon
icon
=
icon_manager
.
get
(
self
.
settings
.
id
+
'_alt'
)
or
icon_manager
.
get
(
self
.
settings
.
id
)
or
self
.
default_user_icon
elif
isinstance
(
self
.
settings
,
GoogleContact
)
:
elif
self
.
type
==
'google'
:
pixmap
=
QPixmap
()
pixmap
=
QPixmap
()
if
pixmap
.
loadFromData
(
self
.
settings
.
icon
.
data
):
if
pixmap
.
loadFromData
(
self
.
settings
.
icon
.
data
):
icon
=
QIcon
(
pixmap
)
icon
=
QIcon
(
pixmap
)
...
...
blink/sessions.py
View file @
15a6f098
...
@@ -3165,10 +3165,8 @@ class SessionManager(object):
...
@@ -3165,10 +3165,8 @@ class SessionManager(object):
notification_center
.
add_observer
(
self
,
name
=
'BlinkSessionListSelectionChanged'
)
notification_center
.
add_observer
(
self
,
name
=
'BlinkSessionListSelectionChanged'
)
def
create_session
(
self
,
contact
,
contact_uri
,
streams
,
account
=
None
,
connect
=
True
,
sibling
=
None
):
def
create_session
(
self
,
contact
,
contact_uri
,
streams
,
account
=
None
,
connect
=
True
,
sibling
=
None
):
from
blink.contacts
import
BonjourNeighbour
if
account
is
None
:
if
account
is
None
:
if
isinstance
(
contact
.
settings
,
BonjourNeighbour
)
:
if
contact
.
type
==
'bonjour'
:
account
=
BonjourAccount
()
account
=
BonjourAccount
()
else
:
else
:
account
=
AccountManager
()
.
default_account
account
=
AccountManager
()
.
default_account
...
...
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