Closed mswallac closed 5 years ago
thanks for the bug report! this should be fixed now
Sorry I didn't get the chance to try this myself until now. It seems I still get a similar error to the one mentioned in my edit. I created a new environment with the current state of the phy-dev branch and the phylib-master branch, and copied the updated version of the plugin from docs/plugins.md.
Edit: It's worth noting that in my case, this only happens when I click View>New view>Add FeatureDensityView. If I don't do this, the FeatureDensityView will not be displayed, and will give no errors.
Here is the current error:
[90m15:15:06.090 [D] gui:390 Add view FeatureDensityView to GUI.[0m
[33m15:15:06.090 [W] actions:190 Error when executing action Add FeatureDensityView.[0m
[90m15:15:06.093 [D] actions:191 Traceback (most recent call last):
File "c:\users\labadmin\desktop\phy\phy2_env\phy-dev\phy\gui\actions.py", line 188, in wrapped
return callback(*args)
File "c:\users\labadmin\desktop\phy\phy2_env\phy-dev\phy\gui\gui.py", line 356, in _create_and_add_view
view.attach(self)
File "c:\users\labadmin\desktop\phy\phy2_env\phy-dev\phy\cluster\views\base.py", line 154, in attach
gui.add_view(self, position=self._default_position)
File "c:\users\labadmin\desktop\phy\phy2_env\phy-dev\phy\gui\gui.py", line 397, in add_view
widget = _try_get_matplotlib_canvas(view)
File "c:\users\labadmin\desktop\phy\phy2_env\phy-dev\phy\gui\gui.py", line 39, in _try_get_matplotlib_canvas
view = FigureCanvasQTAgg(view.canvas.figure)
File "C:\Users\labadmin\Miniconda3\envs\phy2\lib\site-packages\matplotlib\backends\backend_qt5agg.py", line 21, in __init__
super().__init__(figure=figure)
File "C:\Users\labadmin\Miniconda3\envs\phy2\lib\site-packages\matplotlib\backends\backend_qt5.py", line 232, in __init__
self._update_figure_dpi()
File "C:\Users\labadmin\Miniconda3\envs\phy2\lib\site-packages\matplotlib\backends\backend_qt5.py", line 257, in _update_figure_dpi
self.figure._set_dpi(dpi, forward=False)
File "C:\Users\labadmin\Miniconda3\envs\phy2\lib\site-packages\matplotlib\figure.py", line 477, in _set_dpi
self.set_size_inches(w, h, forward=forward)
File "C:\Users\labadmin\Miniconda3\envs\phy2\lib\site-packages\matplotlib\figure.py", line 913, in set_size_inches
self.stale = True
File "C:\Users\labadmin\Miniconda3\envs\phy2\lib\site-packages\matplotlib\artist.py", line 230, in stale
self.stale_callback(self, val)
File "C:\Users\labadmin\Miniconda3\envs\phy2\lib\site-packages\matplotlib\pyplot.py", line 583, in _auto_draw_if_interactive
fig.canvas.draw_idle()
File "C:\Users\labadmin\Miniconda3\envs\phy2\lib\site-packages\matplotlib\backends\backend_qt5.py", line 491, in draw_idle
if not (self._draw_pending or self._is_drawing):
AttributeError: 'FigureCanvasQTAgg' object has no attribute '_draw_pending'
[0m
That might be a matplotlib bug. What is your version of matplotlib? Could you update it to the latest one? Otherwise could you try upgrading to the development version of matplotlib?
I am on version 3.1.0, which seems to be the latest. At the moment I'm having some issues installing the development version of matplotlib, so I'll have to resolve that first. Sorry for the delay.
Edit: For now I think I'll prototype my matplotlib plugins as scripts run from the IPython view.
Edit: Attempted to work around this with 312433ea4caf3cb6afa7ff9b3a5fa8369375dac4 but now receive the error below when trying to add the view associated with this plugin (even after undoing 312433ea4caf3cb6afa7ff9b3a5fa8369375dac4):
Original Issue: When attempting to use the custom matplotlib view plugin it seems like code in base.py will still attempt to treat the matplotlib canvas as an OpenGL canvas.
Here is the full error:
Below is the code in .phy/plugins/MyPlugin.py (which should be unmodified from the example given in phy/docs/plugins.md):
And for the sake of thoroughness here is .phy/phy_config.py: