summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Huuhko <kai.huuhko@gmail.com>2013-10-10 16:25:53 +0300
committerKai Huuhko <kai.huuhko@gmail.com>2013-10-10 16:25:53 +0300
commit27ac972d7a07c7c725029c65e0f7468463ec3a1e (patch)
treeab5e55e3790598e2356e74e2bbeb1679b637ffea
parent184297bdf04b278f6e1dcba1ebd9d917d9607a75 (diff)
Updates for 1.8 bindings
-rw-r--r--.gitignore1
-rw-r--r--apathy/AccountEditor.py94
-rw-r--r--apathy/Accounts.py76
-rw-r--r--apathy/Approver.py36
-rw-r--r--apathy/ContactInfo.py25
-rw-r--r--apathy/Contacts.py112
-rw-r--r--apathy/Conversation.py69
-rw-r--r--apathy/ErrorDialog.py9
-rw-r--r--apathy/Handler.py30
-rw-r--r--apathy/PresenceEditor.py19
10 files changed, 300 insertions, 171 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..c2956c7
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
*.py[oc]
diff --git a/apathy/AccountEditor.py b/apathy/AccountEditor.py
index 8596a61..5caa917 100644
--- a/apathy/AccountEditor.py
+++ b/apathy/AccountEditor.py
@@ -27,7 +27,26 @@ from getpass import getuser
27import mimetypes 27import mimetypes
28import tempfile 28import tempfile
29 29
30import elementary as elm 30try:
31 from elementary import Box, Scroller, Button, Frame, Icon, \
32 Hoversel, ELM_ICON_STANDARD, ELM_ICON_NONE, Entry, Check, \
33 Fileselector, Photo, InnerWindow, Label, Spinner, Popup
34except ImportError:
35 from efl.elementary.box import Box
36 from efl.elementary.scroller import Scroller
37 from efl.elementary.button import Button
38 from efl.elementary.frame import Frame
39 from efl.elementary.icon import Icon
40 from efl.elementary.hoversel import Hoversel, ELM_ICON_STANDARD, \
41 ELM_ICON_NONE
42 from efl.elementary.entry import Entry
43 from efl.elementary.check import Check
44 from efl.elementary.fileselector import Fileselector
45 from efl.elementary.photo import Photo
46 from efl.elementary.innerwindow import InnerWindow
47 from efl.elementary.label import Label
48 from efl.elementary.spinner import Spinner
49 from efl.elementary.popup import Popup
31 50
32from ErrorDialog import ErrorDialog 51from ErrorDialog import ErrorDialog
33from Globals import * 52from Globals import *
@@ -46,20 +65,20 @@ class AccountEditor(object):
46 self.protos = {} 65 self.protos = {}
47 self.cms = {} 66 self.cms = {}
48 67
49 self.box = box = elm.Box(parent) 68 self.box = box = Box(parent)
50 69
51 self.protocol_list = protocol_list = elm.Hoversel(box) 70 self.protocol_list = protocol_list = Hoversel(box)
52 protocol_list.text= _("Select protocol").encode("utf-8") 71 protocol_list.text= _("Select protocol").encode("utf-8")
53 self.populate_protocol_list(protocol_list) 72 self.populate_protocol_list(protocol_list)
54 box.pack_end(protocol_list) 73 box.pack_end(protocol_list)
55 protocol_list.show() 74 protocol_list.show()
56 75
57 self.box1 = box1 = elm.Box(box) 76 self.box1 = box1 = Box(box)
58 box1.size_hint_weight_set(1.0, 1.0) 77 box1.size_hint_weight_set(1.0, 1.0)
59 box1.size_hint_align_set(-1.0, -1.0) 78 box1.size_hint_align_set(-1.0, -1.0)
60 box1.show() 79 box1.show()
61 80
62 scroller = elm.Scroller(box) 81 scroller = Scroller(box)
63 scroller.size_hint_weight_set(1.0, 1.0) 82 scroller.size_hint_weight_set(1.0, 1.0)
64 scroller.size_hint_align_set(-1.0, -1.0) 83 scroller.size_hint_align_set(-1.0, -1.0)
65 scroller.content_set(box1) 84 scroller.content_set(box1)
@@ -68,14 +87,14 @@ class AccountEditor(object):
68 scroller.show() 87 scroller.show()
69 box.pack_end(scroller) 88 box.pack_end(scroller)
70 89
71 self.box2 = box2 = elm.Box(box) 90 self.box2 = box2 = Box(box)
72 box2.size_hint_weight_set(1.0, 0.0) 91 box2.size_hint_weight_set(1.0, 0.0)
73 box2.size_hint_align_set(-1.0, 0.0) 92 box2.size_hint_align_set(-1.0, 0.0)
74 box2.horizontal_set(True) 93 box2.horizontal_set(True)
75 box2.show() 94 box2.show()
76 box.pack_end(box2) 95 box.pack_end(box2)
77 96
78 self.btn_save_settings = btn_save_settings = elm.Button(box) 97 self.btn_save_settings = btn_save_settings = Button(box)
79 btn_save_settings.text_set(_("Save Settings").encode("utf-8")) 98 btn_save_settings.text_set(_("Save Settings").encode("utf-8"))
80 btn_save_settings.size_hint_weight_set(1.0, 0.0) 99 btn_save_settings.size_hint_weight_set(1.0, 0.0)
81 btn_save_settings.size_hint_align_set(-1.0, 0.0) 100 btn_save_settings.size_hint_align_set(-1.0, 0.0)
@@ -83,7 +102,7 @@ class AccountEditor(object):
83 self.box2.pack_end(btn_save_settings) 102 self.box2.pack_end(btn_save_settings)
84 btn_save_settings.show() 103 btn_save_settings.show()
85 104
86 xbtn = elm.Button(box) 105 xbtn = Button(box)
87 xbtn.size_hint_weight_set(1.0, 0.0) 106 xbtn.size_hint_weight_set(1.0, 0.0)
88 xbtn.size_hint_align_set(-1.0, 0.0) 107 xbtn.size_hint_align_set(-1.0, 0.0)
89 xbtn.callback_clicked_add(self._close) 108 xbtn.callback_clicked_add(self._close)
@@ -104,9 +123,12 @@ class AccountEditor(object):
104 protos = cm.dup_protocols() 123 protos = cm.dup_protocols()
105 for proto in protos: 124 for proto in protos:
106 self.protos[proto.get_name()] = proto 125 self.protos[proto.get_name()] = proto
107 ic = elm.Icon(self.box) 126 ic = Icon(self.box)
108 ic.standard_set("im-"+proto.get_name()) 127 try:
109 component.item_add(str.capitalize(proto.get_name()+" ("+cm.get_name()+")"), "im-"+proto.get_name(), elm.ELM_ICON_STANDARD, self._protocol_selected, proto, cm) 128 ic.standard_set("im-"+proto.get_name())
129 except:
130 pass
131 component.item_add(str.capitalize(proto.get_name()+" ("+cm.get_name()+")"), "im-"+proto.get_name(), ELM_ICON_STANDARD, self._protocol_selected, proto, cm)
110 132
111 if self.account: 133 if self.account:
112 self.populate_data(self.account) 134 self.populate_data(self.account)
@@ -164,11 +186,11 @@ class AccountEditor(object):
164 params = proto.dup_params() 186 params = proto.dup_params()
165 187
166 # Avatar 188 # Avatar
167 self.avatar = avatar = elm.Photo(self.box) 189 self.avatar = avatar = Photo(self.box)
168 avatar.size_set(100) 190 avatar.size_set(100)
169 avatar.callback_clicked_add(self.avatar_clicked) 191 avatar.callback_clicked_add(self.avatar_clicked)
170 192
171 avatarframe = elm.Frame(self.box) 193 avatarframe = Frame(self.box)
172 avatarframe.text_set(_("Avatar").encode("utf-8")) 194 avatarframe.text_set(_("Avatar").encode("utf-8"))
173 avatarframe.size_hint_align_set(0.5, -1.0) 195 avatarframe.size_hint_align_set(0.5, -1.0)
174 avatarframe.content_set(avatar) 196 avatarframe.content_set(avatar)
@@ -179,9 +201,9 @@ class AccountEditor(object):
179 # Service 201 # Service
180 proto_name = proto.get_name() 202 proto_name = proto.get_name()
181 if proto_name == "jabber" or proto_name == "irc": 203 if proto_name == "jabber" or proto_name == "irc":
182 self.props[Tp.IFACE_ACCOUNT+".Service"] = service = elm.Hoversel(self.box) 204 self.props[Tp.IFACE_ACCOUNT+".Service"] = service = Hoversel(self.box)
183 service.text_set(_("Select").encode("utf-8")) 205 service.text_set(_("Select").encode("utf-8"))
184 servframe = elm.Frame(self.box) 206 servframe = Frame(self.box)
185 servframe.size_hint_align_set(-1.0, -1.0) 207 servframe.size_hint_align_set(-1.0, -1.0)
186 servframe.text_set(_("Service").encode("utf-8")) 208 servframe.text_set(_("Service").encode("utf-8"))
187 servframe.content_set(service) 209 servframe.content_set(service)
@@ -192,16 +214,16 @@ class AccountEditor(object):
192 proto_name = proto.get_name() 214 proto_name = proto.get_name()
193 if proto_name == "jabber": 215 if proto_name == "jabber":
194 for s in ["jabber", "google-talk", "ovi-chat", "facebook", "lj-talk", "windows-live"]: 216 for s in ["jabber", "google-talk", "ovi-chat", "facebook", "lj-talk", "windows-live"]:
195 service.item_add(str.capitalize(s), "im-"+s, elm.ELM_ICON_STANDARD, self.jabber_service_selected, s) 217 service.item_add(str.capitalize(s), "im-"+s, ELM_ICON_STANDARD, self.jabber_service_selected, s)
196 elif proto_name == "irc": 218 elif proto_name == "irc":
197 for s in ["Freenode", "IRCNet", "GimpNet"]: 219 for s in ["Freenode", "IRCNet", "GimpNet"]:
198 service.item_add(s, None, elm.ELM_ICON_NONE, self.irc_service_selected, s) 220 service.item_add(s, None, ELM_ICON_NONE, self.irc_service_selected, s)
199 221
200 # Display Name 222 # Display Name
201 dnameframe = elm.Frame(self.box) 223 dnameframe = Frame(self.box)
202 dnameframe.text_set(_("Display Name").encode("utf-8")) 224 dnameframe.text_set(_("Display Name").encode("utf-8"))
203 dnameframe.size_hint_align_set(-1.0, -1.0) 225 dnameframe.size_hint_align_set(-1.0, -1.0)
204 self.dname = dname = elm.Entry(self.box) 226 self.dname = dname = Entry(self.box)
205 dname.single_line_set(True) 227 dname.single_line_set(True)
206 dnameframe.content_set(dname) 228 dnameframe.content_set(dname)
207 dname.show() 229 dname.show()
@@ -211,10 +233,10 @@ class AccountEditor(object):
211 233
212 # Entries: Nickname, Icon 234 # Entries: Nickname, Icon
213 for name, title in {Tp.IFACE_ACCOUNT+".Nickname": _("Nickname").encode("utf-8"), Tp.IFACE_ACCOUNT+".Icon": _("Icon").encode("utf-8")}.iteritems(): 235 for name, title in {Tp.IFACE_ACCOUNT+".Nickname": _("Nickname").encode("utf-8"), Tp.IFACE_ACCOUNT+".Icon": _("Icon").encode("utf-8")}.iteritems():
214 frame = elm.Frame(self.box) 236 frame = Frame(self.box)
215 frame.text_set(title) 237 frame.text_set(title)
216 frame.size_hint_align_set(-1.0, -1.0) 238 frame.size_hint_align_set(-1.0, -1.0)
217 self.props[name] = entry = elm.Entry(self.box) 239 self.props[name] = entry = Entry(self.box)
218 entry.single_line_set(True) 240 entry.single_line_set(True)
219 frame.content_set(entry) 241 frame.content_set(entry)
220 entry.show() 242 entry.show()
@@ -225,10 +247,10 @@ class AccountEditor(object):
225 247
226 # Checks: Enabled, ConnectAutomatically 248 # Checks: Enabled, ConnectAutomatically
227 for name, title in {Tp.IFACE_ACCOUNT+".Enabled": _("Enabled").encode("utf-8"), Tp.IFACE_ACCOUNT+".ConnectAutomatically": _("Connect Automatically").encode("utf-8")}.iteritems(): 249 for name, title in {Tp.IFACE_ACCOUNT+".Enabled": _("Enabled").encode("utf-8"), Tp.IFACE_ACCOUNT+".ConnectAutomatically": _("Connect Automatically").encode("utf-8")}.iteritems():
228 frame = elm.Frame(self.box) 250 frame = Frame(self.box)
229 frame.text_set(title) 251 frame.text_set(title)
230 frame.size_hint_align_set(-1.0, -1.0) 252 frame.size_hint_align_set(-1.0, -1.0)
231 self.props[name] = check = elm.Check(self.box) 253 self.props[name] = check = Check(self.box)
232 frame.content_set(check) 254 frame.content_set(check)
233 check.show() 255 check.show()
234 self.box1.pack_end(frame) 256 self.box1.pack_end(frame)
@@ -237,9 +259,9 @@ class AccountEditor(object):
237 self.props[Tp.IFACE_ACCOUNT+".Enabled"].state_set(True) 259 self.props[Tp.IFACE_ACCOUNT+".Enabled"].state_set(True)
238 260
239 # TODO: Automatic Presence 261 # TODO: Automatic Presence
240 apres = elm.Hoversel(self.box) 262 apres = Hoversel(self.box)
241 apres.text_set(_("Select")) 263 apres.text_set(_("Select"))
242 apresframe = elm.Frame(self.box) 264 apresframe = Frame(self.box)
243 apresframe.size_hint_align_set(-1.0, -1.0) 265 apresframe.size_hint_align_set(-1.0, -1.0)
244 apresframe.text_set(_("Automatic Presence")) 266 apresframe.text_set(_("Automatic Presence"))
245 apresframe.content_set(apres) 267 apresframe.content_set(apres)
@@ -247,7 +269,7 @@ class AccountEditor(object):
247 #apresframe.show() 269 #apresframe.show()
248 #apres.show() 270 #apres.show()
249 271
250 paramhead = elm.Label(self.box) 272 paramhead = Label(self.box)
251 paramhead.text_set("<br/>"+_("Account parameters:").encode("utf-8")+"<br/>") 273 paramhead.text_set("<br/>"+_("Account parameters:").encode("utf-8")+"<br/>")
252 paramhead.show() 274 paramhead.show()
253 self.box1.pack_end(paramhead) 275 self.box1.pack_end(paramhead)
@@ -260,7 +282,7 @@ class AccountEditor(object):
260 pname = param.get_name() 282 pname = param.get_name()
261 defaultvalue = GObject.Value() 283 defaultvalue = GObject.Value()
262 284
263 frame = elm.Frame(self.box) 285 frame = Frame(self.box)
264 frame.size_hint_align_set(-1.0, -1.0) 286 frame.size_hint_align_set(-1.0, -1.0)
265 287
266 frametext = "%s" % (pname.rsplit(".", 1)[-1]) 288 frametext = "%s" % (pname.rsplit(".", 1)[-1])
@@ -270,7 +292,7 @@ class AccountEditor(object):
270 ptype = param.get_dbus_signature() 292 ptype = param.get_dbus_signature()
271 293
272 if ptype == "b": 294 if ptype == "b":
273 entry = self.params[pname] = elm.Check(self.box) 295 entry = self.params[pname] = Check(self.box)
274 entry.callback_changed_add(lambda x, pname=pname: self._changed(x, pname)) 296 entry.callback_changed_add(lambda x, pname=pname: self._changed(x, pname))
275 if param.get_default(defaultvalue): 297 if param.get_default(defaultvalue):
276 pdefault = defaultvalue.get_boolean() 298 pdefault = defaultvalue.get_boolean()
@@ -278,7 +300,7 @@ class AccountEditor(object):
278 frametext = frametext+" - "+_("Default: %s") % (str(pdefault)) 300 frametext = frametext+" - "+_("Default: %s") % (str(pdefault))
279 301
280 elif ptype == "s": 302 elif ptype == "s":
281 entry = self.params[pname] = elm.Entry(self.box) 303 entry = self.params[pname] = Entry(self.box)
282 entry.callback_changed_user_add(lambda x, pname=pname: self._changed(x, pname)) 304 entry.callback_changed_user_add(lambda x, pname=pname: self._changed(x, pname))
283 entry.single_line_set(True) 305 entry.single_line_set(True)
284 if param.is_secret(): 306 if param.is_secret():
@@ -289,7 +311,7 @@ class AccountEditor(object):
289 frametext = frametext+" - "+_("Default: %s") % (pdefault) 311 frametext = frametext+" - "+_("Default: %s") % (pdefault)
290 312
291 elif ptype in ["n", "q", "i", "u", "x", "t"]: 313 elif ptype in ["n", "q", "i", "u", "x", "t"]:
292 entry = self.params[pname] = elm.Spinner(self.box) 314 entry = self.params[pname] = Spinner(self.box)
293 entry.callback_changed_add(lambda x, pname=pname: self._changed(x, pname)) 315 entry.callback_changed_add(lambda x, pname=pname: self._changed(x, pname))
294 if "port" in pname: 316 if "port" in pname:
295 entry.min_max_set(0, 65535) 317 entry.min_max_set(0, 65535)
@@ -309,7 +331,7 @@ class AccountEditor(object):
309 331
310 else: 332 else:
311 logging.debug("Unknown parameter type %s in %s" % (ptype, pname)) 333 logging.debug("Unknown parameter type %s in %s" % (ptype, pname))
312 entry = self.params[pname] = elm.Entry(self.box) 334 entry = self.params[pname] = Entry(self.box)
313 entry.callback_changed_user_add(lambda x, pname=pname: self._changed(x, pname)) 335 entry.callback_changed_user_add(lambda x, pname=pname: self._changed(x, pname))
314 entry.single_line_set(True) 336 entry.single_line_set(True)
315 337
@@ -337,9 +359,9 @@ class AccountEditor(object):
337 pass 359 pass
338 360
339 def avatar_clicked(self, obj): 361 def avatar_clicked(self, obj):
340 avatarwin = elm.InnerWindow(self.parentwin) 362 avatarwin = InnerWindow(self.parentwin)
341 363
342 avatarsel = elm.Fileselector(avatarwin) 364 avatarsel = Fileselector(avatarwin)
343 avatarsel.is_save_set(False) 365 avatarsel.is_save_set(False)
344 avatarsel.expandable_set(True) 366 avatarsel.expandable_set(True)
345 avatarsel.callback_done_add(self.avatar_selected, avatarwin) 367 avatarsel.callback_done_add(self.avatar_selected, avatarwin)
@@ -468,10 +490,10 @@ class AccountEditor(object):
468 490
469 if account["params"]: 491 if account["params"]:
470 # XXX: update_parameters(_vardict)_async is broken by https://bugs.freedesktop.org/show_bug.cgi?id=59757 492 # XXX: update_parameters(_vardict)_async is broken by https://bugs.freedesktop.org/show_bug.cgi?id=59757
471 pu = elm.Popup(self.box) 493 pu = Popup(self.box)
472 pu.part_text_set("title,text", "Account parameter updates disabled") 494 pu.part_text_set("title,text", "Account parameter updates disabled")
473 pu.text = "Updating the account parameters has been temporally disabled pending a fix to the underlaying library. As a workaround delete and recreate your account." 495 pu.text = "Updating the account parameters has been temporally disabled pending a fix to the underlaying library. As a workaround delete and recreate your account, or use another utility such as nm-tool."
474 pub = elm.Button(self.box) 496 pub = Button(self.box)
475 pub.text = "OK" 497 pub.text = "OK"
476 pub.callback_clicked_add(self._close) 498 pub.callback_clicked_add(self._close)
477 pu.part_content_set("button1", pub) 499 pu.part_content_set("button1", pub)
diff --git a/apathy/Accounts.py b/apathy/Accounts.py
index 7f28a9a..bf5fcf1 100644
--- a/apathy/Accounts.py
+++ b/apathy/Accounts.py
@@ -25,9 +25,27 @@ import os.path
25import gettext 25import gettext
26import logging 26import logging
27 27
28import ecore 28try:
29import elementary as elm 29 import ecore
30from evas import EVAS_ASPECT_CONTROL_VERTICAL, EVAS_HINT_FILL, EVAS_HINT_EXPAND 30 import elementary as elm
31 from evas import EVAS_ASPECT_CONTROL_VERTICAL, EVAS_HINT_FILL, \
32 EVAS_HINT_EXPAND
33 from elementary import StandardWindow, Box, Genlist, \
34 GenlistItemClass, ELM_GENLIST_ITEM_NONE, ELM_LIST_COMPRESS, \
35 Button, Hoversel, Naviframe, Progressbar, Icon
36except ImportError:
37 from efl import ecore, elementary as elm
38 from efl.evas import EVAS_ASPECT_CONTROL_VERTICAL, EVAS_HINT_FILL, \
39 EVAS_HINT_EXPAND
40 from efl.elementary.window import StandardWindow
41 from efl.elementary.box import Box
42 from efl.elementary.genlist import Genlist, GenlistItemClass, \
43 ELM_GENLIST_ITEM_NONE, ELM_LIST_COMPRESS
44 from efl.elementary.button import Button
45 from efl.elementary.hoversel import Hoversel
46 from efl.elementary.naviframe import Naviframe
47 from efl.elementary.progressbar import Progressbar
48 from efl.elementary.icon import Icon
31 49
32from Globals import * 50from Globals import *
33from AccountEditor import AccountEditor 51from AccountEditor import AccountEditor
@@ -43,26 +61,26 @@ class Accounts(object):
43 self._signals = [] 61 self._signals = []
44 self.accounts_list_items = {} 62 self.accounts_list_items = {}
45 63
46 self.window = window = elm.StandardWindow("accounts", "Apathy - Accounts") 64 self.window = window = StandardWindow("accounts", "Apathy - Accounts")
47 window.callback_delete_request_add(self.quit) 65 window.callback_delete_request_add(self.quit)
48 66
49 box = elm.Box(window) 67 box = Box(window)
50 68
51 self.accounts_list = accounts_list = elm.Genlist(window) 69 self.accounts_list = accounts_list = Genlist(window)
52 accounts_list.size_hint_weight = (EVAS_HINT_EXPAND, EVAS_HINT_EXPAND) 70 accounts_list.size_hint_weight = (EVAS_HINT_EXPAND, EVAS_HINT_EXPAND)
53 accounts_list.size_hint_align = (EVAS_HINT_FILL, EVAS_HINT_FILL) 71 accounts_list.size_hint_align = (EVAS_HINT_FILL, EVAS_HINT_FILL)
54 accounts_list.mode_set(elm.ELM_LIST_COMPRESS) 72 accounts_list.mode_set(ELM_LIST_COMPRESS)
55 accounts_list.callback_activated_add(self.item_activated_cb) 73 accounts_list.callback_activated_add(self.item_activated_cb)
56 accounts_list.callback_selected_add(self.item_selected_cb) 74 accounts_list.callback_selected_add(self.item_selected_cb)
57 accounts_list.show() 75 accounts_list.show()
58 box.pack_end(accounts_list) 76 box.pack_end(accounts_list)
59 77
60 edit_box = elm.Box(window) 78 edit_box = Box(window)
61 edit_box.horizontal = True 79 edit_box.horizontal = True
62 edit_box.size_hint_weight = (EVAS_HINT_EXPAND, 0.0) 80 edit_box.size_hint_weight = (EVAS_HINT_EXPAND, 0.0)
63 edit_box.size_hint_align = (EVAS_HINT_FILL, 1.0) 81 edit_box.size_hint_align = (EVAS_HINT_FILL, 1.0)
64 82
65 btn = elm.Button(window) 83 btn = Button(window)
66 btn.callback_clicked_add(self._add_account) 84 btn.callback_clicked_add(self._add_account)
67 btn.size_hint_weight = (EVAS_HINT_EXPAND, 0.0) 85 btn.size_hint_weight = (EVAS_HINT_EXPAND, 0.0)
68 btn.size_hint_align = (EVAS_HINT_FILL, 0.0) 86 btn.size_hint_align = (EVAS_HINT_FILL, 0.0)
@@ -70,7 +88,7 @@ class Accounts(object):
70 btn.show() 88 btn.show()
71 edit_box.pack_end(btn) 89 edit_box.pack_end(btn)
72 90
73 self.presence_list = presence_list = elm.Hoversel(window) 91 self.presence_list = presence_list = Hoversel(window)
74 presence_list.text = _("Set presence").encode("utf-8") 92 presence_list.text = _("Set presence").encode("utf-8")
75 self._populate_presence_list() 93 self._populate_presence_list()
76 presence_list.show() 94 presence_list.show()
@@ -81,7 +99,7 @@ class Accounts(object):
81 99
82 box.show() 100 box.show()
83 101
84 self.pager = pager = elm.Naviframe(window) 102 self.pager = pager = Naviframe(window)
85 pager.size_hint_weight = (EVAS_HINT_EXPAND, EVAS_HINT_EXPAND) 103 pager.size_hint_weight = (EVAS_HINT_EXPAND, EVAS_HINT_EXPAND)
86 pager.size_hint_align = (EVAS_HINT_FILL, EVAS_HINT_FILL) 104 pager.size_hint_align = (EVAS_HINT_FILL, EVAS_HINT_FILL)
87 window.resize_object_add(pager) 105 window.resize_object_add(pager)
@@ -125,7 +143,7 @@ class Accounts(object):
125 143
126 def am_account_validity_changed(self, am, account, valid, *args): 144 def am_account_validity_changed(self, am, account, valid, *args):
127 if valid: 145 if valid:
128 account.prepare_async(None, self._account_ready, None) 146 account.prepare_async(None, self.am_account_ready, None)
129 147
130 def _populate_presence_list(self): 148 def _populate_presence_list(self):
131 presences = { 149 presences = {
@@ -210,17 +228,17 @@ class AccountManager(object):
210class Account(object): 228class Account(object):
211 def __init__(self, parent, account): 229 def __init__(self, parent, account):
212 self.account = account 230 self.account = account
213 self.list_item = parent.accounts_list.item_append(AccountItem("default"), account, None, elm.ELM_GENLIST_ITEM_NONE) 231 self.list_item = parent.accounts_list.item_append(AccountItem("default"), account, None, ELM_GENLIST_ITEM_NONE)
214 account.connect("presence-changed", self._presence_changed) 232 account.connect("presence-changed", self._presence_changed)
215 account.connect("notify::changing-presence", self._presence_changing) 233 account.connect("notify::changing-presence", self._presence_changing)
216 234
217 def _presence_changed(self, account, presence, status, status_message): 235 def _presence_changed(self, account, presence, status, status_message):
218 self.accounts_list_items[account.get_path_suffix()].update() 236 self.list_item.update()
219 237
220 def _presence_changing(self, account, changing): 238 def _presence_changing(self, account, changing):
221 self.accounts_list_items[account.get_path_suffix()].update() 239 self.list_item.update()
222 240
223class AccountItem(elm.GenlistItemClass): 241class AccountItem(GenlistItemClass):
224 def text_get(self, obj, part, account): 242 def text_get(self, obj, part, account):
225 presence, status, status_message = account.get_current_presence() 243 presence, status, status_message = account.get_current_presence()
226 text = "%s" % (account.get_display_name()) 244 text = "%s" % (account.get_display_name())
@@ -230,23 +248,33 @@ class AccountItem(elm.GenlistItemClass):
230 248
231 def content_get(self, obj, part, account): 249 def content_get(self, obj, part, account):
232 if part == "elm.swallow.icon": 250 if part == "elm.swallow.icon":
233 ic = elm.Icon(obj) 251 ic = Icon(obj)
234 if account.get_icon_name(): 252 if account.get_icon_name():
235 ic.file_set(os.path.join(IMAGE_PATH, account.get_icon_name()+".png")) 253 try:
236 ic.standard = account.get_icon_name() 254 ic.file_set(os.path.join(IMAGE_PATH, account.get_icon_name()+".png"))
255 except:
256 try:
257 ic.standard = account.get_icon_name()
258 except:
259 pass
237 else: 260 else:
238 ic.standard = "apathetic" 261 ic.standard = "apathetic"
239 elif part == "elm.swallow.end": 262 elif part == "elm.swallow.end":
240 if account.get_changing_presence(): 263 if account.get_changing_presence():
241 ic = elm.Progressbar(obj) 264 ic = Progressbar(obj)
242 ic.style = "wheel" 265 ic.style = "wheel"
243 ic.pulse_set(True) 266 ic.pulse_mode = True
244 ic.pulse(True) 267 ic.pulse(True)
245 else: 268 else:
246 ic = elm.Icon(obj) 269 ic = Icon(obj)
247 presence, status, status_message = account.get_current_presence() 270 presence, status, status_message = account.get_current_presence()
248 ic.file_set(os.path.join(IMAGE_PATH, status+".png")) 271 try:
249 ic.standard = "user-"+status 272 ic.file_set(os.path.join(IMAGE_PATH, status+".png"))
273 except:
274 try:
275 ic.standard = "user-"+status
276 except:
277 pass
250 ic.size_hint_aspect = (EVAS_ASPECT_CONTROL_VERTICAL, 1, 1) 278 ic.size_hint_aspect = (EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)
251 return ic 279 return ic
252 280
diff --git a/apathy/Approver.py b/apathy/Approver.py
index 6958482..a364bf3 100644
--- a/apathy/Approver.py
+++ b/apathy/Approver.py
@@ -25,9 +25,19 @@ import os.path
25import gettext 25import gettext
26import logging 26import logging
27 27
28import ecore 28try:
29import elementary as elm 29 import ecore
30from evas import EVAS_ASPECT_CONTROL_VERTICAL 30 import elementary as elm
31 from elementary import Window, Background, Box, Label, Button
32 from evas import EVAS_ASPECT_CONTROL_VERTICAL
33except ImportError:
34 from efl import ecore, elementary as elm
35 from efl.evas import EVAS_ASPECT_CONTROL_VERTICAL
36 from efl.elementary.window import Window
37 from efl.elementary.background import Background
38 from efl.elementary.box import Box
39 from efl.elementary.label import Label
40 from efl.elementary.button import Button
31 41
32from Globals import * 42from Globals import *
33 43
@@ -92,21 +102,21 @@ class Approver(object):
92 102
93 dispatch_operation.connect("channel-lost", self.channel_lost) 103 dispatch_operation.connect("channel-lost", self.channel_lost)
94 104
95 window = elm.Window("approver", elm.ELM_WIN_DIALOG_BASIC) 105 window = Window("approver", ELM_WIN_DIALOG_BASIC)
96 window.title = "Apathy - Approver" 106 window.title = "Apathy - Approver"
97 window.callback_delete_request_add(self.quit) 107 window.callback_delete_request_add(self.quit)
98 108
99 bg = elm.Background(window) 109 bg = Background(window)
100 bg.size_hint_weight = 1, 1 110 bg.size_hint_weight = 1, 1
101 window.resize_object_add(bg) 111 window.resize_object_add(bg)
102 bg.show() 112 bg.show()
103 113
104 box = elm.Box(window) 114 box = Box(window)
105 box.size_hint_weight_set(1.0, 1.0) 115 box.size_hint_weight_set(1.0, 1.0)
106 window.resize_object_add(box) 116 window.resize_object_add(box)
107 box.show() 117 box.show()
108 118
109 title = elm.Label(window) 119 title = Label(window)
110 title.text_set("<b>"+_("Accept channel from").encode("ascii", "xmlcharrefreplace")+"</b>") 120 title.text_set("<b>"+_("Accept channel from").encode("ascii", "xmlcharrefreplace")+"</b>")
111 box.pack_end(title) 121 box.pack_end(title)
112 title.show() 122 title.show()
@@ -117,28 +127,28 @@ class Approver(object):
117 identifier = channel.get_target_contact().get_alias() 127 identifier = channel.get_target_contact().get_alias()
118 if not identifier: 128 if not identifier:
119 identifier = channel.get_identifier() 129 identifier = channel.get_identifier()
120 label = elm.Label(window) 130 label = Label(window)
121 label.size_hint_weight_set(1.0, 1.0) 131 label.size_hint_weight_set(1.0, 1.0)
122 label.show() 132 label.show()
123 label.text_set("%s" % (identifier)) 133 label.text_set("%s" % (identifier))
124 box.pack_end(label) 134 box.pack_end(label)
125 135
126 ok = elm.Button(window) 136 ok = Button(window)
127 ok.text_set(_("Yes").encode("utf-8")) 137 ok.text_set(_("Yes").encode("utf-8"))
128 ok_ic = elm.Icon(window) 138 ok_ic = Icon(window)
129 ok_ic.standard_set("call-start") 139 ok_ic.standard_set("call-start")
130 ok.content_set(ok_ic) 140 ok.content_set(ok_ic)
131 141
132 cancel = elm.Button(window) 142 cancel = Button(window)
133 cancel.text_set(_("No").encode("utf-8")) 143 cancel.text_set(_("No").encode("utf-8"))
134 cancel_ic = elm.Icon(window) 144 cancel_ic = Icon(window)
135 cancel_ic.standard_set("call-stop") 145 cancel_ic.standard_set("call-stop")
136 cancel.content_set(cancel_ic) 146 cancel.content_set(cancel_ic)
137 147
138 ok.callback_clicked_add(self.accept, dispatch_operation, window) 148 ok.callback_clicked_add(self.accept, dispatch_operation, window)
139 cancel.callback_clicked_add(self.cancelled, dispatch_operation, window) 149 cancel.callback_clicked_add(self.cancelled, dispatch_operation, window)
140 150
141 option_box = elm.Box(window) 151 option_box = Box(window)
142 option_box.horizontal_set(True) 152 option_box.horizontal_set(True)
143 option_box.size_hint_weight_set(1.0, 1.0) 153 option_box.size_hint_weight_set(1.0, 1.0)
144 option_box.pack_end(ok) 154 option_box.pack_end(ok)
diff --git a/apathy/ContactInfo.py b/apathy/ContactInfo.py
index 1c25cdf..a07df1e 100644
--- a/apathy/ContactInfo.py
+++ b/apathy/ContactInfo.py
@@ -21,8 +21,15 @@
21# # 21# #
22######################################################################### 22#########################################################################
23 23
24from elementary import * 24try:
25from evas import EVAS_ASPECT_CONTROL_VERTICAL 25 from elementary import *
26 from evas import EVAS_ASPECT_CONTROL_VERTICAL
27except ImportError:
28 from efl.evas import EVAS_ASPECT_CONTROL_VERTICAL
29 from efl.elementary.box import Box
30 from efl.elementary.label import Label
31 from efl.elementary.photo import Photo
32 from efl.elementary.button import Button
26 33
27from gi.repository import TelepathyGLib as Tp 34from gi.repository import TelepathyGLib as Tp
28 35
@@ -38,7 +45,7 @@ class ContactInfo(Box):
38 ident.text_set("<br><b>%s</b><br>" % contact.get_identifier()) 45 ident.text_set("<br><b>%s</b><br>" % contact.get_identifier())
39 self.pack_end(ident) 46 self.pack_end(ident)
40 ident.show() 47 ident.show()
41 48
42 avatar = Photo(self) 49 avatar = Photo(self)
43 avatar.size_set(200) 50 avatar.size_set(200)
44 avatar_file = contact.get_avatar_file() 51 avatar_file = contact.get_avatar_file()
@@ -47,7 +54,7 @@ class ContactInfo(Box):
47 avatar.file_set(path) 54 avatar.file_set(path)
48 self.pack_end(avatar) 55 self.pack_end(avatar)
49 avatar.show() 56 avatar.show()
50 57
51 textbox = Box(self) 58 textbox = Box(self)
52 textcap = "" 59 textcap = ""
53 audiocap = "" 60 audiocap = ""
@@ -67,15 +74,15 @@ class ContactInfo(Box):
67 Tp.SubscriptionState.ASK: _("Waiting confirmation"), 74 Tp.SubscriptionState.ASK: _("Waiting confirmation"),
68 Tp.SubscriptionState.YES: _("Yes") 75 Tp.SubscriptionState.YES: _("Yes")
69 } 76 }
70 77
71 location = "" 78 location = ""
72 if contact.get_location(): 79 if contact.get_location():
73 location = contact.get_location() 80 location = contact.get_location()
74 81
75 blocked = _("No") 82 blocked = _("No")
76 if contact.is_blocked(): 83 if contact.is_blocked():
77 blocked = _("Yes") 84 blocked = _("Yes")
78 85
79 texts = { 86 texts = {
80 _("Alias"): contact.get_alias().decode("utf-8"), 87 _("Alias"): contact.get_alias().decode("utf-8"),
81 _("Status"): contact.get_presence_status().capitalize(), 88 _("Status"): contact.get_presence_status().capitalize(),
@@ -97,10 +104,10 @@ class ContactInfo(Box):
97 label.size_hint_align_set(0.0, 0.0) 104 label.size_hint_align_set(0.0, 0.0)
98 textbox.pack_end(label) 105 textbox.pack_end(label)
99 label.show() 106 label.show()
100 107
101 self.pack_end(textbox) 108 self.pack_end(textbox)
102 textbox.show() 109 textbox.show()
103 110
104 fill = Box(self) 111 fill = Box(self)
105 fill.size_hint_weight_set(1.0, 1.0) 112 fill.size_hint_weight_set(1.0, 1.0)
106 self.pack_end(fill) 113 self.pack_end(fill)
diff --git a/apathy/Contacts.py b/apathy/Contacts.py
index 082e29d..95cb578 100644
--- a/apathy/Contacts.py
+++ b/apathy/Contacts.py
@@ -25,9 +25,25 @@ import os.path
25import gettext 25import gettext
26import logging 26import logging
27 27
28import ecore 28try:
29import elementary as elm 29 import ecore, elementary as elm
30from evas import EVAS_ASPECT_CONTROL_VERTICAL 30 from evas import EVAS_ASPECT_CONTROL_VERTICAL
31 from elementary import StandardWindow, Genlist, GenlistItemClass, \
32 ELM_GENLIST_ITEM_NONE, ELM_GENLIST_ITEM_GROUP, \
33 ELM_LIST_COMPRESS, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY, \
34 Box, Label, Naviframe, Icon, Menu
35except ImportError:
36 from efl import ecore, elementary as elm
37 from efl.evas import EVAS_ASPECT_CONTROL_VERTICAL
38 from efl.elementary.window import StandardWindow
39 from efl.elementary.genlist import Genlist, GenlistItemClass, \
40 ELM_GENLIST_ITEM_NONE, ELM_GENLIST_ITEM_GROUP, \
41 ELM_LIST_COMPRESS, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY
42 from efl.elementary.box import Box
43 from efl.elementary.label import Label
44 from efl.elementary.naviframe import Naviframe
45 from efl.elementary.icon import Icon
46 from efl.elementary.menu import Menu
31 47
32from ContactInfo import ContactInfo 48from ContactInfo import ContactInfo
33from Globals import * 49from Globals import *
@@ -37,7 +53,7 @@ from gi.repository import GObject
37GObject.threads_init() 53GObject.threads_init()
38from gi.repository import TelepathyGLib as Tp 54from gi.repository import TelepathyGLib as Tp
39 55
40class ContactItem(elm.GenlistItemClass): 56class ContactItem(GenlistItemClass):
41 def text_get(self, obj, part, contact): 57 def text_get(self, obj, part, contact):
42 if part == "elm.text": 58 if part == "elm.text":
43 msg = contact.get_presence_message() 59 msg = contact.get_presence_message()
@@ -50,7 +66,7 @@ class ContactItem(elm.GenlistItemClass):
50 return " %s" % contact.get_presence_message() 66 return " %s" % contact.get_presence_message()
51 67
52 def content_get(self, obj, part, contact): 68 def content_get(self, obj, part, contact):
53 ic = elm.Icon(obj) 69 ic = Icon(obj)
54 if part == "elm.swallow.icon": 70 if part == "elm.swallow.icon":
55 if contact.get_presence_status() != "offline": 71 if contact.get_presence_status() != "offline":
56 avatar = contact.get_avatar_file() 72 avatar = contact.get_avatar_file()
@@ -58,23 +74,29 @@ class ContactItem(elm.GenlistItemClass):
58 path = avatar.get_path() 74 path = avatar.get_path()
59 ic.file_set(path) 75 ic.file_set(path)
60 else: 76 else:
61 ic.standard_set("apathetic") 77 try:
78 ic.standard_set("apathetic")
79 except:
80 pass
62 elif part == "elm.swallow.end": 81 elif part == "elm.swallow.end":
63 status = contact.get_presence_status() 82 status = contact.get_presence_status()
64 if status == "xa": 83 if status == "xa":
65 status = "away-extended" 84 status = "away-extended"
66 ic.standard_set("user-"+status) 85 try:
86 ic.standard_set("user-"+status)
87 except:
88 pass
67 ic.size_hint_aspect_set(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1) 89 ic.size_hint_aspect_set(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)
68 90
69 return ic 91 return ic
70 92
71class ContactGroup(elm.GenlistItemClass): 93class ContactGroup(GenlistItemClass):
72 def text_get(self, obj, part, contactgroup): 94 def text_get(self, obj, part, contactgroup):
73 return contactgroup 95 return contactgroup
74 96
75 def content_get(self, obj, part, contactgroup): 97 def content_get(self, obj, part, contactgroup):
76 if part == "elm.swallow.icon": 98 if part == "swallow.icon":
77 ic = elm.Icon(obj) 99 ic = Icon(obj)
78 ic.standard_set("media-playback-start") 100 ic.standard_set("media-playback-start")
79 ic.size_hint_aspect_set(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1) 101 ic.size_hint_aspect_set(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)
80 return ic 102 return ic
@@ -93,8 +115,8 @@ class Contacts(object):
93 115
94 global log 116 global log
95 log = logging.getLogger("apathy.contacts") 117 log = logging.getLogger("apathy.contacts")
96 118
97 self.window = window = elm.StandardWindow("contacts", "Apathy - Contacts") 119 self.window = window = StandardWindow("contacts", "Apathy - Contacts")
98 window.callback_delete_request_add(self.quit) 120 window.callback_delete_request_add(self.quit)
99 121
100 self.am = am = Tp.AccountManager.dup() 122 self.am = am = Tp.AccountManager.dup()
@@ -120,23 +142,23 @@ class Contacts(object):
120 142
121 am.prepare_async(None, self._am_ready, None) 143 am.prepare_async(None, self._am_ready, None)
122 144
123 box = elm.Box(window) 145 box = Box(window)
124 146
125 self.contact_list = contact_list = elm.Genlist(window) 147 self.contact_list = contact_list = Genlist(window)
126 contact_list.size_hint_weight_set(1.0, 1.0) 148 contact_list.size_hint_weight_set(1.0, 1.0)
127 contact_list.size_hint_align_set(-1.0, -1.0) 149 contact_list.size_hint_align_set(-1.0, -1.0)
128 contact_list.mode_set(elm.ELM_LIST_COMPRESS) 150 contact_list.mode_set(ELM_LIST_COMPRESS)
129 box.pack_end(contact_list) 151 box.pack_end(contact_list)
130 contact_list.show() 152 contact_list.show()
131 contact_list.callback_longpressed_add(self.create_contact_info) 153 contact_list.callback_longpressed_add(self.create_contact_info)
132 contact_list.callback_clicked_double_add(self.show_menu) 154 contact_list.callback_clicked_double_add(self.show_menu)
133 155
134 btn_box = elm.Box(window) 156 btn_box = Box(window)
135 btn_box.horizontal_set(True) 157 btn_box.horizontal_set(True)
136 btn_box.size_hint_weight_set(1.0, 0.0) 158 btn_box.size_hint_weight_set(1.0, 0.0)
137 btn_box.size_hint_align_set(-1.0, 1.0) 159 btn_box.size_hint_align_set(-1.0, 1.0)
138 160
139 #add_btn = elm.Button(window) 161 #add_btn = Button(window)
140 #add_btn.callback_clicked_add(self.new_contact) 162 #add_btn.callback_clicked_add(self.new_contact)
141 #Translators: Verb, to add something 163 #Translators: Verb, to add something
142 #add_btn.text_set(_("Add").encode("utf-8")) 164 #add_btn.text_set(_("Add").encode("utf-8"))
@@ -149,7 +171,7 @@ class Contacts(object):
149 #box.pack_end(btn_box) 171 #box.pack_end(btn_box)
150 #btn_box.show() 172 #btn_box.show()
151 173
152 self.pager = pager = elm.Naviframe(window) 174 self.pager = pager = Naviframe(window)
153 pager.size_hint_weight_set(1.0, 1.0) 175 pager.size_hint_weight_set(1.0, 1.0)
154 pager.size_hint_align_set(-1.0, -1.0) 176 pager.size_hint_align_set(-1.0, -1.0)
155 window.resize_object_add(pager) 177 window.resize_object_add(pager)
@@ -164,7 +186,7 @@ class Contacts(object):
164 self.accounts[account.get_path_suffix()] = item = Account(self) 186 self.accounts[account.get_path_suffix()] = item = Account(self)
165 account.prepare_async(None, item.account_ready, None) 187 account.prepare_async(None, item.account_ready, None)
166 log.info("Added account for %s to the list of accounts" % (account.get_display_name())) 188 log.info("Added account for %s to the list of accounts" % (account.get_display_name()))
167 189
168 def new_contact(self, obj, *args): 190 def new_contact(self, obj, *args):
169 new_contact_page = NewContact(self, self.am) 191 new_contact_page = NewContact(self, self.am)
170 192
@@ -172,7 +194,7 @@ class Contacts(object):
172 contact = item.data_get() 194 contact = item.data_get()
173 contact_info = ContactInfo(self, contact) 195 contact_info = ContactInfo(self, contact)
174 self.pager.item_simple_push(contact_info) 196 self.pager.item_simple_push(contact_info)
175 197
176 def start_conversation(self, genlist, item): 198 def start_conversation(self, genlist, item):
177 contact = item.data_get() 199 contact = item.data_get()
178 account = contact.get_connection().get_account() 200 account = contact.get_connection().get_account()
@@ -184,7 +206,7 @@ class Contacts(object):
184 } 206 }
185 request = Tp.AccountChannelRequest.new(account, request_dict, 0) 207 request = Tp.AccountChannelRequest.new(account, request_dict, 0)
186 request.ensure_channel_async("", None, self.ensure_channel_cb, None) 208 request.ensure_channel_async("", None, self.ensure_channel_cb, None)
187 209
188 def start_call(self, genlist, item): 210 def start_call(self, genlist, item):
189 contact = item.data_get() 211 contact = item.data_get()
190 account = contact.get_connection().get_account() 212 account = contact.get_connection().get_account()
@@ -196,36 +218,36 @@ class Contacts(object):
196 } 218 }
197 request = Tp.AccountChannelRequest.new(account, request_dict, 0) 219 request = Tp.AccountChannelRequest.new(account, request_dict, 0)
198 request.ensure_channel_async("", None, self.ensure_channel_cb, None) 220 request.ensure_channel_async("", None, self.ensure_channel_cb, None)
199 221
200 def ensure_channel_cb(self, request, result, user_data): 222 def ensure_channel_cb(self, request, result, user_data):
201 try: 223 try:
202 request.ensure_channel_finish(result) 224 request.ensure_channel_finish(result)
203 except GObject.GError as gerror: 225 except GObject.GError as gerror:
204 ErrorDialog(self.window, _("Error"), gerror.message) 226 ErrorDialog(self.window, _("Error"), gerror.message)
205 227
206 def block_contact(self, genlist, item): 228 def block_contact(self, genlist, item):
207 contact = item.data_get() 229 contact = item.data_get()
208 contact.block_async(False, self.contact_blocked, None) 230 contact.block_async(False, self.contact_blocked, None)
209 231
210 def contact_blocked(self, contact, result, user_data): 232 def contact_blocked(self, contact, result, user_data):
211 try: 233 try:
212 contact.block_finish(result) 234 contact.block_finish(result)
213 except GObject.GError as gerror: 235 except GObject.GError as gerror:
214 ErrorDialog(self, _("Error"), gerror.message) 236 ErrorDialog(self, _("Error"), gerror.message)
215 237
216 def unblock_contact(self, genlist, item): 238 def unblock_contact(self, genlist, item):
217 contact = item.data_get() 239 contact = item.data_get()
218 contact.unblock_async(self.contact_unblocked, None) 240 contact.unblock_async(self.contact_unblocked, None)
219 241
220 def contact_unblocked(self, contact, result, user_data): 242 def contact_unblocked(self, contact, result, user_data):
221 try: 243 try:
222 contact.unblock_finish(result) 244 contact.unblock_finish(result)
223 except GObject.GError as gerror: 245 except GObject.GError as gerror:
224 ErrorDialog(self, _("Error"), gerror.message) 246 ErrorDialog(self, _("Error"), gerror.message)
225 247
226 def show_menu(self, genlist, item): 248 def show_menu(self, genlist, item):
227 contact = item.data_get() 249 contact = item.data_get()
228 menu = elm.Menu(self.window) 250 menu = Menu(self.window)
229 menu.item_add(None, _("Text").encode("utf-8"), "message", self.menu_conversation, genlist, item) 251 menu.item_add(None, _("Text").encode("utf-8"), "message", self.menu_conversation, genlist, item)
230 #menu.item_add(None, _("Call"), "call", self.menu_call, genlist, item) 252 #menu.item_add(None, _("Call"), "call", self.menu_call, genlist, item)
231 #menu.item_add(None, _("Send file", "file", self.menu_file, genlist, item) 253 #menu.item_add(None, _("Send file", "file", self.menu_file, genlist, item)
@@ -235,11 +257,11 @@ class Contacts(object):
235 else: 257 else:
236 menu.item_add(None, _("Block").encode("utf-8"), "", self.menu_block, genlist, item) 258 menu.item_add(None, _("Block").encode("utf-8"), "", self.menu_block, genlist, item)
237 menu.item_add(None, _("Information").encode("utf-8"), "", self.menu_contact_info, genlist, item) 259 menu.item_add(None, _("Information").encode("utf-8"), "", self.menu_contact_info, genlist, item)
238 260
239 w, h = genlist.size_get() 261 w, h = genlist.size_get()
240 menu.move(w/2-50, h/2-100) 262 menu.move(w/2-50, h/2-100)
241 menu.show() 263 menu.show()
242 264
243 def menu_conversation(self, menu, menuitem, genlist, item): 265 def menu_conversation(self, menu, menuitem, genlist, item):
244 self.start_conversation(genlist, item) 266 self.start_conversation(genlist, item)
245 def menu_call(self, menu, menuitem, genlist, item): 267 def menu_call(self, menu, menuitem, genlist, item):
@@ -270,7 +292,7 @@ class Account(object):
270 self.get_contacts(account.get_connection()) 292 self.get_contacts(account.get_connection())
271 293
272 account.connect("status-changed", self._status_changed) 294 account.connect("status-changed", self._status_changed)
273 295
274 def _status_changed(self, account, old_status, new_status, reason, dbus_error_name, details, *args): 296 def _status_changed(self, account, old_status, new_status, reason, dbus_error_name, details, *args):
275 log.debug("Connection status for %s changed from %s to %s, reason %s, dbus error %s, details %s" % (account.get_display_name(), old_status, new_status, reason, dbus_error_name, details)) 297 log.debug("Connection status for %s changed from %s to %s, reason %s, dbus error %s, details %s" % (account.get_display_name(), old_status, new_status, reason, dbus_error_name, details))
276 connection = account.get_connection() 298 connection = account.get_connection()
@@ -316,7 +338,7 @@ class Account(object):
316 def _groups_created(self, added): 338 def _groups_created(self, added):
317 for group in added: 339 for group in added:
318 self.account.get_connection().group_items[group] = item = self.add_group(group) 340 self.account.get_connection().group_items[group] = item = self.add_group(group)
319 item.select_mode_set(elm.ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY) 341 item.select_mode_set(ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY)
320 342
321 def _groups_removed(self, removed): 343 def _groups_removed(self, removed):
322 for group in removed: 344 for group in removed:
@@ -344,7 +366,7 @@ class Account(object):
344 group = connection.group_items[group] 366 group = connection.group_items[group]
345 except KeyError: 367 except KeyError:
346 group = None 368 group = None
347 contact_item = self.parent.contact_list.item_append(item_class, contact, group, elm.ELM_GENLIST_ITEM_NONE) 369 contact_item = self.parent.contact_list.item_append(item_class, contact, group, ELM_GENLIST_ITEM_NONE)
348 contact_item.tooltip_content_cb_set(self._contact_tooltip, contact) 370 contact_item.tooltip_content_cb_set(self._contact_tooltip, contact)
349 contact_items.append(contact_item) 371 contact_items.append(contact_item)
350 return contact_items 372 return contact_items
@@ -370,18 +392,18 @@ class Account(object):
370 del contact 392 del contact
371 393
372 def _contact_tooltip(self, list, item, contact): 394 def _contact_tooltip(self, list, item, contact):
373 helplabel = elm.Label(self.parent.window) 395 helplabel = Label(self.parent.window)
374 helplabel.size_hint_align_set(0.0, 0.0) 396 helplabel.size_hint_align_set(0.0, 0.0)
375 helplabel.text_set("<b>Double-click</b> for contact options<br/><b>Longpress</b> for more information") 397 helplabel.text_set("<b>Double-click</b> for contact options<br/><b>Longpress</b> for more information")
376 398
377 avatar = elm.Photo(self.parent.window) 399 avatar = Photo(self.parent.window)
378 avatar.size_set(100) 400 avatar.size_set(100)
379 avatar_file = contact.get_avatar_file() 401 avatar_file = contact.get_avatar_file()
380 if avatar_file: 402 if avatar_file:
381 path = avatar_file.get_path() 403 path = avatar_file.get_path()
382 avatar.file_set(path) 404 avatar.file_set(path)
383 405
384 textbox = elm.Box(self.parent.window) 406 textbox = Box(self.parent.window)
385 textcap = "" 407 textcap = ""
386 audiocap = "" 408 audiocap = ""
387 audiovideocap = "" 409 audiovideocap = ""
@@ -414,19 +436,19 @@ class Account(object):
414 for k, v in texts.iteritems(): 436 for k, v in texts.iteritems():
415 k = k.encode("ascii", "xmlcharrefreplace") 437 k = k.encode("ascii", "xmlcharrefreplace")
416 v = v.encode("ascii", "xmlcharrefreplace") 438 v = v.encode("ascii", "xmlcharrefreplace")
417 label = elm.Label(self.parent.window) 439 label = Label(self.parent.window)
418 label.text_set("<b>%s:</b> %s" % (k, v)) 440 label.text_set("<b>%s:</b> %s" % (k, v))
419 label.size_hint_align_set(0.0, 0.0) 441 label.size_hint_align_set(0.0, 0.0)
420 textbox.pack_end(label) 442 textbox.pack_end(label)
421 label.show() 443 label.show()
422 444
423 infobox = elm.Box(self.parent.window) 445 infobox = Box(self.parent.window)
424 infobox.horizontal_set(True) 446 infobox.horizontal_set(True)
425 infobox.pack_end(avatar) 447 infobox.pack_end(avatar)
426 avatar.show() 448 avatar.show()
427 infobox.pack_end(textbox) 449 infobox.pack_end(textbox)
428 textbox.show() 450 textbox.show()
429 box = elm.Box(self.parent.window) 451 box = Box(self.parent.window)
430 box.pack_end(helplabel) 452 box.pack_end(helplabel)
431 helplabel.show() 453 helplabel.show()
432 box.pack_end(infobox) 454 box.pack_end(infobox)
@@ -436,7 +458,7 @@ class Account(object):
436 458
437 def add_group(self, group): 459 def add_group(self, group):
438 group_class = ContactGroup() 460 group_class = ContactGroup()
439 return self.parent.contact_list.item_append(group_class, group, None, elm.ELM_GENLIST_ITEM_GROUP) 461 return self.parent.contact_list.item_append(group_class, group, None, ELM_GENLIST_ITEM_GROUP)
440 462
441 def _group_renamed(self, old_name, new_name, *args): 463 def _group_renamed(self, old_name, new_name, *args):
442 pass 464 pass
diff --git a/apathy/Conversation.py b/apathy/Conversation.py
index 50ad609..f12a9be 100644
--- a/apathy/Conversation.py
+++ b/apathy/Conversation.py
@@ -27,8 +27,24 @@ from time import time
27from threading import Timer 27from threading import Timer
28import webbrowser 28import webbrowser
29 29
30from evas import EVAS_ASPECT_CONTROL_VERTICAL 30try:
31import elementary as elm 31 from evas import EVAS_ASPECT_CONTROL_VERTICAL
32 import elementary as elm
33 from elementary import Box, Scroller, Frame, Entry, Bubble, Button, \
34 Check, Icon, InnerWindow, Web
35except:
36 from efl.evas import EVAS_ASPECT_CONTROL_VERTICAL
37 from efl.elementary.box import Box
38 from efl.elementary.scroller import Scroller
39 from efl.elementary.frame import Frame
40 from efl.elementary.entry import Entry
41 from efl.elementary.bubble import Bubble, ELM_BUBBLE_POS_TOP_LEFT, \
42 ELM_BUBBLE_POS_TOP_RIGHT
43 from efl.elementary.button import Button
44 from efl.elementary.check import Check
45 from efl.elementary.icon import Icon
46 from efl.elementary.innerwindow import InnerWindow
47 from efl.elementary.web import Web
32 48
33from Globals import * 49from Globals import *
34from Parser import parse 50from Parser import parse
@@ -46,29 +62,29 @@ class Conversation(object):
46 62
47 self.chat_state = "inactive" 63 self.chat_state = "inactive"
48 64
49 box = self.box = elm.Box(self.parentwin) 65 box = self.box = Box(self.parentwin)
50 box.size_hint_weight_set(1.0, 1.0) 66 box.size_hint_weight_set(1.0, 1.0)
51 box.size_hint_align_set(-1.0, -1.0) 67 box.size_hint_align_set(-1.0, -1.0)
52 68
53 self.scroll = elm.Scroller(self.box) 69 self.scroll = Scroller(self.box)
54 self.scroll.size_hint_weight_set(1.0, 1.0) 70 self.scroll.size_hint_weight_set(1.0, 1.0)
55 self.scroll.size_hint_align_set(-1.0, -1.0) 71 self.scroll.size_hint_align_set(-1.0, -1.0)
56 self.scroll.bounce_set(False,True) 72 self.scroll.bounce_set(False,True)
57 box.pack_end(self.scroll) 73 box.pack_end(self.scroll)
58 self.scroll.show() 74 self.scroll.show()
59 75
60 self.message_box = elm.Box(self.box) 76 self.message_box = Box(self.box)
61 self.message_box.size_hint_weight_set(1.0, 1.0) 77 self.message_box.size_hint_weight_set(1.0, 1.0)
62 self.message_box.size_hint_align_set(-1.0, -1.0) 78 self.message_box.size_hint_align_set(-1.0, -1.0)
63 self.scroll.content_set(self.message_box) 79 self.scroll.content_set(self.message_box)
64 self.message_box.show() 80 self.message_box.show()
65 81
66 fr_entry = elm.Frame(self.box) 82 fr_entry = Frame(self.box)
67 fr_entry.text_set(_("Input:").encode("utf-8")) 83 fr_entry.text_set(_("Input:").encode("utf-8"))
68 fr_entry.size_hint_align_set(0.0, 0.0) 84 fr_entry.size_hint_align_set(0.0, 0.0)
69 fr_entry.size_hint_align_set(-1.0, 0.0) 85 fr_entry.size_hint_align_set(-1.0, 0.0)
70 86
71 self.text_entry = elm.Entry(self.box) 87 self.text_entry = Entry(self.box)
72 self.text_entry.elm_event_callback_add(self.entry_event) 88 self.text_entry.elm_event_callback_add(self.entry_event)
73 self.text_entry.focus_set(True) 89 self.text_entry.focus_set(True)
74 90
@@ -77,23 +93,23 @@ class Conversation(object):
77 self.text_entry.show() 93 self.text_entry.show()
78 fr_entry.show() 94 fr_entry.show()
79 95
80 box1 = elm.Box(self.box) 96 box1 = Box(self.box)
81 box1.horizontal_set(True) 97 box1.horizontal_set(True)
82 box1.size_hint_weight_set(1.0, 0.0) 98 box1.size_hint_weight_set(1.0, 0.0)
83 box1.size_hint_align_set(-1.0, 0.0) 99 box1.size_hint_align_set(-1.0, 0.0)
84 box.pack_end(box1) 100 box.pack_end(box1)
85 101
86 self.entry_mode = entry_mode = elm.Check(self.box) 102 self.entry_mode = entry_mode = Check(self.box)
87 entry_mode.text_set(_("Quick entry mode").encode("utf-8")) 103 entry_mode.text_set(_("Quick entry mode").encode("utf-8"))
88 box1.pack_end(entry_mode) 104 box1.pack_end(entry_mode)
89 entry_mode.show() 105 entry_mode.show()
90 106
91 self.emotes = emotes = elm.Check(self.box) 107 self.emotes = emotes = Check(self.box)
92 emotes.text_set(_("Emoticons").encode("utf-8")) 108 emotes.text_set(_("Emoticons").encode("utf-8"))
93 box1.pack_end(emotes) 109 box1.pack_end(emotes)
94 emotes.show() 110 emotes.show()
95 111
96 send_button = elm.Button(self.box) 112 send_button = Button(self.box)
97 send_button.text_set(_("Send").encode("utf-8")) 113 send_button.text_set(_("Send").encode("utf-8"))
98 send_button.size_hint_weight_set(1.0, 0.0) 114 send_button.size_hint_weight_set(1.0, 0.0)
99 send_button.size_hint_align_set(-1.0, 0.0) 115 send_button.size_hint_align_set(-1.0, 0.0)
@@ -118,13 +134,13 @@ class Conversation(object):
118 134
119 def add_bubble(self, text, timestamp, sender, corner, avatar = None): 135 def add_bubble(self, text, timestamp, sender, corner, avatar = None):
120 timestr = datetime.fromtimestamp(timestamp).strftime("%c") 136 timestr = datetime.fromtimestamp(timestamp).strftime("%c")
121 bb = elm.Bubble(self.box) 137 bb = Bubble(self.box)
122 bb.pos_set(corner) 138 bb.pos_set(corner)
123 bb.text_set(sender) 139 bb.text_set(sender)
124 bb.part_text_set("info", timestr) 140 bb.part_text_set("info", timestr)
125 bb.size_hint_weight_set(0.0, 0.0) 141 bb.size_hint_weight_set(0.0, 0.0)
126 bb.size_hint_align_set(-1.0, 0.0) 142 bb.size_hint_align_set(-1.0, 0.0)
127 ab = elm.Entry(self.box) 143 ab = Entry(self.box)
128 ab.callback_anchor_clicked_add(self.anchor_clicked) 144 ab.callback_anchor_clicked_add(self.anchor_clicked)
129 ab.callback_anchor_hover_opened_add(self.anchor_hover_opened) 145 ab.callback_anchor_hover_opened_add(self.anchor_hover_opened)
130 ab.editable_set(False) 146 ab.editable_set(False)
@@ -145,12 +161,12 @@ class Conversation(object):
145 161
146 def anchor_hover_opened(self, obj, event_info): 162 def anchor_hover_opened(self, obj, event_info):
147 log.debug(event_info) 163 log.debug(event_info)
148 btn = elm.Button(obj) 164 btn = Button(obj)
149 parts = self.anchor_name.partition(":") 165 parts = self.anchor_name.partition(":")
150 if parts[0] == "url": 166 if parts[0] == "url":
151 btn.text_set("Open in browser") 167 btn.text_set("Open in browser")
152 btn.callback_clicked_add(lambda x: webbrowser.open(parts[2])) 168 btn.callback_clicked_add(lambda x: webbrowser.open(parts[2]))
153 btn2 = elm.Button(obj) 169 btn2 = Button(obj)
154 btn2.text_set("Open internally") 170 btn2.text_set("Open internally")
155 btn2.callback_clicked_add(self.open_web, parts[2]) 171 btn2.callback_clicked_add(self.open_web, parts[2])
156 btn2.callback_clicked_add(lambda x: obj.anchor_hover_end()) 172 btn2.callback_clicked_add(lambda x: obj.anchor_hover_end())
@@ -164,10 +180,10 @@ class Conversation(object):
164 event_info.hover.part_content_set("middle", btn) 180 event_info.hover.part_content_set("middle", btn)
165 181
166 def open_web(self, obj, url): 182 def open_web(self, obj, url):
167 box = elm.Box(self.parentwin) 183 box = Box(self.parentwin)
168 web = elm.Web(self.parentwin) 184 web = Web(self.parentwin)
169 inwin = elm.InnerWindow(self.parentwin) 185 inwin = InnerWindow(self.parentwin)
170 xbtn = elm.Button(self.parentwin) 186 xbtn = Button(self.parentwin)
171 187
172 web.size_hint_weight_set(1.0, 1.0) 188 web.size_hint_weight_set(1.0, 1.0)
173 web.size_hint_align_set(-1.0, -1.0) 189 web.size_hint_align_set(-1.0, -1.0)
@@ -186,8 +202,11 @@ class Conversation(object):
186 inwin.show() 202 inwin.show()
187 203
188 def chat_state_changed(self, channel, contact, state, *args): 204 def chat_state_changed(self, channel, contact, state, *args):
189 ic = elm.Icon(self.parentwin) 205 ic = Icon(self.parentwin)
190 ic.file_set(os.path.join(IMAGE_PATH, "apathy.png")) 206 try:
207 ic.file_set(os.path.join(IMAGE_PATH, "apathy.png"))
208 except:
209 pass
191 ic.size_hint_aspect_set(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1) 210 ic.size_hint_aspect_set(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)
192 211
193 states = { 212 states = {
@@ -199,7 +218,7 @@ class Conversation(object):
199 } 218 }
200 log.debug("%s, %s, %s" % (channel, contact, states[state])) 219 log.debug("%s, %s, %s" % (channel, contact, states[state]))
201 if state == Tp.ChannelChatState.GONE: 220 if state == Tp.ChannelChatState.GONE:
202 self.add_bubble("<em>%s %s</em>" % (self.contact.get_alias(), states[state]), time(), self.contact.get_alias(), elm.ELM_BUBBLE_POS_TOP_LEFT, ic) 221 self.add_bubble("<em>%s %s</em>" % (self.contact.get_alias(), states[state]), time(), self.contact.get_alias(), ELM_BUBBLE_POS_TOP_LEFT, ic)
203 #TODO: chat states 222 #TODO: chat states
204 223
205 def entry_event(self, obj, entry, something, event, *args): 224 def entry_event(self, obj, entry, something, event, *args):
@@ -273,14 +292,14 @@ class Conversation(object):
273 except: 292 except:
274 avatar = None 293 avatar = None
275 else: 294 else:
276 avatar = elm.Icon(self.parentwin) 295 avatar = Icon(self.parentwin)
277 avatar.file_set(avatar_path) 296 avatar.file_set(avatar_path)
278 avatar.size_hint_aspect_set(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1) 297 avatar.size_hint_aspect_set(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)
279 298
280 text = parse(self.text_entry.utf8_to_markup(text), urls=False, emotes=self.emotes.state_get()) 299 text = parse(self.text_entry.utf8_to_markup(text), urls=False, emotes=self.emotes.state_get())
281 log.debug(text) 300 log.debug(text)
282 log.debug(type(text)) 301 log.debug(type(text))
283 self.add_bubble(text, timestamp, self.contact.get_alias(), elm.ELM_BUBBLE_POS_TOP_LEFT, avatar) 302 self.add_bubble(text, timestamp, self.contact.get_alias(), ELM_BUBBLE_POS_TOP_LEFT, avatar)
284 303
285 if not self.parentwin.focus_get(): 304 if not self.parentwin.focus_get():
286 notify(_("Message from %s").encode("utf-8") % (self.contact.get_alias()), text, "notification-information") 305 notify(_("Message from %s").encode("utf-8") % (self.contact.get_alias()), text, "notification-information")
@@ -294,7 +313,7 @@ class Conversation(object):
294 timestamp = message.get_sent_timestamp() 313 timestamp = message.get_sent_timestamp()
295 text = text.replace("\n", "<br/>") 314 text = text.replace("\n", "<br/>")
296 text = parse(text, urls=False, emotes=self.emotes.state_get()) 315 text = parse(text, urls=False, emotes=self.emotes.state_get())
297 self.add_bubble(text, timestamp, "You", elm.ELM_BUBBLE_POS_TOP_RIGHT) 316 self.add_bubble(text, timestamp, "You", ELM_BUBBLE_POS_TOP_RIGHT)
298 317
299 def send_error_cb(self, error, timestamp, type, text): 318 def send_error_cb(self, error, timestamp, type, text):
300 log.debug('Error %d sending message: %s' % (error, text)) 319 log.debug('Error %d sending message: %s' % (error, text))
diff --git a/apathy/ErrorDialog.py b/apathy/ErrorDialog.py
index eadec9d..cc54b94 100644
--- a/apathy/ErrorDialog.py
+++ b/apathy/ErrorDialog.py
@@ -21,7 +21,14 @@
21# # 21# #
22######################################################################### 22#########################################################################
23 23
24from elementary import * 24try:
25 from elementary import *
26except ImportError:
27 from efl.elementary.innerwindow import InnerWindow
28 from efl.elementary.box import Box
29 from efl.elementary.frame import Frame
30 from efl.elementary.button import Button
31 from efl.elementary.entry import Entry
25 32
26class ErrorDialog(InnerWindow): 33class ErrorDialog(InnerWindow):
27 def __init__(self, parent, title, *args): 34 def __init__(self, parent, title, *args):
diff --git a/apathy/Handler.py b/apathy/Handler.py
index d9ea376..d8e21a6 100644
--- a/apathy/Handler.py
+++ b/apathy/Handler.py
@@ -25,9 +25,17 @@ import os.path
25import gettext 25import gettext
26import logging 26import logging
27 27
28import ecore 28try:
29import elementary as elm 29 import ecore, elementary as elm
30from evas import EVAS_ASPECT_CONTROL_VERTICAL 30 from evas import EVAS_ASPECT_CONTROL_VERTICAL
31except ImportError:
32 from efl import ecore, elementary as elm
33 from efl.evas import EVAS_ASPECT_CONTROL_VERTICAL
34 from efl.elementary.window import StandardWindow
35 from efl.elementary.box import Box
36 from efl.elementary.hoversel import Hoversel, ELM_ICON_FILE
37 from efl.elementary.naviframe import Naviframe
38 from efl.elementary.button import Button
31 39
32from Globals import * 40from Globals import *
33from Conversation import Conversation 41from Conversation import Conversation
@@ -41,30 +49,30 @@ class Handler(object):
41 global log 49 global log
42 log = logging.getLogger("apathy.handler") 50 log = logging.getLogger("apathy.handler")
43 51
44 window = self.window = elm.StandardWindow("handler", "Apathy - Handler") 52 window = self.window = StandardWindow("handler", "Apathy - Handler")
45 window.callback_delete_request_add(self.quit) 53 window.callback_delete_request_add(self.quit)
46 window.callback_focus_in_add(lambda x: set_urgent(self.window, False)) 54 window.callback_focus_in_add(lambda x: set_urgent(self.window, False))
47 55
48 box = elm.Box(window) 56 box = Box(window)
49 box.size_hint_weight_set(1.0, 1.0) 57 box.size_hint_weight_set(1.0, 1.0)
50 box.size_hint_align_set(-1.0, -1.0) 58 box.size_hint_align_set(-1.0, -1.0)
51 self.window.resize_object_add(box) 59 self.window.resize_object_add(box)
52 60
53 self.chatlist = chatlist = elm.Hoversel(window) 61 self.chatlist = chatlist = Hoversel(window)
54 self.chatlist.text_set(_("Channels")) 62 self.chatlist.text_set(_("Channels"))
55 chatlist.size_hint_weight_set(1.0, 0.0) 63 chatlist.size_hint_weight_set(1.0, 0.0)
56 chatlist.size_hint_align_set(-1.0, -1.0) 64 chatlist.size_hint_align_set(-1.0, -1.0)
57 box.pack_end(chatlist) 65 box.pack_end(chatlist)
58 chatlist.show() 66 chatlist.show()
59 67
60 self.pager = pager = elm.Naviframe(window) 68 self.pager = pager = Naviframe(window)
61 pager.size_hint_weight_set(1.0, 1.0) 69 pager.size_hint_weight_set(1.0, 1.0)
62 pager.size_hint_align_set(-1.0, -1.0) 70 pager.size_hint_align_set(-1.0, -1.0)
63 #self.resize_object_add(pager) 71 #self.resize_object_add(pager)
64 box.pack_end(pager) 72 box.pack_end(pager)
65 pager.show() 73 pager.show()
66 74
67 xbtn = elm.Button(window) 75 xbtn = Button(window)
68 xbtn.callback_clicked_add(self.close_channel_box) 76 xbtn.callback_clicked_add(self.close_channel_box)
69 xbtn.text_set(_("Close")) 77 xbtn.text_set(_("Close"))
70 xbtn.size_hint_weight_set(1.0, 0.0) 78 xbtn.size_hint_weight_set(1.0, 0.0)
@@ -138,7 +146,7 @@ class Handler(object):
138 except: 146 except:
139 avatar = None 147 avatar = None
140 148
141 box_of_channels.list_item = self.chatlist.item_add(identifier, avatar, elm.ELM_ICON_FILE, self.selected, box_of_channels) 149 box_of_channels.list_item = self.chatlist.item_add(identifier, avatar, ELM_ICON_FILE, self.selected, box_of_channels)
142 150
143 self.pager.item_simple_push(box_of_channels) 151 self.pager.item_simple_push(box_of_channels)
144 self.window.resize(480, 640) 152 self.window.resize(480, 640)
@@ -165,9 +173,9 @@ class Handler(object):
165 def quit(self, *args): 173 def quit(self, *args):
166 elm.exit() 174 elm.exit()
167 175
168class Channels(elm.Box): 176class Channels(Box):
169 def __init__(self, parent, channels): 177 def __init__(self, parent, channels):
170 elm.Box.__init__(self, parent.window) 178 Box.__init__(self, parent.window)
171 self.channels = [] 179 self.channels = []
172 self.list_item = None 180 self.list_item = None
173 181
diff --git a/apathy/PresenceEditor.py b/apathy/PresenceEditor.py
index edb8822..fbd244d 100644
--- a/apathy/PresenceEditor.py
+++ b/apathy/PresenceEditor.py
@@ -21,7 +21,12 @@
21# # 21# #
22######################################################################### 22#########################################################################
23 23
24import elementary as elm 24try:
25 from elementary import Box, Frame, Button
26except ImportError:
27 from efl.elementary.box import Box
28 from efl.elementary.frame import Frame
29 from efl.elementary.button import Button
25 30
26from Globals import * 31from Globals import *
27 32
@@ -29,12 +34,12 @@ class PresenceEditor(object):
29 def __init__(self, parent, pager): 34 def __init__(self, parent, pager):
30 self.parentwin = parent 35 self.parentwin = parent
31 self.pager = pager 36 self.pager = pager
32 37
33 self.entries = {} 38 self.entries = {}
34 39
35 self.conf = get_conf() 40 self.conf = get_conf()
36 messages = self.conf.items("StatusMessages") 41 messages = self.conf.items("StatusMessages")
37 42
38 self.box = box = elm.Box(parent) 43 self.box = box = elm.Box(parent)
39 44
40 for status, message in messages: 45 for status, message in messages:
@@ -51,12 +56,12 @@ class PresenceEditor(object):
51 box.pack_end(frame) 56 box.pack_end(frame)
52 entry.show() 57 entry.show()
53 frame.show() 58 frame.show()
54 59
55 box1 = elm.Box(parent) 60 box1 = elm.Box(parent)
56 box1.horizontal_set(True) 61 box1.horizontal_set(True)
57 box1.size_hint_weight_set(1.0, 0.0) 62 box1.size_hint_weight_set(1.0, 0.0)
58 box1.size_hint_align_set(-1.0, 0.0) 63 box1.size_hint_align_set(-1.0, 0.0)
59 64
60 save_btn = elm.Button(parent) 65 save_btn = elm.Button(parent)
61 save_btn.size_hint_weight_set(1.0, 0.0) 66 save_btn.size_hint_weight_set(1.0, 0.0)
62 save_btn.size_hint_align_set(-1.0, 0.0) 67 save_btn.size_hint_align_set(-1.0, 0.0)
@@ -64,7 +69,7 @@ class PresenceEditor(object):
64 save_btn.callback_clicked_add(self.save) 69 save_btn.callback_clicked_add(self.save)
65 box1.pack_end(save_btn) 70 box1.pack_end(save_btn)
66 save_btn.show() 71 save_btn.show()
67 72
68 xbtn = elm.Button(parent) 73 xbtn = elm.Button(parent)
69 xbtn.size_hint_weight_set(1.0, 0.0) 74 xbtn.size_hint_weight_set(1.0, 0.0)
70 xbtn.size_hint_align_set(-1.0, 0.0) 75 xbtn.size_hint_align_set(-1.0, 0.0)
@@ -72,7 +77,7 @@ class PresenceEditor(object):
72 xbtn.callback_clicked_add(lambda x: pager.item_pop()) 77 xbtn.callback_clicked_add(lambda x: pager.item_pop())
73 box.pack_end(xbtn) 78 box.pack_end(xbtn)
74 xbtn.show() 79 xbtn.show()
75 80
76 box.pack_end(box1) 81 box.pack_end(box1)
77 box.show() 82 box.show()
78 83