Ignore:
Timestamp:
Oct 26, 2017 3:13:05 AM (7 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
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
Message:

Initial changes to make SasView? run with python3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/MainWindow/DataExplorer.py

    • Property mode changed from 100644 to 100755
    r88e1f57 rb0b09b9  
    155155        Populate the Perspective combobox and define callbacks 
    156156        """ 
    157         available_perspectives = sorted([p for p in Perspectives.PERSPECTIVES.keys()]) 
     157        available_perspectives = sorted([p for p in list(Perspectives.PERSPECTIVES.keys())]) 
    158158        if available_perspectives: 
    159159            self.cbFitting.clear() 
     
    240240 
    241241        self.manager.assign(manager) 
    242         for id, item in self.manager.get_all_data().iteritems(): 
     242        for id, item in self.manager.get_all_data().items(): 
    243243            self.updateModel(item.data, item.path) 
    244244 
     
    345345        # Figure out which rows are checked 
    346346        selected_items = [self.model.item(index) 
    347                           for index in xrange(self.model.rowCount()) 
     347                          for index in range(self.model.rowCount()) 
    348348                          if isItemReady(index)] 
    349349 
     
    400400        else: 
    401401            freeze_msg = "Unexpected number of theories copied: %i" % theories_copied 
    402             raise AttributeError, freeze_msg 
     402            raise AttributeError(freeze_msg) 
    403403        self.communicator.statusBarUpdateSignal.emit(freeze_msg) 
    404404        # Actively switch tabs 
     
    411411        new_item = item.clone() 
    412412        # clone doesn't do deepcopy :( 
    413         for child_index in xrange(item.rowCount()): 
     413        for child_index in range(item.rowCount()): 
    414414            child_item = self.recursivelyCloneItem(item.child(child_index)) 
    415415            new_item.setChild(child_index, child_item) 
     
    435435            return 
    436436        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()) 
    438438        for plot in active_plots_copy: 
    439439            if self.active_plots[plot] in new_plots: 
     
    478478        for plot in plots: 
    479479            plot_id = plot.id 
    480             if plot_id in self.active_plots.keys(): 
     480            if plot_id in list(self.active_plots.keys()): 
    481481                self.active_plots[plot_id].replacePlot(plot_id, plot) 
    482482            else: 
     
    530530            else: 
    531531                msg = "Incorrect data type passed to Plotting" 
    532                 raise AttributeError, msg 
     532                raise AttributeError(msg) 
    533533 
    534534        if 'new_plot' in locals() and \ 
     
    597597 
    598598        id = data.id 
    599         if data.id in self.active_plots.keys(): 
     599        if data.id in list(self.active_plots.keys()): 
    600600            self.active_plots[id].replacePlot(id, data) 
    601601 
     
    610610        # But only with Qt built-in dialog (non-platform native) 
    611611        paths = QtGui.QFileDialog.getOpenFileNames(self, "Choose a file", "", 
    612                 wlist, None, QtGui.QFileDialog.DontUseNativeDialog) 
     612                wlist, QtGui.QFileDialog.DontUseNativeDialog) 
    613613        if paths is None: 
    614614            return 
    615615 
    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] 
    618618 
    619619        if not isinstance(paths, list): 
     
    687687 
    688688            except Exception as ex: 
    689                 logging.error(sys.exc_value) 
     689                logging.error(sys.exc_info()[1]) 
    690690 
    691691                any_error = True 
     
    747747        if not isinstance(index, int): 
    748748            msg = "Incorrect type passed to DataExplorer.selectData()" 
    749             raise AttributeError, msg 
     749            raise AttributeError(msg) 
    750750 
    751751        # Respond appropriately 
     
    773773                except AttributeError: 
    774774                    msg = "Bad structure of the data model." 
    775                     raise RuntimeError, msg 
     775                    raise RuntimeError(msg) 
    776776 
    777777                if is1D: 
     
    787787                except AttributeError: 
    788788                    msg = "Bad structure of the data model." 
    789                     raise RuntimeError, msg 
     789                    raise RuntimeError(msg) 
    790790 
    791791                if item.isCheckable() and item.checkState() == QtCore.Qt.Checked and is1D: 
     
    801801                except AttributeError: 
    802802                    msg = "Bad structure of the data model." 
    803                     raise RuntimeError, msg 
     803                    raise RuntimeError(msg) 
    804804 
    805805                if is2D: 
     
    815815                except AttributeError: 
    816816                    msg = "Bad structure of the data model." 
    817                     raise RuntimeError, msg 
     817                    raise RuntimeError(msg) 
    818818 
    819819                if item.isCheckable() and item.checkState() == QtCore.Qt.Checked and is2D: 
     
    823823            msg = "Incorrect value in the Selection Option" 
    824824            # Change this to a proper logging action 
    825             raise Exception, msg 
     825            raise Exception(msg) 
    826826 
    827827    def contextMenu(self): 
     
    10161016        # Add the actual Data1D/Data2D object 
    10171017        object_item = QtGui.QStandardItem() 
    1018         object_item.setData(QtCore.QVariant(data)) 
     1018        object_item.setData(data) 
    10191019 
    10201020        checkbox_item.setChild(0, object_item) 
     
    10401040        if not isinstance(model_item, QtGui.QStandardItem): 
    10411041            msg = "Wrong data type returned from calculations." 
    1042             raise AttributeError, msg 
     1042            raise AttributeError(msg) 
    10431043 
    10441044        # TODO: Assert other properties 
     
    10571057        if not isinstance(model_item, QtGui.QStandardItem): 
    10581058            msg = "Wrong data type returned from calculations." 
    1059             raise AttributeError, msg 
     1059            raise AttributeError(msg) 
    10601060 
    10611061        # Check if there are any other items for this tab 
     
    10641064        #  
    10651065        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()): 
    10671067            if current_tab_name in self.theory_model.item(current_index).text(): 
    10681068                self.theory_model.removeRow(current_index) 
Note: See TracChangeset for help on using the changeset viewer.