All pastes #39166 Raw Edit

Diff

public text v1 · immutable
#39166 ·published 2006-01-30 22:16 UTC
rendered paste body
Index: deskbar/ui/cuemiac/Cuemiac.py===================================================================RCS file: /cvs/gnome/deskbar-applet/deskbar/ui/cuemiac/Cuemiac.py,vretrieving revision 1.34diff -u -p -r1.34 Cuemiac.py--- deskbar/ui/cuemiac/Cuemiac.py	29 Jan 2006 22:59:43 -0000	1.34+++ deskbar/ui/cuemiac/Cuemiac.py	30 Jan 2006 22:16:52 -0000@@ -3,12 +3,8 @@ # # - Make the pref dialog non modal ?? i tried but it doesn't work.. ? #-# - (TRIVIAL but THINK) Trim category names to as few as possible, and really get the names right-# # - (TRIVIAL) Adjust max hits per handler (especially beagle-live should return a skazillion hits)-# - Check for pycairo and disable cuemiac if not found in the prefs-#    - hasattr(gtk.gdk.Drawable, 'cairo_create')-#    - (better) check for cairo.gtk+# # Would be really really nice: # # - (EASY) Show nests only for two or more nested results, or something like that@@ -618,8 +614,7 @@ class CuemiacUI (DeskbarUI): 		self.deskbar_button = DeskbarAppletButton (applet) 		self.deskbar_button.connect ("toggled-main", lambda x,y: self.show_entry()) 		self.deskbar_button.connect ("toggled-arrow", lambda x,y: self.show_history())--		self.popup = CuemiacAlignedWindow (self.deskbar_button.button_main, applet.get_orient())+		 		self.icon_entry = deskbar.iconentry.IconEntry () 		self.entry = self.icon_entry.get_entry () 		self.entry_icon = gtk.Image ()@@ -630,15 +625,16 @@ class CuemiacUI (DeskbarUI): 		self.scroll_win = gtk.ScrolledWindow () 		self.scroll_win.set_policy (gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)	 		self.box = gtk.VBox ()+		self.build_popup() 		 		self.set_layout_by_orientation (applet.get_orient(), reshow=False, setup=True) 			-		self.popup.add (self.box)+		#self.popup.add (self.box) 		self.scroll_win.add(self.cview) 		self.icon_entry.pack_widget (self.entry_icon, True) 		self.entry_icon.set_property('pixbuf', self.default_entry_pixbuf) 		-		self.popup.set_border_width (1)+		#self.popup.set_border_width (1) 		self.history_popup.set_border_width (1) 		 		self.box.connect ("size-request", lambda box, event: self.adjust_popup_size())@@ -675,6 +671,21 @@ class CuemiacUI (DeskbarUI): 		 		self.applet.set_applet_flags(gnomeapplet.EXPAND_MINOR) 		self.applet.set_flags(gtk.CAN_FOCUS)+	+	def build_popup(self):+		if hasattr(self, 'popup'):+			self.popup.remove (self.box)+			+		self.popup = CuemiacAlignedWindow (self.deskbar_button.button_main, self.applet.get_orient())+		self.popup.add (self.box)+		self.box.show_all()+		self.popup.set_border_width (1)+	+	def destroy_popup(self):+		self.popup.remove (self.box)+		self.popup.hide()+		self.popup.destroy()+		del self.popup 		 	def update_entry_icon (self): 		path, column = self.cview.get_cursor ()@@ -702,6 +713,7 @@ class CuemiacUI (DeskbarUI): 	def show_entry (self): 		if self.deskbar_button.get_active_main (): 			#if self.entry.get_text().strip() == "":+			self.build_popup() 			self.entry.set_text("") 			self.model.clear () 			self.scroll_win.hide ()@@ -732,7 +744,10 @@ class CuemiacUI (DeskbarUI): 			#self.entry.event(fevent) 			#self.entry.notify("has-focus") 			-			self.popup.hide ()+			#self.popup.hide ()+			#self.popup.destroy()+			#del self.popup+			self.destroy_popup() 			self.emit ("stop-query") 	 	def show_history (self):@@ -855,8 +870,9 @@ class CuemiacUI (DeskbarUI): 		"""Checks if the entry is empty, and hides the window if so. 		Used by on_entry_changed() with a gobject.timeout_add().""" 		if self.entry.get_text().strip() == "":-			self.popup.hide ()-	+			#self.popup.hide ()+			self.destroy_popup()+			 	def on_entry_key_press (self, entry, event): 		 		if event.keyval == gtk.keysyms.Escape:@@ -869,13 +885,29 @@ class CuemiacUI (DeskbarUI): 			self.deskbar_button.set_active_main (False) 			return True 		+		if 	event.state&gtk.gdk.MOD1_MASK != 0:+			# Some Handlers want to know about Alt-keypress+			# combinations, for example.  Here, we notify such+			# Handlers.+			text = entry.get_text().strip()+			if text != "":+				self.emit('stop-query')+				self.emit('keyboard-shortcut', text, event.keyval)+			entry.set_text("")+			+			# Broadcast an escape+			event.state = 0+			event.keyval = gtk.keysyms.Escape+			entry.emit('key-press-event', event)+			return True+			 		if event.keyval == 65362: # Up 			self.cview.grab_focus () 			last = self.cview.last_visible_path () 			self.cview.set_cursor (last) 			return True 			-		elif event.keyval == 65364: # Down+		if event.keyval == 65364: # Down 			self.cview.grab_focus () 			self.cview.set_cursor (self.model.get_path(self.model.get_iter_first())) 			return True