aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPapoteur <papoteur@mageia.org>2023-05-15 10:08:23 +0200
committerPapoteur <papoteur@mageia.org>2023-05-15 10:08:23 +0200
commit8e7b8a4c3f47662489023f0ddd1dbf528b89b6da (patch)
treedd99cfb9d3adf12c35d607ed754a69fecbe580fd
parent9837284df3bb8310cb9988b8f31ccf7a98dbfa04 (diff)
downloadisodumper-8e7b8a4c3f47662489023f0ddd1dbf528b89b6da.tar
isodumper-8e7b8a4c3f47662489023f0ddd1dbf528b89b6da.tar.gz
isodumper-8e7b8a4c3f47662489023f0ddd1dbf528b89b6da.tar.bz2
isodumper-8e7b8a4c3f47662489023f0ddd1dbf528b89b6da.tar.xz
isodumper-8e7b8a4c3f47662489023f0ddd1dbf528b89b6da.zip
Use the same function to generate and compare selected device title (mga#31898)
-rwxr-xr-xlib/isodumper.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/isodumper.py b/lib/isodumper.py
index da79323..076c529 100755
--- a/lib/isodumper.py
+++ b/lib/isodumper.py
@@ -210,11 +210,14 @@ class IsoDumper(basedialog.BaseDialog):
if len(self.list) > 0:
for name, path, size in self.list:
if size != 0:
- label = str(name + ' (' + path.lstrip() + ') ' + self.sizeof_fmt(size))
+ label = self.device_label(name, path, size)
sel = (label == selected) if selected else False
self.devicelist.addItem(label, sel)
return True
+ def device_label(self, name, path, size):
+ return f"{name} ({path.lstrip()}) {self.sizeof_fmt(size)}"
+
def udev_wait(self, operation):
wait = Popen(["udevadm", "settle", "--timeout=15"], stderr=PIPE)
wait.communicate()
@@ -258,7 +261,7 @@ class IsoDumper(basedialog.BaseDialog):
self.dev = selitem.label()
if self.dev != "":
for name, path, size in self.list:
- if self.dev.startswith(name + ' (' + path.lstrip()):
+ if self.dev == self.device_label(name, path, size):
self.deviceSize = size
self.device_name = name.rstrip().replace(' ', '')
message = _('Target Device: {}').format(self.dev)
@@ -267,7 +270,7 @@ class IsoDumper(basedialog.BaseDialog):
partitions = self.u.get_partitions(self.dev.split('(')[1].split(')')[0])
# I18N: verb in singular 3rd person
self.logger(_("Contains this/these partition(s)"))
- # I18N: don't translate keywords inside {}
+ # I18N: don't translate keywords inside braces {}
for partition in partitions:
self.logger(_("{device}: Type={type}, Label={label}").format(device=partition['device'],
type=partition['type'],