Ignore:
Timestamp:
Sep 22, 2017 4:01:32 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:
34d7b35
Parents:
9706d88
Message:

convert sascalc to python 2/3 syntax

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/data_util/calcthread.py

    ra1b8fee r574adc7  
    66from __future__ import print_function 
    77 
    8 import thread 
    98import traceback 
    109import sys 
    1110import logging 
     11try: 
     12    import _thread as thread 
     13except ImportError: # CRUFT: python 2 support 
     14    import thread 
    1215 
    1316if sys.platform.count("darwin") > 0: 
    1417    import time 
    1518    stime = time.time() 
    16      
     19 
    1720    def clock(): 
    1821        return time.time() - stime 
    19      
     22 
    2023    def sleep(t): 
    2124        return time.sleep(t) 
     
    3538    CalcThread.__init__, passing it the keyword arguments for 
    3639    yieldtime, worktime, update and complete. 
    37      
     40 
    3841    When defining the compute() method you need to include code which 
    3942    allows the GUI to run.  They are as follows: :: 
     
    211214            self._lock.release() 
    212215            self._time_for_update += 1e6  # No more updates 
    213              
     216 
    214217            self.updatefn(**kwargs) 
    215218            sleep(self.yieldtime) 
Note: See TracChangeset for help on using the changeset viewer.