mambabase: scanning packages in welcome page with progress bar
This commit is contained in:
parent
0d81a89138
commit
2ee7762745
@ -144,17 +144,30 @@
|
|||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QLabel" name="label_5">
|
<widget class="QLabel" name="progressLabel">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>10</x>
|
<x>10</x>
|
||||||
<y>180</y>
|
<y>180</y>
|
||||||
<width>321</width>
|
<width>531</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><html><head/><body><p><span style=" font-weight:600;">Please, press the Next button to continue.</span></p></body></html></string>
|
<string><html><head/><body><p><br/></p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QProgressBar" name="progressBar">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>150</y>
|
||||||
|
<width>531</width>
|
||||||
|
<height>23</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -18,6 +18,61 @@ from gi.repository import PackageKitGlib as packagekit
|
|||||||
|
|
||||||
DATADIR = os.path.dirname(os.path.realpath((__file__))) + "/"
|
DATADIR = os.path.dirname(os.path.realpath((__file__))) + "/"
|
||||||
|
|
||||||
|
|
||||||
|
class MambabaseWizard(QtWidgets.QWizard):
|
||||||
|
def __init__(self, parent=None):
|
||||||
|
super(MambabaseWizard, self).__init__(parent)
|
||||||
|
self.welcomePage = WelcomePage(self)
|
||||||
|
self.addPage(self.welcomePage)
|
||||||
|
self.selectGroupsPage = SelectGroupsPage(self)
|
||||||
|
self.addPage(self.selectGroupsPage)
|
||||||
|
self.selectExtraPage = SelectExtraPage(self)
|
||||||
|
self.addPage(self.selectExtraPage)
|
||||||
|
self.installationPage = InstallationPage(self)
|
||||||
|
self.addPage(self.installationPage)
|
||||||
|
self.finishPage = FinishPage(self)
|
||||||
|
self.addPage(self.finishPage)
|
||||||
|
self.setWindowTitle(_("openmamba base network installations") +
|
||||||
|
" - openmamba.org")
|
||||||
|
self.setFixedSize(571,465)
|
||||||
|
self.currentIdChanged.connect(self.currentIdChangedSlot)
|
||||||
|
self.prepareThread = PrepareThread(self)
|
||||||
|
self.installThread = InstallThread(self, self.selectGroupsPage.pkggroups)
|
||||||
|
|
||||||
|
def currentIdChangedSlot(self, currentId):
|
||||||
|
if currentId == 0:
|
||||||
|
self.prepareThread.start()
|
||||||
|
elif currentId == 3:
|
||||||
|
self.installThread.start()
|
||||||
|
|
||||||
|
|
||||||
|
class PrepareThread(QtCore.QThread):
|
||||||
|
parent = None
|
||||||
|
doneSignal = QtCore.pyqtSignal()
|
||||||
|
updateProgressSignal = QtCore.pyqtSignal(dict)
|
||||||
|
|
||||||
|
def __init__(self, parent=None):
|
||||||
|
super(PrepareThread, self).__init__(parent)
|
||||||
|
self.parent = parent
|
||||||
|
self.doneSignal.connect(parent.welcomePage.completeChanged)
|
||||||
|
self.updateProgressSignal.connect(
|
||||||
|
parent.welcomePage.updateProgressSlot)
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
# Update packages list
|
||||||
|
self.updateProgressSignal.emit({ 'value': 5,
|
||||||
|
'label': _("Checking installed packages...")})
|
||||||
|
self.parent.selectGroupsPage.loadPkgGroups()
|
||||||
|
self.updateProgressSignal.emit({ 'value': 55,
|
||||||
|
'label': _("Checking installed extra components...")})
|
||||||
|
self.parent.selectExtraPage.setExtras()
|
||||||
|
self.updateProgressSignal.emit({ 'value': 100,
|
||||||
|
'label': _("Done. Please, press the Next button to continue.")})
|
||||||
|
# Enable back and next buttons
|
||||||
|
self.parent.welcomePage.done = True
|
||||||
|
self.doneSignal.emit()
|
||||||
|
|
||||||
|
|
||||||
class InstallThread(QtCore.QThread):
|
class InstallThread(QtCore.QThread):
|
||||||
parent = None
|
parent = None
|
||||||
doneSignal = QtCore.pyqtSignal()
|
doneSignal = QtCore.pyqtSignal()
|
||||||
@ -62,7 +117,7 @@ class InstallThread(QtCore.QThread):
|
|||||||
self.updateProgressSignal.emit({ 'value': 10,
|
self.updateProgressSignal.emit({ 'value': 10,
|
||||||
'label': _("Updating installed packages...")})
|
'label': _("Updating installed packages...")})
|
||||||
|
|
||||||
result = subprocess.run(['pkcon', 'update'],
|
result = subprocess.run(['pkcon', 'update', '-y'],
|
||||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
if result.returncode == 0:
|
if result.returncode == 0:
|
||||||
if result.stdout:
|
if result.stdout:
|
||||||
@ -144,35 +199,24 @@ class InstallThread(QtCore.QThread):
|
|||||||
str(status.get_percentage())))})
|
str(status.get_percentage())))})
|
||||||
|
|
||||||
|
|
||||||
class MambabaseWizard(QtWidgets.QWizard):
|
|
||||||
def __init__(self, parent=None):
|
|
||||||
super(MambabaseWizard, self).__init__(parent)
|
|
||||||
self.addPage(WelcomePage(self))
|
|
||||||
self.selectGroupsPage = SelectGroupsPage(self)
|
|
||||||
self.addPage(self.selectGroupsPage)
|
|
||||||
self.selectExtraPage = SelectExtraPage(self)
|
|
||||||
self.addPage(self.selectExtraPage)
|
|
||||||
self.installationPage = InstallationPage(self)
|
|
||||||
self.addPage(self.installationPage)
|
|
||||||
self.finishPage = FinishPage(self)
|
|
||||||
self.addPage(self.finishPage)
|
|
||||||
self.setWindowTitle(_("openmamba base network installations") +
|
|
||||||
" - openmamba.org")
|
|
||||||
self.setFixedSize(571,465)
|
|
||||||
self.currentIdChanged.connect(self.currentIdChangedSlot)
|
|
||||||
self.installThread = InstallThread(self, self.selectGroupsPage.pkggroups)
|
|
||||||
|
|
||||||
def currentIdChangedSlot(self, currentId):
|
|
||||||
if currentId == 3:
|
|
||||||
self.installThread.start()
|
|
||||||
|
|
||||||
|
|
||||||
class WelcomePage(QtWidgets.QWizardPage):
|
class WelcomePage(QtWidgets.QWizardPage):
|
||||||
|
done = False
|
||||||
|
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super(WelcomePage, self).__init__(parent)
|
super(WelcomePage, self).__init__(parent)
|
||||||
uic.loadUi(DATADIR + "WelcomePage.ui", self)
|
uic.loadUi(DATADIR + "WelcomePage.ui", self)
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
|
def isComplete(self):
|
||||||
|
return self.done
|
||||||
|
|
||||||
|
@QtCore.pyqtSlot(dict)
|
||||||
|
def updateProgressSlot(self, dict):
|
||||||
|
if 'value' in dict:
|
||||||
|
self.progressBar.setValue(dict['value'])
|
||||||
|
if 'label' in dict:
|
||||||
|
self.progressLabel.setText(dict['label'])
|
||||||
|
|
||||||
|
|
||||||
class SelectGroupsPage(QtWidgets.QWizardPage):
|
class SelectGroupsPage(QtWidgets.QWizardPage):
|
||||||
groups_checkboxes = {}
|
groups_checkboxes = {}
|
||||||
@ -181,7 +225,6 @@ class SelectGroupsPage(QtWidgets.QWizardPage):
|
|||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super(SelectGroupsPage, self).__init__(parent)
|
super(SelectGroupsPage, self).__init__(parent)
|
||||||
uic.loadUi(DATADIR + "SelectGroupsPage.ui", self)
|
uic.loadUi(DATADIR + "SelectGroupsPage.ui", self)
|
||||||
self.loadPkgGroups()
|
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
def loadPkgGroups(self):
|
def loadPkgGroups(self):
|
||||||
@ -240,7 +283,6 @@ class SelectExtraPage(QtWidgets.QWizardPage):
|
|||||||
super(SelectExtraPage, self).__init__(parent)
|
super(SelectExtraPage, self).__init__(parent)
|
||||||
uic.loadUi(DATADIR + "SelectExtraPage.ui", self)
|
uic.loadUi(DATADIR + "SelectExtraPage.ui", self)
|
||||||
self.setCommitPage(True)
|
self.setCommitPage(True)
|
||||||
self.setExtras()
|
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
def setExtras(self):
|
def setExtras(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user