Changeset b016f17 in sasview for src/sas/qtgui/Plotting
- Timestamp:
- Mar 28, 2019 9:24:38 AM (6 years ago)
- Branches:
- ESS_GUI, ESS_GUI_opencl
- Children:
- 73fb503
- Parents:
- b8bdbcc
- Location:
- src/sas/qtgui/Plotting
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Plotting/Plotter.py
r4c11b2a rb016f17 19 19 import sas.qtgui.Utilities.GuiUtils as GuiUtils 20 20 import sas.qtgui.Plotting.PlotUtilities as PlotUtilities 21 22 def _legendResize(width): 23 """ 24 resize factor for the legend, based on total canvas width 25 """ 26 # The factor 4.0 was chosen to look similar in size/ratio to what we had in 4.x 27 return (width/100.0)+4.0 21 28 22 29 class PlotterWidget(PlotterBase): … … 194 201 195 202 if self.showLegend: 196 self.legend = ax.legend(loc='upper right', shadow=True) 203 width=_legendResize(self.canvas.size().width()) 204 205 self.legend = ax.legend(loc='upper right', shadow=True, prop={'size':width}) 197 206 if self.legend: 198 207 self.legend.set_picker(True) … … 206 215 # refresh canvas 207 216 self.canvas.draw_idle() 217 218 def onResize(self, event): 219 """ 220 Resize the legend window/font on canvas resize 221 """ 222 width = _legendResize(event.width) 223 # resize the legend to follow the canvas width. 224 self.legend.prop.set_size(width) 208 225 209 226 def createContextMenu(self): -
src/sas/qtgui/Plotting/PlotterBase.py
r8fad50b rb016f17 111 111 self.contextMenu = QtWidgets.QMenu(self) 112 112 self.toolbar = NavigationToolbar(self.canvas, self) 113 cid = self.canvas.mpl_connect('resize_event', self.onResize) 114 113 115 layout.addWidget(self.toolbar) 114 116 if not quickplot: … … 244 246 raise NotImplementedError("Context menu method must be implemented in derived class.") 245 247 248 def onResize(self, event): 249 """ 250 Redefine default resize event 251 """ 252 pass 253 246 254 def contextMenuEvent(self, event): 247 255 """
Note: See TracChangeset
for help on using the changeset viewer.