mambabase.py: refresh packages list before checking for installed packages to fix crash on first run

This commit is contained in:
Silvan Calarco 2024-09-21 14:37:40 +02:00
parent e9e9d48e79
commit bb57dc7095

View File

@ -65,6 +65,19 @@ class PrepareThread(QtCore.QThread):
def run(self): def run(self):
# Update packages list # Update packages list
self.updateProgressSignal.emit({ 'value': 5,
'label': _("Updating packages list..."),
'details': _("Updating packages list...")})
result = subprocess.run(['pkcon', 'refresh'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
if result.returncode == 0:
if result.stdout:
self.updateProgressSignal.emit({
'details': result.stdout.decode('UTF-8').replace('\n', '<br/>')})
else:
if result.stderr:
self.updateProgressSignal.emit({
'details': result.stderr.decode('UTF-8').replace('\n', '<br/>')})
self.updateProgressSignal.emit({ 'value': 5, self.updateProgressSignal.emit({ 'value': 5,
'label': _("Checking installed packages...")}) 'label': _("Checking installed packages...")})
self.parent.selectGroupsPage.loadPkgGroups() self.parent.selectGroupsPage.loadPkgGroups()