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
acc01b04
Commit
acc01b04
authored
May 04, 2010
by
Dan Pascu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable call buttons only when appropriate
parent
b5599b28
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
mainwindow.py
blink/mainwindow.py
+16
-3
No files found.
blink/mainwindow.py
View file @
acc01b04
...
...
@@ -15,7 +15,7 @@ from zope.interface import implements
from
sipsimple.account
import
AccountManager
,
BonjourAccount
from
blink.contacts
import
ContactModel
,
ContactSearchModel
from
blink.contacts
import
Contact
,
Contact
Model
,
ContactSearchModel
from
blink.resources
import
Resources
from
blink.util
import
run_in_gui_thread
...
...
@@ -35,11 +35,14 @@ class MainWindow(base_class, ui_class):
self
.
setWindowIconText
(
'Blink'
)
self
.
_set_user_icon
(
Resources
.
get
(
"icons/default-avatar.png"
))
# ":/resources/icons/default-avatar.png"
self
.
enable_call_buttons
(
False
)
self
.
contact_model
=
ContactModel
(
self
)
self
.
contact_search_model
=
ContactSearchModel
(
self
.
contact_model
,
self
)
self
.
contact_list
.
setModel
(
self
.
contact_model
)
self
.
search_list
.
setModel
(
self
.
contact_search_model
)
self
.
contact_list
.
selectionModel
()
.
selectionChanged
.
connect
(
self
.
contact_list_selection_changed
)
self
.
search_box
.
textChanged
.
connect
(
self
.
contact_search_model
.
setFilterFixedString
)
self
.
contact_model
.
test
()
...
...
@@ -63,7 +66,6 @@ class MainWindow(base_class, ui_class):
self
.
identity
.
activated
[
int
]
.
connect
(
self
.
set_identity
)
#self.connect(self.contact_list, QtCore.SIGNAL("doubleClicked(const QModelIndex &)"), self.double_click_action)
#self.connect(self.contact_list.selectionModel(), QtCore.SIGNAL("selectionChanged(const QItemSelection &, const QItemSelection &)"), self.selection_changed)
notification_center
=
NotificationCenter
()
notification_center
.
add_observer
(
self
,
name
=
"SIPAccountManagerDidChangeDefaultAccount"
)
...
...
@@ -88,6 +90,11 @@ class MainWindow(base_class, ui_class):
painter
.
end
()
self
.
image
.
setPixmap
(
pixmap
)
def
enable_call_buttons
(
self
,
enabled
):
self
.
audio_call
.
setEnabled
(
enabled
)
self
.
im_session
.
setEnabled
(
enabled
)
self
.
ds_session
.
setEnabled
(
enabled
)
def
set_identity
(
self
,
index
):
account_manager
=
AccountManager
()
account_manager
.
default_account
=
self
.
identity
.
itemData
(
index
)
.
toPyObject
()
...
...
@@ -96,14 +103,20 @@ class MainWindow(base_class, ui_class):
if
text
:
self
.
main_view
.
setCurrentWidget
(
self
.
contacts_panel
)
self
.
switch_view
.
setText
(
u"Sessions"
)
self
.
enable_call_buttons
(
True
)
else
:
selected_items
=
self
.
contact_list
.
selectionModel
()
.
selectedIndexes
()
self
.
enable_call_buttons
(
len
(
selected_items
)
==
1
and
type
(
self
.
contact_model
.
data
(
selected_items
[
0
]))
is
Contact
)
# switch to the sessions panel if there are active sessions, else to the contacts panel -Dan
pass
active_widget
=
self
.
contact_list_panel
if
text
.
isEmpty
()
else
self
.
search_panel
self
.
contacts_view
.
setCurrentWidget
(
active_widget
)
active_widget
=
self
.
search_list_panel
if
self
.
contact_search_model
.
rowCount
()
else
self
.
not_found_panel
self
.
search_view
.
setCurrentWidget
(
active_widget
)
def
contact_list_selection_changed
(
self
,
selected
,
deselected
):
selected_items
=
self
.
contact_list
.
selectionModel
()
.
selectedIndexes
()
self
.
enable_call_buttons
(
len
(
selected_items
)
==
1
and
type
(
self
.
contact_model
.
data
(
selected_items
[
0
]))
is
Contact
)
def
switch_main_view
(
self
):
widget
=
self
.
main_view
.
currentWidget
()
.
sibling_panel
self
.
main_view
.
setCurrentWidget
(
widget
)
...
...
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