On Mon, Jun 06, 2011 at 12:45:16PM +1200, Matthew McGowan wrote: > Hi folks, Hi Matthew, > I have just pushed a branch 'enums-style-idea' and thought i should explain > myself. > > The main reason i did it was to make our enums imports go from something > akin to this (as seen in appdetailsview_gtk.py): > from softwarecenter.enums import (PKG_STATE_INSTALLING_PURCHASED, > PKG_STATE_INSTALLED, [..] > ) > > to this: > from softwarecenter.enums import AppActions, PkgStates, Icons, > SOFTWARE_CENTER_PKGNAME > > Usage of enums within code would look something like this: > if state == PkgStates.INSTALLED: [..]
Thanks a lot for doing this work! When I did the work to make the code pyflakes clean I noticed too that the overlong imports are pretty ugly (and errorprone as its just too easy to forget one). The level of granularity in the new code is good IMO. I meant to work on something like this as well and I'm happy that you already fixed it now. > Enums that dont really fit into a logical group i have left separate, i.e. > SOFTWARE_CENTER_PKGNAME remains an 'ungrouped' enum. There are a few other > examples. I think thats fine. I will also move stuff like BUY_SOMETHING_HOST out of this file as it does not really belong there. > So is this a good idea or not? Very good idea! Cheers, Michael _______________________________________________ Mailing list: https://launchpad.net/~software-store-developers Post to : [email protected] Unsubscribe : https://launchpad.net/~software-store-developers More help : https://help.launchpad.net/ListHelp

