[1bf33c1] | 1 | |
---|
[d955bf19] | 2 | ################################################################################ |
---|
[090e07e] | 3 | # This software was developed by the University of Tennessee as part of the |
---|
| 4 | # Distributed Data Analysis of Neutron Scattering Experiments (DANSE) |
---|
| 5 | # project funded by the US National Science Foundation. |
---|
[d955bf19] | 6 | # |
---|
[090e07e] | 7 | # See the license text in license.txt |
---|
[d955bf19] | 8 | # |
---|
[090e07e] | 9 | # copyright 2008, University of Tennessee |
---|
[d955bf19] | 10 | ################################################################################ |
---|
[1bf33c1] | 11 | |
---|
| 12 | |
---|
| 13 | import wx |
---|
[4ac8556] | 14 | import sys |
---|
| 15 | import math |
---|
| 16 | import numpy |
---|
[090e07e] | 17 | import logging |
---|
[d7bb526] | 18 | from sas.sasgui.plottools.PlotPanel import PlotPanel |
---|
[d85c194] | 19 | from sas.sasgui.guiframe.events import StatusEvent |
---|
| 20 | from sas.sasgui.guiframe.events import PanelOnFocusEvent |
---|
| 21 | from sas.sasgui.guiframe.utils import PanelMenu, IdList |
---|
| 22 | from sas.sasgui.guiframe.panel_base import PanelBase |
---|
| 23 | from sas.sasgui.guiframe.gui_style import GUIFRAME_ICON |
---|
[f8be87d] | 24 | from appearanceDialog import appearanceDialog |
---|
[8f59e95] | 25 | from graphAppearance import graphAppearance |
---|
[1bf33c1] | 26 | |
---|
[0d9dae8] | 27 | DEFAULT_QMAX = 0.05 |
---|
[1bf33c1] | 28 | DEFAULT_QSTEP = 0.001 |
---|
| 29 | DEFAULT_BEAM = 0.005 |
---|
[32c0841] | 30 | BIN_WIDTH = 1 |
---|
[940aca7] | 31 | IS_MAC = (sys.platform == 'darwin') |
---|
[0d9dae8] | 32 | |
---|
[8f59e95] | 33 | |
---|
| 34 | def find_key(dic, val): |
---|
| 35 | """return the key of dictionary dic given the value""" |
---|
| 36 | return [k for k, v in dic.iteritems() if v == val][0] |
---|
| 37 | |
---|
[691643c] | 38 | class ModelPanel1D(PlotPanel, PanelBase): |
---|
[1bf33c1] | 39 | """ |
---|
[d955bf19] | 40 | Plot panel for use with the GUI manager |
---|
[1bf33c1] | 41 | """ |
---|
[090e07e] | 42 | |
---|
[1bf33c1] | 43 | ## Internal name for the AUI manager |
---|
| 44 | window_name = "plotpanel" |
---|
| 45 | ## Title to appear on top of the window |
---|
[37c36d9] | 46 | window_caption = "Graph" |
---|
[1bf33c1] | 47 | ## Flag to tell the GUI manager that this panel is not |
---|
| 48 | # tied to any perspective |
---|
| 49 | ALWAYS_ON = True |
---|
| 50 | ## Group ID |
---|
| 51 | group_id = None |
---|
[6f16e25] | 52 | _menu_ids = IdList() |
---|
[090e07e] | 53 | |
---|
| 54 | def __init__(self, parent, id=-1, color=None, |
---|
[32c0841] | 55 | dpi=None, style=wx.NO_FULL_REPAINT_ON_RESIZE, **kwargs): |
---|
| 56 | PlotPanel.__init__(self, parent, id=id, style=style, **kwargs) |
---|
[a45037aa] | 57 | PanelBase.__init__(self, parent) |
---|
[1bf33c1] | 58 | ## Reference to the parent window |
---|
| 59 | self.parent = parent |
---|
[ae84427] | 60 | if hasattr(parent, "parent"): |
---|
| 61 | self.parent = self.parent.parent |
---|
[1bf33c1] | 62 | ## Plottables |
---|
| 63 | self.plots = {} |
---|
[ae84427] | 64 | self.frame = None |
---|
[090e07e] | 65 | # context menu |
---|
[52b8b74] | 66 | self._slicerpop = None |
---|
[090e07e] | 67 | |
---|
[52b8b74] | 68 | self._available_data = [] |
---|
[a07e72f] | 69 | self._symbol_labels = self.get_symbol_label() |
---|
[2636188] | 70 | self._color_labels = self.get_color_label() |
---|
| 71 | self.currColorIndex = "" |
---|
[36288ca] | 72 | self._is_changed_legend_label = False |
---|
[657e52c] | 73 | self.is_xtick = False |
---|
| 74 | self.is_ytick = False |
---|
[090e07e] | 75 | |
---|
[a07e72f] | 76 | self.hide_menu = None |
---|
[1bf33c1] | 77 | ## Unique ID (from gui_manager) |
---|
| 78 | self.uid = None |
---|
[66718a1] | 79 | self.x_size = None |
---|
[6063b16] | 80 | ## Default locations |
---|
[090e07e] | 81 | # self._default_save_location = os.getcwd() |
---|
| 82 | self.size = None |
---|
| 83 | self.vl_ind = 0 |
---|
| 84 | ## Graph |
---|
| 85 | # self.graph = Graph() |
---|
[1bf33c1] | 86 | self.graph.xaxis("\\rm{Q}", 'A^{-1}') |
---|
[32c0841] | 87 | self.graph.yaxis("\\rm{Intensity} ", "cm^{-1}") |
---|
[1bf33c1] | 88 | self.graph.render(self) |
---|
[3e001f9] | 89 | self.cursor_id = None |
---|
[090e07e] | 90 | |
---|
[6d727ae] | 91 | # In resizing event |
---|
| 92 | self.resizing = False |
---|
| 93 | self.canvas.set_resizing(self.resizing) |
---|
| 94 | self.Bind(wx.EVT_SIZE, self._OnReSize) |
---|
[6e75ed0] | 95 | self.parent.SetFocus() |
---|
[090e07e] | 96 | |
---|
| 97 | |
---|
[a07e72f] | 98 | def get_symbol_label(self): |
---|
[52b8b74] | 99 | """ |
---|
[a07e72f] | 100 | Associates label to symbol |
---|
[52b8b74] | 101 | """ |
---|
[a07e72f] | 102 | _labels = {} |
---|
| 103 | i = 0 |
---|
[6d727ae] | 104 | _labels['Circle'] = i |
---|
[a07e72f] | 105 | i += 1 |
---|
[6d727ae] | 106 | _labels['Cross X '] = i |
---|
[a07e72f] | 107 | i += 1 |
---|
| 108 | _labels['Triangle Down'] = i |
---|
| 109 | i += 1 |
---|
| 110 | _labels['Triangle Up'] = i |
---|
| 111 | i += 1 |
---|
| 112 | _labels['Triangle Left'] = i |
---|
| 113 | i += 1 |
---|
| 114 | _labels['Triangle Right'] = i |
---|
| 115 | i += 1 |
---|
[6d727ae] | 116 | _labels['Cross +'] = i |
---|
[a07e72f] | 117 | i += 1 |
---|
| 118 | _labels['Square'] = i |
---|
| 119 | i += 1 |
---|
[318b5bbb] | 120 | _labels['diamond'] = i |
---|
[a07e72f] | 121 | i += 1 |
---|
| 122 | _labels['Diamond'] = i |
---|
| 123 | i += 1 |
---|
| 124 | _labels['Hexagon1'] = i |
---|
| 125 | i += 1 |
---|
| 126 | _labels['Hexagon2'] = i |
---|
| 127 | i += 1 |
---|
| 128 | _labels['Pentagon'] = i |
---|
| 129 | i += 1 |
---|
[6d727ae] | 130 | _labels['Line'] = i |
---|
[6c4130a] | 131 | i += 1 |
---|
| 132 | _labels['Dash'] = i |
---|
| 133 | i += 1 |
---|
| 134 | _labels['Vline'] = i |
---|
| 135 | i += 1 |
---|
| 136 | _labels['Step'] = i |
---|
[a07e72f] | 137 | return _labels |
---|
[090e07e] | 138 | |
---|
[2636188] | 139 | def get_color_label(self): |
---|
| 140 | """ |
---|
| 141 | Associates label to a specific color |
---|
| 142 | """ |
---|
| 143 | _labels = {} |
---|
| 144 | i = 0 |
---|
| 145 | _labels['Blue'] = i |
---|
| 146 | i += 1 |
---|
| 147 | _labels['Green'] = i |
---|
| 148 | i += 1 |
---|
| 149 | _labels['Red'] = i |
---|
| 150 | i += 1 |
---|
| 151 | _labels['Cyan'] = i |
---|
| 152 | i += 1 |
---|
| 153 | _labels['Magenta'] = i |
---|
| 154 | i += 1 |
---|
| 155 | _labels['Yellow'] = i |
---|
[ad019b83] | 156 | i += 1 |
---|
| 157 | _labels['Black'] = i |
---|
[2636188] | 158 | return _labels |
---|
[a07e72f] | 159 | |
---|
[090e07e] | 160 | |
---|
[32c0841] | 161 | def set_data(self, list=None): |
---|
[3c44c66] | 162 | """ |
---|
| 163 | """ |
---|
| 164 | pass |
---|
[090e07e] | 165 | |
---|
[1bf33c1] | 166 | def _reset(self): |
---|
| 167 | """ |
---|
[d955bf19] | 168 | Resets internal data and graph |
---|
[090e07e] | 169 | """ |
---|
[1bf33c1] | 170 | self.graph.reset() |
---|
[090e07e] | 171 | self.plots = {} |
---|
[cafa75f] | 172 | self.is_zoomed = False |
---|
[090e07e] | 173 | |
---|
| 174 | def _OnReSize(self, event): |
---|
[6d727ae] | 175 | """ |
---|
| 176 | On response of the resize of a panel, set axes_visiable False |
---|
| 177 | """ |
---|
[66718a1] | 178 | # It was found that wx >= 2.9.3 sends an event even if no size changed. |
---|
[294efd5] | 179 | # So manually recode the size (=x_size) and compare here. |
---|
[940aca7] | 180 | # Massy code to work around:< |
---|
| 181 | if self.parent._mgr != None: |
---|
| 182 | max_panel = self.parent._mgr.GetPane(self) |
---|
| 183 | if max_panel.IsMaximized(): |
---|
| 184 | self.parent._mgr.RestorePane(max_panel) |
---|
| 185 | max_panel.Maximize() |
---|
[66718a1] | 186 | if self.x_size != None: |
---|
| 187 | if self.x_size == self.GetSize(): |
---|
[71fa9bb9] | 188 | self.resizing = False |
---|
| 189 | self.canvas.set_resizing(self.resizing) |
---|
[66718a1] | 190 | return |
---|
[294efd5] | 191 | self.x_size = self.GetSize() |
---|
| 192 | |
---|
[ad9e5e1] | 193 | # Ready for another event |
---|
[4520830] | 194 | # Do not remove this Skip. Otherwise it will get runtime error on wx>=2.9. |
---|
[090e07e] | 195 | event.Skip() |
---|
[6d727ae] | 196 | # set the resizing flag |
---|
| 197 | self.resizing = True |
---|
| 198 | self.canvas.set_resizing(self.resizing) |
---|
| 199 | self.parent.set_schedule(True) |
---|
[adf44c2] | 200 | pos_x, pos_y = self.GetPositionTuple() |
---|
| 201 | if pos_x != 0 and pos_y != 0: |
---|
[294efd5] | 202 | self.size, _ = self.GetClientSizeTuple() |
---|
[2b29bb4] | 203 | self.SetSizer(self.sizer) |
---|
[090e07e] | 204 | wx.CallAfter(self.parent.disable_app_menu, self) |
---|
| 205 | |
---|
[3e001f9] | 206 | def on_plot_qrange(self, event=None): |
---|
| 207 | """ |
---|
| 208 | On Qmin Qmax vertical line event |
---|
| 209 | """ |
---|
| 210 | if event == None: |
---|
| 211 | return |
---|
[090e07e] | 212 | event.Skip() |
---|
[3e001f9] | 213 | active_ctrl = event.active |
---|
| 214 | if active_ctrl == None: |
---|
| 215 | return |
---|
| 216 | if event.id in self.plots.keys(): |
---|
[b99a4552] | 217 | ctrl = event.ctrl |
---|
| 218 | self.cursor_id = event.id |
---|
[3e001f9] | 219 | # Set line position and color |
---|
| 220 | colors = ['red', 'purple'] |
---|
[b99a4552] | 221 | x_data = self.plots[self.cursor_id].x |
---|
| 222 | values = [max(x_data.min(), float(ctrl[0].GetValue())), |
---|
| 223 | min(x_data.max(), float(ctrl[1].GetValue()))] |
---|
[3e001f9] | 224 | if self.ly == None: |
---|
| 225 | self.ly = [] |
---|
[b99a4552] | 226 | for c, v in zip(colors, values): |
---|
| 227 | h = self.subplot.axvline(x=v, color=c, lw=2.5, alpha=0.7) |
---|
| 228 | h.set_rasterized(True) |
---|
| 229 | self.ly.append(h) |
---|
[3e001f9] | 230 | try: |
---|
| 231 | # Display x,y in the status bar if possible |
---|
| 232 | xval = float(active_ctrl.GetValue()) |
---|
| 233 | position = self.get_data_xy_vals(xval) |
---|
| 234 | if position != None: |
---|
| 235 | wx.PostEvent(self.parent, StatusEvent(status=position)) |
---|
| 236 | except: |
---|
[090e07e] | 237 | logging.error(sys.exc_value) |
---|
[3e001f9] | 238 | if not event.leftdown: |
---|
[090e07e] | 239 | # text event |
---|
[3e001f9] | 240 | try: |
---|
| 241 | is_moved = False |
---|
[b99a4552] | 242 | for h, v in zip(self.ly, values): |
---|
[3e001f9] | 243 | # check if vline moved |
---|
[b99a4552] | 244 | if h.get_xdata() != v: |
---|
| 245 | h.set_xdata(v) |
---|
[3e001f9] | 246 | is_moved = True |
---|
| 247 | if is_moved: |
---|
[090e07e] | 248 | self.canvas.draw() |
---|
[3e001f9] | 249 | except: |
---|
[090e07e] | 250 | logging.error(sys.exc_value) |
---|
| 251 | event.Skip() |
---|
[3e001f9] | 252 | return |
---|
| 253 | self.q_ctrl = ctrl |
---|
[b99a4552] | 254 | for h, c, v in zip(self.ly, colors, values): |
---|
| 255 | h.set_color(c) |
---|
| 256 | h.set_xdata(v) |
---|
[3e001f9] | 257 | self.canvas.draw() |
---|
| 258 | else: |
---|
| 259 | self.q_ctrl = None |
---|
[090e07e] | 260 | |
---|
[3e001f9] | 261 | def get_data_xy_vals(self, xval): |
---|
| 262 | """ |
---|
| 263 | Get x, y data values near x = x_val |
---|
| 264 | """ |
---|
| 265 | try: |
---|
| 266 | x_data = self.plots[self.cursor_id].x |
---|
| 267 | y_data = self.plots[self.cursor_id].y |
---|
| 268 | indx = self._find_nearest(x_data, xval) |
---|
| 269 | pos_x = x_data[indx] |
---|
| 270 | pos_y = y_data[indx] |
---|
| 271 | position = str(pos_x), str(pos_y) |
---|
| 272 | return position |
---|
| 273 | except: |
---|
| 274 | return None |
---|
[090e07e] | 275 | |
---|
[3e001f9] | 276 | def _find_nearest(self, array, value): |
---|
| 277 | """ |
---|
| 278 | Find and return the nearest value in array to the value. |
---|
| 279 | Used in cusor_line() |
---|
| 280 | :Param array: numpy array |
---|
| 281 | :Param value: float |
---|
| 282 | """ |
---|
| 283 | idx = (numpy.abs(array - value)).argmin() |
---|
[090e07e] | 284 | return int(idx) # array.flat[idx] |
---|
| 285 | |
---|
[3e001f9] | 286 | def _check_line_positions(self, pos_x=None, nop=None): |
---|
| 287 | """ |
---|
| 288 | Check vertical line positions |
---|
| 289 | :Param pos_x: position of the current line [float] |
---|
| 290 | :Param nop: number of plots [int] |
---|
| 291 | """ |
---|
| 292 | ly = self.ly |
---|
| 293 | ly0x = ly[0].get_xdata() |
---|
| 294 | ly1x = ly[1].get_xdata() |
---|
| 295 | self.q_ctrl[0].SetBackgroundColour('white') |
---|
| 296 | self.q_ctrl[1].SetBackgroundColour('white') |
---|
| 297 | if ly0x >= ly1x: |
---|
| 298 | if self.vl_ind == 0: |
---|
| 299 | ly[1].set_xdata(pos_x) |
---|
| 300 | ly[1].set_zorder(nop) |
---|
| 301 | self.q_ctrl[1].SetValue(str(pos_x)) |
---|
| 302 | self.q_ctrl[0].SetBackgroundColour('pink') |
---|
| 303 | elif self.vl_ind == 1: |
---|
| 304 | ly[0].set_xdata(pos_x) |
---|
| 305 | ly[0].set_zorder(nop) |
---|
| 306 | self.q_ctrl[0].SetValue(str(pos_x)) |
---|
| 307 | self.q_ctrl[1].SetBackgroundColour('pink') |
---|
[090e07e] | 308 | |
---|
[3e001f9] | 309 | def _get_cusor_lines(self, event): |
---|
| 310 | """ |
---|
| 311 | Revmove or switch cursor line if drawn |
---|
| 312 | :Param event: LeftClick mouse event |
---|
[090e07e] | 313 | """ |
---|
[3e001f9] | 314 | ax = event.inaxes |
---|
[ae84427] | 315 | if hasattr(event, "action"): |
---|
| 316 | dclick = event.action == 'dclick' |
---|
| 317 | if ax == None or dclick: |
---|
| 318 | # remove the vline |
---|
| 319 | self._check_zoom_plot() |
---|
| 320 | self.canvas.draw() |
---|
| 321 | self.q_ctrl = None |
---|
[090e07e] | 322 | return |
---|
[3e001f9] | 323 | if self.ly != None and event.xdata != None: |
---|
| 324 | # Selecting a new line if cursor lines are displayed already |
---|
| 325 | dqmin = math.fabs(event.xdata - self.ly[0].get_xdata()) |
---|
| 326 | dqmax = math.fabs(event.xdata - self.ly[1].get_xdata()) |
---|
| 327 | is_qmax = dqmin > dqmax |
---|
| 328 | if is_qmax: |
---|
| 329 | self.vl_ind = 1 |
---|
| 330 | else: |
---|
[090e07e] | 331 | self.vl_ind = 0 |
---|
| 332 | |
---|
[3e001f9] | 333 | def cusor_line(self, event): |
---|
| 334 | """ |
---|
| 335 | Move the cursor line to write Q range |
---|
| 336 | """ |
---|
| 337 | if self.q_ctrl == None: |
---|
| 338 | return |
---|
[090e07e] | 339 | # release a q range vline |
---|
[3e001f9] | 340 | if self.ly != None and not self.leftdown: |
---|
| 341 | for ly in self.ly: |
---|
| 342 | ly.set_alpha(0.7) |
---|
| 343 | self.canvas.draw() |
---|
| 344 | return |
---|
| 345 | ax = event.inaxes |
---|
| 346 | if ax == None or not hasattr(event, 'action'): |
---|
| 347 | return |
---|
| 348 | end_drag = event.action != 'drag' and event.xdata != None |
---|
| 349 | nop = len(self.plots) |
---|
[090e07e] | 350 | pos_x, _ = float(event.xdata), float(event.ydata) |
---|
[3e001f9] | 351 | try: |
---|
| 352 | ly = self.ly |
---|
| 353 | ly0x = ly[0].get_xdata() |
---|
| 354 | ly1x = ly[1].get_xdata() |
---|
| 355 | if ly0x == ly1x: |
---|
| 356 | if ly[0].get_zorder() > ly[1].get_zorder(): |
---|
| 357 | self.vl_ind = 0 |
---|
| 358 | else: |
---|
| 359 | self.vl_ind = 1 |
---|
| 360 | vl_ind = self.vl_ind |
---|
| 361 | x_data = self.plots[self.cursor_id].x |
---|
| 362 | xmin = x_data.min() |
---|
| 363 | xmax = x_data.max() |
---|
| 364 | indx = self._find_nearest(x_data, pos_x) |
---|
| 365 | # Need to hold LeftButton to drag |
---|
| 366 | if end_drag: |
---|
| 367 | if event.button: |
---|
| 368 | self._check_line_positions(pos_x, nop) |
---|
[090e07e] | 369 | return |
---|
[3e001f9] | 370 | if indx >= len(x_data): |
---|
| 371 | indx = len(x_data) - 1 |
---|
| 372 | pos_x = x_data[indx] |
---|
| 373 | if xmin == ly1x: |
---|
| 374 | vl_ind = 1 |
---|
| 375 | elif xmax == ly0x: |
---|
| 376 | vl_ind = 0 |
---|
| 377 | else: |
---|
| 378 | ly[vl_ind].set_xdata(pos_x) |
---|
| 379 | ly[vl_ind].set_zorder(nop + 1) |
---|
| 380 | self._check_line_positions(pos_x, nop) |
---|
| 381 | ly[vl_ind].set_xdata(pos_x) |
---|
| 382 | ly[vl_ind].set_alpha(1.0) |
---|
| 383 | ly[vl_ind].set_zorder(nop + 1) |
---|
| 384 | self.canvas.draw() |
---|
| 385 | self.q_ctrl[vl_ind].SetValue(str(pos_x)) |
---|
| 386 | except: |
---|
[090e07e] | 387 | logging.error(sys.exc_value) |
---|
| 388 | |
---|
[6d727ae] | 389 | def set_resizing(self, resizing=False): |
---|
| 390 | """ |
---|
| 391 | Set the resizing (True/False) |
---|
| 392 | """ |
---|
| 393 | self.resizing = resizing |
---|
[090e07e] | 394 | # self.canvas.set_resizing(resizing) |
---|
| 395 | |
---|
| 396 | def schedule_full_draw(self, func='append'): |
---|
[6d727ae] | 397 | """ |
---|
| 398 | Put self in schedule to full redraw list |
---|
| 399 | """ |
---|
| 400 | # append/del this panel in the schedule list |
---|
| 401 | self.parent.set_schedule_full_draw(self, func) |
---|
| 402 | |
---|
[a07e72f] | 403 | def remove_data_by_id(self, id): |
---|
[98816c43] | 404 | """ |
---|
| 405 | Remove data from plot |
---|
[a07e72f] | 406 | """ |
---|
| 407 | if id in self.plots.keys(): |
---|
[090e07e] | 408 | data = self.plots[id] |
---|
[a07e72f] | 409 | self.graph.delete(data) |
---|
| 410 | data_manager = self._manager.parent.get_data_manager() |
---|
[df22224] | 411 | data_list, theory_list = data_manager.get_by_id(id_list=[id]) |
---|
[090e07e] | 412 | |
---|
[df22224] | 413 | if id in data_list.keys(): |
---|
| 414 | data = data_list[id] |
---|
[248b918] | 415 | if id in theory_list.keys(): |
---|
[df22224] | 416 | data = theory_list[id] |
---|
[090e07e] | 417 | |
---|
[a07e72f] | 418 | del self.plots[id] |
---|
| 419 | self.graph.render(self) |
---|
[090e07e] | 420 | self.subplot.figure.canvas.draw_idle() |
---|
[a07e72f] | 421 | if len(self.graph.plottables) == 0: |
---|
[090e07e] | 422 | # onRemove: graph is empty must be the panel must be destroyed |
---|
[df22224] | 423 | self.parent.delete_panel(self.uid) |
---|
[090e07e] | 424 | |
---|
[a07e72f] | 425 | def plot_data(self, data): |
---|
[1bf33c1] | 426 | """ |
---|
[d955bf19] | 427 | Data is ready to be displayed |
---|
[090e07e] | 428 | |
---|
[d955bf19] | 429 | :param event: data event |
---|
[1bf33c1] | 430 | """ |
---|
[b837e1f] | 431 | if data.__class__.__name__ == 'Data2D': |
---|
| 432 | return |
---|
[6c4130a] | 433 | plot_keys = self.plots.keys() |
---|
| 434 | if data.id in plot_keys: |
---|
[090e07e] | 435 | # Recover panel prop.s |
---|
[e4a703a] | 436 | xlo, xhi = self.subplot.get_xlim() |
---|
| 437 | ylo, yhi = self.subplot.get_ylim() |
---|
[5eede4e] | 438 | old_data = self.plots[data.id] |
---|
[36288ca] | 439 | if self._is_changed_legend_label: |
---|
| 440 | data.label = old_data.label |
---|
[c9579e0] | 441 | if old_data.__class__.__name__ == 'Data1D': |
---|
| 442 | data.custom_color = old_data.custom_color |
---|
| 443 | data.symbol = old_data.symbol |
---|
| 444 | data.markersize = old_data.markersize |
---|
[6c4130a] | 445 | data.zorder = len(plot_keys) |
---|
[e4a703a] | 446 | # Replace data |
---|
[a07e72f] | 447 | self.graph.replace(data) |
---|
| 448 | self.plots[data.id] = data |
---|
[e4a703a] | 449 | ## Set the view scale for all plots |
---|
[a4964b8e] | 450 | try: |
---|
| 451 | self._onEVT_FUNC_PROPERTY() |
---|
[cafa75f] | 452 | except Exception, exc: |
---|
[090e07e] | 453 | wx.PostEvent(self.parent, |
---|
| 454 | StatusEvent(status="Plotting Error: %s" % str(exc), info="error")) |
---|
[cafa75f] | 455 | if self.is_zoomed: |
---|
[7022fdc] | 456 | # Recover the x,y limits |
---|
[090e07e] | 457 | self.subplot.set_xlim((xlo, xhi)) |
---|
| 458 | self.subplot.set_ylim((ylo, yhi)) |
---|
[a07e72f] | 459 | else: |
---|
| 460 | self.plots[data.id] = data |
---|
[090e07e] | 461 | self.graph.add(self.plots[data.id]) |
---|
[6c4130a] | 462 | data.zorder = len(plot_keys) |
---|
[e4a703a] | 463 | ## Set the view scale for all plots |
---|
[a4964b8e] | 464 | try: |
---|
| 465 | self._onEVT_FUNC_PROPERTY() |
---|
[940aca7] | 466 | if IS_MAC: |
---|
| 467 | # MAC: forcing to plot 2D avg |
---|
| 468 | self.canvas._onDrawIdle() |
---|
[090e07e] | 469 | except Exception, exc: |
---|
[4904062] | 470 | wx.PostEvent(self.parent, StatusEvent(status=\ |
---|
[090e07e] | 471 | "Plotting Error: %s" % str(exc), info="error")) |
---|
[fe48fcc] | 472 | self.toolbar.update() |
---|
[cafa75f] | 473 | self.is_zoomed = False |
---|
[090e07e] | 474 | |
---|
[6d727ae] | 475 | def draw_plot(self): |
---|
| 476 | """ |
---|
| 477 | Draw plot |
---|
| 478 | """ |
---|
[090e07e] | 479 | self.draw() |
---|
[6d727ae] | 480 | |
---|
[090e07e] | 481 | def onLeftDown(self, event): |
---|
| 482 | """ |
---|
[d955bf19] | 483 | left button down and ready to drag |
---|
| 484 | Display the position of the mouse on the statusbar |
---|
[6c0568b] | 485 | """ |
---|
[090e07e] | 486 | # self.parent.set_plot_unfocus() |
---|
[3e001f9] | 487 | self._get_cusor_lines(event) |
---|
[e85e2bc] | 488 | ax = event.inaxes |
---|
[3e001f9] | 489 | PlotPanel.onLeftDown(self, event) |
---|
[e85e2bc] | 490 | if ax != None: |
---|
[902f373] | 491 | try: |
---|
[090e07e] | 492 | pos_x = float(event.xdata) # / size_x |
---|
| 493 | pos_y = float(event.ydata) # / size_y |
---|
| 494 | pos_x = "%8.3g" % pos_x |
---|
| 495 | pos_y = "%8.3g" % pos_y |
---|
[902f373] | 496 | self.position = str(pos_x), str(pos_y) |
---|
| 497 | wx.PostEvent(self.parent, StatusEvent(status=self.position)) |
---|
| 498 | except: |
---|
[090e07e] | 499 | self.position = None |
---|
[0275276] | 500 | # unfocus all |
---|
[090e07e] | 501 | self.parent.set_plot_unfocus() |
---|
| 502 | # post nd event to notify guiframe that this panel is on focus |
---|
[a45037aa] | 503 | wx.PostEvent(self.parent, PanelOnFocusEvent(panel=self)) |
---|
[df68da1] | 504 | |
---|
[090e07e] | 505 | |
---|
[a07e72f] | 506 | def _ontoggle_hide_error(self, event): |
---|
| 507 | """ |
---|
| 508 | Toggle error display to hide or show |
---|
| 509 | """ |
---|
[70ec588d] | 510 | menu = event.GetEventObject() |
---|
[090e07e] | 511 | event_id = event.GetId() |
---|
| 512 | self.set_selected_from_menu(menu, event_id) |
---|
[ebf422a] | 513 | # Check zoom |
---|
| 514 | xlo, xhi = self.subplot.get_xlim() |
---|
| 515 | ylo, yhi = self.subplot.get_ylim() |
---|
| 516 | |
---|
[a07e72f] | 517 | selected_plot = self.plots[self.graph.selected_plottable] |
---|
[5637362] | 518 | if self.hide_menu.GetText() == "Hide Error Bar": |
---|
[a07e72f] | 519 | selected_plot.hide_error = True |
---|
| 520 | else: |
---|
| 521 | selected_plot.hide_error = False |
---|
| 522 | ## increment graph color |
---|
| 523 | self.graph.render(self) |
---|
[090e07e] | 524 | self.subplot.figure.canvas.draw_idle() |
---|
[cafa75f] | 525 | if self.is_zoomed: |
---|
[ebf422a] | 526 | # Recover the x,y limits |
---|
[090e07e] | 527 | self.subplot.set_xlim((xlo, xhi)) |
---|
| 528 | self.subplot.set_ylim((ylo, yhi)) |
---|
| 529 | |
---|
[ebf422a] | 530 | |
---|
[1bf33c1] | 531 | def _onRemove(self, event): |
---|
| 532 | """ |
---|
[090e07e] | 533 | Remove a plottable from the graph and render the graph |
---|
| 534 | |
---|
[d955bf19] | 535 | :param event: Menu event |
---|
[090e07e] | 536 | |
---|
[1bf33c1] | 537 | """ |
---|
[70ec588d] | 538 | menu = event.GetEventObject() |
---|
[090e07e] | 539 | event_id = event.GetId() |
---|
| 540 | self.set_selected_from_menu(menu, event_id) |
---|
[6c0568b] | 541 | ## Check if there is a selected graph to remove |
---|
[a07e72f] | 542 | if self.graph.selected_plottable in self.plots.keys(): |
---|
[090e07e] | 543 | graph_id = self.graph.selected_plottable |
---|
| 544 | self.remove_data_by_id(graph_id) |
---|
| 545 | |
---|
[1bf33c1] | 546 | def onContextMenu(self, event): |
---|
| 547 | """ |
---|
[d955bf19] | 548 | 1D plot context menu |
---|
[090e07e] | 549 | |
---|
[d955bf19] | 550 | :param event: wx context event |
---|
[090e07e] | 551 | |
---|
[1bf33c1] | 552 | """ |
---|
[52b8b74] | 553 | self._slicerpop = PanelMenu() |
---|
| 554 | self._slicerpop.set_plots(self.plots) |
---|
[090e07e] | 555 | self._slicerpop.set_graph(self.graph) |
---|
[6f16e25] | 556 | ids = iter(self._menu_ids) |
---|
[090e07e] | 557 | if not self.graph.selected_plottable in self.plots: |
---|
[70ec588d] | 558 | # Various plot options |
---|
[6f16e25] | 559 | wx_id = ids.next() |
---|
[090e07e] | 560 | self._slicerpop.Append(wx_id, '&Save Image', 'Save image as PNG') |
---|
| 561 | wx.EVT_MENU(self, wx_id, self.onSaveImage) |
---|
[6f16e25] | 562 | wx_id = ids.next() |
---|
[090e07e] | 563 | self._slicerpop.Append(wx_id, '&Print Image', 'Print image ') |
---|
| 564 | wx.EVT_MENU(self, wx_id, self.onPrint) |
---|
| 565 | |
---|
[6f16e25] | 566 | wx_id = ids.next() |
---|
[090e07e] | 567 | self._slicerpop.Append(wx_id, '&Copy to Clipboard', |
---|
[f866fb5] | 568 | 'Copy to the clipboard') |
---|
[090e07e] | 569 | wx.EVT_MENU(self, wx_id, self.OnCopyFigureMenu) |
---|
| 570 | |
---|
[70ec588d] | 571 | self._slicerpop.AppendSeparator() |
---|
| 572 | |
---|
| 573 | for plot in self.plots.values(): |
---|
[090e07e] | 574 | # title = plot.title |
---|
[6d727ae] | 575 | name = plot.name |
---|
[70ec588d] | 576 | plot_menu = wx.Menu() |
---|
[242aff5] | 577 | if self.graph.selected_plottable: |
---|
[4a9bce1] | 578 | if not self.graph.selected_plottable in self.plots.keys(): |
---|
| 579 | continue |
---|
[242aff5] | 580 | if plot != self.plots[self.graph.selected_plottable]: |
---|
| 581 | continue |
---|
[090e07e] | 582 | |
---|
[6f16e25] | 583 | wx_id = ids.next() |
---|
[090e07e] | 584 | plot_menu.Append(wx_id, "&DataInfo", name) |
---|
| 585 | wx.EVT_MENU(self, wx_id, self. _onDataShow) |
---|
[6f16e25] | 586 | wx_id = ids.next() |
---|
[090e07e] | 587 | plot_menu.Append(wx_id, "&Save Points as a File", name) |
---|
| 588 | wx.EVT_MENU(self, wx_id, self._onSave) |
---|
[940aca7] | 589 | plot_menu.AppendSeparator() |
---|
[090e07e] | 590 | |
---|
| 591 | # add menu of other plugins |
---|
[940aca7] | 592 | item_list = self.parent.get_current_context_menu(self) |
---|
[70ec588d] | 593 | if (not item_list == None) and (not len(item_list) == 0): |
---|
[6f16e25] | 594 | # Note: reusing menu ids in submenu. This code works because |
---|
| 595 | # IdItems is set up as a lazy iterator returning each id in |
---|
| 596 | # sequence, creating new ids as needed so it never runs out. |
---|
| 597 | # zip() is set up to stop when any iterator is empty, so it |
---|
| 598 | # only asks for the number of ids in item_list. |
---|
| 599 | for item, wx_id in zip(item_list, self._menu_ids): |
---|
[242aff5] | 600 | |
---|
[70ec588d] | 601 | try: |
---|
[090e07e] | 602 | plot_menu.Append(wx_id, item[0], name) |
---|
| 603 | wx.EVT_MENU(self, wx_id, item[2]) |
---|
[70ec588d] | 604 | except: |
---|
| 605 | msg = "ModelPanel1D.onContextMenu: " |
---|
| 606 | msg += "bad menu item %s" % sys.exc_value |
---|
| 607 | wx.PostEvent(self.parent, StatusEvent(status=msg)) |
---|
| 608 | plot_menu.AppendSeparator() |
---|
[090e07e] | 609 | |
---|
| 610 | if self.parent.ClassName.count('wxDialog') == 0: |
---|
[6f16e25] | 611 | wx_id = ids.next() |
---|
[090e07e] | 612 | plot_menu.Append(wx_id, '&Linear Fit', name) |
---|
| 613 | wx.EVT_MENU(self, wx_id, self.onFitting) |
---|
[70ec588d] | 614 | plot_menu.AppendSeparator() |
---|
[090e07e] | 615 | |
---|
[6f16e25] | 616 | wx_id = ids.next() |
---|
[090e07e] | 617 | plot_menu.Append(wx_id, "Remove", name) |
---|
| 618 | wx.EVT_MENU(self, wx_id, self._onRemove) |
---|
[a436b2e] | 619 | if not plot.is_data: |
---|
[6f16e25] | 620 | wx_id = ids.next() |
---|
[090e07e] | 621 | plot_menu.Append(wx_id, '&Freeze', name) |
---|
| 622 | wx.EVT_MENU(self, wx_id, self.onFreeze) |
---|
| 623 | plot_menu.AppendSeparator() |
---|
| 624 | |
---|
[70ec588d] | 625 | if plot.is_data: |
---|
[6f16e25] | 626 | wx_id = ids.next() |
---|
[090e07e] | 627 | self.hide_menu = plot_menu.Append(wx_id, "Hide Error Bar", name) |
---|
| 628 | |
---|
[70ec588d] | 629 | if plot.dy is not None and plot.dy != []: |
---|
[090e07e] | 630 | if plot.hide_error: |
---|
[70ec588d] | 631 | self.hide_menu.SetText('Show Error Bar') |
---|
| 632 | else: |
---|
| 633 | self.hide_menu.SetText('Hide Error Bar') |
---|
[a436b2e] | 634 | else: |
---|
[70ec588d] | 635 | self.hide_menu.Enable(False) |
---|
[090e07e] | 636 | wx.EVT_MENU(self, wx_id, self._ontoggle_hide_error) |
---|
[f8be87d] | 637 | |
---|
[090e07e] | 638 | plot_menu.AppendSeparator() |
---|
[f8be87d] | 639 | |
---|
[6f16e25] | 640 | wx_id = ids.next() |
---|
[090e07e] | 641 | plot_menu.Append(wx_id, '&Modify Plot Property', name) |
---|
| 642 | wx.EVT_MENU(self, wx_id, self.createAppDialog) |
---|
[6f16e25] | 643 | wx_id = ids.next() |
---|
[090e07e] | 644 | # plot_menu.SetTitle(name) |
---|
| 645 | self._slicerpop.AppendMenu(wx_id, '&%s' % name, plot_menu) |
---|
[f866fb5] | 646 | # Option to hide |
---|
[090e07e] | 647 | # TODO: implement functionality to hide a plottable (legend click) |
---|
| 648 | if not self.graph.selected_plottable in self.plots: |
---|
[70ec588d] | 649 | self._slicerpop.AppendSeparator() |
---|
| 650 | loc_menu = wx.Menu() |
---|
| 651 | for label in self._loc_labels: |
---|
[6f16e25] | 652 | wx_id = ids.next() |
---|
[090e07e] | 653 | loc_menu.Append(wx_id, str(label), str(label)) |
---|
| 654 | wx.EVT_MENU(self, wx_id, self.onChangeLegendLoc) |
---|
| 655 | |
---|
[6f16e25] | 656 | wx_id = ids.next() |
---|
[090e07e] | 657 | self._slicerpop.Append(wx_id, '&Modify Graph Appearance', |
---|
[f866fb5] | 658 | 'Modify graph appearance') |
---|
[090e07e] | 659 | wx.EVT_MENU(self, wx_id, self.modifyGraphAppearance) |
---|
[70ec588d] | 660 | self._slicerpop.AppendSeparator() |
---|
[8f59e95] | 661 | |
---|
[090e07e] | 662 | |
---|
[70ec588d] | 663 | if self.position != None: |
---|
[6f16e25] | 664 | wx_id = ids.next() |
---|
[090e07e] | 665 | self._slicerpop.Append(wx_id, '&Add Text') |
---|
| 666 | wx.EVT_MENU(self, wx_id, self._on_addtext) |
---|
[6f16e25] | 667 | wx_id = ids.next() |
---|
[090e07e] | 668 | self._slicerpop.Append(wx_id, '&Remove Text') |
---|
| 669 | wx.EVT_MENU(self, wx_id, self._on_removetext) |
---|
[70ec588d] | 670 | self._slicerpop.AppendSeparator() |
---|
[6f16e25] | 671 | wx_id = ids.next() |
---|
[090e07e] | 672 | self._slicerpop.Append(wx_id, '&Change Scale') |
---|
| 673 | wx.EVT_MENU(self, wx_id, self._onProperties) |
---|
[857d00f] | 674 | self._slicerpop.AppendSeparator() |
---|
[6f16e25] | 675 | wx_id = ids.next() |
---|
[090e07e] | 676 | self._slicerpop.Append(wx_id, '&Reset Graph Range') |
---|
| 677 | wx.EVT_MENU(self, wx_id, self.onResetGraph) |
---|
| 678 | |
---|
| 679 | if self.parent.ClassName.count('wxDialog') == 0: |
---|
[70ec588d] | 680 | self._slicerpop.AppendSeparator() |
---|
[6f16e25] | 681 | wx_id = ids.next() |
---|
[090e07e] | 682 | self._slicerpop.Append(wx_id, '&Window Title') |
---|
| 683 | wx.EVT_MENU(self, wx_id, self.onChangeCaption) |
---|
[dc51a7f] | 684 | try: |
---|
| 685 | pos_evt = event.GetPosition() |
---|
| 686 | pos = self.ScreenToClient(pos_evt) |
---|
| 687 | except: |
---|
| 688 | pos_x, pos_y = self.toolbar.GetPositionTuple() |
---|
| 689 | pos = (pos_x, pos_y + 5) |
---|
[52b8b74] | 690 | self.PopupMenu(self._slicerpop, pos) |
---|
[090e07e] | 691 | |
---|
[e6a93df] | 692 | def onFreeze(self, event): |
---|
| 693 | """ |
---|
[f866fb5] | 694 | on Freeze data |
---|
[e6a93df] | 695 | """ |
---|
[70ec588d] | 696 | menu = event.GetEventObject() |
---|
[090e07e] | 697 | wx_id = event.GetId() |
---|
| 698 | self.set_selected_from_menu(menu, wx_id) |
---|
[e6a93df] | 699 | plot = self.plots[self.graph.selected_plottable] |
---|
| 700 | self.parent.onfreeze([plot.id]) |
---|
[090e07e] | 701 | |
---|
[1bf33c1] | 702 | def _onSave(self, evt): |
---|
| 703 | """ |
---|
[d955bf19] | 704 | Save a data set to a text file |
---|
[090e07e] | 705 | |
---|
[d955bf19] | 706 | :param evt: Menu event |
---|
[090e07e] | 707 | |
---|
[1bf33c1] | 708 | """ |
---|
[70ec588d] | 709 | menu = evt.GetEventObject() |
---|
[090e07e] | 710 | event_id = evt.GetId() |
---|
| 711 | self.set_selected_from_menu(menu, event_id) |
---|
[176fbf1] | 712 | data = self.plots[self.graph.selected_plottable] |
---|
| 713 | default_name = data.label |
---|
[c553b18] | 714 | if default_name.count('.') > 0: |
---|
| 715 | default_name = default_name.split('.')[0] |
---|
| 716 | default_name += "_out" |
---|
| 717 | if self.parent != None: |
---|
[176fbf1] | 718 | self.parent.save_data1d(data, default_name) |
---|
[c5a769e] | 719 | |
---|
[0aca693] | 720 | def _onDataShow(self, evt): |
---|
| 721 | """ |
---|
| 722 | Show the data set in text |
---|
[090e07e] | 723 | |
---|
[0aca693] | 724 | :param evt: Menu event |
---|
[090e07e] | 725 | |
---|
[0aca693] | 726 | """ |
---|
| 727 | menu = evt.GetEventObject() |
---|
[090e07e] | 728 | event_id = evt.GetId() |
---|
| 729 | self.set_selected_from_menu(menu, event_id) |
---|
[0aca693] | 730 | data = self.plots[self.graph.selected_plottable] |
---|
| 731 | default_name = data.label |
---|
| 732 | if default_name.count('.') > 0: |
---|
| 733 | default_name = default_name.split('.')[0] |
---|
[090e07e] | 734 | # default_name += "_out" |
---|
[0aca693] | 735 | if self.parent != None: |
---|
| 736 | self.parent.show_data1d(data, default_name) |
---|
[090e07e] | 737 | |
---|
[6e75ed0] | 738 | def _on_hide(self, event): |
---|
| 739 | """ |
---|
| 740 | Hides the plot when button is pressed |
---|
[090e07e] | 741 | """ |
---|
[c5a769e] | 742 | if self.parent is not None: |
---|
[6e75ed0] | 743 | self.parent.hide_panel(self.uid) |
---|
[f8be87d] | 744 | |
---|
[ae84427] | 745 | def on_close(self, event): |
---|
| 746 | """ |
---|
| 747 | On Close Event |
---|
| 748 | """ |
---|
| 749 | ID = self.uid |
---|
| 750 | self.parent.delete_panel(ID) |
---|
[090e07e] | 751 | |
---|
[f8be87d] | 752 | def createAppDialog(self, event): |
---|
| 753 | """ |
---|
| 754 | Create the custom dialog for fit appearance modification |
---|
| 755 | """ |
---|
| 756 | menu = event.GetEventObject() |
---|
[090e07e] | 757 | event_id = event.GetId() |
---|
| 758 | self.set_selected_from_menu(menu, event_id) |
---|
[f866fb5] | 759 | self.appearance_selected_plot = \ |
---|
| 760 | self.plots[self.graph.selected_plottable] |
---|
[f8be87d] | 761 | # find current properties |
---|
| 762 | curr_color = self.appearance_selected_plot.custom_color |
---|
| 763 | curr_symbol = self.appearance_selected_plot.symbol |
---|
| 764 | curr_size = self.appearance_selected_plot.markersize |
---|
| 765 | curr_label = self.appearance_selected_plot.label |
---|
| 766 | |
---|
| 767 | if curr_color == None: |
---|
| 768 | curr_color = self._color_labels['Blue'] |
---|
| 769 | curr_symbol = 13 |
---|
| 770 | |
---|
[9f51c2c] | 771 | self.appD = appearanceDialog(self, 'Modify Plot Property') |
---|
| 772 | icon = self.parent.GetIcon() |
---|
| 773 | self.appD.SetIcon(icon) |
---|
[090e07e] | 774 | self.appD.set_defaults(float(curr_size), int(curr_color), |
---|
| 775 | str(appearanceDialog.find_key(self.get_symbol_label(), |
---|
| 776 | int(curr_symbol))), curr_label) |
---|
| 777 | self.appD.Bind(wx.EVT_CLOSE, self.on_AppDialog_close) |
---|
[9f51c2c] | 778 | |
---|
[f866fb5] | 779 | def on_AppDialog_close(self, event): |
---|
| 780 | """ |
---|
| 781 | on_Modify Plot Property_close |
---|
| 782 | """ |
---|
[090e07e] | 783 | if self.appD.okay_clicked == True: |
---|
| 784 | info = self.appD.get_current_values() |
---|
[f866fb5] | 785 | self.appearance_selected_plot.custom_color = \ |
---|
| 786 | self._color_labels[info[1].encode('ascii', 'ignore')] |
---|
[9f51c2c] | 787 | |
---|
| 788 | self.appearance_selected_plot.markersize = float(info[0]) |
---|
[f866fb5] | 789 | self.appearance_selected_plot.symbol = \ |
---|
[090e07e] | 790 | self.get_symbol_label()[info[2]] |
---|
[9f51c2c] | 791 | self.appearance_selected_plot.label = str(info[3]) |
---|
[f8be87d] | 792 | self.appD.Destroy() |
---|
| 793 | self._check_zoom_plot() |
---|
[8f59e95] | 794 | |
---|
[f866fb5] | 795 | def modifyGraphAppearance(self, event): |
---|
| 796 | """ |
---|
[090e07e] | 797 | On Modify Graph Appearance |
---|
[f866fb5] | 798 | """ |
---|
| 799 | self.graphApp = graphAppearance(self, 'Modify Graph Appearance') |
---|
[9f51c2c] | 800 | icon = self.parent.GetIcon() |
---|
| 801 | self.graphApp.SetIcon(icon) |
---|
[090e07e] | 802 | self.graphApp.setDefaults(self.grid_on, self.legend_on, |
---|
| 803 | self.xaxis_label, self.yaxis_label, |
---|
| 804 | self.xaxis_unit, self.yaxis_unit, |
---|
| 805 | self.xaxis_font, self.yaxis_font, |
---|
| 806 | find_key(self.get_loc_label(), self.legendLoc), |
---|
| 807 | self.xcolor, self.ycolor, |
---|
[657e52c] | 808 | self.is_xtick, self.is_ytick) |
---|
[9f51c2c] | 809 | self.graphApp.Bind(wx.EVT_CLOSE, self.on_graphApp_close) |
---|
[8f59e95] | 810 | |
---|
[9f51c2c] | 811 | def on_graphApp_close(self, event): |
---|
[83d9120] | 812 | """ |
---|
| 813 | Gets values from graph appearance dialog and sends them off |
---|
| 814 | to modify the plot |
---|
| 815 | """ |
---|
| 816 | graph_app = self.graphApp |
---|
| 817 | toggle_grid = graph_app.get_togglegrid() |
---|
| 818 | legend_loc = graph_app.get_legend_loc() |
---|
| 819 | toggle_legend = graph_app.get_togglelegend() |
---|
[090e07e] | 820 | |
---|
| 821 | self.onGridOnOff(toggle_grid) |
---|
[83d9120] | 822 | self.ChangeLegendLoc(legend_loc) |
---|
| 823 | self.onLegend(toggle_legend) |
---|
[8a687cfd] | 824 | |
---|
[83d9120] | 825 | self.xaxis_label = graph_app.get_xlab() |
---|
| 826 | self.yaxis_label = graph_app.get_ylab() |
---|
| 827 | self.xaxis_unit = graph_app.get_xunit() |
---|
| 828 | self.yaxis_unit = graph_app.get_yunit() |
---|
[657e52c] | 829 | self.xaxis_font = graph_app.get_xfont() |
---|
| 830 | self.yaxis_font = graph_app.get_yfont() |
---|
[090e07e] | 831 | self.is_xtick = graph_app.get_xtick_check() |
---|
| 832 | self.is_ytick = graph_app.get_ytick_check() |
---|
[657e52c] | 833 | if self.is_xtick: |
---|
| 834 | self.xaxis_tick = self.xaxis_font |
---|
| 835 | if self.is_ytick: |
---|
| 836 | self.yaxis_tick = self.yaxis_font |
---|
[8a687cfd] | 837 | |
---|
[090e07e] | 838 | self.xaxis(self.xaxis_label, self.xaxis_unit, |
---|
| 839 | graph_app.get_xfont(), graph_app.get_xcolor(), |
---|
[657e52c] | 840 | self.xaxis_tick) |
---|
[090e07e] | 841 | self.yaxis(self.yaxis_label, self.yaxis_unit, |
---|
[657e52c] | 842 | graph_app.get_yfont(), graph_app.get_ycolor(), |
---|
| 843 | self.yaxis_tick) |
---|
[8f59e95] | 844 | |
---|
[83d9120] | 845 | graph_app.Destroy() |
---|