On Tue, 2013-03-12 at 10:20 -0400, Chris Lumens wrote:
> What about closing dialog by hitting Escape? I think the best
pattern
> for those cases is "if rc == OK_CODE, do else do nothing".
Well, it's a little more complicated because there's also the
possibility of rc being 2 (see return_to_hub_link_clicked in
lib/refresh.py). But, how does this look instead:
if rc == 1:
# User hit OK on the dialog, indicating they stayed on the dialog
# until rescanning completed and now needs to go back to the
# main storage spoke.
self.skipTo = "StorageSpoke"
elif rc != 2:
# User either hit cancel on the dialog or closed it via escape, so
# there was no rescanning done.
return
This looks good. I would only add a comment about what rc being
2 means
or use some constants with mnemonic names instead.
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic