From 67d821b04d5cb2297b50b553ac0d74fa430fd169 Mon Sep 17 00:00:00 2001 From: Sebastien Estienne Date: Sat, 22 Sep 2007 14:57:58 +0000 Subject: add support for webbrowser thanx to Jason Whitlark git-svn-id: file:///home/lennart/svn/public/service-discovery-applet/trunk@142 3be567f1-68ff-0310-b24a-ad7cc433fd2f --- plugins/Makefile.am | 7 +++++++ plugins/nautilus.py.in | 4 ++-- plugins/website_browser.py.in | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 plugins/website_browser.py.in diff --git a/plugins/Makefile.am b/plugins/Makefile.am index 898d5cc..287b8eb 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -6,6 +6,7 @@ plugins = \ xvncviewer.py.in \ obby.py.in \ ekiga.py.in \ + website_browser.py \ printer.py.in plugins_DATA = \ @@ -14,6 +15,7 @@ plugins_DATA = \ xvncviewer.py \ obby.py \ ekiga.py \ + website_browser.py \ printer.py gconfterminal.py: gconfterminal.py.in @@ -46,6 +48,11 @@ printer.py: printer.py.in -e 's,@toolsdir\@,$(TOOLSDIR),g' \ $< > $@ +website_browser.py: website_browser.py.in + sed \ + -e 's,@toolsdir\@,$(TOOLSDIR),g' \ + $< > $@ + EXTRA_DIST = $(plugins) CLEANFILES = $(plugins_DATA) diff --git a/plugins/nautilus.py.in b/plugins/nautilus.py.in index 50433e4..8d51cd9 100644 --- a/plugins/nautilus.py.in +++ b/plugins/nautilus.py.in @@ -1,4 +1,4 @@ -# -*- coding: UTF-8 -*- +# -*- coding: utf-8 -*- # -*- python -*- # Copyright (C) 2005 by Sebastien Estienne # @@ -17,7 +17,7 @@ import subprocess class plugin_nautilus: def __init__(self): - self.service_type = ["_http._tcp", "_ftp._tcp" , "_https._tcp", "_ftps._tcp" , "_webdav._tcp", "_webdavs._tcp", "_sftp-ssh._tcp"] + self.service_type = ["_ftp._tcp" , "_ftps._tcp" , "_webdav._tcp", "_webdavs._tcp", "_sftp-ssh._tcp"] self.author = "Sébastien Estienne" self.description = "Accessing zeroconf services using Nautilus" diff --git a/plugins/website_browser.py.in b/plugins/website_browser.py.in new file mode 100644 index 0000000..70353e4 --- /dev/null +++ b/plugins/website_browser.py.in @@ -0,0 +1,41 @@ +# -*- coding: UTF-8 -*- +# -*- python -*- +# Copyright (C) 2007 by Jason Whitlark +# +# This file may be distributed and/or modified under the terms of +# the GNU General Public License version 2 as published by +# the Free Software Foundation. +# This file is distributed without any warranty; without even the implied +# warranty of merchantability or fitness for a particular purpose. +# See "COPYING" in the source distribution for more information. +# +# $Id: nautilus.py.in 115 2006-08-06 23:52:31Z sebest $ +# + +from sdapplet.pluginutils import * +import subprocess +import webbrowser + + +class plugin_website_browser: + def __init__(self): + self.service_type = ["_http._tcp", "_https._tcp"] + self.author = "Jason Whitlark" + self.description = "Accessing zeroconf web sites using user's preferred browser" + + def connect(self, use_host_names, name, stype, hostname, address, port, txts): + if use_host_names == True: + address = hostname + print "connecting using firefox" + path = get_txt_value(txts,"path") + username = get_txt_value(txts,"u") + password = get_txt_value(txts,"p") + if stype == "_http._tcp": + url = build_url("http",address,port, path, username,password) + if stype == "_https._tcp": + url = build_url("https",address,port, path, username,password) + + webbrowser.open(url) + +def load(): + return plugin_website_browser() -- cgit