diff options
-rw-r--r-- | CHANGELOG | 9 | ||||
-rw-r--r-- | mageiaSync/mageiaSyncExt.py | 18 | ||||
-rw-r--r-- | mageiaSync/mageiaSyncUI.py | 128 | ||||
-rw-r--r-- | mageiaSync/mageiaSyncUI.ui | 451 | ||||
-rw-r--r-- | mageiaSync/mageiasync.py | 122 |
5 files changed, 434 insertions, 294 deletions
@@ -1,12 +1,19 @@ The modifications are: +mageiasync 0.1.5 +------------ + - change remote list in a table with date and size + - suppression of date checking + - adding tooltips + mageiasync 0.1.4 ------------ - modifications of rsync parameters to allow local files on NTFS. - correction of a crash in renaming action. - launching refresh of lists after renaming and modifications of parameters. - Local list no more selectable. - - adding Dutch translation. + - adding dutch translation. + mageiasync 0.1.3 ------------ diff --git a/mageiaSync/mageiaSyncExt.py b/mageiaSync/mageiaSyncExt.py index bf1a825..7ce29ce 100644 --- a/mageiaSync/mageiaSyncExt.py +++ b/mageiaSync/mageiaSyncExt.py @@ -79,18 +79,18 @@ 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=500+self.isoIndex + signal=400+self.isoIndex self.checkStartSignal.emit(signal) checkMd5=self.processSum('md5') self.md5Signal.emit(self.isoIndex+128*checkMd5) - signal=400+self.isoIndex + signal=300+self.isoIndex self.checkStartSignal.emit(signal) checkSha1=self.processSum('sha1') self.sha1Signal.emit(self.isoIndex+128*checkSha1) - signal=300+self.isoIndex - self.checkStartSignal.emit(signal) - checkDate=self.processDate() - self.dateSignal.emit(self.isoIndex+128*checkDate) +# signal=300+self.isoIndex +# self.checkStartSignal.emit(signal) +# checkDate=self.processDate() +# self.dateSignal.emit(self.isoIndex+128*checkDate) self.quit() @@ -278,8 +278,10 @@ class findIsos(QThread): item=process.stdout.readline().rstrip().decode('unicode_escape') self.lvM.emit(item) if str(item.lower()).endswith('.iso') : - words=item.split() - self.list.append(words[-1]) + words = item.split() + size = words[1] + date = words[2]+' '+ words[3] + self.list.append([size,date,words[-1]]) process.poll() if process.returncode != None: break diff --git a/mageiaSync/mageiaSyncUI.py b/mageiaSync/mageiaSyncUI.py index 83ba21d..53c6f10 100644 --- a/mageiaSync/mageiaSyncUI.py +++ b/mageiaSync/mageiaSyncUI.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'mageiaSyncUI.ui' # -# Created: Wed Feb 18 22:05:27 2015 +# Created: Mon Mar 23 22:38:56 2015 # by: PyQt5 UI code generator 5.1.1 # # WARNING! All changes made in this file will be lost! @@ -15,32 +15,26 @@ class Ui_mainWindow(object): mainWindow.resize(820, 587) mainWindow.setWindowTitle("MageiaSync v0.1.4") icon = QtGui.QIcon() - icon.addPixmap(QtGui.QPixmap("/usr/share/icons/hicolor/scalable/apps/mageiasync.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon.addPixmap(QtGui.QPixmap("../../../../usr/share/icons/hicolor/scalable/apps/mageiasync.svg"), 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) - self.verticalLayout.setObjectName("verticalLayout") - self.remoteDirLabel = QtWidgets.QLabel(self.centralwidget) - self.remoteDirLabel.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) - self.remoteDirLabel.setObjectName("remoteDirLabel") - self.verticalLayout.addWidget(self.remoteDirLabel) - self.selectAll = QtWidgets.QPushButton(self.centralwidget) - self.selectAll.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) - self.selectAll.setObjectName("selectAll") - self.verticalLayout.addWidget(self.selectAll) - self.listIsos = QtWidgets.QListWidget(self.centralwidget) + self.listIsos = QtWidgets.QTableView(self.centralwidget) + self.listIsos.setGeometry(QtCore.QRect(12, 50, 796, 131)) + self.listIsos.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) self.listIsos.setAlternatingRowColors(True) self.listIsos.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection) - self.listIsos.setModelColumn(0) + self.listIsos.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) + self.listIsos.setGridStyle(QtCore.Qt.DotLine) self.listIsos.setObjectName("listIsos") - self.verticalLayout.addWidget(self.listIsos) + self.listIsos.verticalHeader().setVisible(False) self.localDirLabel = QtWidgets.QLabel(self.centralwidget) + self.localDirLabel.setGeometry(QtCore.QRect(12, 189, 119, 19)) self.localDirLabel.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) self.localDirLabel.setObjectName("localDirLabel") - self.verticalLayout.addWidget(self.localDirLabel) self.localList = QtWidgets.QTableView(self.centralwidget) + self.localList.setGeometry(QtCore.QRect(12, 216, 796, 96)) self.localList.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) self.localList.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) self.localList.setAlternatingRowColors(True) @@ -49,59 +43,78 @@ class Ui_mainWindow(object): self.localList.setGridStyle(QtCore.Qt.DotLine) self.localList.setObjectName("localList") self.localList.verticalHeader().setVisible(False) - self.verticalLayout.addWidget(self.localList) - self.horizontalLayout_2 = QtWidgets.QHBoxLayout() + self.label = QtWidgets.QLabel(self.centralwidget) + self.label.setGeometry(QtCore.QRect(12, 366, 52, 19)) + self.label.setObjectName("label") + self.lvText = QtWidgets.QTextEdit(self.centralwidget) + self.lvText.setGeometry(QtCore.QRect(12, 393, 796, 95)) + self.lvText.setReadOnly(True) + self.lvText.setObjectName("lvText") + self.layoutWidget = QtWidgets.QWidget(self.centralwidget) + self.layoutWidget.setGeometry(QtCore.QRect(12, 496, 791, 31)) + self.layoutWidget.setObjectName("layoutWidget") + self.horizontalLayout = QtWidgets.QHBoxLayout(self.layoutWidget) + self.horizontalLayout.setContentsMargins(0, 0, 0, 0) + self.horizontalLayout.setObjectName("horizontalLayout") + self.syncGo = QtWidgets.QPushButton(self.layoutWidget) + self.syncGo.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) + self.syncGo.setObjectName("syncGo") + self.horizontalLayout.addWidget(self.syncGo) + self.stop = QtWidgets.QPushButton(self.layoutWidget) + 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.layoutWidget) + self.quit.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) + self.quit.setObjectName("quit") + self.horizontalLayout.addWidget(self.quit) + self.horizontalLayoutWidget = QtWidgets.QWidget(self.centralwidget) + self.horizontalLayoutWidget.setGeometry(QtCore.QRect(12, 12, 791, 31)) + self.horizontalLayoutWidget.setObjectName("horizontalLayoutWidget") + self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget) + self.horizontalLayout_3.setSizeConstraint(QtWidgets.QLayout.SetFixedSize) + self.horizontalLayout_3.setContentsMargins(0, 0, 0, 0) + self.horizontalLayout_3.setObjectName("horizontalLayout_3") + self.remoteDirLabel = QtWidgets.QLabel(self.horizontalLayoutWidget) + self.remoteDirLabel.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) + self.remoteDirLabel.setObjectName("remoteDirLabel") + self.horizontalLayout_3.addWidget(self.remoteDirLabel) + self.selectAll = QtWidgets.QPushButton(self.horizontalLayoutWidget) + self.selectAll.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) + self.selectAll.setObjectName("selectAll") + self.horizontalLayout_3.addWidget(self.selectAll) + self.layoutWidget1 = QtWidgets.QWidget(self.centralwidget) + self.layoutWidget1.setGeometry(QtCore.QRect(12, 320, 791, 38)) + self.layoutWidget1.setObjectName("layoutWidget1") + self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.layoutWidget1) self.horizontalLayout_2.setContentsMargins(-1, -1, -1, 9) self.horizontalLayout_2.setObjectName("horizontalLayout_2") - self.IprogressBar = QtWidgets.QProgressBar(self.centralwidget) + self.IprogressBar = QtWidgets.QProgressBar(self.layoutWidget1) self.IprogressBar.setEnabled(True) self.IprogressBar.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) self.IprogressBar.setProperty("value", 24) self.IprogressBar.setObjectName("IprogressBar") self.horizontalLayout_2.addWidget(self.IprogressBar) - self.Lsize = QtWidgets.QLabel(self.centralwidget) + self.Lsize = QtWidgets.QLabel(self.layoutWidget1) self.Lsize.setObjectName("Lsize") self.horizontalLayout_2.addWidget(self.Lsize) - self.speedLCD = QtWidgets.QLCDNumber(self.centralwidget) + self.speedLCD = QtWidgets.QLCDNumber(self.layoutWidget1) self.speedLCD.setObjectName("speedLCD") self.horizontalLayout_2.addWidget(self.speedLCD) - self.label_2 = QtWidgets.QLabel(self.centralwidget) + self.label_2 = QtWidgets.QLabel(self.layoutWidget1) self.label_2.setObjectName("label_2") self.horizontalLayout_2.addWidget(self.label_2) - self.label_3 = QtWidgets.QLabel(self.centralwidget) + self.label_3 = QtWidgets.QLabel(self.layoutWidget1) self.label_3.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) self.label_3.setObjectName("label_3") self.horizontalLayout_2.addWidget(self.label_3) - self.timeRemaining = QtWidgets.QTimeEdit(self.centralwidget) + self.timeRemaining = QtWidgets.QTimeEdit(self.layoutWidget1) self.timeRemaining.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) self.timeRemaining.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.timeRemaining.setReadOnly(True) self.timeRemaining.setButtonSymbols(QtWidgets.QAbstractSpinBox.NoButtons) self.timeRemaining.setObjectName("timeRemaining") self.horizontalLayout_2.addWidget(self.timeRemaining) - self.verticalLayout.addLayout(self.horizontalLayout_2) - self.horizontalLayout = QtWidgets.QHBoxLayout() - self.horizontalLayout.setObjectName("horizontalLayout") - self.syncGo = QtWidgets.QPushButton(self.centralwidget) - self.syncGo.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) - self.syncGo.setObjectName("syncGo") - self.horizontalLayout.addWidget(self.syncGo) - self.stop = QtWidgets.QPushButton(self.centralwidget) - 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") - self.verticalLayout.addWidget(self.label) - self.lvText = QtWidgets.QTextEdit(self.centralwidget) - self.lvText.setReadOnly(True) - self.lvText.setObjectName("lvText") - self.verticalLayout.addWidget(self.lvText) mainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(mainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 820, 24)) @@ -112,6 +125,8 @@ class Ui_mainWindow(object): self.menuSync = QtWidgets.QMenu(self.menubar) self.menuSync.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) self.menuSync.setObjectName("menuSync") + self.menuA_bout = QtWidgets.QMenu(self.menubar) + self.menuA_bout.setObjectName("menuA_bout") mainWindow.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(mainWindow) self.statusbar.setObjectName("statusbar") @@ -126,38 +141,43 @@ class Ui_mainWindow(object): self.actionRename.setObjectName("actionRename") self.actionCheck = QtWidgets.QAction(mainWindow) self.actionCheck.setObjectName("actionCheck") + self.actionAbout = QtWidgets.QAction(mainWindow) + self.actionAbout.setObjectName("actionAbout") 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.menuA_bout.addAction(self.actionAbout) self.menubar.addAction(self.menuFile.menuAction()) self.menubar.addAction(self.menuSync.menuAction()) + self.menubar.addAction(self.menuA_bout.menuAction()) self.retranslateUi(mainWindow) QtCore.QMetaObject.connectSlotsByName(mainWindow) - mainWindow.setTabOrder(self.syncGo, self.listIsos) - mainWindow.setTabOrder(self.listIsos, self.stop) + mainWindow.setTabOrder(self.syncGo, self.stop) def retranslateUi(self, mainWindow): _translate = QtCore.QCoreApplication.translate + self.localDirLabel.setText(_translate("mainWindow", "Local directory:")) + self.label.setText(_translate("mainWindow", "Report")) + self.syncGo.setText(_translate("mainWindow", "&Do sync")) + self.stop.setText(_translate("mainWindow", "&Stop")) + self.quit.setText(_translate("mainWindow", "&Quit")) self.remoteDirLabel.setText(_translate("mainWindow", "Remote directory")) 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.quit.setText(_translate("mainWindow", "&Quit")) - self.label.setText(_translate("mainWindow", "Report")) self.menuFile.setTitle(_translate("mainWindow", "&File")) self.menuSync.setTitle(_translate("mainWindow", "S&ync")) + self.menuA_bout.setTitle(_translate("mainWindow", "&Help")) 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")) + self.actionAbout.setText(_translate("mainWindow", "A&bout")) diff --git a/mageiaSync/mageiaSyncUI.ui b/mageiaSync/mageiaSyncUI.ui index 92caad6..6e530bf 100644 --- a/mageiaSync/mageiaSyncUI.ui +++ b/mageiaSync/mageiaSyncUI.ui @@ -15,196 +15,264 @@ </property> <property name="windowIcon"> <iconset> - <normaloff>/usr/share/icons/hicolor/scalable/apps/mageiasync.svg</normaloff>/usr/share/icons/hicolor/scalable/apps/mageiasync.svg</iconset> + <normaloff>../../../../usr/share/icons/hicolor/scalable/apps/mageiasync.svg</normaloff>../../../../usr/share/icons/hicolor/scalable/apps/mageiasync.svg</iconset> </property> <property name="locale"> <locale language="English" country="UnitedStates"/> </property> <widget class="QWidget" name="centralwidget"> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QLabel" name="remoteDirLabel"> - <property name="locale"> - <locale language="English" country="UnitedStates"/> - </property> - <property name="text"> - <string>Remote directory</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="selectAll"> - <property name="locale"> - <locale language="English" country="UnitedStates"/> - </property> - <property name="text"> - <string>Select &All</string> - </property> - </widget> - </item> - <item> - <widget class="QListWidget" name="listIsos"> - <property name="alternatingRowColors"> - <bool>true</bool> - </property> - <property name="selectionMode"> - <enum>QAbstractItemView::MultiSelection</enum> - </property> - <property name="modelColumn"> - <number>0</number> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="localDirLabel"> - <property name="locale"> - <locale language="English" country="UnitedStates"/> - </property> - <property name="text"> - <string>Local directory:</string> - </property> - </widget> - </item> - <item> - <widget class="QTableView" name="localList"> - <property name="locale"> - <locale language="English" country="UnitedStates"/> - </property> - <property name="editTriggers"> - <set>QAbstractItemView::NoEditTriggers</set> - </property> - <property name="alternatingRowColors"> - <bool>true</bool> - </property> - <property name="selectionMode"> - <enum>QAbstractItemView::MultiSelection</enum> - </property> - <property name="selectionBehavior"> - <enum>QAbstractItemView::SelectRows</enum> - </property> - <property name="gridStyle"> - <enum>Qt::DotLine</enum> - </property> - <attribute name="verticalHeaderVisible"> - <bool>false</bool> - </attribute> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <property name="bottomMargin"> - <number>9</number> - </property> - <item> - <widget class="QProgressBar" name="IprogressBar"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="locale"> - <locale language="English" country="UnitedStates"/> - </property> - <property name="value"> - <number>24</number> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="Lsize"> - <property name="text"> - <string>0 bytes</string> - </property> - </widget> - </item> - <item> - <widget class="QLCDNumber" name="speedLCD"/> - </item> - <item> - <widget class="QLabel" name="label_2"> - <property name="text"> - <string>kB/s</string> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_3"> - <property name="locale"> - <locale language="English" country="UnitedStates"/> - </property> - <property name="text"> - <string>Remaining:</string> - </property> - </widget> - </item> - <item> - <widget class="QTimeEdit" name="timeRemaining"> - <property name="locale"> - <locale language="English" country="UnitedStates"/> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - <property name="readOnly"> - <bool>true</bool> - </property> - <property name="buttonSymbols"> - <enum>QAbstractSpinBox::NoButtons</enum> - </property> - <property name="displayFormat"> - <string>H:mm:ss</string> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QPushButton" name="syncGo"> - <property name="locale"> - <locale language="English" country="UnitedStates"/> - </property> - <property name="text"> - <string>&Do sync</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="stop"> - <property name="locale"> - <locale language="English" country="UnitedStates"/> - </property> - <property name="text"> - <string>&Stop</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="quit"> - <property name="locale"> - <locale language="English" country="UnitedStates"/> - </property> - <property name="text"> - <string>&Quit</string> - </property> - </widget> - </item> - </layout> - </item> - <item> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Report</string> - </property> - </widget> - </item> - <item> - <widget class="QTextEdit" name="lvText"> - <property name="readOnly"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> + <widget class="QTableView" name="listIsos"> + <property name="geometry"> + <rect> + <x>12</x> + <y>50</y> + <width>796</width> + <height>131</height> + </rect> + </property> + <property name="editTriggers"> + <set>QAbstractItemView::NoEditTriggers</set> + </property> + <property name="alternatingRowColors"> + <bool>true</bool> + </property> + <property name="selectionMode"> + <enum>QAbstractItemView::MultiSelection</enum> + </property> + <property name="selectionBehavior"> + <enum>QAbstractItemView::SelectRows</enum> + </property> + <property name="gridStyle"> + <enum>Qt::DotLine</enum> + </property> + <attribute name="verticalHeaderVisible"> + <bool>false</bool> + </attribute> + </widget> + <widget class="QLabel" name="localDirLabel"> + <property name="geometry"> + <rect> + <x>12</x> + <y>189</y> + <width>119</width> + <height>19</height> + </rect> + </property> + <property name="locale"> + <locale language="English" country="UnitedStates"/> + </property> + <property name="text"> + <string>Local directory:</string> + </property> + </widget> + <widget class="QTableView" name="localList"> + <property name="geometry"> + <rect> + <x>12</x> + <y>216</y> + <width>796</width> + <height>96</height> + </rect> + </property> + <property name="locale"> + <locale language="English" country="UnitedStates"/> + </property> + <property name="editTriggers"> + <set>QAbstractItemView::NoEditTriggers</set> + </property> + <property name="alternatingRowColors"> + <bool>true</bool> + </property> + <property name="selectionMode"> + <enum>QAbstractItemView::MultiSelection</enum> + </property> + <property name="selectionBehavior"> + <enum>QAbstractItemView::SelectRows</enum> + </property> + <property name="gridStyle"> + <enum>Qt::DotLine</enum> + </property> + <attribute name="verticalHeaderVisible"> + <bool>false</bool> + </attribute> + </widget> + <widget class="QLabel" name="label"> + <property name="geometry"> + <rect> + <x>12</x> + <y>366</y> + <width>52</width> + <height>19</height> + </rect> + </property> + <property name="text"> + <string>Report</string> + </property> + </widget> + <widget class="QTextEdit" name="lvText"> + <property name="geometry"> + <rect> + <x>12</x> + <y>393</y> + <width>796</width> + <height>95</height> + </rect> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + <widget class="QWidget" name="layoutWidget"> + <property name="geometry"> + <rect> + <x>12</x> + <y>496</y> + <width>791</width> + <height>31</height> + </rect> + </property> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QPushButton" name="syncGo"> + <property name="locale"> + <locale language="English" country="UnitedStates"/> + </property> + <property name="text"> + <string>&Do sync</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="stop"> + <property name="locale"> + <locale language="English" country="UnitedStates"/> + </property> + <property name="text"> + <string>&Stop</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="quit"> + <property name="locale"> + <locale language="English" country="UnitedStates"/> + </property> + <property name="text"> + <string>&Quit</string> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="horizontalLayoutWidget"> + <property name="geometry"> + <rect> + <x>12</x> + <y>12</y> + <width>791</width> + <height>31</height> + </rect> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <property name="sizeConstraint"> + <enum>QLayout::SetFixedSize</enum> + </property> + <item> + <widget class="QLabel" name="remoteDirLabel"> + <property name="locale"> + <locale language="English" country="UnitedStates"/> + </property> + <property name="text"> + <string>Remote directory</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="selectAll"> + <property name="locale"> + <locale language="English" country="UnitedStates"/> + </property> + <property name="text"> + <string>Select &All</string> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="layoutWidget"> + <property name="geometry"> + <rect> + <x>12</x> + <y>320</y> + <width>791</width> + <height>38</height> + </rect> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <property name="bottomMargin"> + <number>9</number> + </property> + <item> + <widget class="QProgressBar" name="IprogressBar"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="locale"> + <locale language="English" country="UnitedStates"/> + </property> + <property name="value"> + <number>24</number> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="Lsize"> + <property name="text"> + <string>0 bytes</string> + </property> + </widget> + </item> + <item> + <widget class="QLCDNumber" name="speedLCD"/> + </item> + <item> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>kB/s</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_3"> + <property name="locale"> + <locale language="English" country="UnitedStates"/> + </property> + <property name="text"> + <string>Remaining:</string> + </property> + </widget> + </item> + <item> + <widget class="QTimeEdit" name="timeRemaining"> + <property name="locale"> + <locale language="English" country="UnitedStates"/> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + <property name="buttonSymbols"> + <enum>QAbstractSpinBox::NoButtons</enum> + </property> + <property name="displayFormat"> + <string>H:mm:ss</string> + </property> + </widget> + </item> + </layout> + </widget> </widget> <widget class="QMenuBar" name="menubar"> <property name="geometry"> @@ -236,8 +304,15 @@ <addaction name="actionRename"/> <addaction name="actionCheck"/> </widget> + <widget class="QMenu" name="menuA_bout"> + <property name="title"> + <string>&Help</string> + </property> + <addaction name="actionAbout"/> + </widget> <addaction name="menuFile"/> <addaction name="menuSync"/> + <addaction name="menuA_bout"/> </widget> <widget class="QStatusBar" name="statusbar"/> <action name="actionUpdate"> @@ -268,10 +343,14 @@ <string>Check selected images</string> </property> </action> + <action name="actionAbout"> + <property name="text"> + <string>A&bout</string> + </property> + </action> </widget> <tabstops> <tabstop>syncGo</tabstop> - <tabstop>listIsos</tabstop> <tabstop>stop</tabstop> </tabstops> <resources/> diff --git a/mageiaSync/mageiasync.py b/mageiaSync/mageiasync.py index 9b9c6d4..8f77458 100644 --- a/mageiaSync/mageiasync.py +++ b/mageiaSync/mageiasync.py @@ -92,15 +92,23 @@ class IsosViewer(QMainWindow, mageiaSyncUI.Ui_mainWindow): self.rsyncThread.checkSignal.connect(self.checks) self.checkThreads=[] # A list of thread for each iso - # Model for list view in a table - self.model = QStandardItemModel(0, 6, self) - headers=[self.tr("Directory"),self.tr("Name"),self.tr("Size"),self.tr("Date"),"SHA1","MD5"] + # Model for local list view in a table + self.model = QStandardItemModel(0, 5, self) + headers=[self.tr("Directory"),self.tr("Name"),self.tr("Size"),"SHA1","MD5"] i=0 for label in headers: self.model.setHeaderData(i, QtCore.Qt.Horizontal,label ) i+=1 -# settings for the list view +# Model for remote list view in a table + self.modelRemote = QStandardItemModel(0, 4, self) + headers=[self.tr("Directory"),self.tr("Name"),self.tr("Size"),self.tr("Date")] + i=0 + for label in headers: + self.modelRemote.setHeaderData(i, QtCore.Qt.Horizontal,label ) + i+=1 + +# settings for the local list view self.localList.setModel(self.model) self.localList.setColumnWidth(0,220) self.localList.setColumnWidth(1,220) @@ -109,31 +117,53 @@ class IsosViewer(QMainWindow, mageiaSyncUI.Ui_mainWindow): # settings for local iso names management self.localListNames=[] - def multiSelect(self): - # allows to select multiple lines in remote ISOs list - self.listIsos.setSelectionMode(2) # MultiSelection +# settings for the remote list view + self.listIsos.setModel(self.modelRemote) + self.listIsos.setColumnWidth(0,160) + self.listIsos.setColumnWidth(1,350) + self.listIsos.setColumnWidth(2,120) + self.listIsos.horizontalHeader().setStretchLastSection(True) + self.listIsos.setSelectionMode(2) # MultiSelection + self.listIsosNames=[] - def add(self, iso): + def add(self, path,iso,isoSize,date): # Add an remote ISO in list - self.listIsos.addItem(iso) + itemPath=QStandardItem(path) + itemPath.setData(path,3) # Add tooltip + itemIso=QStandardItem(iso) + itemIso.setData(iso,3) # Add tooltip + if isoSize==0: + itemSize=QStandardItem('--') + else: + formatedSize=isoSize.replace(","," ") + itemSize=QStandardItem(formatedSize) + itemSize.setData(formatedSize,3) # Add tooltip + itemSize.setTextAlignment(QtCore.Qt.AlignVCenter|QtCore.Qt.AlignHCenter) + + itemDate=QStandardItem(date) + itemDate.setData(date,3) # Add tooltip + itemDate.setTextAlignment(QtCore.Qt.AlignVCenter|QtCore.Qt.AlignHCenter) + self.modelRemote.appendRow([itemPath,itemIso,itemSize,itemDate,]) + self.listIsosNames.append([path,iso]) def localAdd(self, path,iso,isoSize): # Add an entry in local ISOs list, with indications about checking itemPath=QStandardItem(path) + itemPath.setData(path,3) # Add tooltip itemIso=QStandardItem(iso) + itemIso.setData(iso,3) # Add tooltip if isoSize==0: itemSize=QStandardItem('--') else: formatedSize='{:n}'.format(isoSize).replace(","," ") itemSize=QStandardItem(formatedSize) + itemSize.setData(formatedSize,3) # Add tooltip itemSize.setTextAlignment(QtCore.Qt.AlignVCenter|QtCore.Qt.AlignHCenter) - itemDate=QStandardItem("--/--/--") - itemDate.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,itemDate, itemCheck1, itemCheck5,]) + self.model.appendRow([itemPath,itemIso,itemSize,itemCheck1, itemCheck5,]) self.localListNames.append([path,iso]) def setProgress(self, value): @@ -153,7 +183,7 @@ class IsosViewer(QMainWindow, mageiaSyncUI.Ui_mainWindow): self.timeRemaining.setTime(content) def manualChecks(self): - for iso in self.listIsos.selectedItems(): + for iso in self.modelRemote.selectedItems(): path,name=iso.text().split('/') try: # Look for ISO in local list @@ -178,7 +208,7 @@ class IsosViewer(QMainWindow, mageiaSyncUI.Ui_mainWindow): isoIndex) self.checkThreads[-1].md5Signal.connect(self.md5Check) self.checkThreads[-1].sha1Signal.connect(self.sha1Check) - self.checkThreads[-1].dateSignal.connect(self.dateCheck) +# self.checkThreads[-1].dateSignal.connect(self.dateCheck) self.checkThreads[-1].sizeFinalSignal.connect(self.sizeUpdate) self.checkThreads[-1].checkStartSignal.connect(self.checkStart) self.checkThreads[-1].start() @@ -197,7 +227,7 @@ class IsosViewer(QMainWindow, mageiaSyncUI.Ui_mainWindow): else: val=self.tr("Failed") row=check - self.model.setData(self.model.index(row, 5, QtCore.QModelIndex()), val) + self.model.setData(self.model.index(row, 4, QtCore.QModelIndex()), val) def sha1Check(self,check): if check>=128: @@ -206,7 +236,7 @@ class IsosViewer(QMainWindow, mageiaSyncUI.Ui_mainWindow): else: val=self.tr("Failed") row=check - self.model.setData(self.model.index(row, 4, QtCore.QModelIndex()), val) + self.model.setData(self.model.index(row, 3, QtCore.QModelIndex()), val) def dateCheck(self,check): if check>=128: @@ -317,12 +347,12 @@ class IsosViewer(QMainWindow, mageiaSyncUI.Ui_mainWindow): def selectAllIsos(self): # Select or unselect the ISOs in remote list if self.selectAllState : - for i in range(self.listIsos.count()): - self.listIsos.item(i).setSelected(True) + for i in range(self.modelRemote.count()): + self.modelRemote.item(i).setSelected(True) self.selectAll.setText(self.tr("Unselect &All")) else: - for i in range(self.listIsos.count()): - self.listIsos.item(i).setSelected(False) + for i in range(self.modelRemote.count()): + self.modelRemote.item(i).setSelected(False) self.selectAll.setText(self.tr("Select &All")) self.selectAllState=not self.selectAllState @@ -340,7 +370,7 @@ class IsosViewer(QMainWindow, mageiaSyncUI.Ui_mainWindow): # From the menu entry self.lw = LogWindow() self.lw.show() - self.listIsos.clear() + self.modelRemote.removeRows(0,self.modelRemote.rowCount()) self.model.removeRows(0,self.model.rowCount()) if self.location == "" : self.nameWithPath='rsync://'+self.user+'@bcd.mageia.org/isos/'+self.release+'/' @@ -415,25 +445,29 @@ class IsosViewer(QMainWindow, mageiaSyncUI.Ui_mainWindow): # Connect the button Stop self.stop.clicked.connect(self.stopSync) self.rsyncThread.params(self.password, self.bwl) - 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() - if self.location == "" : - self.nameWithPath='rsync://'+self.user+'@bcd.mageia.org/isos/'+self.release+'/'+path - else: - self.nameWithPath=self.location+path - if (not str(path).endswith('/')): - self.nameWithPath+='/' - self.rsyncThread.setup(self.nameWithPath, self.destination+'/'+path+'/',row) + remoteRow=-1 + for isoIndex in self.listIsos.selectionModel().selectedIndexes(): + if remoteRow != isoIndex.row(): + remoteRow = isoIndex.row() + path = self.model.data(self.model.index(remoteRow,0)) + name = self.model.data(self.model.index(remoteRow,1)) + 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() + if self.location == "" : + self.nameWithPath='rsync://'+self.user+'@bcd.mageia.org/isos/'+self.release+'/'+path + else: + self.nameWithPath=self.location+path + if (not str(path).endswith('/')): + self.nameWithPath+='/' + self.rsyncThread.setup(self.nameWithPath, self.destination+'/'+path+'/',row) self.rsyncThread.start() # start the thread # Pour les tests uniquement #rsync://$user@bcd.mageia.org/isos/$release/ @@ -442,16 +476,15 @@ class IsosViewer(QMainWindow, mageiaSyncUI.Ui_mainWindow): def closeFill(self,code): if code==0: # list returned list=self.fillList.getList() - for iso in list: - self.add(iso) + for size, date,longName in list: + path=longName.split('/') + self.add(path[0], path[-1], size,date) elif code==1: self.lvMessage(self.tr("Command rsync not found")) elif code==2: self.lvMessage(self.tr("Error in rsync parameters")) elif code==3: self.lvMessage(self.tr("Unknown error in rsync")) - list=self.fillList.getList() - list=self.fillList.getLocal() for path,iso,isoSize in list: self.localAdd(path,iso, isoSize) @@ -473,7 +506,6 @@ class IsosViewer(QMainWindow, mageiaSyncUI.Ui_mainWindow): self.prefsInit() # look for Isos list and add it to the isoSync list. Update preferences self.updateList() - self.multiSelect() def close(self): self.rsyncThread.stop() |