Changeset 9be22cd in sasview for src/sas/sasgui/guiframe


Ignore:
Timestamp:
Sep 27, 2017 10:50:02 AM (7 years ago)
Author:
Paul Kienzle <pkienzle@…>
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, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
fca1f50
Parents:
69a6897 (diff), 83db1cc (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'ticket-887-reorg' into ticket-853-fit-gui-to-calc

Location:
src/sas/sasgui/guiframe
Files:
1 deleted
10 edited

Legend:

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

    r6e50a8d rb963b20  
    1515from collections import defaultdict, OrderedDict 
    1616 
    17 from sas.sasgui import get_user_dir 
     17from sas import get_user_dir 
    1818 
    1919USER_FILE = 'categories.json' 
     
    2727    Note - class is entirely static! 
    2828    """ 
     29 
     30    @staticmethod 
     31    def _get_installed_model_dir(): 
     32        """ 
     33        returns the dir where installed_models.txt should be 
     34        """ 
     35        from sas.sascalc.dataloader.readers import get_data_path 
     36        return get_data_path() 
     37 
     38    @staticmethod 
     39    def _get_default_cat_file_dir(): 
     40        """ 
     41        returns the dir where default_cat.j should be 
     42        """ 
     43        # The default categories file is usually found with the code, except 
     44        # when deploying using py2app (it will be in Contents/Resources), or 
     45        # py2exe (it will be in the exec dir). 
     46        import sas.sasview 
     47        cat_file = "default_categories.json" 
     48 
     49        possible_cat_file_paths = [ 
     50            os.path.join(os.path.split(sas.sasview.__file__)[0], cat_file),           # Source 
     51            os.path.join(os.path.dirname(sys.executable), '..', 'Resources', cat_file), # Mac 
     52            os.path.join(os.path.dirname(sys.executable), cat_file)                     # Windows 
     53        ] 
     54 
     55        for path in possible_cat_file_paths: 
     56            if os.path.isfile(path): 
     57                return os.path.dirname(path) 
     58 
     59        raise RuntimeError('CategoryInstaller: Could not find folder containing default categories') 
     60 
     61    @staticmethod 
     62    def _get_home_dir(): 
     63        """ 
     64        returns the users sasview config dir 
     65        """ 
     66        return os.path.join(os.path.expanduser("~"), ".sasview") 
    2967 
    3068    @staticmethod 
     
    81119               which are user supplied. 
    82120        """ 
    83         _model_dict = { model.name: model for model in model_list} 
     121        _model_dict = {model.name: model for model in model_list} 
    84122        _model_list = _model_dict.keys() 
    85123 
     
    107145                        by_model_dict.pop(model_name) 
    108146                        model_enabled_dict.pop(model_name) 
    109                     except: 
     147                    except Exception: 
    110148                        logger.error("CategoryInstaller: %s", sys.exc_value) 
    111149                else: 
     
    113151        if del_name or (len(add_list) > 0): 
    114152            for model in add_list: 
    115                 model_enabled_dict[model]= True 
    116                 if _model_dict[model].category is None or len(str(_model_dict[model].category.capitalize())) == 0: 
     153                model_enabled_dict[model] = True 
     154                # TODO: should be:  not _model_dict[model].category 
     155                if (_model_dict[model].category is None 
     156                        or len(str(_model_dict[model].category.capitalize())) == 0): 
    117157                    by_model_dict[model].append('Uncategorized') 
    118158                else: 
  • src/sas/sasgui/guiframe/aboutbox.py

    r724af06 rb963b20  
    2525import os 
    2626 
    27 from sas.sasgui import get_local_config 
     27from sas import get_local_config 
    2828config = get_local_config() 
    2929 
  • src/sas/sasgui/guiframe/acknowledgebox.py

    r914ba0a rb963b20  
    1313from wx.lib.expando import ExpandoTextCtrl 
    1414 
    15 from sas.sasgui import get_local_config 
     15from sas import get_local_config 
    1616config = get_local_config() 
    1717 
  • src/sas/sasgui/guiframe/config.py

    r724af06 rb963b20  
    145145UPDATE_TIMEOUT = 2 
    146146 
    147 #OpenCL option 
    148 SAS_OPENCL = None 
    149  
    150147# Time out for updating sasview 
    151148UPDATE_TIMEOUT = 2 
  • src/sas/sasgui/guiframe/data_panel.py

    rc6bdb3b rb963b20  
    3333from sas.sasgui.guiframe.local_perspectives.plotting.SimplePlot \ 
    3434    import PlotFrame as QucikPlotDialog 
    35 from sas.sasgui import get_local_config 
     35from sas import get_local_config 
    3636 
    3737config = get_local_config() 
  • src/sas/sasgui/guiframe/documentation_window.py

    r724af06 rb963b20  
    2727    WX_SUPPORTS_HTML2 = False 
    2828 
    29 from sas.sasgui import get_app_dir 
     29from sas import get_app_dir 
    3030 
    3131# Don't use wx html renderer on windows. 
  • src/sas/sasgui/guiframe/gui_manager.py

    r914ba0a rb963b20  
    2828from matplotlib import _pylab_helpers 
    2929 
    30 from sas.sasgui import get_local_config, get_app_dir, get_user_dir 
     30from sas import get_local_config, get_custom_config, get_app_dir, get_user_dir 
    3131from sas.sasgui.guiframe.events import EVT_CATEGORY 
    3232from sas.sasgui.guiframe.events import EVT_STATUS 
     
    4747from sas.sascalc.dataloader.loader import Loader 
    4848from sas.sasgui.guiframe.proxy import Connection 
    49 from sas.sasgui.guiframe.customdir import setup_custom_config 
    5049 
    5150logger = logging.getLogger(__name__) 
     
    5352 
    5453config = get_local_config() 
    55 custom_config = setup_custom_config() 
     54custom_config = get_custom_config() 
    5655 
    5756# read some constants from config 
     
    6362SPLASH_SCREEN_HEIGHT = config.SPLASH_SCREEN_HEIGHT 
    6463SS_MAX_DISPLAY_TIME = config.SS_MAX_DISPLAY_TIME 
    65 SAS_OPENCL = config.SAS_OPENCL 
    6664if not WELCOME_PANEL_ON: 
    6765    WELCOME_PANEL_SHOW = False 
     
    138136        PARENT_FRAME = wx.Frame 
    139137        CHILD_FRAME = wx.Frame 
    140  
    141 #Initiliaze enviromental variable with custom setting but only if variable not set 
    142 if SAS_OPENCL and not "SAS_OPENCL" in os.environ: 
    143     os.environ["SAS_OPENCL"] = SAS_OPENCL 
    144138 
    145139class ViewerFrame(PARENT_FRAME): 
  • src/sas/sasgui/guiframe/local_perspectives/data_loader/data_loader.py

    r759a8ab rb963b20  
    1010logger = logging.getLogger(__name__) 
    1111 
     12from sas import get_local_config 
     13 
    1214from sas.sascalc.dataloader.loader import Loader 
    1315from sas.sascalc.dataloader.loader_exceptions import NoKnownLoaderException 
    1416 
    15 from sas.sasgui import get_local_config 
    1617from sas.sasgui.guiframe.plugin_base import PluginBase 
    1718from sas.sasgui.guiframe.events import StatusEvent 
  • src/sas/sasgui/guiframe/report_dialog.py

    r463e7ffc r69a6897  
    1313if sys.platform == "win32": 
    1414    _STATICBOX_WIDTH = 450 
    15     PANEL_WIDTH = 500  
     15    PANEL_WIDTH = 500 
    1616    PANEL_HEIGHT = 700 
    1717    FONT_VARIANT = 0 
     
    2626 
    2727class BaseReportDialog(wx.Dialog): 
    28      
     28 
    2929    def __init__(self, report_list, *args, **kwds): 
    3030        """ 
    3131        Initialization. The parameters added to Dialog are: 
    32          
     32 
    3333        :param report_list: list of html_str, text_str, image for report 
    3434        """ 
     
    4848        self.report_list = report_list 
    4949        # wild card 
    50         # pdf supporting only on MAC 
    51         if self.is_pdf: 
    52             self.wild_card = ' PDF files (*.pdf)|*.pdf|' 
     50        if self.is_pdf:  # pdf writer is available 
     51            self.wild_card = 'PDF files (*.pdf)|*.pdf|' 
    5352            self.index_offset = 0 
    5453        else: 
     
    6362        """ 
    6463        hbox = wx.BoxSizer(wx.HORIZONTAL) 
    65          
     64 
    6665        # buttons 
    6766        button_close = wx.Button(self, wx.ID_OK, "Close") 
     
    7574                          id=button_print.GetId()) 
    7675        hbox.Add(button_print) 
    77          
     76 
    7877        button_save = wx.Button(self, wx.NewId(), "Save") 
    7978        button_save.SetToolTipString("Save this report.") 
    8079        button_save.Bind(wx.EVT_BUTTON, self.onSave, id=button_save.GetId()) 
    8180        hbox.Add(button_save) 
    82          
     81 
    8382        # panel for report page 
    8483        vbox = wx.BoxSizer(wx.VERTICAL) 
     
    8786        # set the html page with the report string 
    8887        self.hwindow.SetPage(self.report_html) 
    89          
     88 
    9089        # add panels to boxsizers 
    9190        vbox.Add(hbox) 
     
    103102        previewh = html.HtmlEasyPrinting(name="Printing", parentWindow=self) 
    104103        previewh.PreviewText(self.report_html) 
    105          
     104 
    106105    def onPrint(self, event=None): 
    107106        """ 
     
    118117        """ 
    119118        self.Close() 
    120      
     119 
    121120    def HTML2PDF(self, data, filename): 
    122121        """ 
    123122        Create a PDF file from html source string. 
    124         Returns True is the file creation was successful.  
     123        Returns True is the file creation was successful. 
    125124        : data: html string 
    126125        : filename: name of file to be saved 
     
    136135            self.Update() 
    137136            return pisaStatus.err 
    138         except: 
     137        except Exception: 
    139138            logger.error("Error creating pdf: %s" % sys.exc_value) 
    140139        return False 
    141  
  • src/sas/sasgui/guiframe/startup_configuration.py

    r914ba0a rb963b20  
    1313import wx 
    1414 
    15 from sas.sasgui import get_custom_config_path 
     15from sas import make_custom_config_path 
    1616from sas.sasgui.guiframe.events import StatusEvent 
    1717from sas.sasgui.guiframe.gui_style import GUIFRAME 
     
    194194        Write custom configuration 
    195195        """ 
    196         path = get_custom_config_path() 
     196        path = make_custom_config_path() 
    197197        with open(path, 'w') as out_f: 
    198198            out_f.write("#Application appearance custom configuration\n") 
Note: See TracChangeset for help on using the changeset viewer.