Ignore:
Timestamp:
Oct 7, 2016 3:11:40 PM (8 years ago)
Author:
mathieu
Branches:
master, 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, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
b61bd57
Parents:
60df6c1
Message:

Pull categories from models. Get rid of default categories. Fixes #535

File:
1 edited

Legend:

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

    r80b1df3 r212bfc2  
    1313import sys 
    1414import os 
     15import logging 
    1516from wx.lib.mixins.listctrl import CheckListCtrlMixin, ListCtrlAutoWidthMixin 
    1617from collections import defaultdict 
     
    366367        """ 
    367368        try: 
    368             file = CategoryInstaller.get_user_file() 
    369             if os.path.isfile(file): 
    370                 cat_file = open(file, 'rb') 
    371 #               self.master_category_dict = pickle.load(cat_file) 
    372                 self.master_category_dict = json.load(cat_file) 
    373             else: 
    374                 cat_file = open(CategoryInstaller.get_default_file(), 'rb') 
    375 #                       self.master_category_dict = pickle.load(cat_file) 
    376                 self.master_category_dict = json.load(cat_file) 
    377             cat_file.close() 
     369            cat_file = CategoryInstaller.get_user_file() 
     370            self.master_category_dict = {} 
     371            if os.path.isfile(cat_file): 
     372                with open(cat_file, 'rb') as f: 
     373                    self.master_category_dict = json.load(f) 
    378374        except IOError: 
    379             print 'Problem reading in category file. Please review' 
    380  
     375            logging.error('Problem reading in category file.') 
    381376 
    382377        self._regenerate_model_dict() 
Note: See TracChangeset for help on using the changeset viewer.