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
924a3909
Commit
924a3909
authored
Jul 29, 2010
by
Luci Stanescu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Send DTMF digits when pressing letters based on a phonepad
parent
208e2d31
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
sessions.py
blink/sessions.py
+6
-2
No files found.
blink/sessions.py
View file @
924a3909
...
...
@@ -9,8 +9,10 @@ import bisect
import
cPickle
as
pickle
import
os
import
re
import
string
from
datetime
import
datetime
,
timedelta
from
functools
import
partial
from
itertools
import
chain
,
izip
,
repeat
from
PyQt4
import
uic
from
PyQt4.QtCore
import
Qt
,
QAbstractListModel
,
QByteArray
,
QEvent
,
QMimeData
,
QModelIndex
,
QObject
,
QSize
,
QStringList
,
QTimer
,
pyqtSignal
...
...
@@ -1257,9 +1259,11 @@ class SessionListView(QListView):
def
keyPressEvent
(
self
,
event
):
digit
=
chr
(
event
.
key
())
if
event
.
key
()
<
256
else
None
if
digit
is
not
None
and
digit
in
'0123456789ABCD#*'
:
if
digit
is
not
None
and
digit
in
string
.
digits
+
string
.
uppercase
+
'#*'
:
letter_map
=
{
'2'
:
'ABC'
,
'3'
:
'DEF'
,
'4'
:
'GHI'
,
'5'
:
'JKL'
,
'6'
:
'MNO'
,
'7'
:
'PQRS'
,
'8'
:
'TUV'
,
'9'
:
'WXYZ'
}
letter_map
=
dict
(
chain
(
*
(
izip
(
letters
,
repeat
(
digit
))
for
digit
,
letters
in
letter_map
.
iteritems
())))
for
session
in
(
s
for
s
in
self
.
model
()
.
sessions
if
s
.
active
):
session
.
send_dtmf
(
digit
)
session
.
send_dtmf
(
letter_map
.
get
(
digit
,
digit
)
)
elif
event
.
key
()
in
(
Qt
.
Key_Up
,
Qt
.
Key_Down
):
selection_model
=
self
.
selectionModel
()
current_index
=
selection_model
.
currentIndex
()
...
...
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