diff options
author | papoteur-mga <yves.brungard_git@gadz.org> | 2014-09-20 22:23:25 +0200 |
---|---|---|
committer | papoteur-mga <yves.brungard_git@gadz.org> | 2014-09-20 22:23:25 +0200 |
commit | d77922f27d0fa7b839e8d166b32ba3456907f5cf (patch) | |
tree | 9e3132242de41a59a857ce8af8f9f96a9a52faa7 /mageiaSync | |
parent | 049a4e536fa796c0587bd1fd73790dd212dbec45 (diff) | |
download | MageiaSync-d77922f27d0fa7b839e8d166b32ba3456907f5cf.tar MageiaSync-d77922f27d0fa7b839e8d166b32ba3456907f5cf.tar.gz MageiaSync-d77922f27d0fa7b839e8d166b32ba3456907f5cf.tar.bz2 MageiaSync-d77922f27d0fa7b839e8d166b32ba3456907f5cf.tar.xz MageiaSync-d77922f27d0fa7b839e8d166b32ba3456907f5cf.zip |
A new dialog box added to ask user/password before to list release in a combobox.
Diffstat (limited to 'mageiaSync')
-rw-r--r-- | mageiaSync/mageiaSyncDBprefs.py | 11 | ||||
-rw-r--r-- | mageiaSync/mageiaSyncDBprefs.ui | 17 | ||||
-rw-r--r-- | mageiaSync/mageiaSyncDBprefs0.py | 77 | ||||
-rw-r--r-- | mageiaSync/mageiaSyncDBprefs0.ui | 168 | ||||
-rw-r--r-- | mageiaSync/mageiaSyncExt.py | 2 | ||||
-rw-r--r-- | mageiaSync/mageiasync.py | 87 |
6 files changed, 315 insertions, 47 deletions
diff --git a/mageiaSync/mageiaSyncDBprefs.py b/mageiaSync/mageiaSyncDBprefs.py index 7a7bcec..d96c74c 100644 --- a/mageiaSync/mageiaSyncDBprefs.py +++ b/mageiaSync/mageiaSyncDBprefs.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'mageiaSyncDBprefs.ui' # -# Created: Fri Aug 29 10:56:43 2014 +# Created: Sat Sep 20 19:26:02 2014 # by: PyQt5 UI code generator 5.1.1 # # WARNING! All changes made in this file will be lost! @@ -30,11 +30,6 @@ class Ui_prefsDialog(object): self.label.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) self.label.setObjectName("label") self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.label) - self.release = QtWidgets.QLineEdit(self.formLayoutWidget) - self.release.setToolTip("") - self.release.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) - self.release.setObjectName("release") - self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.release) self.label_2 = QtWidgets.QLabel(self.formLayoutWidget) self.label_2.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) self.label_2.setObjectName("label_2") @@ -84,6 +79,10 @@ class Ui_prefsDialog(object): self.label_7 = QtWidgets.QLabel(self.formLayoutWidget) self.label_7.setObjectName("label_7") self.formLayout.setWidget(0, QtWidgets.QFormLayout.SpanningRole, self.label_7) + self.release = QtWidgets.QComboBox(self.formLayoutWidget) + self.release.setEditable(True) + self.release.setObjectName("release") + self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.release) self.retranslateUi(prefsDialog) self.buttonBox.accepted.connect(prefsDialog.accept) diff --git a/mageiaSync/mageiaSyncDBprefs.ui b/mageiaSync/mageiaSyncDBprefs.ui index 81f947f..092eae1 100644 --- a/mageiaSync/mageiaSyncDBprefs.ui +++ b/mageiaSync/mageiaSyncDBprefs.ui @@ -58,16 +58,6 @@ </property> </widget> </item> - <item row="1" column="1"> - <widget class="QLineEdit" name="release"> - <property name="toolTip"> - <string/> - </property> - <property name="locale"> - <locale language="English" country="UnitedStates"/> - </property> - </widget> - </item> <item row="2" column="0"> <widget class="QLabel" name="label_2"> <property name="toolTip"> @@ -196,6 +186,13 @@ </property> </widget> </item> + <item row="1" column="1"> + <widget class="QComboBox" name="release"> + <property name="editable"> + <bool>true</bool> + </property> + </widget> + </item> </layout> </widget> </widget> diff --git a/mageiaSync/mageiaSyncDBprefs0.py b/mageiaSync/mageiaSyncDBprefs0.py new file mode 100644 index 0000000..04b3911 --- /dev/null +++ b/mageiaSync/mageiaSyncDBprefs0.py @@ -0,0 +1,77 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'mageiaSyncDBprefs0.ui' +# +# Created: Sat Sep 20 21:16:42 2014 +# by: PyQt5 UI code generator 5.1.1 +# +# WARNING! All changes made in this file will be lost! + +from PyQt5 import QtCore, QtGui, QtWidgets + +class Ui_prefsDialog0(object): + def setupUi(self, prefsDialog0): + prefsDialog0.setObjectName("prefsDialog0") + prefsDialog0.resize(520, 171) + self.buttonBox = QtWidgets.QDialogButtonBox(prefsDialog0) + self.buttonBox.setGeometry(QtCore.QRect(10, 130, 511, 32)) + self.buttonBox.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) + self.buttonBox.setOrientation(QtCore.Qt.Horizontal) + self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) + self.buttonBox.setCenterButtons(True) + self.buttonBox.setObjectName("buttonBox") + self.formLayoutWidget = QtWidgets.QWidget(prefsDialog0) + self.formLayoutWidget.setGeometry(QtCore.QRect(9, 9, 501, 111)) + self.formLayoutWidget.setObjectName("formLayoutWidget") + self.formLayout = QtWidgets.QFormLayout(self.formLayoutWidget) + self.formLayout.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow) + self.formLayout.setContentsMargins(0, 0, 0, 0) + self.formLayout.setObjectName("formLayout") + self.label_7 = QtWidgets.QLabel(self.formLayoutWidget) + self.label_7.setObjectName("label_7") + self.formLayout.setWidget(0, QtWidgets.QFormLayout.SpanningRole, self.label_7) + self.label_2 = QtWidgets.QLabel(self.formLayoutWidget) + self.label_2.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) + self.label_2.setObjectName("label_2") + self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.label_2) + self.user = QtWidgets.QLineEdit(self.formLayoutWidget) + self.user.setToolTip("") + self.user.setStatusTip("") + self.user.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) + self.user.setObjectName("user") + self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.user) + self.label_3 = QtWidgets.QLabel(self.formLayoutWidget) + self.label_3.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) + self.label_3.setObjectName("label_3") + self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.label_3) + self.password = QtWidgets.QLineEdit(self.formLayoutWidget) + self.password.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) + self.password.setObjectName("password") + self.formLayout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.password) + self.label_4 = QtWidgets.QLabel(self.formLayoutWidget) + self.label_4.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) + self.label_4.setObjectName("label_4") + self.formLayout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.label_4) + self.location = QtWidgets.QLineEdit(self.formLayoutWidget) + self.location.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) + self.location.setObjectName("location") + self.formLayout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.location) + + self.retranslateUi(prefsDialog0) + self.buttonBox.accepted.connect(prefsDialog0.accept) + self.buttonBox.rejected.connect(prefsDialog0.reject) + QtCore.QMetaObject.connectSlotsByName(prefsDialog0) + + def retranslateUi(self, prefsDialog0): + _translate = QtCore.QCoreApplication.translate + prefsDialog0.setWindowTitle(_translate("prefsDialog0", "Preferences")) + self.label_7.setText(_translate("prefsDialog0", "Define parameters which are stored and used for rsync")) + self.label_2.setToolTip(_translate("prefsDialog0", "User name to acces the repository. Only for testing repository.")) + self.label_2.setText(_translate("prefsDialog0", "User:")) + self.label_3.setToolTip(_translate("prefsDialog0", "Associated with user, if needed")) + self.label_3.setText(_translate("prefsDialog0", "Password:")) + self.password.setToolTip(_translate("prefsDialog0", "Give a value if you want to use testing repository")) + self.label_4.setToolTip(_translate("prefsDialog0", "Source repository. Keep void to use the testing repo.")) + self.label_4.setText(_translate("prefsDialog0", "Source:")) + self.location.setToolTip(_translate("prefsDialog0", "Give a mirror adress with public access")) + diff --git a/mageiaSync/mageiaSyncDBprefs0.ui b/mageiaSync/mageiaSyncDBprefs0.ui new file mode 100644 index 0000000..6c518f8 --- /dev/null +++ b/mageiaSync/mageiaSyncDBprefs0.ui @@ -0,0 +1,168 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>prefsDialog0</class> + <widget class="QDialog" name="prefsDialog0"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>520</width> + <height>171</height> + </rect> + </property> + <property name="windowTitle"> + <string>Preferences</string> + </property> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="geometry"> + <rect> + <x>10</x> + <y>130</y> + <width>511</width> + <height>32</height> + </rect> + </property> + <property name="locale"> + <locale language="English" country="UnitedStates"/> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + <property name="centerButtons"> + <bool>true</bool> + </property> + </widget> + <widget class="QWidget" name="formLayoutWidget"> + <property name="geometry"> + <rect> + <x>9</x> + <y>9</y> + <width>501</width> + <height>111</height> + </rect> + </property> + <layout class="QFormLayout" name="formLayout"> + <property name="fieldGrowthPolicy"> + <enum>QFormLayout::AllNonFixedFieldsGrow</enum> + </property> + <item row="0" column="0" colspan="2"> + <widget class="QLabel" name="label_7"> + <property name="text"> + <string>Define parameters which are stored and used for rsync</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_2"> + <property name="toolTip"> + <string>User name to acces the repository. Only for testing repository.</string> + </property> + <property name="locale"> + <locale language="English" country="UnitedStates"/> + </property> + <property name="text"> + <string>User:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLineEdit" name="user"> + <property name="toolTip"> + <string/> + </property> + <property name="statusTip"> + <string/> + </property> + <property name="locale"> + <locale language="English" country="UnitedStates"/> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_3"> + <property name="toolTip"> + <string>Associated with user, if needed</string> + </property> + <property name="locale"> + <locale language="English" country="UnitedStates"/> + </property> + <property name="text"> + <string>Password:</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLineEdit" name="password"> + <property name="toolTip"> + <string>Give a value if you want to use testing repository</string> + </property> + <property name="locale"> + <locale language="English" country="UnitedStates"/> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_4"> + <property name="toolTip"> + <string>Source repository. Keep void to use the testing repo.</string> + </property> + <property name="locale"> + <locale language="English" country="UnitedStates"/> + </property> + <property name="text"> + <string>Source:</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QLineEdit" name="location"> + <property name="toolTip"> + <string>Give a mirror adress with public access</string> + </property> + <property name="locale"> + <locale language="English" country="UnitedStates"/> + </property> + </widget> + </item> + </layout> + </widget> + </widget> + <resources/> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>prefsDialog0</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>248</x> + <y>254</y> + </hint> + <hint type="destinationlabel"> + <x>157</x> + <y>274</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>prefsDialog0</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>316</x> + <y>260</y> + </hint> + <hint type="destinationlabel"> + <x>286</x> + <y>274</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/mageiaSync/mageiaSyncExt.py b/mageiaSync/mageiaSyncExt.py index f344960..511ffe3 100644 --- a/mageiaSync/mageiaSyncExt.py +++ b/mageiaSync/mageiaSyncExt.py @@ -309,8 +309,6 @@ def findRelease(releasePath, password): # List the remote list of relea item=process.stdout.readline().rstrip().decode('unicode_escape') words=item.split() if words !=[]: - print item - print words releaseList.append(words[-1]) process.poll() if process.returncode != None: diff --git a/mageiaSync/mageiasync.py b/mageiaSync/mageiasync.py index dbdb5a6..ca38178 100644 --- a/mageiaSync/mageiasync.py +++ b/mageiaSync/mageiasync.py @@ -8,6 +8,7 @@ import sys import mageiaSyncUI import mageiaSyncExt import mageiaSyncDBprefs +import mageiaSyncDBprefs0 import mageiaSyncDBrename @@ -18,6 +19,12 @@ class prefsDialog(QDialog,mageiaSyncDBprefs.Ui_prefsDialog ): self.setupUi(self) self.selectDest.clicked.connect(isosSync.selectDestination) +class prefsDialog0(QDialog,mageiaSyncDBprefs0.Ui_prefsDialog0 ): + + def __init__(self, parent=None): + QDialog.__init__(self,parent) + self.setupUi(self) + class renameDialog(QDialog,mageiaSyncDBrename.Ui_renameDialog ): # Display a dialog box to choose to rename an old collection of ISOs to a new one @@ -219,37 +226,62 @@ class IsosViewer(QMainWindow, mageiaSyncUI.Ui_mainWindow): pass if paramRelease =="": # Values are not yet set + self.pd0=prefsDialog0() + self.pd0.user.setFocus() + answer=self.pd0.exec_() + if answer: + # Update params + self.user=self.pd0.user.text() + self.password=self.pd0.password.text() + self.location=self.pd0.location.text() + params=QtCore.QSettings("Mageia","mageiaSync") + params.setValue("user",self.user) + params.setValue("password",self.password) + params.setValue("location",self.location) + else: + pass +# answer=QDialogButtonBox(QDialogButtonBox.Ok) + # the user must set values or default values + self.pd0.close() self.pd=prefsDialog() - # Set values which are already defined -# self.pd.user.setText(params.value("user", type="QString")) -# self.pd.password.setText(params.value("password", type="QString")) -# self.pd.location.setText(params.value("location", type="QString")) -# self.pd.selectDest.setText(params.value("destination", type="QString")) -# self.pd.selectDest.setText(QtCore.QDir.currentPath()) -# self.pd.bwl.setValue(params.value("bwl", type="int")) -# self.pd.password.setText(params.value("password", type="QString")) + if self.password !="": + code,list=mageiaSyncExt.findRelease('rsync://'+self.user+'@bcd.mageia.org/isos/',self.password) + if code==0: + for item in list: + self.pd.release.addItem(item) + self.pd.password.setText(self.password) + self.pd.user.setText(self.user) + self.pd.location.setText(self.location) + self.pd.selectDest.setText(QtCore.QDir.currentPath()) + self.pd.release.setFocus() answer=self.pd.exec_() if answer: # Update params - params=QtCore.QSettings("Mageia","mageiaSync") - params.setValue("release", self.pd.release.text()) - params.setValue("user",self.pd.user.text()) - params.setValue("password",self.pd.password.text()) - params.setValue("location",self.pd.location.text()) - params.setValue("destination",self.pd.selectDest.text()) - params.setValue("bwl",str(self.pd.bwl.value())) self.user=self.pd.user.text() + self.password=self.pd.password.text() + self.location=self.pd.location.text() + params=QtCore.QSettings("Mageia","mageiaSync") + self.release= self.pd.release.currentText() + self.destination=self.pd.selectDest.text() + self.bwl=self.pd.bwl.value() + params.setValue("release", self.release) + params.setValue("user",self.user) + params.setValue("password",self.password) + params.setValue("location",self.location) + params.setValue("destination",self.destination) + params.setValue("bwl",str(self.bwl)) else: pass # answer=QDialogButtonBox(QDialogButtonBox.Ok) - # the user must set values or default values + print "the user must set values or default values" self.pd.close() - self.release=params.value("release", type="QString") - self.user=params.value("user", type="QString") - self.location=params.value("location", type="QString") - self.password=params.value("password", type="QString") - self.destination=params.value("destination", type="QString") - self.bwl=params.value("bwl",type=int) + else: + self.release=params.value("release", type="QString") + self.user=params.value("user", type="QString") + self.location=params.value("location", type="QString") + self.password=params.value("password", type="QString") + self.destination=params.value("destination", type="QString") + self.bwl=params.value("bwl",type=int) self.localDirLabel.setText("Local directory: "+self.destination) if self.location !="": self.remoteDirLabel.setText("Remote directory: "+self.location) @@ -313,21 +345,17 @@ class IsosViewer(QMainWindow, mageiaSyncUI.Ui_mainWindow): loc=[] loc=self.location.split('/') self.rd.oldRelease.setText(loc[-1]) - code,list=mageiaSyncExt.findRelease('rsync://'+self.user+'@bcd.mageia.org/isos/',self.password) - if code==0: - for item in list: - self.rd.newRelease.addItem(item) self.rd.chooseDir.setText(self.destination) answer=self.rd.exec_() if answer: - returnMsg=mageiaSyncExt.rename(self.rd.chooseDir.text(),self.rd.oldRelease.text(),str(self.rd.newRelease.lineEdit())) + returnMsg=mageiaSyncExt.rename(self.rd.chooseDir.text(),self.rd.oldRelease.text(),str(self.rd.newRelease.text())) self.lvMessage(returnMsg) self.rd.close() def prefs(self): # From the menu entry self.pd=prefsDialog() - self.pd.release.setText(self.release) + self.pd.release.addItem(self.release) self.pd.password.setText(self.password) self.pd.user.setText(self.user) self.pd.location.setText(self.location) @@ -336,11 +364,12 @@ class IsosViewer(QMainWindow, mageiaSyncUI.Ui_mainWindow): params=QtCore.QSettings("Mageia","mageiaSync") answer=self.pd.exec_() if answer: - params.setValue("release", self.pd.release.text()) + params.setValue("release", self.pd.release.currentText()) params.setValue("user",self.pd.user.text()) params.setValue("password",self.pd.password.text()) params.setValue("location",self.pd.location.text()) params.setValue("destination",self.pd.selectDest.text()) + print str(self.pd.bwl.value()) params.setValue("bwl",str(self.pd.bwl.value())) self.prefsInit() self.pd.close() |