Call 'pkcon refresh' with force argument to workaround PackageKit not refreshing since rpm 4

sun-java7, sun-java8: replaced by sun-java
Fix crashes
This commit is contained in:
Silvan Calarco 2019-07-12 13:08:41 +02:00
parent 2d44c33365
commit 9444b6052d

View File

@ -17,6 +17,8 @@ from PyQt5.QtCore import QTimer, QProcess
class SystemTrayIcon(QSystemTrayIcon): class SystemTrayIcon(QSystemTrayIcon):
menu = None
def __init__(self, icon, parent=None): def __init__(self, icon, parent=None):
QSystemTrayIcon.__init__(self, icon, parent) QSystemTrayIcon.__init__(self, icon, parent)
@ -24,14 +26,14 @@ class SystemTrayIcon(QSystemTrayIcon):
nOre = 2 nOre = 2
srpm = [ srpm = [
"skype", "flashplugin", "win32codecs", "msttcorefonts", "b43-firmware", "skype", "flashplugin", "win32codecs", "msttcorefonts", "b43-firmware",
"sun-java7", "sun-java8", "virtualbox-extension-pack", "chromium-pepper-flash", "sun-java", "virtualbox-extension-pack", "chromium-pepper-flash",
"spotify" "spotify"
] ]
NetsrpmsArg = "-c" NetsrpmsArg = "-c"
lista = [] lista = []
contatore = 0 contatore = 0
w = parent w = parent
menu = QMenu(parent) self.menu = QMenu(parent)
try: try:
desktop_session = os.path.basename(os.getenv('DESKTOP_SESSION')) desktop_session = os.path.basename(os.getenv('DESKTOP_SESSION'))
@ -63,7 +65,7 @@ class SystemTrayIcon(QSystemTrayIcon):
softwareBaseInstallsProcess = QProcess(self) softwareBaseInstallsProcess = QProcess(self)
dcopServerProcess = QProcess(self) dcopServerProcess = QProcess(self)
softwareMenu = menu.addMenu(QIcon.fromTheme("applications-system"),_("Software")) softwareMenu = self.menu.addMenu(QIcon.fromTheme("applications-system"),_("Software"))
softwareManageAction = softwareMenu.addAction(QIcon.fromTheme("applications-other"),_("Add/Remove software packages...")) softwareManageAction = softwareMenu.addAction(QIcon.fromTheme("applications-other"),_("Add/Remove software packages..."))
softwareManageAction.triggered.connect(self.softwareManager) softwareManageAction.triggered.connect(self.softwareManager)
@ -81,7 +83,7 @@ class SystemTrayIcon(QSystemTrayIcon):
networkFirewallConfigureProcess = QProcess(self) networkFirewallConfigureProcess = QProcess(self)
networkProxyProcess = QProcess(self) networkProxyProcess = QProcess(self)
networkMenu = menu.addMenu(QIcon.fromTheme("preferences-system-network"), networkMenu = self.menu.addMenu(QIcon.fromTheme("preferences-system-network"),
_("Network")) _("Network"))
networkFirewallMenu = networkMenu.addMenu(QIcon.fromTheme("security-medium"),_("Firewall")) networkFirewallMenu = networkMenu.addMenu(QIcon.fromTheme("security-medium"),_("Firewall"))
networkFirewallDisableAction = networkFirewallMenu.addAction(QIcon.fromTheme("security-low"),_("Disable")) networkFirewallDisableAction = networkFirewallMenu.addAction(QIcon.fromTheme("security-low"),_("Disable"))
@ -97,13 +99,13 @@ class SystemTrayIcon(QSystemTrayIcon):
SRPMUpdateProcess.finished.connect(self.SRPMSCheckUpgrade) SRPMUpdateProcess.finished.connect(self.SRPMSCheckUpgrade)
# about box # about box
aboutAction = menu.addSeparator() aboutAction = self.menu.addSeparator()
aboutAction = menu.addAction(QIcon.fromTheme("help-about"),_("About")) aboutAction = self.menu.addAction(QIcon.fromTheme("help-about"),_("About"))
aboutAction.triggered.connect(self.about) aboutAction.triggered.connect(self.about)
self.setToolTip(_("openmamba control center")) self.setToolTip(_("openmamba control center"))
self.activated.connect(self.iconActivated) self.activated.connect(self.iconActivated)
self.setContextMenu(menu) self.setContextMenu(self.menu)
self.show() self.show()
# the first time refresh packages cache after 5 minutes # the first time refresh packages cache after 5 minutes
@ -140,7 +142,7 @@ class SystemTrayIcon(QSystemTrayIcon):
v.close() v.close()
else: else:
version = _("Error: Unable to find /etc/openmamba-release") version = _("Error: Unable to find /etc/openmamba-release")
QMessageBox.about(menu, _("About"), QMessageBox.about(self.menu, _("About"),
"<center><b>"+_("openmamba control center")+"</b>" "<center><b>"+_("openmamba control center")+"</b>"
"<br><br>Copyright(c) 2011-2019 by Silvan Calarco" "<br><br>Copyright(c) 2011-2019 by Silvan Calarco"
"<br>Copyright(c) 2011 by michiamophil" "<br>Copyright(c) 2011 by michiamophil"
@ -162,7 +164,8 @@ class SystemTrayIcon(QSystemTrayIcon):
def softwareManager(self): def softwareManager(self):
#self.setProxyForSmart() #self.setProxyForSmart()
if desktop_session == 'plasma': if desktop_session == 'plasma':
softwareManagerProcess.execute("/usr/bin/plasma-discover", ['--mode', 'Browsing']) #softwareManagerProcess.execute("/usr/bin/plasma-discover", ['--mode', 'Browsing'])
softwareManagerProcess.execute("/usr/bin/apper")
elif desktop_session == 'kde': elif desktop_session == 'kde':
softwareManagerProcess.execute("/opt/kde/bin/apper") softwareManagerProcess.execute("/opt/kde/bin/apper")
else: else:
@ -180,7 +183,7 @@ class SystemTrayIcon(QSystemTrayIcon):
def refreshPackagesCache(self): def refreshPackagesCache(self):
#self.setProxyForSmart() #self.setProxyForSmart()
refreshPackagesTimer.stop() refreshPackagesTimer.stop()
refreshPackagesCacheProcess.start("/usr/bin/pkcon", ['refresh']) refreshPackagesCacheProcess.start("/usr/bin/pkcon", ['refresh', 'force'])
def restartRefreshPackagesTimer(self,status): def restartRefreshPackagesTimer(self,status):
# check every 4 hours and 31 minutes */ # check every 4 hours and 31 minutes */
@ -251,7 +254,7 @@ class SystemTrayIcon(QSystemTrayIcon):
global NetsrpmsArg, lista global NetsrpmsArg, lista
if not lista == []: if not lista == []:
Lista = self.Lista() Lista = self.Lista()
msg = QMessageBox.question(menu, (_("Not Open Source openmamba components")), (_("The following components are available for update: ") + "\n\n" + Lista + "\n\n" + _("Ok to proceed?")), QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes) msg = QMessageBox.question(self.menu, (_("Not Open Source openmamba components")), (_("The following components are available for update: ") + "\n\n" + Lista + "\n\n" + _("Ok to proceed?")), QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes)
if msg == QMessageBox.Yes: if msg == QMessageBox.Yes:
NetsrpmsArg = '-u' NetsrpmsArg = '-u'
self.SRPMSCheckUpgradeList() self.SRPMSCheckUpgradeList()