aboutsummaryrefslogtreecommitdiffstats
path: root/mageiasync
diff options
context:
space:
mode:
Diffstat (limited to 'mageiasync')
-rw-r--r--mageiasync/mageiaSyncDBrename.py10
-rw-r--r--mageiasync/mageiaSyncDBrename.ui13
-rw-r--r--mageiasync/mageiaSyncExt.py34
-rw-r--r--mageiasync/mageiasync.py34
4 files changed, 71 insertions, 20 deletions
diff --git a/mageiasync/mageiaSyncDBrename.py b/mageiasync/mageiaSyncDBrename.py
index 0880a7b..2428721 100644
--- a/mageiasync/mageiaSyncDBrename.py
+++ b/mageiasync/mageiaSyncDBrename.py
@@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'mageiaSyncDBrename.ui'
#
-# Created: Thu Sep 18 07:30:57 2014
+# Created: Sat Sep 20 16:27:56 2014
# by: PyQt5 UI code generator 5.1.1
#
# WARNING! All changes made in this file will be lost!
@@ -35,9 +35,6 @@ class Ui_renameDialog(object):
self.label_2 = QtWidgets.QLabel(self.gridLayoutWidget)
self.label_2.setObjectName("label_2")
self.gridLayout.addWidget(self.label_2, 3, 0, 1, 1)
- self.newRelease = QtWidgets.QLineEdit(self.gridLayoutWidget)
- self.newRelease.setObjectName("newRelease")
- self.gridLayout.addWidget(self.newRelease, 3, 1, 1, 1)
self.label_3 = QtWidgets.QLabel(self.gridLayoutWidget)
self.label_3.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
self.label_3.setWordWrap(False)
@@ -50,6 +47,11 @@ class Ui_renameDialog(object):
self.chooseDir = QtWidgets.QPushButton(self.gridLayoutWidget)
self.chooseDir.setObjectName("chooseDir")
self.gridLayout.addWidget(self.chooseDir, 1, 1, 1, 1)
+ self.newRelease = QtWidgets.QComboBox(self.gridLayoutWidget)
+ self.newRelease.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
+ self.newRelease.setEditable(True)
+ self.newRelease.setObjectName("newRelease")
+ self.gridLayout.addWidget(self.newRelease, 3, 1, 1, 1)
self.retranslateUi(renameDialog)
self.buttonBox.accepted.connect(renameDialog.accept)
diff --git a/mageiasync/mageiaSyncDBrename.ui b/mageiasync/mageiaSyncDBrename.ui
index 60dd051..c17c528 100644
--- a/mageiasync/mageiaSyncDBrename.ui
+++ b/mageiasync/mageiaSyncDBrename.ui
@@ -62,9 +62,6 @@
</property>
</widget>
</item>
- <item row="3" column="1">
- <widget class="QLineEdit" name="newRelease"/>
- </item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_3">
<property name="locale">
@@ -95,6 +92,16 @@
</property>
</widget>
</item>
+ <item row="3" column="1">
+ <widget class="QComboBox" name="newRelease">
+ <property name="locale">
+ <locale language="English" country="UnitedStates"/>
+ </property>
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</widget>
diff --git a/mageiasync/mageiaSyncExt.py b/mageiasync/mageiaSyncExt.py
index 65c0554..f344960 100644
--- a/mageiasync/mageiaSyncExt.py
+++ b/mageiasync/mageiaSyncExt.py
@@ -282,3 +282,37 @@ class findIsos(QThread):
break
self.endSignal.emit(0)
+def findRelease(releasePath, password): # List the remote list of releases
+ releaseList =[]
+ code=0
+ commande = ['rsync', '--list-only',str(releasePath)]
+ print commande
+ try:
+ if password != "":
+ envir = os.environ.copy()
+ envir['RSYNC_PASSWORD']=str(password)
+ process = Popen(commande, shell=False, stdout=PIPE, stderr=PIPE, env=envir)
+ else:
+ process = Popen(commande, shell=False, stdout=PIPE, stderr=PIPE)
+ except OSError as e:
+ code=1
+ return code, "Command rsync not found: "+str(e)
+ except ValueError as e:
+ code=2
+ return code,"Error in rsync parameters: "+str(e)
+ except Exception as e:
+ # Unknown error in rsync
+ code=3
+ return code, "Error in rsync: "+str(e)
+ process.poll()
+ while True :
+ 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:
+ break
+ return code, releaseList
diff --git a/mageiasync/mageiasync.py b/mageiasync/mageiasync.py
index 25ff2b6..dbdb5a6 100644
--- a/mageiasync/mageiasync.py
+++ b/mageiasync/mageiasync.py
@@ -211,19 +211,23 @@ class IsosViewer(QMainWindow, mageiaSyncUI.Ui_mainWindow):
def prefsInit(self):
# Load the parameters at first
params=QtCore.QSettings("Mageia","mageiaSync")
- self.release=params.value("release", type="QString")
- # the parameters already initilised?
- if self.release =="":
+ paramRelease=""
+ try:
+ paramRelease=params.value("release", type="QString")
+ # the parameters already initialised?
+ except:
+ pass
+ if paramRelease =="":
# Values are not yet set
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"))
+# 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"))
answer=self.pd.exec_()
if answer:
# Update params
@@ -240,6 +244,7 @@ class IsosViewer(QMainWindow, mageiaSyncUI.Ui_mainWindow):
# answer=QDialogButtonBox(QDialogButtonBox.Ok)
# 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")
@@ -308,11 +313,14 @@ class IsosViewer(QMainWindow, mageiaSyncUI.Ui_mainWindow):
loc=[]
loc=self.location.split('/')
self.rd.oldRelease.setText(loc[-1])
- self.rd.newRelease.setText(loc[-1])
- self.rd.chooseDir.setText(self.location)
+ 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(),self.rd.newRelease.text())
+ returnMsg=mageiaSyncExt.rename(self.rd.chooseDir.text(),self.rd.oldRelease.text(),str(self.rd.newRelease.lineEdit()))
self.lvMessage(returnMsg)
self.rd.close()