diff --git a/src/mambatray b/src/mambatray index d9a478e..beb9c09 100755 --- a/src/mambatray +++ b/src/mambatray @@ -1,12 +1,13 @@ #!/usr/bin/python -# mambatray2 -# Copyright (C) 2011 by Silvan Calarco +# mambatray 2 +# Copyright (C) 2011-2013 by Silvan Calarco # Copyright (C) 2011 by michiamophil # Distributed under the terms of the GPL version 3 FLOSS License # import sys import os import gettext +import libproxy from PyQt4.QtCore import SIGNAL from PyQt4 import QtGui from PyQt4 import QtCore @@ -93,6 +94,19 @@ class SystemTrayIcon(QtGui.QSystemTrayIcon): # the first time check for SRPMS updates after 4 minutes checkSRPMSUpdatesTimer.start( 4 * 60000 ) + def setProxyForSmart(self): + setProxyProcess = QtCore.QProcess(self) + pf = libproxy.ProxyFactory() + for protocol in ["http","https","ftp"]: + proxies = pf.getProxies("%s://www.openmamba.org" % protocol) + for proxy in proxies: + if proxy == "direct://": + setProxyProcess.execute("smart",['config','--remove','%s_proxy' % protocol]) + break + else: + setProxyProcess.execute("smart",['config','--set','%s_proxy=%s' %(protocol,proxy)]) + break + def iconActivated(self, reason): if reason in (QtGui.QSystemTrayIcon.Trigger, QtGui.QSystemTrayIcon.DoubleClick): menu.popup(self.geometry().center()) @@ -110,7 +124,7 @@ class SystemTrayIcon(QtGui.QSystemTrayIcon): version = _("Error: Unable to find /etc/openmamba-release") QtGui.QMessageBox.about(menu, _("About"), "