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):
menu = None
def __init__(self, icon, parent=None):
QSystemTrayIcon.__init__(self, icon, parent)
@ -24,14 +26,14 @@ class SystemTrayIcon(QSystemTrayIcon):
nOre = 2
srpm = [
"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"
]
NetsrpmsArg = "-c"
lista = []
contatore = 0
w = parent
menu = QMenu(parent)
self.menu = QMenu(parent)
try:
desktop_session = os.path.basename(os.getenv('DESKTOP_SESSION'))
@ -63,7 +65,7 @@ class SystemTrayIcon(QSystemTrayIcon):
softwareBaseInstallsProcess = 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.triggered.connect(self.softwareManager)
@ -81,7 +83,7 @@ class SystemTrayIcon(QSystemTrayIcon):
networkFirewallConfigureProcess = QProcess(self)
networkProxyProcess = QProcess(self)
networkMenu = menu.addMenu(QIcon.fromTheme("preferences-system-network"),
networkMenu = self.menu.addMenu(QIcon.fromTheme("preferences-system-network"),
_("Network"))
networkFirewallMenu = networkMenu.addMenu(QIcon.fromTheme("security-medium"),_("Firewall"))
networkFirewallDisableAction = networkFirewallMenu.addAction(QIcon.fromTheme("security-low"),_("Disable"))
@ -97,13 +99,13 @@ class SystemTrayIcon(QSystemTrayIcon):
SRPMUpdateProcess.finished.connect(self.SRPMSCheckUpgrade)
# about box
aboutAction = menu.addSeparator()
aboutAction = menu.addAction(QIcon.fromTheme("help-about"),_("About"))
aboutAction = self.menu.addSeparator()
aboutAction = self.menu.addAction(QIcon.fromTheme("help-about"),_("About"))
aboutAction.triggered.connect(self.about)
self.setToolTip(_("openmamba control center"))
self.activated.connect(self.iconActivated)
self.setContextMenu(menu)
self.setContextMenu(self.menu)
self.show()
# the first time refresh packages cache after 5 minutes
@ -140,7 +142,7 @@ class SystemTrayIcon(QSystemTrayIcon):
v.close()
else:
version = _("Error: Unable to find /etc/openmamba-release")
QMessageBox.about(menu, _("About"),
QMessageBox.about(self.menu, _("About"),
"<center><b>"+_("openmamba control center")+"</b>"
"<br><br>Copyright(c) 2011-2019 by Silvan Calarco"
"<br>Copyright(c) 2011 by michiamophil"
@ -162,7 +164,8 @@ class SystemTrayIcon(QSystemTrayIcon):
def softwareManager(self):
#self.setProxyForSmart()
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':
softwareManagerProcess.execute("/opt/kde/bin/apper")
else:
@ -180,7 +183,7 @@ class SystemTrayIcon(QSystemTrayIcon):
def refreshPackagesCache(self):
#self.setProxyForSmart()
refreshPackagesTimer.stop()
refreshPackagesCacheProcess.start("/usr/bin/pkcon", ['refresh'])
refreshPackagesCacheProcess.start("/usr/bin/pkcon", ['refresh', 'force'])
def restartRefreshPackagesTimer(self,status):
# check every 4 hours and 31 minutes */
@ -251,7 +254,7 @@ class SystemTrayIcon(QSystemTrayIcon):
global NetsrpmsArg, lista
if not 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:
NetsrpmsArg = '-u'
self.SRPMSCheckUpgradeList()