Code freeze break requests for Totem



Hi,

It's come to our attention (thanks to Sebastian Pölsterl) that the
Python plugins in Totem are currently broken, due to changes in libpeas,
and changes in the GIR for GDK.

Can we get a code freeze break for the three patches in the following
two bugs please?

https://bugzilla.gnome.org/show_bug.cgi?id=645687
https://bugzilla.gnome.org/show_bug.cgi?id=645762

I've tested them, and they work fine. Patch #184307 was based on the
corresponding changes in gedit, which I presume were tested well before
being applied too.

Patches attached for convenience.

Thanks,
Philip
From 3973da94327e3962db064d4d8654308f2b619eac Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sebastian=20P=C3=B6lsterl?= <sebp k-d-w org>
Date: Sat, 26 Mar 2011 12:26:07 +0100
Subject: [PATCH 1/3] Retrieve "object" property containing the TotemObject in do_activate instead of __init__, because in the latter case it would be None.

https://bugzilla.gnome.org/show_bug.cgi?id=645687
---
 src/plugins/coherence_upnp/coherence_upnp.py |    3 ++-
 src/plugins/iplayer/iplayer.py               |    3 ++-
 src/plugins/jamendo/jamendo.py               |    3 ++-
 src/plugins/opensubtitles/opensubtitles.py   |    3 ++-
 src/plugins/pythonconsole/pythonconsole.py   |    3 ++-
 5 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/plugins/coherence_upnp/coherence_upnp.py b/src/plugins/coherence_upnp/coherence_upnp.py
index 29d74d5..d785830 100644
--- a/src/plugins/coherence_upnp/coherence_upnp.py
+++ b/src/plugins/coherence_upnp/coherence_upnp.py
@@ -23,7 +23,7 @@ class UPnPClient(gobject.GObject, Peas.Activatable):
     object = gobject.property(type = gobject.GObject)
 
     def __init__ (self):
-        self.totem_object = self.object
+        self.totem_object = None
         self.ui = TreeWidget()
         self.ui.window.set_shadow_type(gtk.SHADOW_IN)
         self.ui.cb_item_right_click = self.button_pressed
@@ -113,6 +113,7 @@ class UPnPClient(gobject.GObject, Peas.Activatable):
             self.context = self.context_no_delete
 
     def do_activate (self):
+        self.totem_object = self.object
         self.totem_object.add_sidebar_page ("upnp-coherence", _(u"Coherence DLNA/UPnP Client"), self.ui.window)
 
         def load_and_play(url):
diff --git a/src/plugins/iplayer/iplayer.py b/src/plugins/iplayer/iplayer.py
index ae86284..26baea0 100644
--- a/src/plugins/iplayer/iplayer.py
+++ b/src/plugins/iplayer/iplayer.py
@@ -20,10 +20,11 @@ class IplayerPlugin (gobject.GObject, Peas.Activatable):
 
 	def __init__ (self):
 		self.debug = False
-		self.totem = self.object
+		self.totem = None
 		self.programme_download_lock = threading.Lock ()
 
 	def do_activate (self):
+		self.totem = self.object
 		# Build the interface
 		builder = Totem.plugin_load_interface ("iplayer", "iplayer.ui", True, self.totem.get_main_window (), self)
 		container = builder.get_object ('iplayer_vbox')
diff --git a/src/plugins/jamendo/jamendo.py b/src/plugins/jamendo/jamendo.py
index 17af39c..5619cf3 100644
--- a/src/plugins/jamendo/jamendo.py
+++ b/src/plugins/jamendo/jamendo.py
@@ -80,7 +80,7 @@ class JamendoPlugin(gobject.GObject, Peas.Activatable, PeasGtk.Configurable):
     def __init__(self):
         self.debug = True
         self.gstreamer_plugins_present = True
-        self.totem = self.object
+        self.totem = None
         self.settings = Gio.Settings.new ('org.gnome.totem.plugins.jamendo')
         self.settings.connect ('changed::format', self.on_format_changed)
         self.settings.connect ('changed::num-per-page', self.on_num_per_page_changed)
@@ -89,6 +89,7 @@ class JamendoPlugin(gobject.GObject, Peas.Activatable, PeasGtk.Configurable):
         """
         Plugin activation.
         """
+        self.totem = self.object
         # Initialise the interface
         builder = Totem.plugin_load_interface ("jamendo", "jamendo.ui", True, self.totem.get_main_window (), self)
         self.popup = builder.get_object('popup_menu')
diff --git a/src/plugins/opensubtitles/opensubtitles.py b/src/plugins/opensubtitles/opensubtitles.py
index 7fa98b6..791cc67 100644
--- a/src/plugins/opensubtitles/opensubtitles.py
+++ b/src/plugins/opensubtitles/opensubtitles.py
@@ -302,7 +302,7 @@ class OpenSubtitles(gobject.GObject, Peas.Activatable):
 
     def __init__(self):
         self.dialog = None
-        self.totem = self.object
+        self.totem = None
         self.settings = Gio.Settings.new ('org.gnome.totem.plugins.opensubtitles')
 
     # totem.Plugin methods
@@ -313,6 +313,7 @@ class OpenSubtitles(gobject.GObject, Peas.Activatable):
         Here the sidebar page is initialized(set up the treeview, connect 
         the callbacks, ...) and added to totem.
         """
+        self.totem = self.object
 	self.filename = None
 
         self.manager = self.totem.get_ui_manager()
diff --git a/src/plugins/pythonconsole/pythonconsole.py b/src/plugins/pythonconsole/pythonconsole.py
index 7929e96..ec18756 100644
--- a/src/plugins/pythonconsole/pythonconsole.py
+++ b/src/plugins/pythonconsole/pythonconsole.py
@@ -72,10 +72,11 @@ class PythonConsolePlugin(gobject.GObject, Peas.Activatable):
 	object = gobject.property(type = gobject.GObject)
 
 	def __init__(self):
-		self.totem = self.object
+		self.totem = None
 		self.window = None
 	
 	def do_activate(self):
+		self.totem = self.object
 
 		data = dict()
 		manager = self.totem.get_ui_manager()
-- 
1.7.4

From c204c3cb15554bca792cc7b60d66a5c9aa31a3f1 Mon Sep 17 00:00:00 2001
From: Philip Withnall <philip tecnocode co uk>
Date: Sat, 26 Mar 2011 17:36:08 +0000
Subject: [PATCH 2/3] pythonconsole: Fix calls to Gtk.Action()

stock_id isn't marked as allow-none, unfortunately. Fixing this allows the
pythonconsole plugin to actually be activated successfully.

Helps: bgo#645762
---
 src/plugins/pythonconsole/pythonconsole.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/plugins/pythonconsole/pythonconsole.py b/src/plugins/pythonconsole/pythonconsole.py
index ec18756..6e6b286 100644
--- a/src/plugins/pythonconsole/pythonconsole.py
+++ b/src/plugins/pythonconsole/pythonconsole.py
@@ -83,7 +83,7 @@ class PythonConsolePlugin(gobject.GObject, Peas.Activatable):
 
 		data['action_group'] = Gtk.ActionGroup(name = 'Python')
 		
-		action = Gtk.Action(name = 'Python', label = 'Python', tooltip = _(u'Python Console Menu'))
+		action = Gtk.Action(name = 'Python', label = 'Python', tooltip = _(u'Python Console Menu'), stock_id = None)
 		data['action_group'].add_action(action)
 
 		action = Gtk.Action(name = 'PythonConsole', label = _(u'_Python Console'),
@@ -93,7 +93,7 @@ class PythonConsolePlugin(gobject.GObject, Peas.Activatable):
 		data['action_group'].add_action(action)
 
 		action = Gtk.Action(name = 'PythonDebugger', label = _(u'Python Debugger'),
-				    tooltip = _(u"Enable remote Python debugging with rpdb2"))
+				    tooltip = _(u"Enable remote Python debugging with rpdb2"), stock_id = None)
 		if have_rpdb2:
 			action.connect('activate', self.enable_debugging)
 		else:
-- 
1.7.4

From 2b1cbeb518539fdf84b76bbd3d87c9e35bf826a3 Mon Sep 17 00:00:00 2001
From: Philip Withnall <philip tecnocode co uk>
Date: Sat, 26 Mar 2011 17:37:55 +0000
Subject: [PATCH 3/3] pythonconsole: Port fixes to key event handling from gedit's pythonconsole

Fix the event handling for key events so that typing in the console works
as expected.

Based on:
http://git.gnome.org/browse/gedit/commit/plugins/pythonconsole/pythonconsole/console.py?id=da49b588a394717b5ea0a3f9e6a823a86e62feae
http://git.gnome.org/browse/gedit/commit/plugins/pythonconsole/pythonconsole/console.py?id=ba74278347888e4a16f3a0fee2a359b7f2bcde8b

Closes: bgo#645762
---
 src/plugins/pythonconsole/console.py |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/plugins/pythonconsole/console.py b/src/plugins/pythonconsole/console.py
index f1e6bdd..6a71183 100644
--- a/src/plugins/pythonconsole/console.py
+++ b/src/plugins/pythonconsole/console.py
@@ -88,12 +88,13 @@ class PythonConsole(Gtk.ScrolledWindow):
 		
  		
 	def __key_press_event_cb(self, view, event):
-		(_, state) = event.get_state ()
+		modifier_mask = Gtk.accelerator_get_default_mod_mask()
+		event_state = event.state & modifier_mask
 
-		if event.key.keyval == Gdk.KEY_d and state & Gdk.ModifierType.CONTROL_MASK:
+		if event.keyval == Gdk.KEY_d and event_state == Gdk.ModifierType.CONTROL_MASK:
 			self.destroy()
 		
-		elif event.key.keyval == Gdk.KEY_Return and state & Gdk.ModifierType.CONTROL_MASK:
+		elif event.keyval == Gdk.KEY_Return and event_state == Gdk.ModifierType.CONTROL_MASK:
 			# Get the command
 			buffer = view.get_buffer()
 			inp_mark = buffer.get_mark("input")
@@ -119,7 +120,7 @@ class PythonConsole(Gtk.ScrolledWindow):
 			gobject.idle_add(self.scroll_to_end)
 			return True
 		
-		elif event.key.keyval == Gdk.KEY_Return:
+		elif event.keyval == Gdk.KEY_Return:
 			# Get the marks
 			buffer = view.get_buffer()
 			lin_mark = buffer.get_mark("input-line")
@@ -163,32 +164,32 @@ class PythonConsole(Gtk.ScrolledWindow):
 			gobject.idle_add(self.scroll_to_end)
 			return True
 
-		elif event.key.keyval == Gdk.KEY_KP_Down or event.key.keyval == Gdk.KEY_Down:
+		elif event.keyval == Gdk.KEY_KP_Down or event.keyval == Gdk.KEY_Down:
 			# Next entry from history
 			view.emit_stop_by_name("key_press_event")
 			self.history_down()
 			gobject.idle_add(self.scroll_to_end)
 			return True
 
-		elif event.key.keyval == Gdk.KEY_KP_Up or event.key.keyval == Gdk.KEY_Up:
+		elif event.keyval == Gdk.KEY_KP_Up or event.keyval == Gdk.KEY_Up:
 			# Previous entry from history
 			view.emit_stop_by_name("key_press_event")
 			self.history_up()
 			gobject.idle_add(self.scroll_to_end)
 			return True
 
-		elif event.key.keyval == Gdk.KEY_KP_Left or event.key.keyval == Gdk.KEY_Left or \
-		     event.key.keyval == Gdk.KEY_BackSpace:
+		elif event.keyval == Gdk.KEY_KP_Left or event.keyval == Gdk.KEY_Left or \
+		     event.keyval == Gdk.KEY_BackSpace:
 			buffer = view.get_buffer()
 			inp = buffer.get_iter_at_mark(buffer.get_mark("input"))
 			cur = buffer.get_iter_at_mark(buffer.get_insert())
 			return inp.compare(cur) == 0
 
-		elif event.key.keyval == Gdk.KEY_Home:
+		elif event.keyval == Gdk.KEY_Home:
 			# Go to the begin of the command instead of the begin of the line
 			buffer = view.get_buffer()
 			inp = buffer.get_iter_at_mark(buffer.get_mark("input"))
-			if state & Gdk.ModifierType.SHIFT_MASK:
+			if event_state == Gdk.ModifierType.SHIFT_MASK:
 				buffer.move_mark_by_name("insert", inp)
 			else:
 				buffer.place_cursor(inp)
-- 
1.7.4

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]