diff --git a/blivetgui/actions_menu.py b/blivetgui/actions_menu.py index 7de14d17..06f46de2 100644 --- a/blivetgui/actions_menu.py +++ b/blivetgui/actions_menu.py @@ -42,6 +42,7 @@ def create_menu(self): items = [("add", self.blivet_gui.add_device), ("delete", self.blivet_gui.delete_selected_partition), ("resize", self.blivet_gui.resize_device), + ("rename", self.blivet_gui.rename_device), ("format", self.blivet_gui.format_device), ("label", self.blivet_gui.edit_label), ("unmount", self.blivet_gui.umount_partition), diff --git a/blivetgui/actions_toolbar.py b/blivetgui/actions_toolbar.py index 7dd29da9..b1ebdbba 100644 --- a/blivetgui/actions_toolbar.py +++ b/blivetgui/actions_toolbar.py @@ -64,6 +64,7 @@ def __init__(self, blivet_gui): items = [("add", "clicked", self.blivet_gui.add_device), ("delete", "clicked", self.blivet_gui.delete_selected_partition), ("resize", "activate", self.blivet_gui.resize_device), + ("rename", "activate", self.blivet_gui.rename_device), ("format", "activate", self.blivet_gui.format_device), ("unmount", "clicked", self.blivet_gui.umount_partition), ("decrypt", "clicked", self.blivet_gui.decrypt_device), diff --git a/blivetgui/blivet_utils.py b/blivetgui/blivet_utils.py index 239537af..cb8365e8 100644 --- a/blivetgui/blivet_utils.py +++ b/blivetgui/blivet_utils.py @@ -839,6 +839,20 @@ def relabel_format(self, user_input): return ProxyDataContainer(success=True, actions=[label_ac], message=None, exception=None, traceback=None) + def rename_device(self, user_input): + rename_ac = blivet.deviceaction.ActionConfigureDevice(device=user_input.edit_device, + attr="name", + new_value=user_input.name) + + try: + self.storage.devicetree.actions.add(rename_ac) + except Exception as e: # pylint: disable=broad-except + return ProxyDataContainer(success=False, actions=None, message=None, exception=e, + traceback=traceback.format_exc()) + else: + return ProxyDataContainer(success=True, actions=[rename_ac], message=None, + exception=None, traceback=None) + def edit_lvmvg_device(self, user_input): """ Edit LVM Volume group """ @@ -1410,6 +1424,12 @@ def get_mountpoints(self): return list(self.storage.mountpoints.keys()) + def get_names(self): + """ Return list of currently used device names + """ + + return self.storage.names + def get_supported_filesystems(self, installer_mode=False): _fs_types = [] diff --git a/blivetgui/blivetgui.py b/blivetgui/blivetgui.py index 7d0afd36..45bf3301 100644 --- a/blivetgui/blivetgui.py +++ b/blivetgui/blivetgui.py @@ -305,6 +305,30 @@ def resize_device(self, _widget=None): self._handle_user_change() self.update_partitions_view() + def rename_device(self, _widget=None): + device = self.list_partitions.selected_partition[0] + names = self.client.remote_call("get_names") + + dialog = edit_dialog.RenameDialog(self.main_window, device, names, + installer_mode=self.installer_mode) + message = _("Failed to rename the device:") + user_input = self.run_dialog(dialog) + if user_input.rename: + result = self.client.remote_call("rename_device", user_input) + if not result.success: + if not result.exception: + self.show_error_dialog(result.message) + else: + self._reraise_exception(result.exception, result.traceback, message, + dialog_window=dialog.dialog) + else: + if result.actions: + action_str = _("rename {name} {type}").format(name=device.name, type=device.type) + self.list_actions.append("edit", action_str, result.actions) + + self._handle_user_change() + self.update_partitions_view() + def format_device(self, _widget=None): device = self.list_partitions.selected_partition[0] diff --git a/blivetgui/dialogs/edit_dialog.py b/blivetgui/dialogs/edit_dialog.py index c66429b0..dbd0af31 100644 --- a/blivetgui/dialogs/edit_dialog.py +++ b/blivetgui/dialogs/edit_dialog.py @@ -28,7 +28,7 @@ from gi.repository import Gtk from .size_chooser import SizeChooser -from .helpers import is_mountpoint_valid, is_label_valid +from .helpers import is_mountpoint_valid, is_label_valid, is_name_valid from ..dialogs import message_dialogs from ..gui_utils import locate_ui_file from ..communication.proxy_utils import ProxyDataContainer @@ -432,6 +432,87 @@ def _on_format_button(self, _button): self.dialog.response(Gtk.ResponseType.ACCEPT) +class RenameDialog(object): + + def __init__(self, main_window, edit_device, names, installer_mode=False): + self.main_window = main_window + self.edit_device = edit_device + self.names = names + self.installer_mode = installer_mode + + self.builder = Gtk.Builder() + self.builder.set_translation_domain("blivet-gui") + self.builder.add_from_file(locate_ui_file("rename_dialog.ui")) + + self.dialog = self.builder.get_object("rename_dialog") + self.dialog.set_transient_for(self.main_window) + + self.entry_rename = self.builder.get_object("entry_rename") + + button_cancel = self.builder.get_object("button_cancel") + button_cancel.connect("clicked", self._on_cancel_button) + + button_rename = self.builder.get_object("button_rename") + button_rename.connect("clicked", self._on_rename_button) + + def set_decorated(self, decorated): + self.dialog.set_decorated(decorated) + + # no decoration --> display dialog title in the dialog + if not decorated: + label = self.builder.get_object("label_title") + title = self.dialog.get_title() + label.set_text(title) + + def _validate_user_input(self, name): + if not is_name_valid(self.edit_device.type, name): + msg = _("\"{0}\" is not a valid name.").format(name) + message_dialogs.ErrorDialog(self, msg, + not self.installer_mode) # do not show decoration in installer mode + return False + + if hasattr(self.edit_device, "lvname"): + old_name = self.edit_device.lvname + new_name = "%s-%s" % (self.edit_device.vg.name, name) + else: + old_name = self.edit_device.name + new_name = name + + if name == old_name: + msg = _("Selected device is already named \"{0}\".").format(name) + message_dialogs.ErrorDialog(self.dialog, msg, + not self.installer_mode) # do not show decoration in installer mode + return False + + if new_name in self.names: + msg = _("Selected name \"{0}\" is already in use.").format(name) + message_dialogs.ErrorDialog(self.dialog, msg, + not self.installer_mode) # do not show decoration in installer mode + return False + + return True + + def run(self): + response = self.dialog.run() + + if response == Gtk.ResponseType.REJECT: + self.dialog.destroy() + return ProxyDataContainer(edit_device=self.edit_device, rename=False, name=None) + else: + new_name = self.entry_rename.get_text() + if not self._validate_user_input(new_name): + return self.run() + else: + self.dialog.destroy() + return ProxyDataContainer(edit_device=self.edit_device, rename=True, name=new_name) + + def _on_cancel_button(self, _button): + self.dialog.response(Gtk.ResponseType.REJECT) + + def _on_rename_button(self, _button): + self.dialog.response(Gtk.ResponseType.ACCEPT) + + class UnmountDialog(object): def __init__(self, main_window, edit_device, mountpoints, installer_mode=False): diff --git a/blivetgui/list_partitions.py b/blivetgui/list_partitions.py index ace4136b..83c8703d 100644 --- a/blivetgui/list_partitions.py +++ b/blivetgui/list_partitions.py @@ -265,6 +265,12 @@ def _allow_relabel_device(self, device): return device.format.labeling() and device.format.relabels() + def _allow_rename_device(self, device): + if device.protected or device.format.status: + return False + + return hasattr(device, "_renamable") and device._renamable + def _allow_add_device(self, device): if device.protected: return False @@ -311,6 +317,9 @@ def activate_action_buttons(self, selected_device): if self._allow_relabel_device(device): self.blivet_gui.activate_device_actions(["label"]) + if self._allow_rename_device(device): + self.blivet_gui.activate_device_actions(["rename"]) + if self._allow_add_device(device): self.blivet_gui.activate_device_actions(["add"]) diff --git a/data/ui/blivet-gui.ui b/data/ui/blivet-gui.ui index c3759e5b..5961987e 100644 --- a/data/ui/blivet-gui.ui +++ b/data/ui/blivet-gui.ui @@ -43,6 +43,14 @@ True + + + True + False + Rename + True + + True @@ -123,6 +131,14 @@ True + + + True + False + Rename + True + + True diff --git a/data/ui/rename_dialog.ui b/data/ui/rename_dialog.ui new file mode 100644 index 00000000..4e58c004 --- /dev/null +++ b/data/ui/rename_dialog.ui @@ -0,0 +1,98 @@ + + + + + + False + Rename device + center-on-parent + dialog + center + + + False + vertical + 2 + + + False + end + + + Cancel + True + True + True + 0.62000000476837158 + + + True + True + 0 + + + + + Rename + True + True + True + + + True + True + 1 + + + + + False + False + 0 + + + + + True + False + 12 + 12 + 8 + 8 + True + + + True + False + 6 + Enter new name for this device: + center + + + False + True + 0 + + + + + True + True + + + False + True + 1 + + + + + False + True + 1 + + + + + + diff --git a/po/blivet-gui.pot b/po/blivet-gui.pot index de79334c..72bf7072 100644 --- a/po/blivet-gui.pot +++ b/po/blivet-gui.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-12-31 19:18+0100\n" +"POT-Creation-Date: 2022-01-09 19:58+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -27,115 +27,124 @@ msgstr "" msgid "resize {name} {type}" msgstr "" -#: ../blivetgui/blivetgui.py:321 +#: ../blivetgui/blivetgui.py:314 +msgid "Failed to rename the device:" +msgstr "" + +#: ../blivetgui/blivetgui.py:326 +#, python-brace-format +msgid "rename {name} {type}" +msgstr "" + +#: ../blivetgui/blivetgui.py:345 msgid "Failed to format the device:" msgstr "" -#: ../blivetgui/blivetgui.py:335 +#: ../blivetgui/blivetgui.py:359 #, python-brace-format msgid "format {name} {type}" msgstr "" -#: ../blivetgui/blivetgui.py:348 +#: ../blivetgui/blivetgui.py:372 msgid "Failed to edit the LVM2 Volume Group:" msgstr "" -#: ../blivetgui/blivetgui.py:363 +#: ../blivetgui/blivetgui.py:387 #, python-brace-format msgid "edit {name} {type}" msgstr "" -#: ../blivetgui/blivetgui.py:392 +#: ../blivetgui/blivetgui.py:416 msgid "Failed to change filesystem label on the device:" msgstr "" -#: ../blivetgui/blivetgui.py:397 +#: ../blivetgui/blivetgui.py:421 #, python-brace-format msgid "change filesystem label of {name} {type}" msgstr "" -#: ../blivetgui/blivetgui.py:413 +#: ../blivetgui/blivetgui.py:437 #, python-brace-format msgid "" "{name} is not complete. It is not possible to add new LVs to VG with missing " "PVs." msgstr "" -#: ../blivetgui/blivetgui.py:418 +#: ../blivetgui/blivetgui.py:442 msgid "Not enough free space for a new LVM Volume Group." msgstr "" -#: ../blivetgui/blivetgui.py:424 +#: ../blivetgui/blivetgui.py:448 #, python-brace-format msgid "" "Disk {name} already reached maximum allowed number of primary partitions for " "{label} disklabel." msgstr "" -#: ../blivetgui/blivetgui.py:434 +#: ../blivetgui/blivetgui.py:458 msgid "Failed to add disklabel:" msgstr "" -#: ../blivetgui/blivetgui.py:447 +#: ../blivetgui/blivetgui.py:471 #, python-brace-format msgid "create new disklabel on {name}" msgstr "" -#: ../blivetgui/blivetgui.py:499 +#: ../blivetgui/blivetgui.py:523 msgid "Failed to add the device:" msgstr "" -#: ../blivetgui/blivetgui.py:514 +#: ../blivetgui/blivetgui.py:538 #, python-brace-format msgid "add {size} {type} device" msgstr "" -#: ../blivetgui/blivetgui.py:558 +#: ../blivetgui/blivetgui.py:582 msgid "Failed to delete the device:" msgstr "" -#: ../blivetgui/blivetgui.py:573 +#: ../blivetgui/blivetgui.py:597 #, python-brace-format msgid "delete partition {name}" msgstr "" -#: ../blivetgui/blivetgui.py:612 +#: ../blivetgui/blivetgui.py:636 msgid "Failed to perform the actions:" msgstr "" -#: ../blivetgui/blivetgui.py:656 +#: ../blivetgui/blivetgui.py:680 msgid "Confirm scheduled actions" msgstr "" -#: ../blivetgui/blivetgui.py:657 +#: ../blivetgui/blivetgui.py:681 msgid "Are you sure you want to perform scheduled actions?" msgstr "" -#: ../blivetgui/blivetgui.py:698 +#: ../blivetgui/blivetgui.py:722 #, python-brace-format msgid "" "Unmount of '{mountpoint}' failed. Are you sure the device is not in use?" msgstr "" -#: ../blivetgui/blivetgui.py:720 +#: ../blivetgui/blivetgui.py:744 msgid "Unlocking failed. Are you sure provided password is correct?" msgstr "" -#: ../blivetgui/blivetgui.py:770 ../data/ui/blivet-gui.ui:659 +#: ../blivetgui/blivetgui.py:794 ../data/ui/blivet-gui.ui:678 msgid "Quit" msgstr "" -#: ../blivetgui/blivetgui.py:773 +#: ../blivetgui/blivetgui.py:797 msgid "blivet-gui is already running" msgstr "" -#: ../blivetgui/blivetgui.py:774 +#: ../blivetgui/blivetgui.py:798 msgid "" "Another instance of blivet-gui is already running.\n" "Only one instance of blivet-gui can run at the same time." msgstr "" -#: ../blivetgui/blivetgui.py:776 +#: ../blivetgui/blivetgui.py:800 msgid "" "If your previous instance of blivet-gui crashed, please make sure that the " "blivet-gui-daemon process was terminated too.\n" @@ -146,24 +155,24 @@ msgid "" "command to force quit it." msgstr "" -#: ../blivetgui/blivetgui.py:808 +#: ../blivetgui/blivetgui.py:832 msgid "Failed to init blivet:" msgstr "" -#: ../blivetgui/blivetgui.py:815 +#: ../blivetgui/blivetgui.py:839 msgid "Quit blivet-gui" msgstr "" -#: ../blivetgui/blivetgui.py:817 +#: ../blivetgui/blivetgui.py:841 msgid "Ignore disk and continue" msgstr "" -#: ../blivetgui/blivetgui.py:820 +#: ../blivetgui/blivetgui.py:844 #, python-brace-format msgid "Error: {error}" msgstr "" -#: ../blivetgui/blivetgui.py:821 +#: ../blivetgui/blivetgui.py:845 #, python-brace-format msgid "" "Blivet-gui can't use the {name} disk due to a corrupted/unknown " @@ -172,19 +181,19 @@ msgid "" "this disk." msgstr "" -#: ../blivetgui/blivetgui.py:857 +#: ../blivetgui/blivetgui.py:881 msgid "Confirm reload storage" msgstr "" -#: ../blivetgui/blivetgui.py:858 +#: ../blivetgui/blivetgui.py:882 msgid "There are pending operations. Are you sure you want to continue?" msgstr "" -#: ../blivetgui/blivetgui.py:889 +#: ../blivetgui/blivetgui.py:913 msgid "Are you sure you want to quit?" msgstr "" -#: ../blivetgui/blivetgui.py:890 +#: ../blivetgui/blivetgui.py:914 msgid "" "There are pending operations. Are you sure you want to quit blivet-gui now?" msgstr "" @@ -193,72 +202,72 @@ msgstr "" msgid "free space" msgstr "" -#: ../blivetgui/blivet_utils.py:662 +#: ../blivetgui/blivet_utils.py:659 #, python-brace-format msgid "Resizing of {type} devices is currently not supported" msgstr "" -#: ../blivetgui/blivet_utils.py:667 +#: ../blivetgui/blivet_utils.py:664 msgid "Protected devices cannot be resized" msgstr "" -#: ../blivetgui/blivet_utils.py:672 +#: ../blivetgui/blivet_utils.py:669 msgid "Immutable formats cannot be resized" msgstr "" -#: ../blivetgui/blivet_utils.py:677 +#: ../blivetgui/blivet_utils.py:674 msgid "Devices with children cannot be resized" msgstr "" -#: ../blivetgui/blivet_utils.py:688 +#: ../blivetgui/blivet_utils.py:685 msgid "Unformatted devices are not resizable" msgstr "" #. unfortunately we can't use format._resizable here because blivet uses it to both mark #. formats as not resizable and force users to call update_size_info on resizable formats -#: ../blivetgui/blivet_utils.py:695 +#: ../blivetgui/blivet_utils.py:692 #, python-brace-format msgid "Resizing of {type} format is currently not supported" msgstr "" -#: ../blivetgui/blivet_utils.py:700 +#: ../blivetgui/blivet_utils.py:697 #, python-brace-format msgid "Tools for resizing format {type} are not available." msgstr "" #. TODO: we could support this by simply changing formats target size but we'd need #. a workaround for the missing action -#: ../blivetgui/blivet_utils.py:707 +#: ../blivetgui/blivet_utils.py:704 msgid "Formats scheduled to be created cannot be resized" msgstr "" -#: ../blivetgui/blivet_utils.py:712 +#: ../blivetgui/blivet_utils.py:709 #, python-brace-format msgid "Format {type} doesn't support updating its size limit information" msgstr "" -#: ../blivetgui/blivet_utils.py:717 +#: ../blivetgui/blivet_utils.py:714 msgid "Mounted devices cannot be resized" msgstr "" -#: ../blivetgui/blivet_utils.py:722 +#: ../blivetgui/blivet_utils.py:719 msgid "Logical Volumes with snapshots cannot be resized." msgstr "" -#: ../blivetgui/blivet_utils.py:727 +#: ../blivetgui/blivet_utils.py:724 msgid "Resizing of LUKS2 devices is currently not supported." msgstr "" -#: ../blivetgui/blivet_utils.py:739 +#: ../blivetgui/blivet_utils.py:736 #, python-brace-format msgid "Failed to update filesystem size info: {error}" msgstr "" -#: ../blivetgui/blivet_utils.py:758 +#: ../blivetgui/blivet_utils.py:755 msgid "Device is not resizable." msgstr "" -#: ../blivetgui/blivet_utils.py:760 +#: ../blivetgui/blivet_utils.py:757 msgid "Format is not resizable after updating its size limit information." msgstr "" @@ -277,7 +286,7 @@ msgid "" msgstr "" #: ../blivetgui/list_actions.py:70 ../blivetgui/list_actions.py:121 -#: ../blivetgui/list_actions.py:144 ../data/ui/blivet-gui.ui:611 +#: ../blivetgui/list_actions.py:144 ../data/ui/blivet-gui.ui:633 msgid "No pending actions" msgstr "" @@ -464,31 +473,31 @@ msgid "Device type:" msgstr "" #: ../blivetgui/dialogs/add_dialog.py:451 -#: ../blivetgui/dialogs/edit_dialog.py:548 -#: ../blivetgui/dialogs/edit_dialog.py:597 -#: ../blivetgui/dialogs/edit_dialog.py:659 ../data/ui/blivet-gui.ui:465 +#: ../blivetgui/dialogs/edit_dialog.py:629 +#: ../blivetgui/dialogs/edit_dialog.py:678 +#: ../blivetgui/dialogs/edit_dialog.py:740 ../data/ui/blivet-gui.ui:485 #: ../data/ui/cache_area.ui:76 msgid "Device" msgstr "" #: ../blivetgui/dialogs/add_dialog.py:452 -#: ../blivetgui/dialogs/edit_dialog.py:549 -#: ../blivetgui/dialogs/edit_dialog.py:598 -#: ../blivetgui/dialogs/edit_dialog.py:660 ../data/ui/blivet-gui.ui:478 +#: ../blivetgui/dialogs/edit_dialog.py:630 +#: ../blivetgui/dialogs/edit_dialog.py:679 +#: ../blivetgui/dialogs/edit_dialog.py:741 ../data/ui/blivet-gui.ui:498 #: ../data/ui/cache_area.ui:87 msgid "Type" msgstr "" #: ../blivetgui/dialogs/add_dialog.py:453 -#: ../blivetgui/dialogs/edit_dialog.py:550 -#: ../blivetgui/dialogs/edit_dialog.py:599 -#: ../blivetgui/dialogs/edit_dialog.py:661 ../data/ui/blivet-gui.ui:500 +#: ../blivetgui/dialogs/edit_dialog.py:631 +#: ../blivetgui/dialogs/edit_dialog.py:680 +#: ../blivetgui/dialogs/edit_dialog.py:742 ../data/ui/blivet-gui.ui:520 msgid "Size" msgstr "" #: ../blivetgui/dialogs/add_dialog.py:462 -#: ../blivetgui/dialogs/edit_dialog.py:608 -#: ../blivetgui/dialogs/edit_dialog.py:670 ../data/ui/cache_area.ui:130 +#: ../blivetgui/dialogs/edit_dialog.py:689 +#: ../blivetgui/dialogs/edit_dialog.py:751 ../data/ui/cache_area.ui:130 msgid "Available devices:" msgstr "" @@ -527,6 +536,7 @@ msgid "Please select at least two parent devices." msgstr "" #: ../blivetgui/dialogs/add_dialog.py:1035 +#: ../blivetgui/dialogs/edit_dialog.py:469 #, python-brace-format msgid "\"{0}\" is not a valid name." msgstr "" @@ -790,44 +800,54 @@ msgstr "" msgid "'{label}' is not a valid label for this filesystem" msgstr "" +#: ../blivetgui/dialogs/edit_dialog.py:482 +#, python-brace-format +msgid "Selected device is already named \"{0}\"." +msgstr "" + +#: ../blivetgui/dialogs/edit_dialog.py:488 +#, python-brace-format +msgid "Selected name \"{0}\" is already in use." +msgstr "" + #. auto shrink after removing/hiding widgets -#: ../blivetgui/dialogs/edit_dialog.py:518 +#: ../blivetgui/dialogs/edit_dialog.py:599 msgid "Edit device" msgstr "" -#: ../blivetgui/dialogs/edit_dialog.py:558 +#: ../blivetgui/dialogs/edit_dialog.py:639 msgid "Parent devices:" msgstr "" -#: ../blivetgui/dialogs/edit_dialog.py:565 +#: ../blivetgui/dialogs/edit_dialog.py:646 msgid "Add parent" msgstr "" -#: ../blivetgui/dialogs/edit_dialog.py:568 +#: ../blivetgui/dialogs/edit_dialog.py:649 msgid "Remove parent" msgstr "" -#: ../blivetgui/dialogs/edit_dialog.py:579 +#: ../blivetgui/dialogs/edit_dialog.py:660 msgid "" "There are currently no empty physical volumes or\n" "disks with enough free space to create one." msgstr "" -#: ../blivetgui/dialogs/edit_dialog.py:596 +#: ../blivetgui/dialogs/edit_dialog.py:677 msgid "Add?" msgstr "" -#: ../blivetgui/dialogs/edit_dialog.py:638 +#: ../blivetgui/dialogs/edit_dialog.py:719 msgid "" "There is no physical volume that could be\n" "removed from this volume group." msgstr "" -#: ../blivetgui/dialogs/edit_dialog.py:650 +#: ../blivetgui/dialogs/edit_dialog.py:731 msgid "Currently it is possible to remove only one parent at time." msgstr "" -#: ../blivetgui/dialogs/edit_dialog.py:658 +#: ../blivetgui/dialogs/edit_dialog.py:739 msgid "Remove?" msgstr "" @@ -960,116 +980,120 @@ msgstr "" msgid "Edit" msgstr "" -#: ../data/ui/blivet-gui.ui:42 ../data/ui/blivet-gui.ui:122 +#: ../data/ui/blivet-gui.ui:42 ../data/ui/blivet-gui.ui:130 msgid "Resize" msgstr "" +#: ../data/ui/blivet-gui.ui:50 ../data/ui/blivet-gui.ui:138 +msgid "Rename" +msgstr "" + #. Edit format (e.g. delete existing and create a new one) on selected device. -#: ../data/ui/blivet-gui.ui:50 ../data/ui/blivet-gui.ui:130 +#: ../data/ui/blivet-gui.ui:58 ../data/ui/blivet-gui.ui:146 msgctxt "Menu|Edit" msgid "Format" msgstr "" -#: ../data/ui/blivet-gui.ui:58 ../data/ui/blivet-gui.ui:138 +#: ../data/ui/blivet-gui.ui:66 ../data/ui/blivet-gui.ui:154 msgid "Modify parents" msgstr "" -#: ../data/ui/blivet-gui.ui:66 ../data/ui/blivet-gui.ui:146 +#: ../data/ui/blivet-gui.ui:74 ../data/ui/blivet-gui.ui:162 #: ../data/ui/mountpoint_dialog.ui:7 msgid "Set mountpoint" msgstr "" -#: ../data/ui/blivet-gui.ui:74 ../data/ui/blivet-gui.ui:154 +#: ../data/ui/blivet-gui.ui:82 ../data/ui/blivet-gui.ui:170 msgid "Set label" msgstr "" -#: ../data/ui/blivet-gui.ui:82 ../data/ui/blivet-gui.ui:162 +#: ../data/ui/blivet-gui.ui:90 ../data/ui/blivet-gui.ui:178 msgid "Set partition table" msgstr "" -#: ../data/ui/blivet-gui.ui:94 ../data/ui/unmount_dialog.ui:15 +#: ../data/ui/blivet-gui.ui:102 ../data/ui/unmount_dialog.ui:15 msgid "Unmount" msgstr "" -#: ../data/ui/blivet-gui.ui:102 +#: ../data/ui/blivet-gui.ui:110 msgid "Decrypt" msgstr "" -#: ../data/ui/blivet-gui.ui:110 +#: ../data/ui/blivet-gui.ui:118 msgid "Information" msgstr "" -#: ../data/ui/blivet-gui.ui:239 +#: ../data/ui/blivet-gui.ui:255 msgid "blivet-gui" msgstr "" -#: ../data/ui/blivet-gui.ui:274 ../data/ui/blivet-gui.ui:286 -#: ../data/ui/blivet-gui.ui:821 ../data/ui/blivet-gui.ui:832 -#: ../data/ui/blivet-gui.ui:843 +#: ../data/ui/blivet-gui.ui:290 ../data/ui/blivet-gui.ui:302 +#: ../data/ui/blivet-gui.ui:840 ../data/ui/blivet-gui.ui:851 +#: ../data/ui/blivet-gui.ui:862 msgid "column" msgstr "" -#: ../data/ui/blivet-gui.ui:348 +#: ../data/ui/blivet-gui.ui:364 msgctxt "ActionsToolbar|Add" msgid "Add new device" msgstr "" -#: ../data/ui/blivet-gui.ui:364 +#: ../data/ui/blivet-gui.ui:380 msgctxt "ActionsToolbar|Delete" msgid "Delete selected device" msgstr "" -#: ../data/ui/blivet-gui.ui:380 +#: ../data/ui/blivet-gui.ui:396 msgctxt "ActionsToolbar|Edit" msgid "Edit selected device" msgstr "" -#: ../data/ui/blivet-gui.ui:406 +#: ../data/ui/blivet-gui.ui:422 msgctxt "ActionsToolbar|Unmount" msgid "Unmount selected device" msgstr "" -#: ../data/ui/blivet-gui.ui:421 +#: ../data/ui/blivet-gui.ui:437 msgctxt "ActionsToolbar|Decrypt" msgid "Unlock/Open selected device" msgstr "" -#: ../data/ui/blivet-gui.ui:436 +#: ../data/ui/blivet-gui.ui:452 msgctxt "ActionsToolbar|Info" msgid "Display information about selected device" msgstr "" #. Format (filesystem) type of selected device. -#: ../data/ui/blivet-gui.ui:489 +#: ../data/ui/blivet-gui.ui:509 msgctxt "LogicalView|Column" msgid "Format" msgstr "" -#: ../data/ui/blivet-gui.ui:511 +#: ../data/ui/blivet-gui.ui:531 msgid "Label" msgstr "" -#: ../data/ui/blivet-gui.ui:522 +#: ../data/ui/blivet-gui.ui:542 msgid "Mountpoint" msgstr "" -#: ../data/ui/blivet-gui.ui:544 +#: ../data/ui/blivet-gui.ui:566 msgid "Logical View" msgstr "" -#: ../data/ui/blivet-gui.ui:567 +#: ../data/ui/blivet-gui.ui:589 msgid "Physical View" msgstr "" -#: ../data/ui/blivet-gui.ui:643 +#: ../data/ui/blivet-gui.ui:662 msgid "Reload Storage" msgstr "" -#: ../data/ui/blivet-gui.ui:651 +#: ../data/ui/blivet-gui.ui:670 msgid "Queued Actions" msgstr "" -#: ../data/ui/blivet-gui.ui:673 +#: ../data/ui/blivet-gui.ui:692 msgid "About blivet-gui" msgstr "" @@ -1176,7 +1200,8 @@ msgstr "" msgid "Information:" msgstr "" -#: ../data/ui/label_dialog.ui:25 ../data/ui/unmount_dialog.ui:36 +#: ../data/ui/label_dialog.ui:25 ../data/ui/rename_dialog.ui:22 +#: ../data/ui/unmount_dialog.ui:36 msgid "Cancel" msgstr "" @@ -1214,6 +1239,20 @@ msgstr "" msgid "RAID level:" msgstr "" +#: ../data/ui/rename_dialog.ui:7 +msgid "Rename device" +msgstr "" + +#. Perform selected format change on this device. +#: ../data/ui/rename_dialog.ui:36 +msgctxt "Dialog|Format" +msgid "Rename" +msgstr "" + +#: ../data/ui/rename_dialog.ui:68 +msgid "Enter new name for this device:" +msgstr "" + #: ../data/ui/resize_dialog.ui:7 msgid "Resize device" msgstr "" diff --git a/tests/blivetgui_tests/list_partitions_test.py b/tests/blivetgui_tests/list_partitions_test.py index 33cb8ae6..8d45bbbc 100644 --- a/tests/blivetgui_tests/list_partitions_test.py +++ b/tests/blivetgui_tests/list_partitions_test.py @@ -89,6 +89,19 @@ def test_allow_add(self): # allow adding lvm snapshots device = MagicMock(type="lvmlv", protected=False, vg=MagicMock(free_space=Size("1 GiB"), pe_size=Size("4 MiB"))) self.assertTrue(self.list_partitions._allow_add_device(device)) + + def test_allow_rename(self): + # do not allow to rename a protected devices + device = MagicMock(type="lvmlv", protected=True, _renamable=True) + self.assertFalse(self.list_partitions._allow_rename_device(device)) + + # non-renamable device + device = MagicMock(type="lvmlv", protected=False, _renamable=False) + self.assertFalse(self.list_partitions._allow_rename_device(device)) + + # renamable device + device = MagicMock(type="lvmlv", protected=False, _renamable=True) + self.assertFalse(self.list_partitions._allow_rename_device(device)) def test_add_to_store(self):