aboutsummaryrefslogtreecommitdiffstats
path: root/mageiaSync/mageiasync.py
diff options
context:
space:
mode:
authorPapoteur <papoteur@mageia.org>2024-03-02 10:04:49 +0100
committerPapoteur <papoteur@mageia.org>2024-03-02 10:04:49 +0100
commit4a27544538c8bf341f7f8e2325efde59eb365c5b (patch)
treebf17fbea5b7eea739598cc4822ffabd8eba10d17 /mageiaSync/mageiasync.py
parentfab80fffac7e9c839f76d00e9b44d8d751cbc26c (diff)
downloadMageiaSync-4a27544538c8bf341f7f8e2325efde59eb365c5b.tar
MageiaSync-4a27544538c8bf341f7f8e2325efde59eb365c5b.tar.gz
MageiaSync-4a27544538c8bf341f7f8e2325efde59eb365c5b.tar.bz2
MageiaSync-4a27544538c8bf341f7f8e2325efde59eb365c5b.tar.xz
MageiaSync-4a27544538c8bf341f7f8e2325efde59eb365c5b.zip
Populate release fields when renaming with the common part of the directories names in destination directory
Diffstat (limited to 'mageiaSync/mageiasync.py')
-rw-r--r--mageiaSync/mageiasync.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/mageiaSync/mageiasync.py b/mageiaSync/mageiasync.py
index c5dbb57..e634e4c 100644
--- a/mageiaSync/mageiasync.py
+++ b/mageiaSync/mageiasync.py
@@ -17,6 +17,8 @@ from PyQt6.QtGui import (
from PyQt6.QtCore import QLibraryInfo, QUrl, QItemSelectionModel, QFileInfo
from PyQt6 import QtCore, uic # , Qt, QThread, QObject, pyqtSignal)
import sys
+import glob
+import os
try:
from . import mageiaSyncExt
@@ -470,9 +472,9 @@ class IsosViewer(QMainWindow):
def rename(self):
# rename old isos and directories to a new release
self.rd = renameDialog()
- loc = []
- loc = self.location.split("/")
- self.rd.oldRelease.setText(loc[-1])
+ prefix = os.path.commonprefix([x for x in glob.glob("*", root_dir=self.destination) if os.path.isdir(os.path.join(self.destination,x))])
+ self.rd.oldRelease.setText(prefix)
+ self.rd.newRelease.setText(prefix)
self.rd.chooseDir.setText(self.destination)
answer = self.rd.exec()
if answer:
@@ -487,7 +489,7 @@ class IsosViewer(QMainWindow):
nbf, nbr
)
self.lvMessage(returnMsg)
- self.updateList()
+ self.updateList()
self.rd.close()
def prefs(self):