Re: I'm updating wx.lib.plot
Douglas Thor <[email protected]>
| Newsgroups | gmane.comp.python.wxpython.devel |
|---|---|
| Message-ID | <[email protected]> |
>
> Isn't this PR from you? https://github.com/wxWidgets/Phoenix/pull/23
> <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2FwxWidgets%2FPhoenix%2Fpull%2F23&sa=D&sntz=1&usg=AFQjCNG6CQB374V3aVfPEkSO6dQ8YidXqw>
Yes it is. I'd actually forgotten about that one ^_^ I'll have to make
sure I didn't accidentally overwrite my changes from that PR.
I'm still getting used to the git process flow, especially when it comes to
contributing to other projects. Should I have made a branch after forking?
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'll make sure that this is not part of PR #23.
Regarding properties:
I'll go through and make properties for every getter/setter, using
CamelCase for the property names (not camelCase as they are now).
On Friday, July 31, 2015 at 12:04:29 AM UTC-7, werner wrote:
>
> 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.