Re: I'm updating wx.lib.plot
Werner <[email protected]>
| Newsgroups | gmane.comp.python.wxpython.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Douglas,
On 7/30/2015 19:54, Douglas Thor wrote:
> Hello,
...
> As I work on this I'll continue to update the list with other changes
> that I make. Once I feel like things are complete, I'll submit the PR
> to github.
Isn't this PR from you? https://github.com/wxWidgets/Phoenix/pull/23
If yes, then additional updates/commits you do to the same branch will
update this PR.
One thing I noted is that you updated 'build.py' in it, I think that
should not be in this PR as it has nothing to do with the plot changes.
> I do have a question though:
> plot.PlotCanvas uses various methods like 'GetEnableGrid' and
> 'SetEngbleGrid' to access private attributes. Would you want new
> private attributes to use @property? I would think that we'd want to
> keep the current way so that the API is similar to the rest of the
> module. If desired, I could go through and switch everything to
> @properties, but that would be a pretty big API change.
See Robin's thoughts on this (at the end):
http://wiki.wxpython.org/ProjectPhoenix/ProjectGoals
>
> Example using the new _gridStyle that I'm implementing.
>
> ----- Current Way -----
> def GetGridStyle(self):
> return self._gridStyle
>
> def SetGridStyle(self, style):
> if isinstance(style, wx.PenStyle):
> self._gridStyle = style
> else:
> raise TypeError("`style` must be an instance of wx.PenStyle")
> -----------------------
>
>
> ----- Property Way -----
> @property
> def gridStyle(self):
> return self._gridStyle
>
> @gridStyle.setter
> def gridStyle(self, style):
> if isinstance(style, wx.PenStyle):
> self._gridStyle = style
> else:
> raise TypeError("`style` must be an instance of wx.PenStyle")
> ------------------------
>
As this is new why not use the property way, but I think it should be
"GridStyle" (upper case G).
Maybe add a property for the existing Get/Set in this way:
TheProperty = property(GetTheProperty, SetTheProperty)
See also e.g.:
wxFrame MenuBar
or:
http://eli.thegreenplace.net/2009/02/06/getters-and-setters-in-python/
Werner
--
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.