From d7a7e5df2de2cb68b3c75dbf7ca9dbd2218291ab Mon Sep 17 00:00:00 2001 From: papoteur-mga Date: Tue, 28 Oct 2014 21:19:05 +0100 Subject: Correction of check being launched after stopping. Added shortcuts. Added new feature : launching checks on demand Correction of size display Added "Quit" button Correction of the icon --- CHANGELOG | 8 ++ mageiaSync/mageiaSyncExt.py | 4 +- mageiaSync/mageiaSyncUI.py | 39 +++++++--- mageiaSync/mageiaSyncUI.ui | 51 ++++++++++--- mageiaSync/mageiasync.py | 31 +++++++- share/icons/mageiasync.png | Bin 0 -> 1987 bytes share/icons/mageiasync.svg | 179 ++++++++++++++++++++++++-------------------- 7 files changed, 203 insertions(+), 109 deletions(-) create mode 100644 share/icons/mageiasync.png diff --git a/CHANGELOG b/CHANGELOG index bb685e2..1e68a84 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,13 @@ The modifications are: + - added shortcuts. + - added new feature : launching checks on demand + - corrected size display + - Correction of check being launched after stopping + - Correction : Reset the remaining field when stopped + - Added "Quit" button + - Correction of the icon + mageiasync 0.1.1 ------------ - bugfix: change the rename dialog box which was not synced. diff --git a/mageiaSync/mageiaSyncExt.py b/mageiaSync/mageiaSyncExt.py index 135d80c..ebd224f 100644 --- a/mageiaSync/mageiaSyncExt.py +++ b/mageiaSync/mageiaSyncExt.py @@ -122,6 +122,7 @@ class syncThread(QThread): try: self.process.terminate() self.lvM.emit("Process rsync stopped") + self.list=[] except: self.lvM.emit("Process rsync already stopped") # Init progressbar and speed counter @@ -186,9 +187,10 @@ class syncThread(QThread): if self.process.returncode != None: break self.lvM.emit("Ending with "+iso['nameWithPath']) - self.checkSignal.emit(iso['row']) if self.stopped: break + else: + self.checkSignal.emit(iso['row']) self.endSignal.emit(0) self.speedSignal.emit(0) self.progressSignal.emit(0) diff --git a/mageiaSync/mageiaSyncUI.py b/mageiaSync/mageiaSyncUI.py index fed1972..6ed3175 100644 --- a/mageiaSync/mageiaSyncUI.py +++ b/mageiaSync/mageiaSyncUI.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'mageiaSyncUI.ui' # -# Created: Sat Aug 30 20:19:01 2014 +# Created: Sat Nov 22 10:27:11 2014 # by: PyQt5 UI code generator 5.1.1 # # WARNING! All changes made in this file will be lost! @@ -12,7 +12,11 @@ from PyQt5 import QtCore, QtGui, QtWidgets class Ui_mainWindow(object): def setupUi(self, mainWindow): mainWindow.setObjectName("mainWindow") - mainWindow.resize(862, 587) + mainWindow.resize(820, 587) + icon = QtGui.QIcon() + icon.addPixmap(QtGui.QPixmap("share/icons/mageiasync.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + mainWindow.setWindowIcon(icon) + mainWindow.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) self.centralwidget = QtWidgets.QWidget(mainWindow) self.centralwidget.setObjectName("centralwidget") self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget) @@ -85,6 +89,10 @@ class Ui_mainWindow(object): self.stop.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) self.stop.setObjectName("stop") self.horizontalLayout.addWidget(self.stop) + self.quit = QtWidgets.QPushButton(self.centralwidget) + self.quit.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) + self.quit.setObjectName("quit") + self.horizontalLayout.addWidget(self.quit) self.verticalLayout.addLayout(self.horizontalLayout) self.label = QtWidgets.QLabel(self.centralwidget) self.label.setObjectName("label") @@ -95,12 +103,13 @@ class Ui_mainWindow(object): self.verticalLayout.addWidget(self.lvText) mainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(mainWindow) - self.menubar.setGeometry(QtCore.QRect(0, 0, 862, 19)) + self.menubar.setGeometry(QtCore.QRect(0, 0, 820, 19)) self.menubar.setObjectName("menubar") self.menuFile = QtWidgets.QMenu(self.menubar) self.menuFile.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) self.menuFile.setObjectName("menuFile") self.menuSync = QtWidgets.QMenu(self.menubar) + self.menuSync.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) self.menuSync.setObjectName("menuSync") mainWindow.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(mainWindow) @@ -114,10 +123,13 @@ class Ui_mainWindow(object): self.actionPreferences.setObjectName("actionPreferences") self.actionRename = QtWidgets.QAction(mainWindow) self.actionRename.setObjectName("actionRename") + self.actionCheck = QtWidgets.QAction(mainWindow) + self.actionCheck.setObjectName("actionCheck") self.menuFile.addAction(self.actionUpdate) self.menuFile.addAction(self.actionPreferences) self.menuFile.addAction(self.actionQuit) self.menuSync.addAction(self.actionRename) + self.menuSync.addAction(self.actionCheck) self.menubar.addAction(self.menuFile.menuAction()) self.menubar.addAction(self.menuSync.menuAction()) @@ -130,19 +142,22 @@ class Ui_mainWindow(object): _translate = QtCore.QCoreApplication.translate mainWindow.setWindowTitle(_translate("mainWindow", "MageiaSync")) self.remoteDirLabel.setText(_translate("mainWindow", "Remote directory")) - self.selectAll.setText(_translate("mainWindow", "Select All")) + self.selectAll.setText(_translate("mainWindow", "Select &All")) self.localDirLabel.setText(_translate("mainWindow", "Local directory:")) self.Lsize.setText(_translate("mainWindow", "0 bytes")) self.label_2.setText(_translate("mainWindow", "kB/s")) self.label_3.setText(_translate("mainWindow", "Remaining:")) self.timeRemaining.setDisplayFormat(_translate("mainWindow", "H:mm:ss")) - self.syncGo.setText(_translate("mainWindow", "Do sync")) - self.stop.setText(_translate("mainWindow", "Stop")) + self.syncGo.setText(_translate("mainWindow", "&Do sync")) + self.stop.setText(_translate("mainWindow", "&Stop")) + self.quit.setText(_translate("mainWindow", "&Quit")) self.label.setText(_translate("mainWindow", "Report")) - self.menuFile.setTitle(_translate("mainWindow", "File")) - self.menuSync.setTitle(_translate("mainWindow", "Sync")) - self.actionUpdate.setText(_translate("mainWindow", "Update list")) - self.actionQuit.setText(_translate("mainWindow", "Quit")) - self.actionPreferences.setText(_translate("mainWindow", "Preferences")) - self.actionRename.setText(_translate("mainWindow", "Rename archives")) + self.menuFile.setTitle(_translate("mainWindow", "&File")) + self.menuSync.setTitle(_translate("mainWindow", "S&ync")) + self.actionUpdate.setText(_translate("mainWindow", "&Update list")) + self.actionQuit.setText(_translate("mainWindow", "&Quit")) + self.actionPreferences.setText(_translate("mainWindow", "&Preferences")) + self.actionRename.setText(_translate("mainWindow", "&Rename archives")) + self.actionCheck.setText(_translate("mainWindow", "&Check")) + self.actionCheck.setToolTip(_translate("mainWindow", "Check selected images")) diff --git a/mageiaSync/mageiaSyncUI.ui b/mageiaSync/mageiaSyncUI.ui index a86d314..a9933cd 100644 --- a/mageiaSync/mageiaSyncUI.ui +++ b/mageiaSync/mageiaSyncUI.ui @@ -6,13 +6,20 @@ 0 0 - 862 + 820 587 MageiaSync + + + icons/mageiasync.pngicons/mageiasync.png + + + + @@ -31,7 +38,7 @@ - Select All + Select &All @@ -157,7 +164,7 @@ - Do sync + &Do sync @@ -167,7 +174,17 @@ - Stop + &Stop + + + + + + + + + + &Quit @@ -194,7 +211,7 @@ 0 0 - 862 + 820 19 @@ -203,17 +220,21 @@ - File + &File + + + - Sync + S&ync + @@ -221,22 +242,30 @@ - Update list + &Update list - Quit + &Quit - Preferences + &Preferences - Rename archives + &Rename archives + + + + + &Check + + + Check selected images diff --git a/mageiaSync/mageiasync.py b/mageiaSync/mageiasync.py index 4faf149..07ea7a5 100644 --- a/mageiaSync/mageiasync.py +++ b/mageiaSync/mageiasync.py @@ -150,12 +150,30 @@ class IsosViewer(QMainWindow, mageiaSyncUI.Ui_mainWindow): content=QtCore.QTime.fromString(remainTime,"h:mm:ss") self.timeRemaining.setTime(content) + def manualChecks(self): + for iso in self.listIsos.selectedItems(): + path,name=iso.text().split('/') + try: + # Look for ISO in local list + item=self.model.findItems(name,QtCore.Qt.MatchExactly,1)[0] + except: + # Remote ISO is not yet in local directory. We add it in localList and create the directory + self.localAdd(path,name,0) + basedir=QtCore.QDir(self.destination) + basedir.mkdir(path) + item=self.model.findItems(name,QtCore.Qt.MatchExactly,1)[0] + row=self.model.indexFromItem(item).row() + self.checks(row) + def checks(self,isoIndex): - # process a checking for each iso + # processes a checking for each iso # launches a thread for each iso newThread=mageiaSyncExt.checkThread(self) self.checkThreads.append(newThread) - self.checkThreads[-1].setup(self.destination,self.model.data(self.model.index(isoIndex,0)) ,self.model.data(self.model.index(isoIndex,1)),isoIndex) + self.checkThreads[-1].setup(self.destination, + 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].sha1Signal.connect(self.sha1Check) self.checkThreads[-1].dateSignal.connect(self.dateCheck) @@ -298,17 +316,19 @@ class IsosViewer(QMainWindow, mageiaSyncUI.Ui_mainWindow): if self.selectAllState : for i in range(self.listIsos.count()): self.listIsos.item(i).setSelected(True) - self.selectAll.setText("Unselect all") + self.selectAll.setText("Unselect &All") else: for i in range(self.listIsos.count()): self.listIsos.item(i).setSelected(False) - self.selectAll.setText("Select all") + self.selectAll.setText("Select &All") self.selectAllState=not self.selectAllState def connectActions(self): self.actionQuit.triggered.connect(app.quit) + self.quit.clicked.connect(app.quit) self.actionRename.triggered.connect(self.rename) self.actionUpdate.triggered.connect(self.updateList) + self.actionCheck.triggered.connect(self.manualChecks) self.actionPreferences.triggered.connect(self.prefs) self.syncGo.clicked.connect(self.launchSync) self.selectAll.clicked.connect(self.selectAllIsos) @@ -329,6 +349,9 @@ class IsosViewer(QMainWindow, mageiaSyncUI.Ui_mainWindow): self.fillList.setup(self.nameWithPath, self.password,self.destination) self.fillList.endSignal.connect(self.closeFill) self.fillList.start() + # Reset the button + self.selectAll.setText("Select &All") + self.selectAllState=True def lvMessage( self,message): # Add a line in the logview diff --git a/share/icons/mageiasync.png b/share/icons/mageiasync.png new file mode 100644 index 0000000..00e30f4 Binary files /dev/null and b/share/icons/mageiasync.png differ diff --git a/share/icons/mageiasync.svg b/share/icons/mageiasync.svg index e12be99..88c3cfd 100644 --- a/share/icons/mageiasync.svg +++ b/share/icons/mageiasync.svg @@ -11,12 +11,15 @@ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" id="svg2" - sodipodi:docname="optical_disc_schema.svg" - viewBox="0 0 700 700" + sodipodi:docname="mageiasync.svg" + viewBox="0 0 885.82675 885.82675" version="1.1" inkscape:version="0.48.4 r9939" width="100%" - height="100%"> + height="100%" + inkscape:export-filename="/home/yves/Documents/git/mageiaSync/share/icons/mageiasync.png" + inkscape:export-xdpi="3.2408426" + inkscape:export-ydpi="3.2408426"> + inkscape:document-units="px" + units="cm" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" + width="25cm"> + id="path2816" + inkscape:connector-curvature="0" /> + id="path2818" + inkscape:connector-curvature="0" /> + inkscape:transform-center-y="98.610193" + inkscape:transform-center-x="173.46692" + id="path2977" + inkscape:connector-curvature="0" /> + inkscape:transform-center-x="-123.59545" + id="path2981" + inkscape:connector-curvature="0" /> + inkscape:transform-center-y="-98.610189" + inkscape:transform-center-x="-173.46692" + id="path2985" + inkscape:connector-curvature="0" /> + inkscape:transform-center-x="123.59545" + id="path2943" + inkscape:connector-curvature="0" /> + id="path2820" + inkscape:connector-curvature="0" /> + d="M 432.79412,-1.5388052 C 296.85755,0.18590988 187.18445,110.92628 187.18445,247.27269 c 0,137.41368 111.42343,248.8371 248.83711,248.8371 137.41368,0 248.81149,-111.42342 248.81149,-248.8371 0,-137.41369 -111.38927,-248.8114952 -248.81149,-248.8114952 -1.07359,0 -2.1582,-0.013576 -3.22846,0 z m 3.22846,144.3979252 c 57.67294,0 104.40503,46.73295 104.40503,104.40503 0,57.67293 -46.73294,104.43064 -104.40503,104.43064 -57.67293,0 -104.43064,-46.76027 -104.43064,-104.43064 0,-57.67293 46.76027,-104.40503 104.43064,-104.40503 z" + style="opacity:0.2;fill:#999999" + id="path2865" + inkscape:connector-curvature="0" /> + d="M 433.27226,36.430541 C 318.07496,37.88972 225.1538,131.72532 225.1538,247.27269 c 0,116.45242 94.4068,210.86776 210.86776,210.86776 116.45242,0 210.84215,-94.40681 210.84215,-210.86776 0,-116.45242 -94.38119,-210.842149 -210.84215,-210.842149 -0.90983,0 -1.84118,-0.01153 -2.74827,0 z m 2.74828,106.437119 c 57.67293,0 104.40502,46.73295 104.40502,104.40503 0,57.67293 -46.73294,104.43064 -104.40502,104.43064 -57.67294,0 -104.43065,-46.76027 -104.43065,-104.43064 0,-57.67294 46.76027,-104.40503 104.43065,-104.40503 z" + style="opacity:0.2;fill:#999999" + id="path2867" + inkscape:connector-curvature="0" /> + d="m 433.91263,84.722564 c -88.81429,1.124992 -160.46681,73.466026 -160.46681,162.550126 0,89.7791 72.79151,162.57574 162.57574,162.57574 89.7791,0 162.55012,-72.79152 162.55012,-162.57574 0,-89.7791 -72.76419,-162.550126 -162.55012,-162.550126 -0.7014,0 -1.40855,-0.0089 -2.10791,0 z m 2.10791,58.139976 c 57.67293,0 104.40502,46.73294 104.40502,104.40502 0,57.67294 -46.73294,104.43065 -104.40502,104.43065 -57.67294,0 -104.43065,-46.76027 -104.43065,-104.43065 0,-57.67293 46.76027,-104.40502 104.43065,-104.40502 z" + style="opacity:0.2;fill:#999999" + id="path2869" + inkscape:connector-curvature="0" /> + d="m 434.41638,124.39955 c -67.13581,0.85382 -121.29357,55.53241 -121.29357,122.87314 0,67.8701 55.02694,122.89875 122.89875,122.89875 67.8701,0 122.87314,-55.02695 122.87314,-122.89875 0,-67.8701 -55.00048,-122.87314 -122.87314,-122.87314 -0.53022,0 -1.07223,-0.007 -1.60091,0 z m 1.60091,18.46384 c 57.67294,0 104.40503,46.73295 104.40503,104.40503 0,57.67293 -46.73295,104.43064 -104.40503,104.43064 -57.67293,0 -104.43064,-46.76027 -104.43064,-104.43064 0,-57.67294 46.76027,-104.40503 104.43064,-104.40503 z" + style="opacity:0.2;fill:#999999" + id="path2871" + inkscape:connector-curvature="0" /> + inkscape:connector-curvature="0" /> + inkscape:connector-curvature="0" />