Changeset a8ec5b1 in sasview
- Timestamp:
- Dec 9, 2016 5:56:20 AM (8 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:
- 253e7170
- Parents:
- d1fb22ee
- Location:
- src/sas/qtgui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/GuiManager.py
r363fbfa ra8ec5b1 26 26 from sas.qtgui.DensityPanel import DensityPanel 27 27 from sas.qtgui.KiessigPanel import KiessigPanel 28 from sas.qtgui.SlitSizeCalculator import SlitSizeCalculator 28 29 29 30 # Perspectives … … 139 140 self.DVCalculator = DensityPanel(self) 140 141 #self.KIESSIGCalculator = DensityPanel(self)#KiessigPanel(self) 141 self.KIESSIGCalculator = KiessigPanel(self) 142 self.KIESSIGCalculator = KiessigPanel(self) 143 self.SlitSizeCalculator = SlitSizeCalculator(self._parent, self, manager=self._data_manager) 142 144 def statusBarSetup(self): 143 145 """ … … 539 541 """ 540 542 """ 541 print("actionSlit_Size_Calculator TRIGGERED") 542 pass 543 self.SlitSizeCalculator.show() 543 544 544 545 def actionSAS_Resolution_Estimator(self): -
src/sas/qtgui/SlitSizeCalculator.py
rd1fb22ee ra8ec5b1 2 2 from PyQt4 import QtCore 3 3 from UI.SlitSizeCalculator import Ui_SlitSizeCalculator 4 from twisted.internet import threads 5 import logging 4 6 5 7 # sas-global 6 8 from sas.sascalc.calculator.slit_length_calculator import SlitlengthCalculator 7 9 from DataExplorer import DataExplorerWindow 8 10 9 11 class SlitSizeCalculator(QtGui.QDialog, Ui_SlitSizeCalculator): 10 def __init__(self, parent=None ):12 def __init__(self, parent=None, guimanager=None, manager=None): 11 13 super(SlitSizeCalculator, self).__init__() 12 14 self.setupUi(self) … … 14 16 self.setWindowTitle("Slit Size Calculator") 15 17 self._parent = parent 18 self._guimanager = guimanager 19 self._manager = manager 16 20 17 21 self.thickness = SlitlengthCalculator() … … 34 38 try: 35 39 location = self._parent.HELP_DIRECTORY_LOCATION + \ 36 "/user/sasgui/perspectives/calculator/slit_ lenght_calculator.html"40 "/user/sasgui/perspectives/calculator/slit_calculator_help.html" 37 41 38 42 self._parent._helpView.load(QtCore.QUrl(location)) … … 50 54 return 51 55 self.loadFromURL(path_str) 56 #Path_str is a list - it needs to be changed, so that only one file can be uploaded 57 self.deltaq_in.setText(path_str[0]) 52 58 53 59 def loadFromURL(self, url): … … 55 61 Threaded file load 56 62 """ 57 load_thread = threads.deferToThread(self.readData, url) 58 load_thread.addCallback(self.loadComplete) 63 data_explorer = DataExplorerWindow(parent=self._parent, guimanager=self._guimanager) 64 load_thread = threads.deferToThread(data_explorer.readData, url) 65 load_thread.addCallback(data_explorer.loadComplete) 66 #On complete loading 59 67 60 68 def chooseFiles(self): … … 66 74 # But only with Qt built-in dialog (non-platform native) 67 75 paths = QtGui.QFileDialog.getOpenFileNames(self, "Choose a file", "", 68 "Scattering data (*.DAT, *.dat)", None, QtGui.QFileDialog.DontUseNativeDialog) 76 "SAXSess Data 1D (*.txt *.TXT *.dat *.DAT)", None, 77 QtGui.QFileDialog.DontUseNativeDialog) 69 78 if paths is None: 70 79 return … … 83 92 """ 84 93 self.close() 94 95 def complete_loading(self, data=None): 96 """ 97 Complete the loading and compute the slit size 98 """ 99 #TODO: Provided we have an access to data then it should be fairly easy 100 index = self.treeView.selectedIndexes()[0] 101 model_item = self.model.itemFromIndex(self.data_proxy.mapToSource(index)) 102 data = GuiUtils.dataFromItem(model_item) 103 104 if data is None or isinstance(data, Data2D): 105 #I guess this doesn't apply 106 if self.parent.parent is None: 107 return 108 msg = "Slit Length cannot be computed for 2D Data" 109 logging.info(msg) 110 return 111 self.data_name_tcl.SetValue(str(data.filename)) 112 #compute the slit size 113 try: 114 x = data.x 115 y = data.y 116 if x == [] or x is None or y == [] or y is None: 117 msg = "The current data is empty please check x and y" 118 raise ValueError, msg 119 slit_length_calculator = SlitlengthCalculator() 120 slit_length_calculator.set_data(x=x, y=y) 121 slit_length = slit_length_calculator.calculate_slit_length() 122 except: 123 if self.parent.parent is None: 124 return 125 msg = "Slit Size Calculator: %s" % (sys.exc_value) 126 logging.info(msg) 127 return 128 self.slit_size_tcl.SetValue(str(slit_length)) 129 #Display unit 130 self.slit_size_unit_tcl.SetValue('[Unknown]') 131 if self.parent.parent is None: 132 return 133 msg = "Load Complete" 134 logging.info(msg) 135
Note: See TracChangeset
for help on using the changeset viewer.