Merge lp:~chrisccoulson/lernid/no-mozembed into lp:lernid

Proposed by Chris Coulson
Status: Merged
Merged at revision: 226
Proposed branch: lp:~chrisccoulson/lernid/no-mozembed
Merge into: lp:lernid
Diff against target: 131 lines (+18/-12)
7 files modified
debian/control (+0/-1)
lernid/AboutLernidDialog.py (+1/-1)
lernid/lernidconfig.py (+2/-0)
lernid/widgets/Classroom.py (+0/-1)
lernid/widgets/IrcWidget.py (+11/-4)
lernid/widgets/NativeChatroom.py (+0/-1)
lernid/widgets/WebChatroom.py (+4/-4)
To merge this branch: bzr merge lp:~chrisccoulson/lernid/no-mozembed
Reviewer Review Type Date Requested Status
John S. Gruber Pending
Review via email: mp+64106@code.launchpad.net

Description of the change

lernid depends on python-gtkmozembed, which is being dropped from Ubuntu (see https://blueprints.launchpad.net/ubuntu/+spec/desktop-o-mozilla-rapid-release-maintenance). This ports the remaining gtkmozembed part to webkit

To post a comment you must log in.
Revision history for this message
John S. Gruber (jsjgruber) wrote :

Thanks for keeping us in mind as the mozilla software changes. I'm not aware of all you are doing as part of rapid development, but I don't see any problem with removing the dependency--that was on my list to do as well as we are now using webkit for our embeded web browser.

How urgent is this dependency change? In particular, can it wait until late August or should it be done now?

I don't see the exception at build time you were referring to wrt cursors. Can you point it out to me? On occasion I have seen an exception at lernid start-up. I'd like to know what I'm missing in the build, however, if you can spare the time to explain it.

I'm afraid I don't understand the point of the gettext changes. I must be missing something here. The change you propose seems to redefine the gettext call in lernidconfig.py to be the identity function which would remove the DESCRIPTION translation from the about box. I built this merge and tested the about box while running lernid with LANGUAGE=fr lernid -v and, indeed, the description mistakenly goes from french to english. I don't understand adding the gettext import to the AboutLearnidDialog.py either, I'm afraid.

I'm afraid my questions may not be very intelligent ones, so please excuse me. I certainly appreciate your attention to lernid and I'm grateful for your time.

lp:~chrisccoulson/lernid/no-mozembed updated
227. By Chris Coulson

Fix the translation in the about dialog

Revision history for this message
Chris Coulson (chrisccoulson) wrote :
Download full text (3.8 KiB)

Oops, yes I broke the translations in the about dialog. Sorry. I've fixed that now. The reason for that change is because I get this when I try to build it on oneiric:

cd . && \
  python2.6 setup.py clean \
  -a
running clean
'build/lib.linux-x86_64-2.6' does not exist -- can't clean it
'build/bdist.linux-x86_64' does not exist -- can't clean it
'build/scripts-2.6' does not exist -- can't clean it
WARNING: the following files are not recognized by DistUtilsExtra.auto:
  Copyright
  lernid.desktop.in
  po/lernid.pot
rm -rf debian/python-module-stampdir
find "/home/chr1s/src/lernid/lernid" -name '*.py[co]' -delete
find "/home/chr1s/src/lernid/lernid" -name __pycache__ -type d -empty -delete
find "/home/chr1s/src/lernid/lernid" -prune -name '*.egg-info' -exec rm -rf '{}' ';'
 debian/rules build
test -x debian/rules
mkdir -p "."
mkdir -p debian/python-module-stampdir
cd . && \
  python2.6 setup.py build \
  --build-base="/home/chr1s/src/lernid/lernid/./build"
/usr/lib/python2.6/dist-packages/gtk-2.0/gtk/__init__.py:57: GtkWarning: could not open display
  warnings.warn(str(e), _gtk.Warning)
ERROR: Python module lernid.CouchDBPreferences not found
Traceback (most recent call last):
  File "setup.py", line 86, in <module>
    'install': InstallAndUpdateDataDirectory
  File "/usr/lib/python2.6/dist-packages/DistUtilsExtra/auto.py", line 96, in setup
    __requires(attrs, src_all)
  File "/usr/lib/python2.6/dist-packages/DistUtilsExtra/auto.py", line 414, in __requires
    __add_imports(imports, s, attrs)
  File "/usr/lib/python2.6/dist-packages/DistUtilsExtra/auto.py", line 361, in __add_imports
    if __external_mod(cur_module, node.module, attrs):
  File "/usr/lib/python2.6/dist-packages/DistUtilsExtra/auto.py", line 315, in __external_mod
    mod = __import__(module)
  File "/home/chr1s/src/lernid/lernid/lernid/LernidOptions.py", line 23, in <module>
    from lernid.lernidconfig import VERSION
  File "/home/chr1s/src/lernid/lernid/lernid/lernidconfig.py", line 33, in <module>
    DESCRIPTION = _('Connect to a world of online tutorials quickly and easily.')
NameError: name '_' is not defined
make: *** [debian/python-module-stampdir/lernid] Error 1

Also, the GdkCursor change is required to fix this issue (also at build time), which occurs because there is no DISPLAY:

cd . && \
  python setup.py build \
  --build-base="/home/chr1s/src/lernid/lernid/./build"
/usr/lib/python2.7/dist-packages/gtk-2.0/gtk/__init__.py:57: GtkWarning: could not open display
  warnings.warn(str(e), _gtk.Warning)
/home/chr1s/src/lernid/lernid/lernid/widgets/IrcWidget.py:33: GtkWarning: IA__gdk_cursor_new_for_display: assertion `GDK_IS_DISPLAY (display)' failed
  hand_cursor = gtk.gdk.Cursor(gtk.gdk.HAND2)
Traceback (most recent call last):
  File "setup.py", line 86, in <module>
    'install': InstallAndUpdateDataDirectory
  File "/usr/lib/python2.7/dist-packages/DistUtilsExtra/auto.py", line 96, in setup
    __requires(attrs, src_all)
  File "/usr/lib/python2.7/dist-packages/DistUtilsExtra/auto.py", line 414, in __requires
    __add_imports(imports, s, attrs)
  File "/usr/lib/python2.7/dist-packages/DistUtilsExtra/auto.py", line 361, in __add_imports
    if __external_m...

Read more...

Revision history for this message
John S. Gruber (jsjgruber) wrote :

So I gather the idea is that DESCRIPTIONS should be untranslated but
the _('something') form is necessary to keep the translation in the
translation system?

Thanks again for pointing out the FTBS issues as well as the
dependency problem. I'm apologize for all the questions.

Revision history for this message
Chris Coulson (chrisccoulson) wrote :

Hi,

Yeah, the identity function in lernidconfig.py is there just ensure that the string ends up in the translation template.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2011-03-14 03:20:05 +0000
3+++ debian/control 2011-06-15 11:22:58 +0000
4@@ -17,7 +17,6 @@
5 ${python:Depends},
6 telepathy-idle,
7 python-xdg,
8- python-gtkmozembed,
9 python-telepathy,
10 python-webkit,
11 python-dbus,
12
13=== modified file 'lernid/AboutLernidDialog.py'
14--- lernid/AboutLernidDialog.py 2010-02-08 16:49:55 +0000
15+++ lernid/AboutLernidDialog.py 2011-06-15 11:22:58 +0000
16@@ -47,7 +47,7 @@
17 self.builder = builder
18 self.builder.connect_signals(self)
19
20- self.set_comments(DESCRIPTION)
21+ self.set_comments(_(DESCRIPTION))
22 self.set_version(VERSION)
23 self.set_website(WEBSITE)
24 self.set_authors(CONTRIBUTORS)
25
26=== modified file 'lernid/lernidconfig.py'
27--- lernid/lernidconfig.py 2011-06-02 04:43:14 +0000
28+++ lernid/lernidconfig.py 2011-06-15 11:22:58 +0000
29@@ -29,6 +29,8 @@
30 import os
31 import xdg.BaseDirectory
32
33+def _(message): return message
34+
35 VERSION = '0.8.1'
36 DESCRIPTION = _('Connect to a world of online tutorials quickly and easily.')
37 WEBSITE = 'http://wiki.ubuntu.com/Lernid'
38
39=== modified file 'lernid/widgets/Classroom.py'
40--- lernid/widgets/Classroom.py 2011-03-14 03:19:11 +0000
41+++ lernid/widgets/Classroom.py 2011-06-15 11:22:58 +0000
42@@ -19,7 +19,6 @@
43
44 import gtk
45 import gobject
46-import gtkmozembed
47 import pango
48 import time
49
50
51=== modified file 'lernid/widgets/IrcWidget.py'
52--- lernid/widgets/IrcWidget.py 2010-03-05 00:45:41 +0000
53+++ lernid/widgets/IrcWidget.py 2011-06-15 11:22:58 +0000
54@@ -30,8 +30,15 @@
55
56 class IrcWidget(Widget):
57
58- hand_cursor = gtk.gdk.Cursor(gtk.gdk.HAND2)
59- regular_cursor = gtk.gdk.Cursor(gtk.gdk.XTERM)
60+ def get_hand_cursor(self):
61+ if not hasattr(self, "_hand_cursor"):
62+ self._hand_cursor = gtk.gdk.Cursor(gtk.gdk.HAND2)
63+ return self._hand_cursor
64+
65+ def get_regular_cursor(self):
66+ if not hasattr(self, "_regular_cursor"):
67+ self._regular_cursor = gtk.gdk.Cursor(gtk.gdk.XTERM)
68+ return self._regular_cursor
69
70 def do_event_connect(self, event_man, event):
71 self._browser = event_man.get_widget_by_name('browser')
72@@ -92,9 +99,9 @@
73 int(event.x), int(event.y))
74 iter = text_view.get_iter_at_location(x, y)
75 if (iter.has_tag(tag)):
76- text_view.get_window(gtk.TEXT_WINDOW_TEXT).set_cursor(self.hand_cursor)
77+ text_view.get_window(gtk.TEXT_WINDOW_TEXT).set_cursor(self.get_hand_cursor())
78 else:
79- text_view.get_window(gtk.TEXT_WINDOW_TEXT).set_cursor(self.regular_cursor)
80+ text_view.get_window(gtk.TEXT_WINDOW_TEXT).set_cursor(self.get_regular_cursor())
81 return False
82
83 def _focus_out(self, widget, event):
84
85=== modified file 'lernid/widgets/NativeChatroom.py'
86--- lernid/widgets/NativeChatroom.py 2011-03-14 03:19:11 +0000
87+++ lernid/widgets/NativeChatroom.py 2011-06-15 11:22:58 +0000
88@@ -20,7 +20,6 @@
89
90 import gtk
91 import gobject
92-import gtkmozembed
93 import urlparse
94 import logging
95 import pango
96
97=== modified file 'lernid/widgets/WebChatroom.py'
98--- lernid/widgets/WebChatroom.py 2010-02-08 16:49:55 +0000
99+++ lernid/widgets/WebChatroom.py 2011-06-15 11:22:58 +0000
100@@ -19,7 +19,7 @@
101
102 import gtk
103 import gobject
104-import gtkmozembed
105+import webkit
106
107 from lernid.widgets.Widget import Widget
108
109@@ -37,7 +37,7 @@
110 Widget.__init__(self, 'chatroom')
111 scroll = gtk.ScrolledWindow()
112 scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
113- self._chat = gtkmozembed.MozEmbed()
114+ self._chat = webkit.WebView()
115 scroll.add_with_viewport(self._chat)
116 self.add(scroll)
117
118@@ -50,11 +50,11 @@
119 def do_event_connect(self, event_man, event):
120 chatirc = 'http://webchat.freenode.net/?nick={nick}&channels={chans}'.format(
121 nick=event.nick, chans=event.chat)
122- self._chat.load_url(chatirc)
123+ self._chat.load_uri(chatirc)
124 self._chat.show()
125
126 def do_event_disconnect(self, event_man, event):
127- self._chat.load_url('about:blank')
128+ self._chat.load_uri('about:blank')
129 self._chat.hide()
130
131 def get_input_widget(self):

Subscribers

People subscribed via source and target branches