Ignore:
Timestamp:
Oct 11, 2018 12:20:56 PM (6 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1249
Children:
98b9f32
Parents:
67ed543
Message:

improved support for py37 in sasgui

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/guiframe/data_panel.py

    rb963b20 r5251ec6  
    1313from __future__ import print_function 
    1414 
     15import sys 
     16 
    1517import wx 
    16 from wx.build import build_options 
    17  
    18 import sys 
    1918from wx.lib.scrolledpanel import ScrolledPanel 
    2019import wx.lib.agw.customtreectrl as CT 
     20#from wx.build import build_options 
     21 
    2122from sas.sasgui.guiframe.dataFitting import Data1D 
    2223from sas.sasgui.guiframe.dataFitting import Data2D 
     
    444445            self.parent.get_data_manager().get_by_id(id_list=[id]) 
    445446        if data_list: 
    446             data = data_list.values()[0] 
     447            data = list(data_list.values())[0] 
    447448        if data is None: 
    448             data = theory_list.values()[0][0] 
     449            data = list(theory_list.values())[0][0] 
    449450        return data 
    450451 
     
    667668        """ 
    668669        if list: 
    669             for state_id, dstate in list.iteritems(): 
     670            for state_id, dstate in list.items(): 
    670671                data = dstate.get_data() 
    671672                theory_list = dstate.get_theory() 
     
    764765        if not theory_list: 
    765766            return 
    766         if state_id not in self.list_cb_data.keys(): 
     767        if state_id not in self.list_cb_data: 
    767768            root = self.tree_ctrl_theory.root 
    768769            tree = self.tree_ctrl_theory 
     
    783784        Append theory helper 
    784785        """ 
    785         if state_id in self.list_cb_theory.keys(): 
     786        if state_id in self.list_cb_theory: 
    786787            # update current list of theory for this data 
    787788            theory_list_ctrl = self.list_cb_theory[state_id] 
    788789 
    789             for theory_id, item in theory_list.iteritems(): 
     790            for theory_id, item in theory_list.items(): 
    790791                theory_data, _ = item 
    791792                if theory_data is None: 
     
    828829            # data didn't have a theory associated it before 
    829830            theory_list_ctrl = {} 
    830             for theory_id, item in theory_list.iteritems(): 
     831            for theory_id, item in theory_list.items(): 
    831832                theory_data, _ = item 
    832833                if theory_data is not None: 
     
    868869 
    869870        for theory_dict in self.list_cb_theory.values(): 
    870             for _, value in theory_dict.iteritems(): 
     871            for _, value in theory_dict.items(): 
    871872                item, _, _ = value 
    872873                if item.IsChecked(): 
     
    924925        theory_key = [] 
    925926        # remove  data from treectrl 
    926         for d_key, item in self.list_cb_data.iteritems(): 
     927        for d_key, item in self.list_cb_data.items(): 
    927928            data_c, _, _, _,  _, _, _, _ = item 
    928929            if data_c.IsChecked(): 
    929930                self.tree_ctrl.Delete(data_c) 
    930931                data_key.append(d_key) 
    931                 if d_key in self.list_cb_theory.keys(): 
     932                if d_key in self.list_cb_theory: 
    932933                    theory_list_ctrl = self.list_cb_theory[d_key] 
    933                     theory_to_remove += theory_list_ctrl.keys() 
     934                    theory_to_remove += list(theory_list_ctrl.keys()) 
    934935        # Remove theory from treectrl 
    935         for _, theory_dict in self.list_cb_theory.iteritems(): 
    936             for key, value in theory_dict.iteritems(): 
     936        for _, theory_dict in self.list_cb_theory.items(): 
     937            for key, value in theory_dict.items(): 
    937938                item, _, _ = value 
    938939                if item.IsChecked(): 
     
    950951        # remove theory  references independently of data 
    951952        for key in theory_key: 
    952             for _, theory_dict in self.list_cb_theory.iteritems(): 
     953            for _, theory_dict in self.list_cb_theory.items(): 
    953954                if key in theory_dict: 
    954                     for key, value in theory_dict.iteritems(): 
     955                    for key, value in theory_dict.items(): 
    955956                        item, _, _ = value 
    956957                        if item.IsChecked(): 
     
    10471048        if self.cb_plotpanel and self.cb_plotpanel.IsBeingDeleted(): 
    10481049            return 
    1049         for _, value in self.parent.plot_panels.iteritems(): 
     1050        for _, value in self.parent.plot_panels.items(): 
    10501051            name_plot_panel = str(value.window_caption) 
    10511052            if name_plot_panel not in self.cb_plotpanel.GetItems(): 
     
    11291130        #import documentation window here to avoid circular imports 
    11301131        #if put at top of file with rest of imports. 
    1131         from documentation_window import DocumentationWindow 
     1132        from .documentation_window import DocumentationWindow 
    11321133 
    11331134        _TreeLocation = "user/sasgui/guiframe/data_explorer_help.html" 
     
    14991500        window.Show(True) 
    15001501        window.load_data_list(list=temp_data_list) 
    1501     except: 
     1502    except Exception as exc: 
    15021503        # raise 
    1503         print("error", sys.exc_value) 
     1504        print("error", exc) 
    15041505 
    15051506    app.MainLoop() 
Note: See TracChangeset for help on using the changeset viewer.