I think that would be good. I see no real reason why we want to raise
BzrCommandError. Possible Gary wanted to have it catched by
qbzr-specific error reporting dialog? In any case show MessageBox
explicitly is good idea here.
>
> But there are two more points:
> 1) Perhaps the best way to prevent this is to deactivate the OK button
> if no files are selected to revert.
I would like to not to. As I remember I've tried to follow the following
design: use any checks in validate method and show any useful warnings
and even maybe prevent command to run.
> 2) The current mechanism in revert.py doesn't get it if you open
> qrevert in a working tree with nothing to revert (i.e. the working
> tree is at the state of the tip) and check "Select / deselect all". If
> you do this, no warning/BzrCommandError is generated - currently it
> will simply call "bzr revert" and do nothing further. Ideally it
> should also notice that nothing is selected to revert.
I think that also should be handled in validate method.
> I want to fix this behaviour by my own, but I will need some support.
> For issue 1, I see that the OK and Cancel buttons are from buttonbox.
> Here I couldn't find a way to disable the OK button, because I don't
> know how to properly acces it.
> For issue 2, I had the following idea: The OK button should begin with
> its disabled state. It should only be enabled (=clickable) by a
> QtCore.SIGNAL if there is at least one file selected to revert. This
> way the user can't even click on this button because it wouldn't do
> anything anyway. Here my problem is to get the information if at least
> one file is selected or not.
>
> I appreciate any hints on this! :)
I would recommend you place additional checks to validate and prevent
command to run if there is user error / no files selected to revert.
I think that should be the easiest way to improve the user experience here.
What do you think?
--
All the dude wanted was his rug back