diff options
author | Papoteur <papoteur@mageia.org> | 2024-03-02 10:04:49 +0100 |
---|---|---|
committer | Papoteur <papoteur@mageia.org> | 2024-03-02 10:04:49 +0100 |
commit | 4a27544538c8bf341f7f8e2325efde59eb365c5b (patch) | |
tree | bf17fbea5b7eea739598cc4822ffabd8eba10d17 /mageiaSync/mageiasync.py | |
parent | fab80fffac7e9c839f76d00e9b44d8d751cbc26c (diff) | |
download | MageiaSync-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.py | 10 |
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): |