Opened 9 years ago

Closed 9 years ago

#370 closed defect (fixed)

Data operations tool is broken

Reported by: butler Owned by: ricardo
Priority: blocker Milestone: SasView 3.1.0
Component: SasView Keywords:
Cc: Work Package: SasView Bug Fixing

Description (last modified by butler)

The graphics of data operations tool does not seem to work. Instead of showing the plot in the window it makes a blank square. Apply does seem to work but hard to tell. Fails on both mac and PC it seems.

Change History (11)

comment:1 Changed 9 years ago by butler

  • Priority changed from major to blocker

comment:2 Changed 9 years ago by butler

  • Owner set to butler
  • Status changed from new to accepted

comment:3 Changed 9 years ago by butler

  • Description modified (diff)
  • Summary changed from Check on using data operations tool to Data operations tool is broken

On March 26, 2015 Paul Kienzle added the following note to ticket 390 which really belongs here so copying it over here.

The drop down box Tool:Data Operation:Data1 doesn't work on mac, but works on windows.

Note that actually the drop down on mac has a fast "jitter" which does not the PC, but the PC is not able to see any data in the box once chosen.

comment:4 Changed 9 years ago by butler

Some sleuthing seems to indicat that the problem is in add_image method of DataOperPanel? in data_operato.py. The final line is:

  self.subplot.figure.canas.draw()

This line does seem to draw the data in the pre code-camp version but does nothing now.

comment:5 Changed 9 years ago by butler

Ricardo Notes on April 21, 2015:

The problem seems to lie with the wx.EVT_PAINT. It can’t be used without wx.PaintDC. Otherwise it creates a stream of events that in this case are calling:

 464    def set_panel_on_focus(self, event)

Thus the dropdown flickering in Mac….

In my Ubuntu changing this:

  65         self.Bind(wx.EVT_PAINT, self.set_panel_on_focus)

to:

65         self.Bind(wx.EVT_SET_FOCUS, self.set_panel_on_focus)

Sorted out the problems

comment:6 Changed 9 years ago by butler

Testing this fix it seems that it probably fixes the mac flicker problem and changes the PC failure behavior on redrawing but the data is still not plotted. It now leaves the panel apparently intact (with a question mark) instead of plotting a blank square. This however does seem to be an appropriate correction even if it does not completely fix the problem.

comment:7 Changed 9 years ago by smk78

22/04/15 09:36 BST
Just PULLed from the repo and built SasView? locally. I no longer have a Tools option in my menu bar!

comment:8 Changed 9 years ago by ricardo

In sas/perspectives/calculator/data_operator.py:

        self.Bind(wx.EVT_SET_FOCUS, self.set_panel_on_focus)

I guess we still need an event different from wx.EVT_PAINT because there is no
wx.PaintDC to catch the stream of events. You can easily see this with prints in

    def set_panel_on_focus(self, event):

Not sure if the wx.EVT_SET_FOCUS is the right one.

Regarding the images not appearing. The problem was in the PlotPanel.properties(self, prop). It was using the old matplotlib latex format. In my Ubuntu everything appears to work now.

The changes were committed to branch ricardo_dev.

comment:9 Changed 9 years ago by ricardo

It looks like matplotlib is smart enough to detect latex and plot the right labels.

The problem was an empty label being rendered as r"$$". There's test for empty strings now https://github.com/SasView/sasview/commit/7e0f9b55273843a20a74196a1fed0b9a76b3f411.
No need for matplotlib.rc('text', usetex=True) which was making thing slow (Don't know why…).

Tested in Ubuntu and Mac:

  • Tools → Data Operations : Working
  • Data Explorer → New Plot : Working

comment:10 Changed 9 years ago by butler

  • Owner changed from butler to ricardo
  • Status changed from accepted to assigned

Downloaded from ESS Jenkins server and tested on windows - works fine.

comment:11 Changed 9 years ago by ricardo

  • Resolution set to fixed
  • Status changed from assigned to closed
Note: See TracTickets for help on using tickets.