Compare commits

..

2 Commits

17 changed files with 412 additions and 492 deletions

40
ChangeLog.old Normal file
View File

@ -0,0 +1,40 @@
Changes in version 1.90
- full program rewrite using PyQt4
-------------------------------------------------------------------------------
Changes in version 0.4.3
- patches integration:
* disable_Desktop.patch
* fix_proxy_with_kde4.patch
* move_proxy_to_network_menu.patch
-------------------------------------------------------------------------------
Changes in version 0.4.2
- use kcmshell4 to launch proxy configuration with KDE4
- added spanish translation
-------------------------------------------------------------------------------
Changes in version 0.4.1
- disabled configure and restart network functions (for use with wicd instead)
-------------------------------------------------------------------------------
Changes in version 0.4
- added support for proxy
-------------------------------------------------------------------------------
Changes in version 0.3.6
- mambapt: run the first time after 5 minutes, then every 3 hours and 31 minutes
-------------------------------------------------------------------------------
Changes in version 0.3.4
- added italian translation
-------------------------------------------------------------------------------
Changes in version 0.3.3
- enable network menu for superuser
-------------------------------------------------------------------------------
Changes in version 0.3.2
- introduced a Changelog
- add mambatray::apply_init_workarounds to fix ccsm default user configuration
-------------------------------------------------------------------------------

View File

@ -1,5 +1,5 @@
# Makefile for mambatray # Makefile for livecd-tools
# Copyright (c) 2011-2022 by Silvan Calarco <silvan.calarco@mambasoft.it> # Copyright (c) 2011 by Silvan Calarco <silvan.calarco@mambasoft.it>
# Released under the terms of the GNU GPLv3 license # Released under the terms of the GNU GPLv3 license
PACKAGE=mambatray PACKAGE=mambatray
@ -18,10 +18,10 @@ bindir = ${exec_prefix}/bin
mandir = ${prefix}/usr/share/man mandir = ${prefix}/usr/share/man
datadir = ${prefix}/share datadir = ${prefix}/share
iconsdir = ${datadir}/icons/hicolor iconsdir = ${datadir}/icons/hicolor
initrddir = ${sysconfdir}/rc.d/init.d
sysconfigdir= ${sysconfdir}/sysconfig sysconfigdir= ${sysconfdir}/sysconfig
localesdir = ${datadir}/locale localesdir = ${datadir}/locale
xdgautostartdir = ${sysconfdir}/xdg/autostart xdgautostartdir = ${sysconfdir}/xdg/autostart
xdgapplicationsdir = ${datadir}/applications
srcdir = . srcdir = .
DESTDIR = DESTDIR =
@ -53,18 +53,24 @@ install-locales: locales
install-dirs: install-dirs:
@$(INSTALL_DIR) $(DESTDIR)$(bindir) @$(INSTALL_DIR) $(DESTDIR)$(bindir)
@$(INSTALL_DIR) $(DESTDIR)$(xdgautostartdir) @$(INSTALL_DIR) $(DESTDIR)$(xdgautostartdir)
@$(INSTALL_DIR) $(DESTDIR)$(xdgapplicationsdir)
install: install-dirs install-locales install-icons:
$(INSTALL_PROGRAM) mambatray.py $(DESTDIR)$(bindir)/mambatray @for i in 16 22 32 64 128; do \
$(INSTALL_DIR) $(DESTDIR)$(iconsdir)/$${i}x$${i}/apps/; \
$(INSTALL_DATA) icons/hi$$i-app-mambatray.png $(DESTDIR)$(iconsdir)/$${i}x$${i}/apps/mambatray.png; \
done
install: install-dirs install-locales install-icons
$(INSTALL_PROGRAM) src/mambatray $(DESTDIR)$(bindir)/mambatray
$(INSTALL_DATA) mambatray.desktop $(DESTDIR)$(xdgautostartdir)/mambatray.desktop $(INSTALL_DATA) mambatray.desktop $(DESTDIR)$(xdgautostartdir)/mambatray.desktop
$(INSTALL_DATA) mambatray.desktop $(DESTDIR)$(xdgapplicationsdir)/mambatray.desktop
clean: clean:
rm -f $(pck_catalogs:.po=.mo) rm -f $(pck_catalogs:.po=.mo)
rm -f $(dist_archive) rm -f $(dist_archive)
dist: clean dist: clean
@git clean -f
@git log > ChangeLog
@mkdir /tmp/$(distdir) @mkdir /tmp/$(distdir)
@cp -a * /tmp/$(distdir)/ @cp -a * /tmp/$(distdir)/
@rm -f $(dist_archive);\ @rm -f $(dist_archive);\

View File

@ -1 +1 @@
VERSION=5.3 VERSION=1.96.1

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 768 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

BIN
icons/mambatray.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -8,4 +8,3 @@ Comment=openmamnba control center
Comment[it]=Centro di controllo openmamba Comment[it]=Centro di controllo openmamba
X-KDE-autostart-after=panel X-KDE-autostart-after=panel
X-KDE-autostart-phase=2 X-KDE-autostart-phase=2
NoDisplay=true

View File

@ -1,262 +0,0 @@
#!/usr/bin/python3
# mambatray 2
# Copyright (C) 2011-2024 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 distro
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QIcon, QCursor
from PyQt5.QtWidgets import QSystemTrayIcon, QApplication, QMenu, QMessageBox
from PyQt5.QtCore import QTimer, QProcess
DATADIR = os.path.dirname(os.path.realpath((__file__))) + "/"
class SystemTrayIcon(QSystemTrayIcon):
menu = None
contatore = 0
NetsrpmsArg = "-c"
lista = []
nOre = 2
srpm = [
"skype", "win32codecs", "msttcorefonts", "b43-firmware",
"virtualbox-extension-pack", "chromium-widevine", "spotify"
]
desktop_session = 'default'
xdg_session_type = 'x11'
refreshPackagesTimer = None
checkSRPMSUpdatesTimer = None
refreshPackagesCacheProcess = None
SRPMUpdateProcess = None
softwareManagerProcess = None
softwareCheckUpgradesProcess = None
softwareBaseInstallsProcess = None
networkOnlineProcess = None
networkFirewallDisableProcess = None
networkFirewallEnableProcess = None
networkFirewallConfigureProcess = None
networkProxyProcess = None
def __init__(self, icon):
QSystemTrayIcon.__init__(self, icon)
self.menu = QMenu()
try:
self.desktop_session = os.path.basename(os.getenv('DESKTOP_SESSION'))
except:
None
try:
self.xdg_session_type = os.path.basename(os.getenv('XDG_SESSION_TYPE'))
except:
None
if self.desktop_session == 'default':
self.desktop_session = 'plasma'
elif self.desktop_session[:3] == 'kde':
self.desktop_session = 'kde'
# refresh packages cache timer
self.refreshPackagesTimer = QTimer(self)
self.checkSRPMSUpdatesTimer = QTimer(self)
self.refreshPackagesCacheProcess = QProcess(self)
self.SRPMUpdateProcess = QProcess(self)
self.networkOnlineProcess = QProcess(self)
self.refreshPackagesTimer.timeout.connect(self.refreshPackagesCache)
self.refreshPackagesCacheProcess.finished.connect(self.restartRefreshPackagesTimer)
self.checkSRPMSUpdatesTimer.timeout.connect(self.SRPMSCheckUpgradeList)
# software menu
self.softwareManagerProcess = QProcess(self)
self.softwareCheckUpgradesProcess = QProcess(self)
self.softwareBaseInstallsProcess = QProcess(self)
self.softwareMenu = self.menu.addMenu(QIcon.fromTheme("applications-system"),_("Software"))
self.softwareManageAction = self.softwareMenu.addAction(QIcon.fromTheme("applications-other"),_("Add/Remove software packages..."))
self.softwareManageAction.triggered.connect(self.softwareManager)
self.softwareCheckUpgradesAction = self.softwareMenu.addAction(QIcon.fromTheme("system-software-update"),_("Check for updates now..."))
self.softwareCheckUpgradesAction.triggered.connect(self.softwareCheckUpgrades)
self.softwareBaseInstallsAction = self.softwareMenu.addAction(QIcon.fromTheme("mambabase"),_("{} components...").format(distro.name()))
self.softwareBaseInstallsAction.triggered.connect(self.softwareBaseInstalls)
# network menu
self.networkFirewallDisableProcess = QProcess(self)
self.networkFirewallEnableProcess = QProcess(self)
self.networkFirewallConfigureProcess = QProcess(self)
self.networkProxyProcess = QProcess(self)
self.networkMenu = self.menu.addMenu(QIcon.fromTheme("preferences-system-network"), _("Network"))
self.networkFirewallMenu = self.networkMenu.addMenu(QIcon.fromTheme("security-medium"),_("Firewall"))
self.networkFirewallDisableAction = self.networkFirewallMenu.addAction(QIcon.fromTheme("security-low"),_("Disable"))
self.networkFirewallDisableAction.triggered.connect(self.networkFirewallDisable)
self.networkFirewallDisableProcess.finished.connect(self.networkFirewallDisableMessage)
self.networkFirewallEnableAction = self.networkFirewallMenu.addAction(QIcon.fromTheme("security-high"),_("Enable"))
self.networkFirewallEnableAction.triggered.connect(self.networkFirewallEnable)
self.networkFirewallEnableProcess.finished.connect(self.networkFirewallEnableMessage)
self.networkFirewallConfigureAction = self.networkFirewallMenu.addAction(QIcon.fromTheme("security-medium"),_("Configure..."))
self.networkFirewallConfigureAction.triggered.connect(self.networkFirewallConfigure)
self.networkProxyAction = self.networkMenu.addAction(QIcon.fromTheme("network-server"),_("Proxy..."))
self.networkProxyAction.triggered.connect(self.networkProxy)
self.SRPMUpdateProcess.finished.connect(self.SRPMSCheckUpgrade)
# about box
self.aboutAction = self.menu.addSeparator()
self.aboutAction = self.menu.addAction(QIcon.fromTheme("system-logo"),_("About"))
self.aboutAction.triggered.connect(self.about)
self.setToolTip(_("{} control center").format(distro.name()))
self.activated.connect(self.iconActivated)
self.setContextMenu(self.menu)
# the first time refresh packages cache after 5 minutes
self.refreshPackagesTimer.start( 5 * 60000 )
# the first time check for SRPMS updates after 4 minutes
self.checkSRPMSUpdatesTimer.start( 4 * 60000 )
def iconActivated(self, reason):
if reason in (QSystemTrayIcon.Trigger, QSystemTrayIcon.DoubleClick, QSystemTrayIcon.Context):
# FIXME: on plasma wayland and left click menu will popup in the center of the screen
# disabling and only supporting right click.
if self.xdg_session_type != 'wayland':
self.contextMenu().popup(QCursor.pos())
def about(self):
aboutBox = QMessageBox(self.menu)
aboutBox.setWindowIcon(QIcon.fromTheme("mambatray"))
aboutBox.setWindowTitle(_("About"))
aboutBox.setText(
"<center><b>"+_("{} control center").format(distro.name()+"</b>"
"<br/><br/>"+distro.name(pretty=True)+
"<br/><br/><a href=\""+distro.os_release_info()['home_url']+
"\">" + distro.os_release_info()['home_url'] + "</a>"
"</center>"))
aboutBox.setTextFormat(Qt.RichText)
aboutBox.setIconPixmap(QIcon.fromTheme("system-logo").pixmap(32));
aboutBox.setWindowModality(Qt.NonModal);
aboutBox.exec()
def networkOnline(self):
return self.networkOnlineProcess.execute("/usr/bin/nm-online",['-q','-x'])
def softwareManager(self):
self.softwareManagerProcess.execute("/usr/bin/plasma-discover")
def softwareCheckUpgrades(self):
self.softwareCheckUpgradesProcess.start("/usr/bin/pkcon", ['refresh', 'force'])
def refreshPackagesCache(self):
self.refreshPackagesTimer.stop()
self.refreshPackagesCacheProcess.start("/usr/bin/pkcon", ['refresh', 'force'])
def restartRefreshPackagesTimer(self,status):
# check every 4 hours and 31 minutes */
self.refreshPackagesTimer.start( (4 * 60 + 31) * 60000)
def softwareBaseInstalls(self):
self.softwareBaseInstallsProcess.start("/usr/bin/mambabase")
def networkFirewallDisable(self):
self.networkFirewallDisableProcess.start("sudo",['/usr/sbin/ufw','disable'])
def networkFirewallDisableMessage(self,status):
if (status == QProcess.NormalExit):
self.showMessage("Firewall", _("Firewall disabled in current session"))
else:
self.showMessage("Firewall", _("Could not disable firewall"))
def networkFirewallEnable(self):
self.networkFirewallEnableProcess.start("sudo",['/usr/sbin/ufw','enable'])
def networkFirewallEnableMessage(self,status):
if (status == QProcess.NormalExit):
self.showMessage("Firewall", _("Firewall enabled in current session"))
else:
self.showMessage("Firewall", _("Could not enable firewall"))
def networkFirewallConfigure(self):
if self.desktop_session == 'kde' or self.desktop_session.startswith('plasma'):
self.networkFirewallConfigureProcess.execute("/usr/bin/kcmshell5", list(set(['firewall'])))
else:
self.networkFirewallConfigureProcess.execute("/usr/bin/gufw")
def networkProxy(self):
if self.desktop_session.startswith('plasma'):
self.networkProxyProcess.execute("/usr/bin/kcmshell5", list(set(['proxy'])))
elif self.desktop_session == 'kde':
self.networkProxyProcess.execute("/opt/kde/bin/kcmshell4", list(set(['proxy'])))
elif self.desktop_session == 'gnome':
self.networkProxyProcess.execute("/usr/bin/gnome-control-center", "network")
def SRPMSCheckUpgradeList(self):
self.checkSRPMSUpdatesTimer.stop()
if (self.networkOnline() == 0):
try:
self.SRPMUpdateProcess.start("/usr/bin/openmamba-netsrpms",[self.NetsrpmsArg,self.srpm[self.contatore]])
except:
self.contatore = 0
if self.NetsrpmsArg == '-c':
self.SRPMSAskAndInstall()
else:
self.lista = []
self.NetsrpmsArg = '-c'
self.checkSRPMSUpdatesTimer.start((self.nOre * 60) * 60000)
# run for each netsrpm at the end of SRPMUpdateProcess
def SRPMSCheckUpgrade(self, status):
if status == 1:
self.lista.append(self.srpm[self.contatore])
self.contatore += 1
self.SRPMSCheckUpgradeList()
# netsrpm updates ask and install
def SRPMSAskAndInstall(self):
if not self.lista == []:
self.Lista = self.PrintLista()
msg = QMessageBox.question(self.menu,
(_("Not Open Source {} components").format(distro.name())),
(_("The following components are available for update: ") +
"\n\n" + self.Lista + "\n\n" + _("Ok to proceed?")),
QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes)
if msg == QMessageBox.Yes:
self.NetsrpmsArg = '-u'
self.SRPMSCheckUpgradeList()
else:
self.lista = []
self.checkSRPMSUpdatesTimer.start((self.nOre * 60) * 60000)
else:
self.checkSRPMSUpdatesTimer.start((self.nOre * 60) * 60000)
# starting from the list "lista" returns the list in readable format
# FIXME: make this code more clear and clean
def PrintLista(self):
testo = ''
for a in self.lista:
testo = testo + a + ', '
return testo[0:len(testo)-2]
if __name__ == '__main__':
app = QApplication(sys.argv)
app.setDesktopFileName("mambatray")
if app.isSessionRestored():
app.exit(1)
else:
app.setQuitOnLastWindowClosed(0)
gettext.install('mambatray', '/usr/share/locale')
trayIcon = SystemTrayIcon(QIcon.fromTheme("mambatray"))
trayIcon.show()
sys.exit(app.exec())

View File

@ -1,2 +1,2 @@
EXTRA_DIST = it.po es.po fr.po EXTRA_DIST = it.po es.po
POFILES = it.po es.po fr.po POFILES = it.po es.po

108
po/es.po
View File

@ -5,89 +5,77 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: 1.90\n" "Project-Id-Version: 1.90\n"
"Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2011-04-26 18:37+CEST\n"
"POT-Creation-Date: 2022-06-19 12:53+0200\n"
"PO-Revision-Date: 2011-04-26 18:37+CEST\n" "PO-Revision-Date: 2011-04-26 18:37+CEST\n"
"Last-Translator: Silvan Calarco <silvan.calarco@mambasot.it>\n" "Last-Translator: Silvan Calarco <silvan.calarco@mambasot.it>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n" "Generated-By: pygettext.py 1.5\n"
#: mambatray.py:102 mambatray.py:134
msgid "About"
msgstr "Sobre"
#: mambatray.py:68 #: src/mambatray:27
msgid "Software"
msgstr ""
#: src/mambatray:28
msgid "Add/Remove software packages..." msgid "Add/Remove software packages..."
msgstr "Añadir/Eliminar paquetes software..." msgstr "Añadir/Eliminar paquetes software..."
#: mambatray.py:71 #: src/mambatray:31
msgid "Check for updates now..." msgid "Check for updates now..."
msgstr "Controla la disponibilidad de actualizaciones..." msgstr "Controla la disponibilidad de actualizaciones..."
#: mambatray.py:94 #: src/mambatray:34
msgid "Configure..." msgid "openmamba components..."
msgstr "Configura..." msgstr "Componentes de openmamba..."
#: mambatray.py:168 #: src/mambatray:44
msgid "Could not disable firewall"
msgstr "No se ha podido desactivar el firewall"
#: mambatray.py:177
msgid "Could not enable firewall"
msgstr "No se ha podido activar el firewall"
#: mambatray.py:88
msgid "Disable"
msgstr "Desactiva"
#: mambatray.py:91
msgid "Enable"
msgstr "Activa"
#: mambatray.py:87
msgid "Firewall"
msgstr "Firewall"
#: mambatray.py:166
msgid "Firewall disabled in current session"
msgstr "Firewall desactivado en la sesión actual"
#: mambatray.py:175
msgid "Firewall enabled in current session"
msgstr "Firewall activo en la sesión actual"
#: mambatray.py:86
msgid "Network" msgid "Network"
msgstr "Red" msgstr "Red"
#: mambatray.py:222 #: src/mambatray:45
msgid "Not Open Source {} components" msgid "Firewall"
msgstr "No componentes de código abierto de {}" msgstr ""
#: mambatray.py:223 #: src/mambatray:46
msgid "Ok to proceed?" msgid "Disable"
msgstr "Bien para proceder?" msgstr "Desactiva"
#: mambatray.py:96 #: src/mambatray:49
msgid "Enable"
msgstr "Activa"
#: src/mambatray:52
msgid "Configure..."
msgstr "Configura..."
#: src/mambatray:54
msgid "Proxy..." msgid "Proxy..."
msgstr "Proxy..." msgstr ""
#: mambatray.py:67 #: src/mambatray:59
msgid "Software" msgid "About"
msgstr "Software" msgstr ""
#: mambatray.py:223 #: src/mambatray:63
msgid "The following components are available for update: " msgid "openmamba control center"
msgstr "Los siguientes componentes están disponibles para actualizar" msgstr "Centro de control de openmamba"
#: mambatray.py:74 #: src/mambatray:91
msgid "{} components..." msgid "Firewall disabled in current session"
msgstr "Componentes de {}..." msgstr "Firewall desactivado en la sesión actual"
#: src/mambatray:93
msgid "Could not disable firewall"
msgstr "No se ha podido desactivar el firewall"
#: src/mambatray:100
msgid "Firewall enabled in current session"
msgstr "Firewall activo en la sesión actual"
#: src/mambatray:102
msgid "Could not enable firewall"
msgstr "No se ha podido activar el firewall"
#: mambatray.py:105 mambatray.py:135
msgid "{} control center"
msgstr "Centro de control de {}"

View File

@ -1,93 +0,0 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: 1.90\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-06-19 12:53+0200\n"
"PO-Revision-Date: 2011-04-26 18:37+CEST\n"
"Last-Translator: Silvan Calarco <silvan.calarco@mambasot.it>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"
#: mambatray.py:102 mambatray.py:134
msgid "About"
msgstr "Informations"
#: mambatray.py:68
msgid "Add/Remove software packages..."
msgstr "Installer/Supprimer paquets logiciels..."
#: mambatray.py:71
msgid "Check for updates now..."
msgstr "Mise à jour du système..."
#: mambatray.py:94
msgid "Configure..."
msgstr "Configurer..."
#: mambatray.py:168
msgid "Could not disable firewall"
msgstr "Impossible de désactiver le pare-feu"
#: mambatray.py:177
msgid "Could not enable firewall"
msgstr "Impossible d'activer le pare-feu"
#: mambatray.py:88
msgid "Disable"
msgstr "Désactiver"
#: mambatray.py:91
msgid "Enable"
msgstr "Activer"
#: mambatray.py:87
msgid "Firewall"
msgstr "Pare-feu"
#: mambatray.py:166
msgid "Firewall disabled in current session"
msgstr "Pare-feu désactivé pour la session en cours"
#: mambatray.py:175
msgid "Firewall enabled in current session"
msgstr "Pare-feu activé pour la session en cours"
#: mambatray.py:86
msgid "Network"
msgstr "Réseau"
#: mambatray.py:222
msgid "Not Open Source {} components"
msgstr "Composants non open source de {}"
#: mambatray.py:223
msgid "Ok to proceed?"
msgstr "Mettre à jour maintenant?"
#: mambatray.py:96
msgid "Proxy..."
msgstr "Proxy..."
#: mambatray.py:67
msgid "Software"
msgstr "Logiciels"
#: mambatray.py:223
msgid "The following components are available for update: "
msgstr "Les composants suivants sont disponibles pour la mise à jour: "
#: mambatray.py:74
msgid "{} components..."
msgstr "Composants de {}..."
#: mambatray.py:105 mambatray.py:135
msgid "{} control center"
msgstr "Centre de contrôle de {}"

128
po/it.po
View File

@ -5,89 +5,97 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: 1.90\n" "Project-Id-Version: 1.90\n"
"Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2011-04-26 18:37+CEST\n"
"POT-Creation-Date: 2022-06-19 12:53+0200\n"
"PO-Revision-Date: 2011-04-26 18:37+CEST\n" "PO-Revision-Date: 2011-04-26 18:37+CEST\n"
"Last-Translator: Silvan Calarco <silvan.calarco@mambasot.it>\n" "Last-Translator: Silvan Calarco <silvan.calarco@mambasot.it>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n" "Generated-By: pygettext.py 1.5\n"
#: mambatray.py:102 mambatray.py:134
msgid "About"
msgstr "Informazioni"
#: mambatray.py:68 #: src/mambatray:27
msgid "Software"
msgstr ""
#: src/mambatray:28
msgid "Add/Remove software packages..." msgid "Add/Remove software packages..."
msgstr "Aggiungi/Rimuovi applicazioni..." msgstr "Aggiungi/Rimuovi pacchetti software..."
#: mambatray.py:71 #: src/mambatray:31
msgid "Check for updates now..." msgid "Check for updates now..."
msgstr "Verifica la presenza di aggiornamenti..." msgstr "Aggiorna il sistema..."
#: mambatray.py:94 #: src/mambatray:34
msgid "Configure..." msgid "openmamba components..."
msgstr "Configura..." msgstr "Componenti di openmamba..."
#: mambatray.py:168 #: src/mambatray:44
msgid "Could not disable firewall"
msgstr "Non è stato possibile disabilitare il firewall"
#: mambatray.py:177
msgid "Could not enable firewall"
msgstr "Non è stato possibile abilitare il firewall"
#: mambatray.py:88
msgid "Disable"
msgstr "Disabilita"
#: mambatray.py:91
msgid "Enable"
msgstr "Abilita"
#: mambatray.py:87
msgid "Firewall"
msgstr "Firewall"
#: mambatray.py:166
msgid "Firewall disabled in current session"
msgstr "Firewall disabilitato per la sessione corrente"
#: mambatray.py:175
msgid "Firewall enabled in current session"
msgstr "Firewall abilitato per la sessione corrente"
#: mambatray.py:86
msgid "Network" msgid "Network"
msgstr "Rete" msgstr "Rete"
#: mambatray.py:222 #: src/mambatray:45
msgid "Not Open Source {} components" msgid "Firewall"
msgstr "Componenti non Open Source di {}" msgstr ""
#: mambatray.py:223 #: src/mambatray:46
msgid "Ok to proceed?" msgid "Disable"
msgstr "Aggiornare adesso?" msgstr "Disabilita"
#: mambatray.py:96 #: src/mambatray:49
msgid "Enable"
msgstr "Abilita"
#: src/mambatray:52
msgid "Configure..."
msgstr "Configura..."
#: src/mambatray:54
msgid "Proxy..." msgid "Proxy..."
msgstr "Proxy..." msgstr ""
#: mambatray.py:67 #: src/mambatray:59
msgid "Software" msgid "About"
msgstr "Software" msgstr "Informazioni"
#: src/mambatray:63
msgid "openmamba control center"
msgstr "Centro di controllo di openmamba"
#: src/mambatray:91
msgid "Firewall disabled in current session"
msgstr "Firewall disabilitato per la sessione corrente"
#: src/mambatray:93
msgid "Could not disable firewall"
msgstr "Non è stato possibile disabilitare il firewall"
#: src/mambatray:100
msgid "Firewall enabled in current session"
msgstr "Firewall abilitato per la sessione corrente"
#: src/mambatray:102
msgid "Could not enable firewall"
msgstr "Non è stato possibile abilitare il firewall"
msgid "Not Open Source openmamba components"
msgstr "Componenti non Open Source di openmamba"
#: mambatray.py:223
msgid "The following components are available for update: " msgid "The following components are available for update: "
msgstr "I seguenti componenti sono disponibili per l'aggiornamento: " msgstr "I seguenti componenti sono disponibili per l'aggiornamento: "
#: mambatray.py:74 msgid "Ok to proceed?"
msgid "{} components..." msgstr "Aggiornare adesso?"
msgstr "Componenti di {}..."
#: src/mambatray:107
msgid "Platform: "
msgstr "Piattaforma: "
msgid "System info:"
msgstr "Informazioni sul sistema:"
msgid "Error: Unable to find /etc/openmamba-release"
msgstr "Errore: Impossibile trovare il file /etc/openmamba-release"
#: mambatray.py:105 mambatray.py:135
msgid "{} control center"
msgstr "Centro di controllo di {}"

240
src/mambatray Executable file
View File

@ -0,0 +1,240 @@
#!/usr/bin/python
# mambatray2
# Copyright (C) 2011 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
from PyQt4.QtCore import SIGNAL
from PyQt4 import QtGui
from PyQt4 import QtCore
class SystemTrayIcon(QtGui.QSystemTrayIcon):
def __init__(self, icon, parent=None):
global w, menu, contatore, srpm, lista, NetsrpmsArg, nOre, desktop_session
nOre = 2
srpm = ["skype", "flashplugin", "win32codecs", "msttcorefonts", "b43-firmware"]
NetsrpmsArg = "-c"
lista = []
contatore = 0
w = parent
QtGui.QSystemTrayIcon.__init__(self, icon, parent)
menu = QtGui.QMenu(parent)
desktop_session = QtCore.QString(os.getenv('DESKTOP_SESSION'))
if desktop_session == 'default':
desktop_session = QtCore.QString('kde')
if desktop_session.left(3) == 'kde':
desktop_session = QtCore.QString('kde')
# refresh packages cache timer
global refreshPackagesTimer, refreshPackagesCacheProcess, checkSRPMSUpdatesTimer, SRPMUpdateProcess
refreshPackagesTimer = QtCore.QTimer(self)
checkSRPMSUpdatesTimer = QtCore.QTimer(self)
refreshPackagesCacheProcess = QtCore.QProcess(self)
SRPMUpdateProcess = QtCore.QProcess(self)
self.connect(refreshPackagesTimer, SIGNAL("timeout()"), self.refreshPackagesCache)
self.connect(refreshPackagesCacheProcess, SIGNAL("finished(int,QProcess::ExitStatus)"), self.restartRefreshPackagesTimer)
self.connect(checkSRPMSUpdatesTimer, SIGNAL("timeout()"), self.SRPMSCheckUpgradeList)
# software menu
global softwareManagerProcess, softwareCheckUpgradesProcess, softwareBaseInstallsProcess, dcopServerProcess
softwareManagerProcess = QtCore.QProcess(self)
softwareCheckUpgradesProcess = QtCore.QProcess(self)
softwareBaseInstallsProcess = QtCore.QProcess(self)
dcopServerProcess = QtCore.QProcess(self)
softwareMenu = menu.addMenu(QtGui.QIcon.fromTheme("applications-system"),_("Software"))
softwareManageAction = softwareMenu.addAction(QtGui.QIcon.fromTheme("applications-other"),_("Add/Remove software packages..."))
self.connect(softwareManageAction, SIGNAL("triggered()"), self.softwareManager)
softwareCheckUpgradesAction = softwareMenu.addAction(QtGui.QIcon.fromTheme("system-software-update"),_("Check for updates now..."))
self.connect(softwareCheckUpgradesAction, SIGNAL("triggered()"), self.softwareCheckUpgrades)
softwareBaseInstallsAction = softwareMenu.addAction(QtGui.QIcon.fromTheme("openmamba"),_("openmamba components..."))
self.connect(softwareBaseInstallsAction, SIGNAL("triggered()"), self.softwareBaseInstalls)
# network menu
global networkFirewallDisableProcess, networkFirewallEnableProcess, networkFirewallConfigureProcess, networkProxyProcess
networkFirewallDisableProcess = QtCore.QProcess(self)
networkFirewallEnableProcess = QtCore.QProcess(self)
networkFirewallConfigureProcess = QtCore.QProcess(self)
networkProxyProcess = QtCore.QProcess(self)
networkMenu = menu.addMenu(QtGui.QIcon.fromTheme("preferences-system-network"),_("Network"))
networkFirewallMenu = networkMenu.addMenu(QtGui.QIcon.fromTheme("security-medium"),_("Firewall"))
networkFirewallDisableAction = networkFirewallMenu.addAction(QtGui.QIcon.fromTheme("security-low"),_("Disable"))
self.connect(networkFirewallDisableAction, SIGNAL("triggered()"), self.networkFirewallDisable)
self.connect(networkFirewallDisableProcess, SIGNAL("finished(int,QProcess::ExitStatus)"), self.networkFirewallDisableMessage)
networkFirewallEnableAction = networkFirewallMenu.addAction(QtGui.QIcon.fromTheme("security-high"),_("Enable"))
self.connect(networkFirewallEnableAction, SIGNAL("triggered()"), self.networkFirewallEnable)
self.connect(networkFirewallEnableProcess, SIGNAL("finished(int,QProcess::ExitStatus)"), self.networkFirewallEnableMessage)
networkFirewallConfigureAction = networkFirewallMenu.addAction(QtGui.QIcon.fromTheme("security-medium"),_("Configure..."))
self.connect(networkFirewallConfigureAction, SIGNAL("triggered()"), self.networkFirewallConfigure)
networkProxyAction = networkMenu.addAction(QtGui.QIcon.fromTheme("network-server"),_("Proxy..."))
self.connect(networkProxyAction, SIGNAL("triggered()"), self.networkProxy)
self.connect(SRPMUpdateProcess, SIGNAL("finished(int,QProcess::ExitStatus)"), self.SRPMSCheckUpgrade)
# about box
aboutAction = menu.addSeparator()
aboutAction = menu.addAction(QtGui.QIcon.fromTheme("help-about"),_("About"))
self.connect(aboutAction, SIGNAL("triggered()"), self.about)
self.setContextMenu(menu)
self.setToolTip(_("openmamba control center"))
self.activated.connect(self.iconActivated)
# the first time refresh packages cache after 5 minutes
refreshPackagesTimer.start( 5 * 60000 )
# the first time check for SRPMS updates after 4 minutes
checkSRPMSUpdatesTimer.start( 4 * 60000 )
def iconActivated(self, reason):
if reason in (QtGui.QSystemTrayIcon.Trigger, QtGui.QSystemTrayIcon.DoubleClick):
menu.popup(self.geometry().center())
def about(self):
global version
path = '/etc/openmamba-release'
if os.path.exists(path):
v = open(path, 'r')
version = v.read()
a = self.FormattaInfo()
version = "<ul><li>"+_("<font color=\"green\">open</font>mamba release:")+" <i>"+a[0]+"</i><li>"+_("Platform: ")+"<i>"+a[1]+"</i></ul>"
v.close()
else:
version = _("Error: Unable to find /etc/openmamba-release")
QtGui.QMessageBox.about(menu, _("About"),
"<center><b>"+_("openmamba control center")+"</b>"
"<br><br>Copyright(c) 2011 by Silvan Calarco"
"<br>Copyright(c) 2011 by michiamophil"
"<br><br><b>"+_("System info:")+"</b></center>"
""+_(version)+"<center><a href=\"http://www.openmamba.org\">http://www.openmamba.org</a></center>")
def FormattaInfo(self):
result = []
v = version
#result[0]=versione
result.append(v[ v.find("openmamba release ")+18 : v.find(" for") ] + " " + v[ v.find("(") : v.find(")")+1 ])
#result[1] = piattaforma
result.append(v[ v.find("for")+4 : v.find("(") ])
return result
def softwareManager(self):
if desktop_session == 'kde':
softwareManagerProcess.execute("/opt/kde/bin/kpackagekit")
else:
softwareManagerProcess.execute("/usr/bin/gpk-application")
def softwareCheckUpgrades(self):
if desktop_session == 'kde':
softwareCheckUpgradesProcess.start("/opt/kde/bin/kpackagekit", ['--updates'])
else:
softwareCheckUpgradesProcess.start("/usr/bin/gpk-update-viewer")
def refreshPackagesCache(self):
refreshPackagesTimer.stop()
refreshPackagesCacheProcess.start("/usr/bin/pkcon", ['refresh'])
def restartRefreshPackagesTimer(self,status):
# check every 4 hours and 31 minutes */
refreshPackagesTimer.start( (4 * 60 + 31) * 60000)
def softwareBaseInstalls(self):
dcopServerProcess.startDetached("/opt/kde3/bin/dcopserver")
softwareBaseInstallsProcess.start("/opt/kde3/bin/kmdr-executor", ['/usr/share/openmamba/mambabase/mambabase.kmdr'])
def networkFirewallDisable(self):
networkFirewallDisableProcess.start("sudo",['/sbin/service','iptables','stop'])
def networkFirewallDisableMessage(self,status):
if (status == QtCore.QProcess.NormalExit):
self.showMessage("Firewall", _("Firewall disabled in current session"))
else:
self.showMessage("Firewall", _("Could not disable firewall"))
def networkFirewallEnable(self):
networkFirewallEnableProcess.start("sudo",['/usr/sbin/ufw','enable'])
def networkFirewallEnableMessage(self,status):
if (status == QtCore.QProcess.NormalExit):
self.showMessage("Firewall", _("Firewall enabled in current session"))
else:
self.showMessage("Firewall", _("Could not enable firewall"))
def networkFirewallConfigure(self):
if desktop_session == 'kde':
networkFirewallConfigureProcess.execute("/opt/kde/bin/kcmshell4", QtCore.QStringList(list(set(['ufw']))))
else:
networkFirewallConfigureProcess.execute("/usr/bin/gufw")
def networkProxy(self):
if desktop_session == 'kde':
networkProxyProcess.execute("/opt/kde/bin/kcmshell4", QtCore.QStringList(list(set(['proxy']))))
elif desktop_session == 'gnome':
networkProxyProcess.execute("/usr/bin/gnome-network-properties")
def SRPMSCheckUpgradeList(self):
checkSRPMSUpdatesTimer.stop()
global contatore, lista, NetsrpmsArg
try:
SRPMUpdateProcess.start("/usr/bin/openmamba-netsrpms",[NetsrpmsArg,srpm[contatore]])
except: #supera il limite dell'indice nella lista
contatore = 0
if NetsrpmsArg == '-c':
self.SRPMSAskAndInstall()
else:
lista = []
NetsrpmsArg = '-c'
checkSRPMSUpdatesTimer.start((nOre * 60) * 60000)
#viene eseguita per ogni SRPM al termine del processo SRPMUpdateProcess
def SRPMSCheckUpgrade(self, status):
global contatore, lista
if status == 1:
lista.append(srpm[contatore])
contatore += 1
self.SRPMSCheckUpgradeList()
#viene eseguita una volta terminata la fase di controllo degli aggiornamenti
def SRPMSAskAndInstall(self):
global NetsrpmsArg, lista
if not lista == []:
Lista = self.Lista()
msg = QtGui.QMessageBox.question(menu, (_("Not Open Source openmamba components")), (_("The following components are available for update: ") + "\n\n" + Lista + "\n\n" + _("Ok to proceed?")), QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, QtGui.QMessageBox.Yes)
if msg == QtGui.QMessageBox.Yes:
NetsrpmsArg = '-u'
self.SRPMSCheckUpgradeList()
else:
lista = []
checkSRPMSUpdatesTimer.start((nOre * 60) * 60000)
else:
checkSRPMSUpdatesTimer.start((nOre * 60) * 60000)
#partendo dalla lista lista (scusate il gioco di parole :) ) restituisce la lista in modo 'leggibile'
def Lista(self):
testo = ''
for a in lista:
testo = testo + a + ', '
return testo[0:len(testo)-2]
def main():
app = QtGui.QApplication(sys.argv)
if (app.isSessionRestored()):
app.exit(1)
else:
app.setQuitOnLastWindowClosed(0)
gettext.install('mambatray', '/usr/share/locale', unicode=1)
w = QtGui.QWidget()
w.setWindowIcon(QtGui.QIcon.fromTheme("mambatray",QtGui.QIcon("/usr/share/icons/hicolor/64x64/apps/mambatray.png")))
trayIcon = SystemTrayIcon(QtGui.QIcon.fromTheme("mambatray", QtGui.QIcon("/usr/share/icons/hicolor/32x32/apps/mambatray.png")), w)
trayIcon.show()
sys.exit(app.exec_())
if __name__ == '__main__':
main()

View File

@ -1,6 +0,0 @@
#!/bin/bash
xgettext -s -o - mambatray.py --output=po/messages.pot
for l in it es fr; do
msgmerge --update --no-fuzzy-matching --backup=off po/$l.po po/messages.pot
done
#lupdate-qt5 *.ui -ts mambatray_it.ts