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
f853be5a
Commit
f853be5a
authored
Jun 25, 2010
by
Luci Stanescu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for incoming session ringing
parent
1a71a3b9
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
174 additions
and
9 deletions
+174
-9
__init__.py
blink/__init__.py
+4
-0
account.py
blink/configuration/account.py
+24
-0
datatypes.py
blink/configuration/datatypes.py
+46
-2
settings.py
blink/configuration/settings.py
+2
-1
sessions.py
blink/sessions.py
+98
-6
beeping_ringtone.wav
resources/sounds/beeping_ringtone.wav
+0
-0
inbound_ringtone.wav
resources/sounds/inbound_ringtone.wav
+0
-0
outbound_ringtone.wav
resources/sounds/outbound_ringtone.wav
+0
-0
No files found.
blink/__init__.py
View file @
f853be5a
...
...
@@ -11,10 +11,12 @@ from application.notification import IObserver, NotificationCenter
from
application.python.util
import
Null
from
zope.interface
import
implements
from
sipsimple.account
import
Account
,
BonjourAccount
from
sipsimple.application
import
SIPApplication
from
sipsimple.configuration.backend.file
import
FileBackend
from
sipsimple.configuration.settings
import
SIPSimpleSettings
from
blink.configuration.account
import
AccountExtension
,
BonjourAccountExtension
from
blink.configuration.settings
import
SIPSimpleSettingsExtension
from
blink.mainwindow
import
MainWindow
from
blink.resources
import
ApplicationData
...
...
@@ -32,6 +34,8 @@ class Blink(QApplication):
self
.
application
=
SIPApplication
()
self
.
main_window
=
MainWindow
()
Account
.
register_extension
(
AccountExtension
)
BonjourAccount
.
register_extension
(
BonjourAccountExtension
)
SIPSimpleSettings
.
register_extension
(
SIPSimpleSettingsExtension
)
session_manager
=
SessionManager
()
session_manager
.
initialize
(
self
.
main_window
,
self
.
main_window
.
session_model
)
...
...
blink/configuration/account.py
0 → 100644
View file @
f853be5a
# Copyright (C) 2010 AG Projects. See LICENSE for details.
#
"""Blink account settings extensions."""
__all__
=
[
'AccountExtension'
,
'BonjourAccountExtension'
]
from
sipsimple.configuration
import
Setting
,
SettingsGroup
,
SettingsObjectExtension
from
blink.configuration.datatypes
import
CustomSoundFile
,
DefaultPath
class
SoundSettings
(
SettingsGroup
):
inbound_ringtone
=
Setting
(
type
=
CustomSoundFile
,
default
=
CustomSoundFile
(
DefaultPath
),
nillable
=
True
)
class
AccountExtension
(
SettingsObjectExtension
):
sounds
=
SoundSettings
class
BonjourAccountExtension
(
SettingsObjectExtension
):
sounds
=
SoundSettings
blink/configuration/datatypes.py
View file @
f853be5a
...
...
@@ -3,9 +3,10 @@
"""Definitions of datatypes for use in settings extensions."""
__all__
=
[
'ApplicationDataPath'
,
'SoundFile'
]
__all__
=
[
'ApplicationDataPath'
,
'SoundFile'
,
'DefaultPath'
,
'CustomSoundFile'
]
import
os
import
re
from
blink.resources
import
ApplicationData
...
...
@@ -26,7 +27,7 @@ class SoundFile(object):
def
__init__
(
self
,
path
,
volume
=
100
):
self
.
path
=
path
self
.
volume
=
int
(
volume
)
if
self
.
volume
<
0
or
self
.
volume
>
100
:
if
not
(
0
<=
self
.
volume
<=
100
)
:
raise
ValueError
(
'illegal volume level:
%
d'
%
self
.
volume
)
def
__getstate__
(
self
):
...
...
@@ -54,3 +55,46 @@ class SoundFile(object):
del
_get_path
,
_set_path
class
DefaultPath
(
object
):
def
__repr__
(
self
):
return
self
.
__class__
.
__name__
class
CustomSoundFile
(
object
):
def
__init__
(
self
,
path
=
DefaultPath
,
volume
=
100
):
self
.
path
=
path
self
.
volume
=
int
(
volume
)
if
self
.
volume
<
0
or
self
.
volume
>
100
:
raise
ValueError
(
'illegal volume level:
%
d'
%
self
.
volume
)
def
__getstate__
(
self
):
if
self
.
path
is
DefaultPath
:
return
u'default'
else
:
return
u'file:
%
s,
%
s'
%
(
self
.
__dict__
[
'path'
],
self
.
volume
)
def
__setstate__
(
self
,
state
):
match
=
re
.
match
(
r'^(?P<type>default|file:)(?P<path>.+?)?(,(?P<volume>\d+))?$'
,
state
)
if
match
is
None
:
raise
ValueError
(
'illegal value:
%
r'
%
state
)
data
=
match
.
groupdict
()
if
data
.
pop
(
'type'
)
==
'default'
:
data
[
'path'
]
=
DefaultPath
data
[
'volume'
]
=
data
[
'volume'
]
or
100
self
.
__init__
(
**
data
)
def
__repr__
(
self
):
return
'
%
s(
%
r,
%
r)'
%
(
self
.
__class__
.
__name__
,
self
.
path
,
self
.
volume
)
def
_get_path
(
self
):
path
=
self
.
__dict__
[
'path'
]
return
path
if
path
is
DefaultPath
else
ApplicationData
.
get
(
path
)
def
_set_path
(
self
,
path
):
if
path
is
not
DefaultPath
:
path
=
os
.
path
.
normpath
(
path
)
if
path
.
startswith
(
ApplicationData
.
directory
+
os
.
path
.
sep
):
path
=
path
[
len
(
ApplicationData
.
directory
+
os
.
path
.
sep
):]
self
.
__dict__
[
'path'
]
=
path
path
=
property
(
_get_path
,
_set_path
)
del
_get_path
,
_set_path
blink/configuration/settings.py
View file @
f853be5a
...
...
@@ -17,7 +17,8 @@ class AudioSettingsExtension(AudioSettings):
class
SoundSettings
(
SettingsGroup
):
outbound_ringtone
=
Setting
(
type
=
SoundFile
,
default
=
SoundFile
(
Resources
.
get
(
'sounds/ring_outbound.wav'
)),
nillable
=
True
)
inbound_ringtone
=
Setting
(
type
=
SoundFile
,
default
=
SoundFile
(
Resources
.
get
(
'sounds/inbound_ringtone.wav'
)),
nillable
=
True
)
outbound_ringtone
=
Setting
(
type
=
SoundFile
,
default
=
SoundFile
(
Resources
.
get
(
'sounds/outbound_ringtone.wav'
)),
nillable
=
True
)
class
SIPSimpleSettingsExtension
(
SettingsObjectExtension
):
...
...
blink/sessions.py
View file @
f853be5a
This diff is collapsed.
Click to expand it.
resources/sounds/beeping_ringtone.wav
0 → 100644
View file @
f853be5a
File added
resources/sounds/inbound_ringtone.wav
0 → 100644
View file @
f853be5a
File added
resources/sounds/
ring_outbound
.wav
→
resources/sounds/
outbound_ringtone
.wav
View file @
f853be5a
File moved
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