vorta
vorta copied to clipboard
FR: Disable "Collapse" button in "Flat" view
The "Collapse" button doesn't do anything when "Flat" view is selected. Could be disabled in such cases Originally posted by @m3nu in https://github.com/borgbase/vorta/issues/1749#issuecomment-1682002001
This is a very minor FR, probably a few lines or so but I wanted to keep it seperate from original PR. I'll submit a PR in a while but please feel free to pick this up if anyone is interested.
Instructions
- Have a look at https://github.com/borgbase/vorta/blob/567a3546ae09878cf64f9f10c5c6f7bb7254720e/src/vorta/views/diff_result.py#L183
- Use
setEnabledto disablebCollapseAllin flat mode and enable it in the other modes. - Write a test for that behaviour in https://github.com/borgbase/vorta/blob/e85ec38c65f838a1c42dc3d5afdcb3dccb9802f4/tests/unit/test_diff.py
def change_display_mode(self, selection: int):
"""
Change the display mode of the tree view
The `selection` parameter specifies the index of the selected mode in
`comboBoxDisplayMode`.
"""
if selection == 0:
mode = FileTreeModel.DisplayMode.TREE
elif selection == 1:
mode = FileTreeModel.DisplayMode.SIMPLIFIED_TREE
elif selection == 2:
mode = FileTreeModel.DisplayMode.FLAT
else:
raise Exception("Unknown item in comboBoxDisplayMode with index {}".format(selection))
SettingsModel.update({SettingsModel.str_value: str(selection)}).where(
SettingsModel.key == 'diff_files_display_mode'
).execute()
self.model.setMode(mode)
I will have make the setEnable in vorta/views/treemodels.py -> FileTreeModel? is this correct?
No, you will have to modify the code of change_display_mode so that it correctly calls setEnabled.
What I forgot to write down is that the same has to be done for
https://github.com/borgbase/vorta/blob/567a3546ae09878cf64f9f10c5c6f7bb7254720e/src/vorta/views/extract_dialog.py#L178
i've made a PR, do suggest any changes/improvements needed.
Is it still open? Can I work on this?
Is it still open? Can I work on this?
Yes, please.
@real-yfprojects Thanks for assigning me this issue 😄. Can you help me with these questions?
- How to reproduce this issue locally?
- Where in UI is the
Flatview?
@prady0t In Archives Tab, there are two options "Extract" and "Diff" which open a new dialog with TreeView. Here you will find a caret up icon i.e. Collapse button
In tree view you can expand an item and reveal its children and this button collapses all items. However In Flat View, there's nothing to expand and collapse. To reproduce, click on View Dropdown and select Flat (defaults to Tree).
Thanks! That was really helpful.
Buttons are greyed out. I tried to add a new repository but I was unable to do that. I got this error message:
Should I open a PR regarding this?
Hi @real-yfprojects, Can I work on this?
Yes, of course!