Merge lp:~rodrigo-moya/desktopcouch/gtk-contacts-picker into lp:desktopcouch

Proposed by Rodrigo Moya
Status: Merged
Approved by: Elliot Murphy
Approved revision: 41
Merged at revision: not available
Proposed branch: lp:~rodrigo-moya/desktopcouch/gtk-contacts-picker
Merge into: lp:desktopcouch
Diff against target: None lines
To merge this branch: bzr merge lp:~rodrigo-moya/desktopcouch/gtk-contacts-picker
Reviewer Review Type Date Requested Status
Elliot Murphy (community) Approve
Rodrigo Moya (community) Abstain
Review via email: mp+10306@code.launchpad.net

Commit message

First version of the contacts picker, based on CouchWidget

To post a comment you must log in.
Revision history for this message
Rodrigo Moya (rodrigo-moya) wrote :

First version of the contacts picker, based on CouchWidget

Revision history for this message
Elliot Murphy (statik) wrote :

Looks cool, but I'm having trouble running it:

emurphy@detox:~/canonical/ubuntuone/shared/desktopcouch/gtk-contacts-picker$ PYTHONPATH=. python ./desktopcouch/contacts/contactspicker.py
Traceback (most recent call last):
  File "./desktopcouch/contacts/contactspicker.py", line 79, in <module>
    picker = ContactsPicker()
  File "./desktopcouch/contacts/contactspicker.py", line 54, in __init__
    self.contacts_list = CouchWidget(self.server_ip)
AttributeError: can't set attribute

review: Needs Fixing
38. By Rodrigo Moya

Changed property to be a class method, to avoid name clashing

39. By Rodrigo Moya

Reverted column name

40. By Rodrigo Moya

Fixed typo

41. By Rodrigo Moya

Provide the server_ip when creating CouchDatabase

Revision history for this message
Rodrigo Moya (rodrigo-moya) wrote :

> Looks cool, but I'm having trouble running it:
>
> emurphy@detox:~/canonical/ubuntuone/shared/desktopcouch/gtk-contacts-picker$
> PYTHONPATH=. python ./desktopcouch/contacts/contactspicker.py
> Traceback (most recent call last):
> File "./desktopcouch/contacts/contactspicker.py", line 79, in <module>
> picker = ContactsPicker()
> File "./desktopcouch/contacts/contactspicker.py", line 54, in __init__
> self.contacts_list = CouchWidget(self.server_ip)
> AttributeError: can't set attribute

right, it seems I added the property after testing and didn't test back again, so please pull and test again, I've added that and a couple of fixes to CouchWidget itself. It only shows the records in the database for now, but that's working now correctly for me

review: Abstain
Revision history for this message
Elliot Murphy (statik) wrote :

The picker shows up fine for me now, but it's not showing the record I added in the contacts database via evolution (by dragging a contact from my personal address book to the couchDB address book named "contacts"). Looking in CouchDB, I think that may be a problem with evolution-couchdb rather than the contacts picker though, so marking this as approved! Great work.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'desktopcouch/contacts/contactspicker.py'
2--- desktopcouch/contacts/contactspicker.py 1970-01-01 00:00:00 +0000
3+++ desktopcouch/contacts/contactspicker.py 2009-08-18 11:54:42 +0000
4@@ -0,0 +1,84 @@
5+# Copyright 2009 Canonical Ltd.
6+#
7+# This file is part of desktopcouch-contacts.
8+#
9+# desktopcouch is free software: you can redistribute it and/or modify
10+# it under the terms of the GNU Lesser General Public License version 3
11+# as published by the Free Software Foundation.
12+#
13+# desktopcouch is distributed in the hope that it will be useful,
14+# but WITHOUT ANY WARRANTY; without even the implied warranty of
15+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+# GNU Lesser General Public License for more details.
17+#
18+# You should have received a copy of the GNU Lesser General Public License
19+# along with desktopcouch. If not, see <http://www.gnu.org/licenses/>.
20+#
21+# Authors: Rodrigo Moya <rodrigo.moya@canonical.com
22+
23+"""A widget to allow users to pick contacts"""
24+
25+import gtk
26+import gobject
27+from desktopcouch.contacts.record import (
28+ Contact,
29+ CONTACT_RECORD_TYPE)
30+from desktopcouch.records.couchwidget import CouchWidget
31+
32+class ContactsPicker(gtk.VBox):
33+ __gtype_name__ = "ContactsPicker"
34+
35+ def __init__(self, server_ip = 'http://127.0.0.1:5984/'):
36+ """Create a new ContactsPicker widget
37+ optional arguments:
38+ server_ip - specify and ip and port for the server location.
39+ Defaults to http://127.0.0.1:5984
40+
41+ """
42+
43+ gtk.VBox.__init__(self)
44+
45+ self.server_ip = server_ip
46+
47+ # Create search entry and button
48+ hbox = gtk.HBox()
49+ self.pack_start(hbox, False, False, 3)
50+
51+ self.search_entry = gtk.Entry()
52+ hbox.pack_start(self.search_entry, True, True, 3)
53+
54+ self.search_button = gtk.Button(stock=gtk.STOCK_FIND, use_underline=True)
55+ hbox.pack_start(self.search_button, False, False, 3)
56+
57+ # Create CouchWidget to contain list of contacts
58+ self.contacts_list = CouchWidget(self.server_ip)
59+ self.contacts_list.database = 'contacts'
60+ self.contacts_list.editable = False
61+ self.contacts_list.headings = [ "first_name", "last_name" ]
62+ self.contacts_list.record_type = CONTACT_RECORD_TYPE
63+ self.contacts_list.show()
64+ self.pack_start(self.contacts_list, True, True, 3)
65+
66+ @property
67+ def contacts_list(self):
68+ """contacts_list - gtk.Widget value
69+ Gets the CouchWidget inside the ContactsPicker widget
70+ """
71+ return self.contacts_list
72+
73+if __name__ == "__main__":
74+ """creates a test ContactsPicker if called directly"""
75+
76+ # Create and show a test window
77+ win = gtk.Dialog("ContactsPicket widget test", None, 0,
78+ (gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE))
79+ win.connect("response", gtk.main_quit)
80+ win.resize(300, 450)
81+
82+ # Create the contacts picker widget
83+ picker = ContactsPicker()
84+ win.get_content_area().pack_start(picker, True, True, 3)
85+
86+ # Run the test application
87+ win.show_all()
88+ gtk.main()
89
90=== modified file 'desktopcouch/records/couchwidget.py'
91--- desktopcouch/records/couchwidget.py 2009-08-05 14:46:06 +0000
92+++ desktopcouch/records/couchwidget.py 2009-08-18 11:54:42 +0000
93@@ -2,7 +2,7 @@
94 #
95 # This file is part of desktopcouch.
96 #
97-# desktopcouch is free software: you can redistribute it and/or modify
98+# desktopcouch is free software: you can redistribute it and/or modify
99 # it under the terms of the GNU Lesser General Public License version 3
100 # as published by the Free Software Foundation.
101 #

Subscribers

People subscribed via source and target branches