Changeset cbcdd2c in sasview for src/sas/qtgui/DataExplorer.py
- Timestamp:
- Mar 10, 2017 9:44:44 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:
- cd31251
- Parents:
- 5236449
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/DataExplorer.py
r5236449 rcbcdd2c 73 73 self.contextMenu() 74 74 75 # Same menus for the theory view 76 self.freezeView.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) 77 self.freezeView.customContextMenuRequested.connect(self.onCustomContextMenu) 78 75 79 # Connect the comboboxes 76 80 self.cbSelect.currentIndexChanged.connect(self.selectData) 77 81 78 82 #self.closeEvent.connect(self.closeEvent) 79 # self.aboutToQuit.connect(self.closeEvent)83 self.currentChanged.connect(self.onTabSwitch) 80 84 self.communicator = self.parent.communicator() 81 85 self.communicator.fileReadSignal.connect(self.loadFromURL) 82 86 self.communicator.activeGraphsSignal.connect(self.updateGraphCombo) 83 87 self.communicator.activeGraphName.connect(self.updatePlotName) 84 #self.communicator.updateTheoryFromPerspectiveSignal.connect(self.updateTheoryFromPerspective)85 88 self.cbgraph.editTextChanged.connect(self.enableGraphCombo) 86 89 self.cbgraph.currentIndexChanged.connect(self.enableGraphCombo) 87 90 88 91 self._perspective = self.parent.perspective() 89 self._perspective.updateTheoryFromPerspectiveSignal.connect(self.updateTheoryFromPerspective)90 92 91 93 # Proxy model for showing a subset of Data1D/Data2D content … … 111 113 self.enableGraphCombo(None) 112 114 115 # Current view on model 116 self.current_view = self.treeView 117 113 118 def closeEvent(self, event): 114 119 """ … … 116 121 """ 117 122 event.ignore() 123 124 def onTabSwitch(self, index): 125 """ Callback for tab switching signal """ 126 if index == 0: 127 self.current_view = self.treeView 128 else: 129 self.current_view = self.freezeView 118 130 119 131 def displayHelp(self): … … 725 737 Show the right-click context menu in the data treeview 726 738 """ 727 index = self.treeView.indexAt(position) 739 index = self.current_view.indexAt(position) 740 proxy = self.current_view.model() 741 model = proxy.sourceModel() 742 728 743 if index.isValid(): 729 model_item = self.model.itemFromIndex(self.data_proxy.mapToSource(index))744 model_item = model.itemFromIndex(proxy.mapToSource(index)) 730 745 # Find the mapped index 731 746 orig_index = model_item.isCheckable() … … 736 751 self.actionEditMask.setEnabled(is_2D) 737 752 # Fire up the menu 738 self.context_menu.exec_(self. treeView.mapToGlobal(position))753 self.context_menu.exec_(self.current_view.mapToGlobal(position)) 739 754 740 755 def showDataInfo(self): … … 742 757 Show a simple read-only text edit with data information. 743 758 """ 744 index = self.treeView.selectedIndexes()[0] 745 model_item = self.model.itemFromIndex(self.data_proxy.mapToSource(index)) 759 index = self.current_view.selectedIndexes()[0] 760 proxy = self.current_view.model() 761 model = proxy.sourceModel() 762 model_item = model.itemFromIndex(proxy.mapToSource(index)) 763 746 764 data = GuiUtils.dataFromItem(model_item) 747 765 if isinstance(data, Data1D): … … 769 787 Save the data points as either txt or xml 770 788 """ 771 index = self.treeView.selectedIndexes()[0] 772 model_item = self.model.itemFromIndex(self.data_proxy.mapToSource(index)) 789 index = self.current_view.selectedIndexes()[0] 790 proxy = self.current_view.model() 791 model = proxy.sourceModel() 792 model_item = model.itemFromIndex(proxy.mapToSource(index)) 793 773 794 data = GuiUtils.dataFromItem(model_item) 774 795 if isinstance(data, Data1D): … … 781 802 Frozen plot - display an image of the plot 782 803 """ 783 index = self.treeView.selectedIndexes()[0] 784 model_item = self.model.itemFromIndex(self.data_proxy.mapToSource(index)) 804 index = self.current_view.selectedIndexes()[0] 805 proxy = self.current_view.model() 806 model = proxy.sourceModel() 807 model_item = model.itemFromIndex(proxy.mapToSource(index)) 808 785 809 data = GuiUtils.dataFromItem(model_item) 786 810 … … 805 829 Slowish 3D plot 806 830 """ 807 index = self.treeView.selectedIndexes()[0] 808 model_item = self.model.itemFromIndex(self.data_proxy.mapToSource(index)) 831 index = self.current_view.selectedIndexes()[0] 832 proxy = self.current_view.model() 833 model = proxy.sourceModel() 834 model_item = model.itemFromIndex(proxy.mapToSource(index)) 835 809 836 data = GuiUtils.dataFromItem(model_item) 810 837 … … 824 851 Mask Editor for 2D plots 825 852 """ 826 index = self.treeView.selectedIndexes()[0] 827 model_item = self.model.itemFromIndex(self.data_proxy.mapToSource(index)) 853 index = self.current_view.selectedIndexes()[0] 854 proxy = self.current_view.model() 855 model = proxy.sourceModel() 856 model_item = model.itemFromIndex(proxy.mapToSource(index)) 857 828 858 data = GuiUtils.dataFromItem(model_item) 829 859
Note: See TracChangeset
for help on using the changeset viewer.