- Timestamp:
- Jan 24, 2018 3:52:41 AM (7 years ago)
- Branches:
- ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
- Children:
- 116dd4c1
- Parents:
- 0764593
- Location:
- src/sas/qtgui
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/ConstraintWidget.py
r0764593 reb1a386 142 142 is_good_moniker = self.validateMoniker(new_moniker) 143 143 if not is_good_moniker: 144 self.tblTabList.blockSignals(True) 144 145 item.setBackground(QtCore.Qt.red) 146 self.tblTabList.blockSignals(False) 145 147 self.cmdFit.setEnabled(False) 146 148 return -
src/sas/qtgui/Plotting/Plotter.py
r8f83719f reb1a386 282 282 Show a dialog allowing adding custom text to the chart 283 283 """ 284 if self.addText.exec_() == QtWidgets.QDialog.Accepted: 285 # Retrieve the new text, its font and color 286 extra_text = self.addText.text() 287 extra_font = self.addText.font() 288 extra_color = self.addText.color() 289 290 # Place the text on the screen at (0,0) 291 pos_x = self.x_click 292 pos_y = self.y_click 293 294 # Map QFont onto MPL font 295 mpl_font = FontProperties() 296 mpl_font.set_size(int(extra_font.pointSize())) 297 mpl_font.set_family(str(extra_font.family())) 298 mpl_font.set_weight(int(extra_font.weight())) 299 # MPL style names 300 styles = ['normal', 'italic', 'oblique'] 301 # QFont::Style maps directly onto the above 302 try: 303 mpl_font.set_style(styles[extra_font.style()]) 304 except: 305 pass 306 307 if len(extra_text) > 0: 308 new_text = self.ax.text(str(pos_x), 309 str(pos_y), 310 extra_text, 311 color=extra_color, 312 fontproperties=mpl_font) 313 # Update the list of annotations 314 self.textList.append(new_text) 315 self.canvas.draw_idle() 316 pass 284 if self.addText.exec_() != QtWidgets.QDialog.Accepted: 285 return 286 287 # Retrieve the new text, its font and color 288 extra_text = self.addText.text() 289 extra_font = self.addText.font() 290 extra_color = self.addText.color() 291 292 # Place the text on the screen at the click location 293 pos_x = self.x_click 294 pos_y = self.y_click 295 296 # Map QFont onto MPL font 297 mpl_font = FontProperties() 298 mpl_font.set_size(int(extra_font.pointSize())) 299 mpl_font.set_family(str(extra_font.family())) 300 mpl_font.set_weight(int(extra_font.weight())) 301 # MPL style names 302 styles = ['normal', 'italic', 'oblique'] 303 # QFont::Style maps directly onto the above 304 try: 305 mpl_font.set_style(styles[extra_font.style()]) 306 except: 307 pass 308 309 if len(extra_text) > 0: 310 new_text = self.ax.text(pos_x, 311 pos_y, 312 extra_text, 313 color=extra_color, 314 fontproperties=mpl_font) 315 316 # Update the list of annotations 317 self.textList.append(new_text) 318 self.canvas.draw() 317 319 318 320 def onRemoveText(self): … … 325 327 txt = self.textList[num_text - 1] 326 328 text_remove = txt.get_text() 327 txt.remove() 329 try: 330 txt.remove() 331 except ValueError: 332 # Text got already deleted somehow 333 pass 328 334 self.textList.remove(txt) 329 335 -
src/sas/qtgui/Plotting/PlotterBase.py
r8f83719f reb1a386 6 6 from PyQt5 import QtWidgets, QtPrintSupport 7 7 8 # TODO: Replace the qt4agg calls below with qt5 equivalent.9 # Requires some code modifications.10 # https://www.boxcontrol.net/embedding-matplotlib-plot-on-pyqt5-gui.html11 #12 # matplotlib.use("Qt5Agg")13 8 from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas 14 9 from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar … … 36 31 37 32 #plt.style.use('ggplot') 38 plt.style.use('seaborn-darkgrid')33 #plt.style.use('seaborn-darkgrid') 39 34 40 35 # a figure instance to plot on … … 176 171 def xscale(self, scale='linear'): 177 172 """ X-axis scale setter """ 173 self.ax.cla() 178 174 self.ax.set_xscale(scale) 179 175 self._xscale = scale
Note: See TracChangeset
for help on using the changeset viewer.