예제 #1
0
	def entry_goto(self, e):
		"Goes to an entry"

		try:
			command = self.__get_launcher(e)

			if command == None:
				return

			self.entry_copychain(e)

			util.execute_child(command)

		except ( util.SubstFormatError, config.ConfigError ):
			dialog.Error(self, _('Invalid goto command format'), _('The goto command for \'%s\' entries is invalid, please correct it in the preferences.') % e.typename).run()

		except util.SubstValueError:
			self.entry_show(e)
예제 #2
0
	def __init_ui(self):
		"Sets up the main ui"

		gtk.about_dialog_set_url_hook(lambda d,l: gtk.show_uri(None, l, gtk.get_current_event_time()))
		gtk.about_dialog_set_email_hook(lambda d,l: gtk.show_uri(None, "mailto:" + l, gtk.get_current_event_time()))

		# set up applet
		self.applet.set_flags(gnomeapplet.EXPAND_MINOR)

		# set up window icons
		pixbufs = [ self.items.get_pixbuf("revelation", size) for size in ( 48, 32, 24, 16) ]
		pixbufs = [ pixbuf for pixbuf in pixbufs if pixbuf != None ]

		if len(pixbufs) > 0:
			gtk.window_set_default_icon_list(*pixbufs)

		# set up popup menu
		self.applet.setup_menu("""
			<popup name="button3">
				<menuitem name="file-unlock"	verb="file-unlock"	label=\"""" + _('Unlock File') + """\"		pixtype="stock" pixname="revelation-unlock" />
				<menuitem name="file-lock"	verb="file-lock"	label=\"""" + _('Lock File') + """\"		pixtype="stock" pixname="revelation-lock" />
				<menuitem name="file-reload"	verb="file-reload"	label=\"""" + _('Reload File') + """\"		pixtype="stock" pixname="revelation-reload" />
				<separator />
				<menuitem name="revelation"	verb="revelation"	label=\"""" + _('Start Revelation') + """\"	pixtype="stock" pixname="revelation-revelation" />
				<menuitem name="prefs"		verb="prefs"		label=\"""" + _('Preferences') + """\"		pixtype="stock"	pixname="gtk-properties" />
				<menuitem name="about"		verb="about"		label=\"""" + _('About') + """\"		pixtype="stock"	pixname="gnome-stock-about" />
			</popup>
		""", (
			( "about",		lambda w,d=None: self.about() ),
			( "file-lock",		lambda w,d=None: self.file_close() ),
			( "file-reload",	lambda w,d=None: self.file_reload() ),
			( "file-unlock",	lambda w,d=None: self.file_open(self.config.get("file")) ),
			( "prefs",		lambda w,d=None: self.prefs() ),
			( "revelation",		lambda w,d=None: util.execute_child("@bindir@/revelation") ),
		), None)

		# set up ui items
		self.entry = ui.Entry()
		self.entry.set_width_chars(14)
		self.entry.connect("activate", self.__cb_entry_activate)
		self.entry.connect("button_press_event", self.__cb_entry_buttonpress)
		self.entry.connect("key_press_event", lambda w,d=None: self.locktimer.reset())

		self.icon = ui.Image()
		self.icon.set_from_stock(ui.STOCK_REVELATION, ui.ICON_SIZE_APPLET)

		self.eventbox = ui.EventBox(self.icon)
		self.eventbox.connect("button_press_event", self.__cb_icon_buttonpress)

		self.hbox = ui.HBox(self.eventbox, self.entry)
		self.applet.add(self.hbox)
		
		# handle Gnome Panel background
		self.applet.connect("change-background",self.panel_bg)

		self.applet.show_all()

		# set up various ui element holders
		self.popup_entryview	= None
		self.popup_entrylist	= None

		self.entrymenu		= None