wxp4: .ViewStart not available on wx.ScrolledPanel/Window anymore ?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

wxp4: .ViewStart not available on wx.ScrolledPanel/Window anymore ?

Karsten Hilbert
I am seeing this exception with some code ported from wxp2/3 to wxp4:

        2019-07-02 12:13:58  DEBUG     gm.gui        [3081825984 MainThread]  (/home/ncq/Projekte/gm/git/gnumed/gnumed/Gnumed/wxpython/gmExceptionHandlingWidgets.py::handle_uncaught_exception_wx() #198): unhandled exception caught:
        Traceback (most recent call last):
          File "/home/ncq/Projekte/gm/git/gnumed/gnumed/Gnumed/wxpython/gmTextCtrl.py", line 386, in _on_expando_needs_layout
            y_view = self.ViewStart[1]
        AttributeError: 'cProgressNotesEAPnl' object has no attribute 'ViewStart'

The cProgressNotesEAPnl is a child of wx.ScrolledWindow and
uses .ViewStart to scroll into view the line with the cursor
of an (expando) text ctrl contained within the panel:

        def _on_expando_needs_layout(self, evt):
                # need to tell ourselves to re-Layout to refresh scroll bars

                # provoke adding scrollbar if needed
                #self.Fit() # works on Linux but not on Windows
                self.FitInside() # needed on Windows rather than self.Fit()

                if self.HasScrollbar(wx.VERTICAL):
                        # scroll panel to show cursor
                        expando = self.FindWindowById(evt.GetId())
                        y_expando = expando.GetPositionTuple()[1]
                        h_expando = expando.GetSize()[1]
                        line_of_cursor = expando.PositionToXY(expando.GetInsertionPoint())[2] + 1
                        if expando.NumberOfLines == 0:
                                no_of_lines = 1
                        else:
                                no_of_lines = expando.NumberOfLines
                        y_cursor = int(round((float(line_of_cursor) / no_of_lines) * h_expando))
                        y_desired_visible = y_expando + y_cursor

                        ###############################
                        # failing call:
                        ###############################
                        y_view = self.ViewStart[1]
                        h_view = self.GetClientSize()[1]

                        # expando starts before view
                        if y_desired_visible < y_view:
                                self.Scroll(0, y_desired_visible)

                        if y_desired_visible > h_view:
                                self.Scroll(0, y_desired_visible)

which fails, due to the .ViewStart property not available anymore.

I have not been able to derive from documentation what I
should use instead.

Thanks for any suggestions,
Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/20190703094216.GB2383%40hermes.hilbert.loc.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: wxp4: .ViewStart not available on wx.ScrolledPanel/Window anymore ?

Karsten Hilbert
On Wed, Jul 03, 2019 at 11:42:16AM +0200, Karsten Hilbert wrote:

> I am seeing this exception with some code ported from wxp2/3 to wxp4:
>
> 2019-07-02 12:13:58  DEBUG     gm.gui        [3081825984 MainThread]  (/home/ncq/Projekte/gm/git/gnumed/gnumed/Gnumed/wxpython/gmExceptionHandlingWidgets.py::handle_uncaught_exception_wx() #198): unhandled exception caught:
> Traceback (most recent call last):
>  File "/home/ncq/Projekte/gm/git/gnumed/gnumed/Gnumed/wxpython/gmTextCtrl.py", line 386, in _on_expando_needs_layout
>    y_view = self.ViewStart[1]
> AttributeError: 'cProgressNotesEAPnl' object has no attribute 'ViewStart'
...
> which fails, due to the .ViewStart property not available anymore.
>
> I have not been able to derive from documentation what I
> should use instead.

However, single-stepping through dir(wx.ScrolledWindow)
showed that .GetViewStart() still exists, it simply seems to
not be exposed as a Property anymore.

Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/20190703124858.GE2383%40hermes.hilbert.loc.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: wxp4: .ViewStart not available on wx.ScrolledPanel/Window anymore ?

Robin Dunn
On Wednesday, July 3, 2019 at 5:49:09 AM UTC-7, Karsten Hilbert wrote:

However, single-stepping through dir(wx.ScrolledWindow)
showed that .GetViewStart() still exists, it simply seems to
not be exposed as a Property anymore.

Thanks, I've created a ticket for it here: https://github.com/wxWidgets/Phoenix/issues/1295

--
Robin

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/bbb292a8-1624-416f-a1d2-daacb73e5c30%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.