Changeset b0b09b9 in sasview for src/sas/qtgui/MainWindow
- Timestamp:
- Oct 26, 2017 3:13:05 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:
- 895e7359
- Parents:
- def64a0
- Location:
- src/sas/qtgui/MainWindow
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/MainWindow/AboutBox.py
- Property mode changed from 100644 to 100755
rcd2cc745 rb0b09b9 8 8 from sas.qtgui.UI import main_resources_rc 9 9 10 from UI.AboutUI import Ui_AboutUI10 from .UI.AboutUI import Ui_AboutUI 11 11 12 12 class AboutBox(QtGui.QDialog, Ui_AboutUI): -
src/sas/qtgui/MainWindow/DataExplorer.py
- Property mode changed from 100644 to 100755
r88e1f57 rb0b09b9 155 155 Populate the Perspective combobox and define callbacks 156 156 """ 157 available_perspectives = sorted([p for p in Perspectives.PERSPECTIVES.keys()])157 available_perspectives = sorted([p for p in list(Perspectives.PERSPECTIVES.keys())]) 158 158 if available_perspectives: 159 159 self.cbFitting.clear() … … 240 240 241 241 self.manager.assign(manager) 242 for id, item in self.manager.get_all_data().ite ritems():242 for id, item in self.manager.get_all_data().items(): 243 243 self.updateModel(item.data, item.path) 244 244 … … 345 345 # Figure out which rows are checked 346 346 selected_items = [self.model.item(index) 347 for index in xrange(self.model.rowCount())347 for index in range(self.model.rowCount()) 348 348 if isItemReady(index)] 349 349 … … 400 400 else: 401 401 freeze_msg = "Unexpected number of theories copied: %i" % theories_copied 402 raise AttributeError , freeze_msg402 raise AttributeError(freeze_msg) 403 403 self.communicator.statusBarUpdateSignal.emit(freeze_msg) 404 404 # Actively switch tabs … … 411 411 new_item = item.clone() 412 412 # clone doesn't do deepcopy :( 413 for child_index in xrange(item.rowCount()):413 for child_index in range(item.rowCount()): 414 414 child_item = self.recursivelyCloneItem(item.child(child_index)) 415 415 new_item.setChild(child_index, child_item) … … 435 435 return 436 436 new_plots = [PlotHelper.plotById(plot) for plot in graph_list] 437 active_plots_copy = self.active_plots.keys()437 active_plots_copy = list(self.active_plots.keys()) 438 438 for plot in active_plots_copy: 439 439 if self.active_plots[plot] in new_plots: … … 478 478 for plot in plots: 479 479 plot_id = plot.id 480 if plot_id in self.active_plots.keys():480 if plot_id in list(self.active_plots.keys()): 481 481 self.active_plots[plot_id].replacePlot(plot_id, plot) 482 482 else: … … 530 530 else: 531 531 msg = "Incorrect data type passed to Plotting" 532 raise AttributeError , msg532 raise AttributeError(msg) 533 533 534 534 if 'new_plot' in locals() and \ … … 597 597 598 598 id = data.id 599 if data.id in self.active_plots.keys():599 if data.id in list(self.active_plots.keys()): 600 600 self.active_plots[id].replacePlot(id, data) 601 601 … … 610 610 # But only with Qt built-in dialog (non-platform native) 611 611 paths = QtGui.QFileDialog.getOpenFileNames(self, "Choose a file", "", 612 wlist, None,QtGui.QFileDialog.DontUseNativeDialog)612 wlist, QtGui.QFileDialog.DontUseNativeDialog) 613 613 if paths is None: 614 614 return 615 615 616 if isinstance(paths, QtCore.QStringList):617 paths = [str(f) for f in paths]616 #if isinstance(paths, QtCore.QStringList): 617 # paths = [str(f) for f in paths] 618 618 619 619 if not isinstance(paths, list): … … 687 687 688 688 except Exception as ex: 689 logging.error(sys.exc_ value)689 logging.error(sys.exc_info()[1]) 690 690 691 691 any_error = True … … 747 747 if not isinstance(index, int): 748 748 msg = "Incorrect type passed to DataExplorer.selectData()" 749 raise AttributeError , msg749 raise AttributeError(msg) 750 750 751 751 # Respond appropriately … … 773 773 except AttributeError: 774 774 msg = "Bad structure of the data model." 775 raise RuntimeError , msg775 raise RuntimeError(msg) 776 776 777 777 if is1D: … … 787 787 except AttributeError: 788 788 msg = "Bad structure of the data model." 789 raise RuntimeError , msg789 raise RuntimeError(msg) 790 790 791 791 if item.isCheckable() and item.checkState() == QtCore.Qt.Checked and is1D: … … 801 801 except AttributeError: 802 802 msg = "Bad structure of the data model." 803 raise RuntimeError , msg803 raise RuntimeError(msg) 804 804 805 805 if is2D: … … 815 815 except AttributeError: 816 816 msg = "Bad structure of the data model." 817 raise RuntimeError , msg817 raise RuntimeError(msg) 818 818 819 819 if item.isCheckable() and item.checkState() == QtCore.Qt.Checked and is2D: … … 823 823 msg = "Incorrect value in the Selection Option" 824 824 # Change this to a proper logging action 825 raise Exception , msg825 raise Exception(msg) 826 826 827 827 def contextMenu(self): … … 1016 1016 # Add the actual Data1D/Data2D object 1017 1017 object_item = QtGui.QStandardItem() 1018 object_item.setData( QtCore.QVariant(data))1018 object_item.setData(data) 1019 1019 1020 1020 checkbox_item.setChild(0, object_item) … … 1040 1040 if not isinstance(model_item, QtGui.QStandardItem): 1041 1041 msg = "Wrong data type returned from calculations." 1042 raise AttributeError , msg1042 raise AttributeError(msg) 1043 1043 1044 1044 # TODO: Assert other properties … … 1057 1057 if not isinstance(model_item, QtGui.QStandardItem): 1058 1058 msg = "Wrong data type returned from calculations." 1059 raise AttributeError , msg1059 raise AttributeError(msg) 1060 1060 1061 1061 # Check if there are any other items for this tab … … 1064 1064 # 1065 1065 current_tab_name = model_item.text()[:2] 1066 for current_index in xrange(self.theory_model.rowCount()):1066 for current_index in range(self.theory_model.rowCount()): 1067 1067 if current_tab_name in self.theory_model.item(current_index).text(): 1068 1068 self.theory_model.removeRow(current_index) -
src/sas/qtgui/MainWindow/DataManager.py
- Property mode changed from 100644 to 100755
rf4a1433 rb0b09b9 24 24 import json 25 25 import time 26 from StringIOimport StringIO26 from io import StringIO 27 27 import numpy as np 28 28 … … 66 66 _str += "No of states is %s \n" % str(len(self.stored_data)) 67 67 n_count = 0 68 for value in self.stored_data.values():68 for value in list(self.stored_data.values()): 69 69 n_count += 1 70 70 _str += "State No %s \n" % str(n_count) … … 146 146 receive a list of 147 147 """ 148 for id, data in data_list.ite ritems():148 for id, data in data_list.items(): 149 149 if id in self.stored_data: 150 150 msg = "Data manager already stores %s" % str(data.name) … … 162 162 """ 163 163 """ 164 if prev_data.id not in self.stored_data.keys():164 if prev_data.id not in list(self.stored_data.keys()): 165 165 return None, {} 166 166 data_state = self.stored_data[prev_data.id] 167 167 self.stored_data[new_data.id] = data_state.clone() 168 168 self.stored_data[new_data.id].data = new_data 169 if prev_data.id in self.stored_data.keys():169 if prev_data.id in list(self.stored_data.keys()): 170 170 del self.stored_data[prev_data.id] 171 171 return prev_data.id, {new_data.id: self.stored_data[new_data.id]} … … 177 177 if data_id is None and theory is not None: 178 178 uid = theory.id 179 if uid in self.stored_data.keys():179 if uid in list(self.stored_data.keys()): 180 180 data_state = self.stored_data[uid] 181 181 else: … … 207 207 if search_id == d_id: 208 208 _selected_data[search_id] = data 209 if search_id in theory_list.keys():209 if search_id in list(theory_list.keys()): 210 210 _selected_theory_list[search_id] = theory_list[search_id] 211 211 … … 216 216 """ 217 217 """ 218 return self.freeze_theory( self.stored_data.keys(), theory_id)218 return self.freeze_theory(list(self.stored_data.keys()), theory_id) 219 219 220 220 def freeze_theory(self, data_id, theory_id): … … 227 227 theory_list = data_state.get_theory() 228 228 for t_id in theory_id: 229 if t_id in theory_list.keys():229 if t_id in list(theory_list.keys()): 230 230 theory_data, theory_state = theory_list[t_id] 231 231 new_theory = copy.deepcopy(theory_data) … … 247 247 """ 248 248 for d_id in data_id: 249 if d_id in self.stored_data.keys():249 if d_id in list(self.stored_data.keys()): 250 250 data_state = self.stored_data[d_id] 251 251 if data_state.data.name in self.data_name_dict: … … 265 265 data_state = self.stored_data[d_id] 266 266 theory_list = data_state.get_theory() 267 if theory_id in theory_list.keys():267 if theory_id in list(theory_list.keys()): 268 268 del theory_list[theory_id] 269 269 #del pure theory … … 284 284 _selected_data = {} 285 285 for selected_name in name_list: 286 for id, data_state in self.stored_data.ite ritems():286 for id, data_state in self.stored_data.items(): 287 287 if data_state.data.name == selected_name: 288 288 _selected_data[id] = data_state.data … … 294 294 """ 295 295 for selected_name in name_list: 296 for id, data_state in self.stored_data.ite ritems():296 for id, data_state in self.stored_data.items(): 297 297 if data_state.data.name == selected_name: 298 298 del self.stored_data[id] … … 303 303 # Take the copy of current, possibly shorter stored_data dict 304 304 stored_data = copy.deepcopy(self.stored_data) 305 for idx in stored_data.keys():305 for idx in list(stored_data.keys()): 306 306 if str(selected_name) in str(idx): 307 307 del self.stored_data[idx] … … 313 313 _selected_data_state = {} 314 314 for id in data_id: 315 if id in self.stored_data.keys():315 if id in list(self.stored_data.keys()): 316 316 _selected_data_state[id] = self.stored_data[id] 317 317 return _selected_data_state … … 396 396 class Empty(object): 397 397 def __init__(self): 398 for key, value in data.ite ritems():398 for key, value in data.items(): 399 399 setattr(self, key, generate(value, level)) 400 400 … … 451 451 # if dictionary doesn't have __type__ then it is assumed to be just an ordinary dictionary 452 452 o = {} 453 for key, value in data.ite ritems():453 for key, value in data.items(): 454 454 o[key] = generate(value, level) 455 455 return o … … 463 463 464 464 new_stored_data = {} 465 for id, data in json.load(fp).ite ritems():465 for id, data in json.load(fp).items(): 466 466 try: 467 467 new_stored_data[id] = generate(data, 0) -
src/sas/qtgui/MainWindow/DataState.py
rdc5ef15 rb0b09b9 37 37 _str += "Theories available: %s \n" % len(self.theory_list) 38 38 if self.theory_list: 39 for id, item in self.theory_list.ite ritems():39 for id, item in self.theory_list.items(): 40 40 theory_data, theory_state = item 41 41 _str += "Theory name : %s \n" % str(theory_data.name) … … 53 53 obj.message = self.message 54 54 obj.id = self.id 55 for id, item in self.theory_list.ite ritems():55 for id, item in self.theory_list.items(): 56 56 theory_data, theory_state = item 57 57 state = None … … 95 95 """ 96 96 self.theory_list[theory_data.id] = [theory_data, theory_state] 97 data, state = self.theory_list.values()[0]97 data, state = list(self.theory_list.values())[0] 98 98 99 99 def get_theory(self): -
src/sas/qtgui/MainWindow/GuiManager.py
- Property mode changed from 100644 to 100755
rf0bb711 rb0b09b9 191 191 workspace_height = self._workspace.workspace.sizeHint().height() 192 192 perspective_size = self._current_perspective.sizeHint() 193 if workspace_height < perspective_size.height :193 if workspace_height < perspective_size.height(): 194 194 perspective_width = perspective_size.width() 195 195 self._current_perspective.resize(perspective_width, workspace_height-10) … … 202 202 assert isinstance(data, list) 203 203 if self._current_perspective is not None: 204 self._current_perspective.setData( data.values())204 self._current_perspective.setData(list(data.values())) 205 205 else: 206 206 msg = "No perspective is currently active." … … 246 246 """ 247 247 if self._current_perspective is not None: 248 self._current_perspective.setData( data.values())248 self._current_perspective.setData(list(data.values())) 249 249 else: 250 250 msg = "Guiframe does not have a current perspective" … … 289 289 version_info = json.loads(content) 290 290 self.processVersion(version_info) 291 except ValueError ,ex:291 except ValueError as ex: 292 292 logging.info("Failed to connect to www.sasview.org:", ex) 293 293 … … 321 321 except: 322 322 msg = "guiframe: could not get latest application" 323 msg += " version number\n %s" % sys.exc_ value323 msg += " version number\n %s" % sys.exc_info()[1] 324 324 logging.error(msg) 325 325 msg = "Could not connect to the application server." … … 743 743 not isinstance(new_datalist_item, dict): 744 744 msg = "Wrong data type returned from calculations." 745 raise AttributeError , msg745 raise AttributeError(msg) 746 746 747 747 self.filesWidget.model.appendRow(new_item) -
src/sas/qtgui/MainWindow/MainWindow.py
- Property mode changed from 100644 to 100755
r2a8bd705 rb0b09b9 5 5 # Local UI 6 6 from sas.qtgui.UI import main_resources_rc 7 from UI.MainWindowUI import Ui_MainWindow7 from .UI.MainWindowUI import Ui_MainWindow 8 8 9 9 # Initialize logging … … 21 21 22 22 # Create the gui manager 23 from GuiManager import GuiManager23 from .GuiManager import GuiManager 24 24 self.guiManager = GuiManager(self) 25 25
Note: See TracChangeset
for help on using the changeset viewer.