tags 332850 patch
thanks

Since debian still uses python 2.3, I made a patch to deskbar-applet to
make it work with 2.3 and other versions of stuff in debian unstable.
The patch is attached, and it fixes 6 tracebacks with older versions of
python, pygtk and pygnome (I stole one from the replies on the blog
entry). It works in GNOME 2.10, but isn't nearly as pretty as the
screenshots.

Also, this is a great applet, but the startup time is a little long :/
Also, I get heaps of these warnings on startup:

(deskbar-applet:16559): GdkPixbuf-CRITICAL **: 
gdk_pixbuf_new_from_file_at_scale: assertion `width > 0 && height > 0' failed

-- 
bye,
pabs

http://wiki.debian.org/PaulWise
--- deskbar-applet-0.5.0/debian/changelog
+++ deskbar-applet-0.5.0/debian/changelog
@@ -1,3 +1,9 @@
+deskbar-applet (0.5.0-3) unstable; urgency=low
+
+  * Add Python / PyGTK / PyGNOME compatability patches (Closes: #329072)
+
+ -- Tollef Fog Heen <[EMAIL PROTECTED]>  Mon, 10 Oct 2005 13:44:05 +0800
+
 deskbar-applet (0.5.0-2) unstable; urgency=low
 
   * Clean up package a bit, fixing FHS compliance, correct depends and
--- deskbar-applet-0.5.0.orig/deskbar/deskbarentry.py
+++ deskbar-applet-0.5.0/deskbar/deskbarentry.py
@@ -60,10 +60,18 @@
 		
 		# Create the completion model
 		completion = gtk.EntryCompletion()
-		completion.set_popup_set_width(False)
-		completion.set_match_func(lambda x, y, z: True)
-		completion.set_model(self._completion_model)
-		completion.set_property("text-column", ACTION_COL)
+		try:
+			# PyGTK >= 2.8
+			completion.set_popup_set_width(False)
+			completion.set_property("text-column", ACTION_COL)
+		except AttributeError:
+			pass
+		try:
+			# PyGTK >= 2.4
+			completion.set_match_func(lambda x, y, z: True)
+			completion.set_model(self._completion_model)
+		except AttributeError:
+			pass
 		completion.connect("match-selected", self._on_completion_selected)
 		entry.set_completion(completion)
 		
--- deskbar-applet-0.5.0.orig/deskbar/applet.py
+++ deskbar-applet-0.5.0/deskbar/applet.py
@@ -24,7 +24,11 @@
 			None, [("About", self.on_about), ("Prefs", self.on_preferences)])
 
 		self.applet.show_all()
-		self.applet.request_focus(long(time.time()))
+		try:
+			# GNOME 2.12
+			self.applet.request_focus(long(time.time()))
+		except AttributeError:
+			pass
 		
 	def on_about(self, component, verb):
 		deskbar.about.show_about()
@@ -56,5 +60,9 @@
 		return False
 		
 	def on_entry_button_press(self, widget, event):
-		self.applet.request_focus(long(event.time))
+		try:
+			# GNOME 2.12
+			self.applet.request_focus(long(event.time))
+		except AttributeError:
+			pass
 		return False
only in patch2:
unchanged:
--- deskbar-applet-0.5.0.orig/deskbar/handlers/mozilla.py
+++ deskbar-applet-0.5.0/deskbar/handlers/mozilla.py
@@ -6,6 +6,12 @@
 import deskbar, deskbar.indexer
 import handler
 
+try:
+	# Python 2.4
+	set()
+except NameError:
+	from sets import Set as set
+
 PRIORITY = 50
 
 class MozillaMatch(handler.Match):
@@ -131,7 +137,12 @@
 				header, content = self.icon_data.split(",", 2)
 				loader = gtk.gdk.PixbufLoader()
 				loader.set_size(deskbar.ICON_SIZE, deskbar.ICON_SIZE)
-				loader.write(base64.b64decode(content))
+				try:
+					# Python 2.4
+					loader.write(base64.b64decode(content))
+				except AttributeError:
+					# Python 2.3 and earlier
+					loader.write(base64.decodestring(content))
 				loader.close()
 				
 				pixbuf = loader.get_pixbuf()
--- deskbar-applet-0.5.0.orig/deskbar/indexer.py
+++ deskbar-applet-0.5.0/deskbar/indexer.py
@@ -1,5 +1,11 @@
 import portstem, tokenizer
 
+try:
+	# Python 2.4
+	set()
+except NameError:
+	from sets import Set as set
+
 TOKENS_REGEXP = r'\w+'
 STOP_WORDS = {'and': 1, 'be': 1, 'to': 1, 'that': 1, 'into': 1,
 			'it': 1, 'but': 1, 'as': 1, 'are': 1, 'they': 1,

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

Reply via email to