Changeset dba8557 in sasview for src/sas/sasgui/perspectives/fitting


Ignore:
Timestamp:
Sep 23, 2017 3:37:35 PM (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, 66000ae
Parents:
948484f (diff), 53b8266 (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-869' into ticket-887-reorg

Location:
src/sas/sasgui/perspectives/fitting
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/perspectives/fitting/basepage.py

    rf80b416e r53b8266  
    1515import traceback 
    1616 
     17from Queue import Queue 
     18from threading import Thread 
    1719from collections import defaultdict 
    1820from wx.lib.scrolledpanel import ScrolledPanel 
     
    241243        self.set_layout() 
    242244 
     245        # Setting up a thread for the fitting 
     246        self.threaded_draw_queue = Queue() 
     247 
     248        self.draw_worker_thread = Thread(target = self._threaded_draw_worker, 
     249                                         args = (self.threaded_draw_queue,)) 
     250        self.draw_worker_thread.setDaemon(True) 
     251        self.draw_worker_thread.start() 
     252 
     253        # And a home for the thread submission times 
     254        self.last_time_fit_submitted = 0.00 
     255 
    243256    def set_index_model(self, index): 
    244257        """ 
     
    16931706        :param chisqr: update chisqr value [bool] 
    16941707        """ 
    1695         wx.CallAfter(self._draw_model_after, update_chisqr, source) 
     1708        self.threaded_draw_queue.put([copy.copy(update_chisqr), copy.copy(source)]) 
     1709 
     1710    def _threaded_draw_worker(self, threaded_draw_queue): 
     1711        while True: 
     1712            # sit and wait for the next task 
     1713            next_task = threaded_draw_queue.get() 
     1714 
     1715            # sleep for 1/10th second in case some other tasks accumulate 
     1716            time.sleep(0.1) 
     1717 
     1718            # skip all intermediate tasks 
     1719            while self.threaded_draw_queue.qsize() > 0: 
     1720                self.threaded_draw_queue.task_done() 
     1721                next_task = self.threaded_draw_queue.get() 
     1722 
     1723            # and finally, do the task 
     1724            self._draw_model_after(*next_task) 
     1725            threaded_draw_queue.task_done() 
    16961726 
    16971727    def _draw_model_after(self, update_chisqr=True, source='model'): 
     
    17161746            toggle_mode_on = self.model_view.IsEnabled() 
    17171747            is_2d = self._is_2D() 
     1748 
    17181749            self._manager.draw_model(self.model, 
    17191750                                     data=self.data, 
  • src/sas/sasgui/perspectives/fitting/__init__.py

    r959eb01 r12d3e0e  
    1313    # Check for data path next to exe/zip file. 
    1414    # If we are inside a py2exe zip file, we need to go up 
    15     # to get to the directory containing  
     15    # to get to the directory containing 
    1616    # the media for this module 
    1717    path = os.path.dirname(__file__) 
     
    2626                return module_media_path 
    2727            return media_path 
    28     
     28 
    2929    raise RuntimeError('Could not find models media files') 
    3030 
     
    3232    """ 
    3333    Return the data files associated with media. 
    34      
     34 
    3535    The format is a list of (directory, [files...]) pairs which can be 
    3636    used directly in setup(...,data_files=...) for setup.py. 
     
    3838    """ 
    3939    data_files = [] 
    40     path = os.path.dirname(__file__) 
    41     p_path = os.path.join(path, 'plugin_models') 
    42     for f in findall(p_path): 
    43         data_files.append(('plugin_models', [f])) 
    44     # path = get_data_path(media="media") 
    45     for f in findall(path): 
    46         data_files.append(('media/fitting_media', [f])) 
    47      
     40    # Note: windows installer requires the plugin_models directory 
     41    plugin_models = os.path.join(os.path.dirname(__file__), "plugin_models") 
     42    data_files.append(('plugin_models', findall(plugin_models))) 
     43    data_files.append(('media/fitting_media', findall(get_data_path("media")))) 
     44 
    4845    return data_files 
  • src/sas/sasgui/perspectives/fitting/models.py

    r13374be r724af06  
    1515import shutil 
    1616from copy import copy 
     17 
     18from sasmodels.sasview_model import load_custom_model, load_standard_models 
     19 
    1720# Explicitly import from the pluginmodel module so that py2exe 
    1821# places it in the distribution. The Model1DPlugin class is used 
    1922# as the base class of plug-in models. 
     23from sas.sasgui import get_user_dir 
    2024from sas.sascalc.fit.pluginmodel import Model1DPlugin 
    2125from sas.sasgui.guiframe.CategoryInstaller import CategoryInstaller 
    22 from sasmodels.sasview_model import load_custom_model, load_standard_models 
    2326from sas.sasgui.perspectives.fitting.fitpage import CUSTOM_MODEL 
    2427 
     
    2730 
    2831PLUGIN_DIR = 'plugin_models' 
    29 PLUGIN_LOG = os.path.join(os.path.expanduser("~"), '.sasview', PLUGIN_DIR, 
    30                           "plugins.log") 
     32PLUGIN_LOG = os.path.join(get_user_dir(), PLUGIN_DIR, "plugins.log") 
    3133PLUGIN_NAME_BASE = '[plug-in] ' 
    3234 
Note: See TracChangeset for help on using the changeset viewer.