def open_gconf_application(key): """ Get the name from gconf and open the application. """ specto_gconf = Specto_gconf(key) application = specto_gconf.get_entry("command") if "mailto" in key: application = application.replace(" %s", "")#this is an ugly hack, because evolution really doesn't want to startup with %s return application
def return_webpage(webpage): """ Open the webpage in the default browser. """ specto_gconf = Specto_gconf("/desktop/gnome/url-handlers/http") default_browser = specto_gconf.get_entry("command") # Return the browser executable with the URL if "%s" in default_browser: # Most browsers return (default_browser % webpage) else: # TODO: This is a hack for Google Chrome. We should use xdg-open instead, ideally. See bug #284. return ("%s %s" % (default_browser, webpage))
import gettext import spectlib.util as util from spectlib.watch import Watch_collection from spectlib.watch import Watch_io from spectlib.console import Console from spectlib.logger import Logger from spectlib.tools.specto_gconf import Specto_gconf from spectlib.tools import networkmanager as conmgr from spectlib import __pkg_version__ as VERSION #create a gconf object specto_gconf = Specto_gconf("/apps/specto") DEBUG = specto_gconf.get_entry("debug_mode") try: import pygtk #pygtk.require("2.0") import gtk except: print(_("no GTK, activating console mode")) GTK = False else: GTK = True from spectlib.notifier import Notifier, INDICATOR class Specto: """ The main Specto class. """
# version 2 of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public # License along with this program; if not, write to the # Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. import urllib2 #to add a timeout to the global process import socket from spectlib.tools.specto_gconf import Specto_gconf proxy_gconf = Specto_gconf("/system/http_proxy") socket.setdefaulttimeout(10)# set globally the timeout to 10 if proxy_gconf.get_entry("use_http_proxy"): http_proxy = "http://%s:%s" % (proxy_gconf.get_entry("host"), \ proxy_gconf.get_entry("port")) proxy_gconf = Specto_gconf("/system/proxy") https_proxy = "https://%s:%s" % (proxy_gconf.get_entry("secure_host"), \ proxy_gconf.get_entry("secure_port")) proxy = {"http": http_proxy, "https": https_proxy} proxy_support = urllib2.ProxyHandler(proxy) opener = urllib2.build_opener(proxy_support)
# version 2 of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public # License along with this program; if not, write to the # Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. import urllib2 #to add a timeout to the global process import socket from spectlib.tools.specto_gconf import Specto_gconf proxy_gconf = Specto_gconf("/system/http_proxy") socket.setdefaulttimeout(10) # set globally the timeout to 10 if proxy_gconf.get_entry("use_http_proxy"): http_proxy = "http://%s:%s" % (proxy_gconf.get_entry("host"), \ proxy_gconf.get_entry("port")) proxy_gconf = Specto_gconf("/system/proxy") https_proxy = "https://%s:%s" % (proxy_gconf.get_entry("secure_host"), \ proxy_gconf.get_entry("secure_port")) proxy = {"http": http_proxy, "https": https_proxy} proxy_support = urllib2.ProxyHandler(proxy) opener = urllib2.build_opener(proxy_support)
import spectlib.util as util from spectlib.watch import Watch_collection from spectlib.watch import Watch_io from spectlib.console import Console from spectlib.logger import Logger from spectlib.tools.specto_gconf import Specto_gconf from spectlib.tools import networkmanager as conmgr from spectlib import __pkg_version__ as VERSION #create a gconf object specto_gconf = Specto_gconf("/apps/specto") DEBUG = specto_gconf.get_entry("debug_mode") try: import pygtk #pygtk.require("2.0") import gtk except: print (_("no GTK, activating console mode")) GTK = False else: GTK = True from spectlib.notifier import Notifier, INDICATOR class Specto: """ The main Specto class. """