From b8ca5347d19cf4b6f67f85074f9ae97dad89c336 Mon Sep 17 00:00:00 2001 From: Papoteur Date: Sat, 25 Jul 2020 12:49:17 +0200 Subject: Keep only one sum checking --- mageiaSync/mageiaSyncExt.py | 7 ------- mageiaSync/mageiasync.py | 47 +++++++-------------------------------------- 2 files changed, 7 insertions(+), 47 deletions(-) (limited to 'mageiaSync') diff --git a/mageiaSync/mageiaSyncExt.py b/mageiaSync/mageiaSyncExt.py index 88703f3..ff4ebaa 100644 --- a/mageiaSync/mageiaSyncExt.py +++ b/mageiaSync/mageiaSyncExt.py @@ -11,7 +11,6 @@ from subprocess import Popen, PIPE from PyQt5.QtCore import QDir, QFileInfo,pyqtSignal,QThread class checkThread(QThread): - md5Signal = pyqtSignal(int) sha512Signal= pyqtSignal(int) dateSignal=pyqtSignal(int) sizeFinalSignal=pyqtSignal(int,str) @@ -25,8 +24,6 @@ class checkThread(QThread): checkvalue=0 if sumType=='sha512': hashfunc = hashlib.sha512() - if sumType=='md5': - hashfunc = hashlib.md5() # Check if the sum file has a valid signature gpg = gnupg.GPG() gpg.encoding = 'utf-8' @@ -75,10 +72,6 @@ class checkThread(QThread): signal=200+self.isoIndex isoSize=QFileInfo(str(self.destination)+'/'+self.path+'/' +self.name).size() self.sizeFinalSignal.emit(signal, '{:,}'.format(isoSize).replace(',',' ')) - signal=400+self.isoIndex - self.checkStartSignal.emit(signal) - checkMd5=self.processSum('md5') - self.md5Signal.emit(self.isoIndex+checkMd5) signal=300+self.isoIndex self.checkStartSignal.emit(signal) checkSha=self.processSum('sha512') diff --git a/mageiaSync/mageiasync.py b/mageiaSync/mageiasync.py index 330ceef..82e7d83 100644 --- a/mageiaSync/mageiasync.py +++ b/mageiaSync/mageiasync.py @@ -126,8 +126,8 @@ class IsosViewer(QMainWindow, mageiaSyncUI.Ui_mainWindow): self.checkThreads=[] # A list of thread for each iso # Model for local list view in a table - self.model = QStandardItemModel(0, 5, self) - headers=[self.tr("Directory"),self.tr("Name"),self.tr("Size"),"SHA512","MD5"] + self.model = QStandardItemModel(0, 4, self) + headers=[self.tr("Directory"),self.tr("Name"),self.tr("Size"),"SHA512"] i=0 for label in headers: self.model.setHeaderData(i, QtCore.Qt.Horizontal,label ) @@ -143,9 +143,9 @@ class IsosViewer(QMainWindow, mageiaSyncUI.Ui_mainWindow): # settings for the local list view self.localList.setModel(self.model) - self.localList.setColumnWidth(0,230) - self.localList.setColumnWidth(1,230) - self.localList.setColumnWidth(2,140) + self.localList.setColumnWidth(0,160) + self.localList.setColumnWidth(1,350) + self.localList.setColumnWidth(2,120) self.localList.horizontalHeader().setStretchLastSection(True) self.localList.setSelectionMode(0) # NoSelection # settings for local iso names management @@ -154,7 +154,7 @@ class IsosViewer(QMainWindow, mageiaSyncUI.Ui_mainWindow): # settings for the remote list view self.listIsos.setModel(self.modelRemote) self.listIsos.setColumnWidth(0,160) - self.listIsos.setColumnWidth(1,350) + self.listIsos.setColumnWidth(1,340) self.listIsos.setColumnWidth(2,120) self.listIsos.horizontalHeader().setStretchLastSection(True) self.listIsos.setSelectionMode(2) # MultiSelection @@ -195,9 +195,7 @@ class IsosViewer(QMainWindow, mageiaSyncUI.Ui_mainWindow): itemSize.setTextAlignment(QtCore.Qt.AlignVCenter|QtCore.Qt.AlignHCenter) itemCheck1=QStandardItem("--") itemCheck1.setTextAlignment(QtCore.Qt.AlignVCenter|QtCore.Qt.AlignHCenter) - itemCheck5=QStandardItem("--") - itemCheck5.setTextAlignment(QtCore.Qt.AlignVCenter|QtCore.Qt.AlignHCenter) - self.model.appendRow([itemPath,itemIso,itemSize,itemCheck1, itemCheck5,]) + self.model.appendRow([itemPath,itemIso,itemSize,itemCheck1, ]) self.localListNames.append([path,iso]) def setProgress(self, value): @@ -244,7 +242,6 @@ class IsosViewer(QMainWindow, mageiaSyncUI.Ui_mainWindow): self.model.data(self.model.index(isoIndex,0)) , self.model.data(self.model.index(isoIndex,1)), isoIndex) - self.checkThreads[-1].md5Signal.connect(self.md5Check) self.checkThreads[-1].sha512Signal.connect(self.sha512Check) # self.checkThreads[-1].dateSignal.connect(self.dateCheck) self.checkThreads[-1].sizeFinalSignal.connect(self.sizeUpdate) @@ -258,36 +255,6 @@ class IsosViewer(QMainWindow, mageiaSyncUI.Ui_mainWindow): row=isoIndex-col*100 self.model.setData(self.model.index(row, col, QtCore.QModelIndex()), self.tr("Checking")) - def md5Check(self,check): - verified=False - signed=True - if check>=128: - val=self.tr("OK") - row=check-128 - if row >= 64: - verified=True - row -= 64 - if row >= 32: - row -= 32 - signed=False - else: - val=self.tr("Failed") - row=check - if row >= 64: - verified=True - row -= 64 - if row >=32: - signed=False - row-=32 - if not signed: - print("Row: ", row) - self.lvMessage("Signature for %s.md5 not found"%self.model.data(self.model.index(row,1))) - if verified: - # we add an icon for the GPG key - self.model.setData(self.model.index(row, 4, QtCore.QModelIndex()),QIcon("preflight-verifier"),1) - self.lvMessage("MD5 Signature OK") - self.model.setData(self.model.index(row, 4, QtCore.QModelIndex()), val) - def sha512Check(self,check): verified=False signed=True -- cgit v1.2.1