Changeset 5251ec6 in sasview for src/sas/sasgui/guiframe/local_perspectives/plotting/Plotter1D.py
- Timestamp:
- Oct 11, 2018 12:20:56 PM (6 years ago)
- Branches:
- master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1249
- Children:
- 98b9f32
- Parents:
- 67ed543
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/guiframe/local_perspectives/plotting/Plotter1D.py
r2469df7 r5251ec6 11 11 12 12 13 import wx14 13 import sys 15 14 import math 15 import logging 16 17 import wx 16 18 import numpy as np 17 import logging 19 18 20 from sas.sasgui.plottools.PlotPanel import PlotPanel 19 21 from sas.sasgui.guiframe.events import StatusEvent … … 22 24 from sas.sasgui.guiframe.panel_base import PanelBase 23 25 from sas.sasgui.guiframe.gui_style import GUIFRAME_ICON 24 from appearanceDialog import appearanceDialog 25 from graphAppearance import graphAppearance 26 27 from .appearanceDialog import appearanceDialog 28 from .graphAppearance import graphAppearance 26 29 27 30 logger = logging.getLogger(__name__) … … 36 39 def find_key(dic, val): 37 40 """return the key of dictionary dic given the value""" 38 return [k for k, v in dic.ite ritems() if v == val][0]41 return [k for k, v in dic.items() if v == val][0] 39 42 40 43 class ModelPanel1D(PlotPanel, PanelBase): … … 220 223 if hasattr(event, 'is_corfunc'): 221 224 self.is_corfunc = event.is_corfunc 222 if event.id in self.plots .keys():225 if event.id in self.plots: 223 226 ctrl = event.ctrl 224 227 self.cursor_id = event.id … … 243 246 if position is not None and not self.is_corfunc: 244 247 wx.PostEvent(self.parent, StatusEvent(status=position)) 245 except :246 logger.error( sys.exc_value)248 except Exception as exc: 249 logger.error(exc) 247 250 if not event.leftdown: 248 251 # text event … … 256 259 if is_moved: 257 260 self.canvas.draw() 258 except :259 logger.error( sys.exc_value)261 except Exception as exc: 262 logger.error(exc) 260 263 event.Skip() 261 264 return … … 410 413 self.canvas.draw() 411 414 self.q_ctrl[vl_ind].SetValue(str(pos_x)) 412 except :413 logger.error( sys.exc_value)415 except Exception as exc: 416 logger.error(exc) 414 417 415 418 def set_resizing(self, resizing=False): … … 431 434 Remove data from plot 432 435 """ 433 if id in self.plots .keys():436 if id in self.plots: 434 437 data = self.plots[id] 435 438 self.graph.delete(data) … … 437 440 data_list, theory_list = data_manager.get_by_id(id_list=[id]) 438 441 439 if id in data_list .keys():442 if id in data_list: 440 443 data = data_list[id] 441 if id in theory_list .keys():444 if id in theory_list: 442 445 data = theory_list[id] 443 446 … … 457 460 if data.__class__.__name__ == 'Data2D': 458 461 return 459 plot_keys = self.plots.keys()462 plot_keys = list(self.plots.keys()) 460 463 if data.id in plot_keys: 461 464 # Recover panel prop.s … … 476 479 try: 477 480 self._onEVT_FUNC_PROPERTY() 478 except Exception ,exc:481 except Exception as exc: 479 482 wx.PostEvent(self.parent, 480 483 StatusEvent(status="Plotting Error: %s" % str(exc), info="error")) … … 493 496 # MAC: forcing to plot 2D avg 494 497 self.canvas._onDrawIdle() 495 except Exception ,exc:498 except Exception as exc: 496 499 wx.PostEvent(self.parent, StatusEvent(status=\ 497 500 "Plotting Error: %s" % str(exc), info="error")) … … 567 570 self.set_selected_from_menu(menu, event_id) 568 571 ## Check if there is a selected graph to remove 569 if self.graph.selected_plottable in self.plots .keys():572 if self.graph.selected_plottable in self.plots: 570 573 graph_id = self.graph.selected_plottable 571 574 self.remove_data_by_id(graph_id) … … 603 606 plot_menu = wx.Menu() 604 607 if self.graph.selected_plottable: 605 if not self.graph.selected_plottable in self.plots .keys():608 if not self.graph.selected_plottable in self.plots: 606 609 continue 607 610 if plot != self.plots[self.graph.selected_plottable]: … … 623 626 plot_menu.Append(wx_id, item[0], name) 624 627 wx.EVT_MENU(self, wx_id, item[2]) 625 except :628 except Exception as exc: 626 629 msg = "ModelPanel1D.onContextMenu: " 627 msg += "bad menu item %s" % sys.exc_value630 msg += "bad menu item %s" % exc 628 631 wx.PostEvent(self.parent, StatusEvent(status=msg)) 629 632 plot_menu.AppendSeparator()
Note: See TracChangeset
for help on using the changeset viewer.