Example #1
0
def OpenUri(uri):
	"""Open a URI in an external (web) browser. The given argument has
	to be a properly formed URI including the scheme (fe. HTTP).
	
	As of now failures will be silently discarded."""
	# Situation 1, user defined a way of handling the protocol
	protocol = uri[:uri.find(":")]
	if protocol in PROTOCOL_HANDLERS:
		if NICOTINE.browser is not None and NICOTINE.np.config.sections["ui"]["open_in_mozembed"] and protocol in ("http", 'https'):
			NICOTINE.browser.load_url(uri, 0)
			return
		if PROTOCOL_HANDLERS[protocol].__class__ is types.MethodType:
			PROTOCOL_HANDLERS[protocol](uri.strip())
			return
		if PROTOCOL_HANDLERS[protocol]:
			executeCommand(PROTOCOL_HANDLERS[protocol], uri)
			return
	# Situation 2, user did not define a way of handling the protocol, we'll leave it up to python
	if webbrowser:
		webbrowser.open(uri)
		return
	# Situation 3a, we let Gnome (new way?) deal with it
	try:
		import gnomevfs
		gnomevfs.url_show(uri)
		return
	except Exception, e:
		pass
def show_uri(uri):
	# use gtk_show_uri if available, otherwise use gnome-vfs
	if hasattr(gtk, 'show_uri'):
		gtk.show_uri(gtk.gdk.Screen(), uri, 0)
	else:
		import gnomevfs
		gnomevfs.url_show(uri)
Example #3
0
def OpenUri(uri):
    """Open a URI in an external (web) browser. The given argument has
    to be a properly formed URI including the scheme (fe. HTTP).

    As of now failures will be silently discarded."""

    # Situation 1, user defined a way of handling the protocol
    protocol = uri[:uri.find(":")]
    if protocol in PROTOCOL_HANDLERS:
        if PROTOCOL_HANDLERS[protocol].__class__ is types.MethodType:
            PROTOCOL_HANDLERS[protocol](uri.strip())
            return
        if PROTOCOL_HANDLERS[protocol]:
            executeCommand(PROTOCOL_HANDLERS[protocol], uri)
            return

    # Situation 2, user did not define a way of handling the protocol, we'll leave it up to python
    if webbrowser:
        webbrowser.open(uri)
        return

    # Situation 3, we let Gnome VFS deal with it
    try:
        import gnomevfs
        gnomevfs.url_show(uri)
        return
    except Exception, e:
        pass
Example #4
0
 def __action_invoked(self, notification, action):
     """Called when buttons in the notification is pressed."""
     if action == "file":
         uri = gnomevfs.make_uri_from_input_with_dirs(self.download.file, 2)
         gnomevfs.url_show(uri)
     elif action == "folder":
         uri = gnomevfs.make_uri_from_input(self.download.path)
         gnomevfs.url_show(uri)
     notification.close()
Example #5
0
 def __action_invoked(self, notification, action):
     """Called when buttons in the notification is pressed."""
     if action == "file":
         uri = gnomevfs.make_uri_from_input_with_dirs(self.download.file, 2)
         gnomevfs.url_show(uri)
     elif action == "folder":
         uri = gnomevfs.make_uri_from_input(self.download.path)
         gnomevfs.url_show(uri)
     notification.close()
Example #6
0
	def launchHelp( self ):
		if self.appGnomeDocPath:
			bn = os.path.basename( self.appGnomeDocPath )
			dn = os.path.dirname( self.appGnomeDocPath )
			if self.appGnomeDocPath[0:6] != "ghelp:":
				self.appGnomeDocPath = "ghelp:" + self.appGnomeDocPath
			gnomevfs.url_show( self.appGnomeDocPath )
		elif self.appKdeDocPath:
			if self.appKdeDocPath[0:6] != "help:/" and self.appKdeDocPath[0:6] != "file:/":
				self.appKdeDocPath = "help:/" + self.appKdeDocPath
			if self.appKdeDocPath[0:6] == "file:/":
				gnomevfs.url_show( self.appKdeDocPath )
			else:
				Execute( [ "khelpcenter", self.appKdeDocPath ] )
Example #7
0
 def launchHelp(self):
     if self.appGnomeDocPath:
         bn = os.path.basename(self.appGnomeDocPath)
         dn = os.path.dirname(self.appGnomeDocPath)
         if self.appGnomeDocPath[0:6] != "ghelp:":
             self.appGnomeDocPath = "ghelp:" + self.appGnomeDocPath
         gnomevfs.url_show(self.appGnomeDocPath)
     elif self.appKdeDocPath:
         if self.appKdeDocPath[0:6] != "help:/" and self.appKdeDocPath[
                 0:6] != "file:/":
             self.appKdeDocPath = "help:/" + self.appKdeDocPath
         if self.appKdeDocPath[0:6] == "file:/":
             gnomevfs.url_show(self.appKdeDocPath)
         else:
             Execute(["khelpcenter", self.appKdeDocPath])
Example #8
0
def openUrl(url):
	if osName == "win":
		return Popen([url])
	if osName == "mac":
		return Popen(["open", url])
	try:
		Popen(["xdg-open", url])
	except:
		myRaise()
	else:
		return
	#if not url.startswith("http"):  # FIXME
	#	return
	try:
		import webbrowser
		return webbrowser.open(url)
	except ImportError:
		pass
	try:
		import gnomevfs
		return gnomevfs.url_show(url)
	except ImportError:
		pass
	for command in ("gnome-www-browser", "firefox", "iceweasel", "konqueror"):
		try:
			Popen([command, url])
		except:
			pass
		else:
			return
Example #9
0
def openUrl(url):
	if osName == "win":
		return Popen([url])
	if osName == "mac":
		return Popen(["open", url])
	try:
		Popen(["xdg-open", url])
	except:
		myRaise()
	else:
		return
	#if not url.startswith("http"):  # FIXME
	#	return
	try:
		import webbrowser
		return webbrowser.open(url)
	except ImportError:
		pass
	try:
		import gnomevfs
		return gnomevfs.url_show(url)
	except ImportError:
		pass
	for command in ("gnome-www-browser", "firefox", "iceweasel", "konqueror"):
		try:
			Popen([command, url])
		except:
			pass
		else:
			return
Example #10
0
def openUrl(url):
    if osName == 'win':
        return Popen([url])
    if osName == 'mac':
        return Popen(['open', url])
    try:
        Popen(['xdg-open', url])
    except:
        myRaise()
    else:
        return
    #if not url.startswith('http'):## FIXME
    #	return
    try:
        import webbrowser
        return webbrowser.open(url)
    except ImportError:
        pass
    try:
        import gnomevfs
        return gnomevfs.url_show(url)
    except ImportError:
        pass
    for command in ('gnome-www-browser', 'firefox', 'iceweasel', 'konqueror'):
        try:
            Popen([command, url])
        except:
            pass
        else:
            return
Example #11
0
def openUrl(url):
    if osName=='win':
        return Popen([url])
    if osName=='mac':
        return Popen(['open', url])
    try:
        Popen(['xdg-open', url])
    except:
        myRaise()
    else:
        return
    #if not url.startswith('http'):## FIXME
    #    return
    try:
        import webbrowser
        return webbrowser.open(url)
    except ImportError:
        pass
    try:
        import gnomevfs
        return gnomevfs.url_show(url)
    except ImportError:
        pass
    for command in ('gnome-www-browser', 'firefox', 'iceweasel', 'konqueror'):
        try:
            Popen([command, url])
        except:
            pass
        else:
            return
Example #12
0
	def showAboutDialog( self, uicomponent, verb ):
		gtk.about_dialog_set_email_hook( lambda dialog, mail: gnomevfs.url_show( "mailto:" + mail ) )
		gtk.about_dialog_set_url_hook( lambda dialog, url: gnomevfs.url_show( url ) )
		about = gtk.AboutDialog()
		about.set_name("Menu Tuquito")
		import commands
		about.set_version("1.0")
		try:
           		h = open('/usr/share/common-licenses/GPL','r')
			s = h.readlines()
			gpl = ""
		        for line in s:
		            gpl += line
		        h.close()
		        about.set_license(gpl)
        	except Exception, detail:
            		print detail            	        
Example #13
0
	def showAboutDialog( self, uicomponent, verb ):

		gtk.about_dialog_set_email_hook( lambda dialog, mail: gnomevfs.url_show( "mailto:" + mail ) )
		gtk.about_dialog_set_url_hook( lambda dialog, url: gnomevfs.url_show( url ) )
		about = gtk.AboutDialog()
		about.set_name("mintMenu")
		import commands
		version = commands.getoutput("/usr/lib/linuxmint/common/version.py mintmenu")
		about.set_version(version)
		try:
           		h = open('/usr/share/common-licenses/GPL','r')
			s = h.readlines()
			gpl = ""
		        for line in s:
		            gpl += line
		        h.close()
		        about.set_license(gpl)
        	except Exception, detail:
            		print detail            	        
Example #14
0
    def showAboutDialog(self, uicomponent, verb):

        gtk.about_dialog_set_email_hook(
            lambda dialog, mail: gnomevfs.url_show("mailto:" + mail))
        gtk.about_dialog_set_url_hook(
            lambda dialog, url: gnomevfs.url_show(url))
        about = gtk.AboutDialog()
        about.set_name("mintMenu")
        import commands
        version = commands.getoutput(
            "/usr/lib/linuxmint/common/version.py mintmenu")
        about.set_version(version)
        try:
            h = open('/usr/share/common-licenses/GPL', 'r')
            s = h.readlines()
            gpl = ""
            for line in s:
                gpl += line
            h.close()
            about.set_license(gpl)
        except Exception, detail:
            print detail
Example #15
0
	print release_note
	
if opts.create_release_email:
	if opts.release_note_template:
		url = create_release_email(opts.create_release_email, 
					   opts.revision, 
					   opts.release_note_template)
	else:
		url = create_release_email(opts.create_release_email, 
					   opts.revision, 
					   'DEFAULT')

	if opts.debug:
		print '\nCreating email...' 

	gnomevfs.url_show(url)
	
if opts.upload:
	upload_tarball()

if opts.get_news_items:
	if opts.debug:
		print '\nNews Items:'
	print get_news_items()

if opts.get_news:
	if opts.debug:
		print '\nNews:'
	print get_news()

if opts.tag:
Example #16
0
def on_email(about, mail):
   gnomevfs.url_show("mailto:%s" % mail)
 def quitHook(self):
     if self._uri and self._changessuccessful:
         import gnomevfs
         gnomevfs.url_show(self._uri)
Example #18
0
def on_url(about, link):
   gnomevfs.url_show(link)
Example #19
0
 def action(self, text=None):
         gnomevfs.url_show("file://"+self.url)
Example #20
0
	def open_url(self, url):
		import gnomevfs
		gnomevfs.url_show(url)
Example #21
0
 def action(self, text=None):
     gnomevfs.url_show(bzurl % self.name)
Example #22
0
 def quitHook(self):
     if self._uri and self._changessuccessful:
         import gnomevfs
         gnomevfs.url_show(self._uri)
Example #23
0
	def action(self, text=None):
		gnomevfs.url_show(bzurl % self.name)
Example #24
0
 def open_url(self, url):
     import gnomevfs
     gnomevfs.url_show(url)