vorta icon indicating copy to clipboard operation
vorta copied to clipboard

FR: Disable "Collapse" button in "Flat" view

Open jetchirag opened this issue 2 years ago • 11 comments
trafficstars

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

  1. Have a look at https://github.com/borgbase/vorta/blob/567a3546ae09878cf64f9f10c5c6f7bb7254720e/src/vorta/views/diff_result.py#L183
  2. Use setEnabled to disable bCollapseAll in flat mode and enable it in the other modes.
  3. Write a test for that behaviour in https://github.com/borgbase/vorta/blob/e85ec38c65f838a1c42dc3d5afdcb3dccb9802f4/tests/unit/test_diff.py

jetchirag avatar Aug 21 '23 22:08 jetchirag

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?

SAMAD101 avatar Sep 03 '23 07:09 SAMAD101

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

real-yfprojects avatar Sep 03 '23 08:09 real-yfprojects

i've made a PR, do suggest any changes/improvements needed.

SAMAD101 avatar Sep 03 '23 10:09 SAMAD101

Is it still open? Can I work on this?

prady0t avatar Sep 19 '23 09:09 prady0t

Is it still open? Can I work on this?

Yes, please.

real-yfprojects avatar Sep 19 '23 20:09 real-yfprojects

@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 Flat view?

prady0t avatar Sep 20 '23 12:09 prady0t

@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

image

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).

image

jetchirag avatar Sep 20 '23 12:09 jetchirag

Thanks! That was really helpful.

prady0t avatar Sep 21 '23 04:09 prady0t

Buttons are greyed out. I tried to add a new repository but I was unable to do that. I got this error message:

Screenshot 2023-09-22 at 11 21 20 AM

Should I open a PR regarding this?

prady0t avatar Sep 22 '23 05:09 prady0t

Hi @real-yfprojects, Can I work on this?

AdwaitSalankar avatar Nov 26 '23 16:11 AdwaitSalankar

Yes, of course!

real-yfprojects avatar Nov 26 '23 19:11 real-yfprojects