Added option to dump GPT and check all partitions. Progress bar is not fully displaying 100% ok yet though..

This commit is contained in:
cygnusx 2021-12-27 16:26:53 +01:00
parent 569afd2238
commit d6f7186fc8
3 changed files with 97 additions and 30 deletions

View file

@ -51,6 +51,15 @@ class ReadFlashWindow(QDialog):
def dumpPartDone(self):
self.sendToLogSignal.emit("dump done!")
def selectAll(self):
if self.ui.SelectAllCheckbox.isChecked():
for partition in self.partitionCheckboxes:
self.partitionCheckboxes[partition]['box'].setChecked(True);
else:
for partition in self.partitionCheckboxes:
self.partitionCheckboxes[partition]['box'].setChecked(False);
def dumpPartition(self):
self.ui.startBtn.setEnabled(False)
self.dumpFolder = str(QFileDialog.getExistingDirectory(self, "Select output directory"))
@ -94,6 +103,17 @@ class ReadFlashWindow(QDialog):
self.da_handler.handle_da_cmds(self.mtkClass, "r", variables)
self.dumpStatus["allPartitions"][partition]['done'] = True
# MtkTool.cmd_stage(mtkClass, None, None, None, False)
if self.ui.DumpGPTCheckbox.isChecked():
#also dump the GPT
variables = mock.Mock()
variables.directory = self.dumpFolder
variables.parttype = None
self.dumpStatus["allPartitions"]["GPT"] = {};
self.dumpStatus["allPartitions"]["GPT"]['size'] = 17;
self.dumpStatus["currentPartition"] = "GPT"
self.da_handler.close = self.dumpPartDone # Ignore the normally used sys.exit
self.da_handler.handle_da_cmds(self.mtkClass, "gpt", variables)
self.dumpStatus["allPartitions"]["GPT"]['done'] = True
self.dumpStatus["done"] = True
thread.wait()
@ -137,5 +157,6 @@ class ReadFlashWindow(QDialog):
partitionListWidgetVBox.addWidget(self.partitionCheckboxes[partition.name]['box'])
self.ui.startBtn.clicked.connect(self.dumpPartition)
self.ui.SelectAllCheckbox.clicked.connect(self.selectAll);
self.ui.closeBtn.clicked.connect(self.close)
self.show()

View file

@ -22,30 +22,43 @@ class Ui_partitionListWidget(object):
self.gridLayout.setSpacing(0)
self.gridLayout.setObjectName(u"gridLayout")
self.gridLayout.setContentsMargins(-1, 8, -1, 8)
self.verticalSpacer_3 = QSpacerItem(20, 5, QSizePolicy.Minimum, QSizePolicy.Fixed)
self.gridLayout.addItem(self.verticalSpacer_3, 1, 0, 1, 1)
self.verticalSpacer_4 = QSpacerItem(20, 10, QSizePolicy.Minimum, QSizePolicy.Fixed)
self.gridLayout.addItem(self.verticalSpacer_4, 6, 0, 1, 1)
self.DumpGPTCheckbox = QCheckBox(partitionListWidget)
self.DumpGPTCheckbox.setObjectName(u"DumpGPTCheckbox")
self.gridLayout.addWidget(self.DumpGPTCheckbox, 5, 0, 1, 1)
self.verticalSpacer = QSpacerItem(20, 10, QSizePolicy.Minimum, QSizePolicy.Fixed)
self.gridLayout.addItem(self.verticalSpacer, 3, 0, 1, 1)
self.verticalSpacer_2 = QSpacerItem(20, 10, QSizePolicy.Minimum, QSizePolicy.Fixed)
self.gridLayout.addItem(self.verticalSpacer_2, 8, 0, 1, 1)
self.gridLayout.addItem(self.verticalSpacer_2, 11, 0, 1, 1)
self.partProgressText = QLabel(partitionListWidget)
self.partProgressText.setObjectName(u"partProgressText")
self.gridLayout.addWidget(self.partProgressText, 4, 0, 1, 1)
self.gridLayout.addWidget(self.partProgressText, 7, 0, 1, 1)
self.partProgress = QProgressBar(partitionListWidget)
self.partProgress.setObjectName(u"partProgress")
self.partProgress.setValue(0)
self.gridLayout.addWidget(self.partProgress, 5, 0, 1, 1)
self.gridLayout.addWidget(self.partProgress, 8, 0, 1, 1)
self.fullProgress = QProgressBar(partitionListWidget)
self.fullProgress.setObjectName(u"fullProgress")
self.fullProgress.setValue(0)
self.gridLayout.addWidget(self.fullProgress, 7, 0, 1, 1)
self.gridLayout.addWidget(self.fullProgress, 10, 0, 1, 1)
self.partitionList = QScrollArea(partitionListWidget)
self.partitionList.setObjectName(u"partitionList")
@ -55,7 +68,7 @@ class Ui_partitionListWidget(object):
self.partitionList.setWidgetResizable(True)
self.scrollAreaWidgetContents = QWidget()
self.scrollAreaWidgetContents.setObjectName(u"scrollAreaWidgetContents")
self.scrollAreaWidgetContents.setGeometry(QRect(0, 0, 376, 436))
self.scrollAreaWidgetContents.setGeometry(QRect(0, 0, 376, 394))
self.partitionList.setWidget(self.scrollAreaWidgetContents)
self.gridLayout.addWidget(self.partitionList, 2, 0, 1, 1)
@ -63,7 +76,7 @@ class Ui_partitionListWidget(object):
self.fullProgressText = QLabel(partitionListWidget)
self.fullProgressText.setObjectName(u"fullProgressText")
self.gridLayout.addWidget(self.fullProgressText, 6, 0, 1, 1)
self.gridLayout.addWidget(self.fullProgressText, 9, 0, 1, 1)
self.horizontalLayout = QHBoxLayout()
self.horizontalLayout.setObjectName(u"horizontalLayout")
@ -82,7 +95,7 @@ class Ui_partitionListWidget(object):
self.horizontalLayout.addWidget(self.closeBtn)
self.gridLayout.addLayout(self.horizontalLayout, 9, 0, 1, 1)
self.gridLayout.addLayout(self.horizontalLayout, 12, 0, 1, 1)
self.title = QLabel(partitionListWidget)
self.title.setObjectName(u"title")
@ -90,9 +103,10 @@ class Ui_partitionListWidget(object):
self.gridLayout.addWidget(self.title, 0, 0, 1, 1)
self.verticalSpacer_3 = QSpacerItem(20, 5, QSizePolicy.Minimum, QSizePolicy.Fixed)
self.SelectAllCheckbox = QCheckBox(partitionListWidget)
self.SelectAllCheckbox.setObjectName(u"SelectAllCheckbox")
self.gridLayout.addItem(self.verticalSpacer_3, 1, 0, 1, 1)
self.gridLayout.addWidget(self.SelectAllCheckbox, 4, 0, 1, 1)
self.retranslateUi(partitionListWidget)
@ -102,10 +116,12 @@ class Ui_partitionListWidget(object):
def retranslateUi(self, partitionListWidget):
partitionListWidget.setWindowTitle(QCoreApplication.translate("partitionListWidget", u"Read partition(s)", None))
self.DumpGPTCheckbox.setText(QCoreApplication.translate("partitionListWidget", u"Dump GPT", None))
self.partProgressText.setText(QCoreApplication.translate("partitionListWidget", u"Ready to start...", None))
self.fullProgressText.setText("")
self.startBtn.setText(QCoreApplication.translate("partitionListWidget", u"Start", None))
self.closeBtn.setText(QCoreApplication.translate("partitionListWidget", u"Close", None))
self.title.setText(QCoreApplication.translate("partitionListWidget", u"Select partitions to read", None))
self.SelectAllCheckbox.setText(QCoreApplication.translate("partitionListWidget", u"Select all", None))
# retranslateUi

View file

@ -23,6 +23,45 @@
<property name="spacing">
<number>0</number>
</property>
<item row="1" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="0">
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="DumpGPTCheckbox">
<property name="text">
<string>Dump GPT</string>
</property>
</widget>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
@ -39,7 +78,7 @@
</property>
</spacer>
</item>
<item row="8" column="0">
<item row="11" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -55,21 +94,21 @@
</property>
</spacer>
</item>
<item row="4" column="0">
<item row="7" column="0">
<widget class="QLabel" name="partProgressText">
<property name="text">
<string>Ready to start...</string>
</property>
</widget>
</item>
<item row="5" column="0">
<item row="8" column="0">
<widget class="QProgressBar" name="partProgress">
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="7" column="0">
<item row="10" column="0">
<widget class="QProgressBar" name="fullProgress">
<property name="value">
<number>0</number>
@ -96,20 +135,20 @@
<x>0</x>
<y>0</y>
<width>376</width>
<height>436</height>
<height>394</height>
</rect>
</property>
</widget>
</widget>
</item>
<item row="6" column="0">
<item row="9" column="0">
<widget class="QLabel" name="fullProgressText">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="9" column="0">
<item row="12" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="startBtn">
@ -150,21 +189,12 @@
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
<item row="4" column="0">
<widget class="QCheckBox" name="SelectAllCheckbox">
<property name="text">
<string>Select all</string>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>5</height>
</size>
</property>
</spacer>
</widget>
</item>
</layout>
</widget>