Changeset 899e084 in sasview
- Timestamp:
- Jun 27, 2016 7:36:41 AM (8 years ago)
- 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:
- 80c2c85
- Parents:
- efe730d
- Files:
-
- 2 added
- 1 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
run.py
refe730d r899e084 126 126 if __name__ == "__main__": 127 127 prepare() 128 from sas.sasview.sasview import run 129 run ()128 from sas.sasview.sasview import run_gui 129 run_gui() -
sasview/installer_generator.py
refe730d r899e084 4 4 exists in the current directory. Edit local_config.py according to your needs. 5 5 """ 6 import os 7 import sys 8 import string 9 10 root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 11 sys.path.insert(0, os.path.join(root, 'sasview-install', 'Lib', 'site-packages')) 6 12 from sas.sasview import local_config 7 import os8 import string9 13 10 14 REG_PROGRAM = """{app}\MYPROG.EXE"" ""%1""" … … 13 17 AppVerName = str(local_config.__appname__ )+'-'+ str(local_config.__version__) 14 18 Dev = '' 15 if AppVerName.lower().count('dev') > 0:19 if 'dev' in AppVerName.lower(): 16 20 Dev = '-Dev' 17 21 AppPublisher = local_config._copyright -
sasview/setup_exe.py
refe730d r899e084 33 33 root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 34 34 platform = '%s-%s'%(get_platform(), sys.version[:3]) 35 build_path = os.path.join(root, 'build', 'lib.'+platform) 36 #build_path = os.path.join(root, 'sasview-install', 'Lib', 'site-packages') 35 build_path = os.path.join(root, 'sasview-install', 'Lib', 'site-packages') 37 36 sys.path.insert(0, build_path) 37 doc_path = os.path.join(root, 'build', 'lib.'+platform, 'doc') 38 38 39 39 from sas.sasview import local_config … … 279 279 280 280 # See if the documentation has been built, and if so include it. 281 doc_path = os.path.join(build_path, "doc")282 281 if os.path.exists(doc_path): 283 282 for dirpath, dirnames, filenames in os.walk(doc_path): … … 314 313 ]) 315 314 packages.append('periodictable.core') # not found automatically 316 #packages.append('IPython') 315 # For an interactive interpreter, SasViewCom 316 packages.extend(['IPython','pyreadline','pyreadline.unicode_helper']) 317 318 # individual models 317 319 includes = ['site', 'lxml._elementpath', 'lxml.etree'] 318 320 … … 329 331 'tcl84.dll', 'tk84.dll', 'QtGui4.dll', 'QtCore4.dll', 330 332 # numpy 1.8 openmp bindings (still seems to use all the cores without them) 331 'libiomp5md.dll', 'libifcoremd.dll', 'libmmd.dll', 'svml_dispmd.dll','libifportMD.dll', 333 # ... but we seem to need them when building from anaconda, so don't exclude ... 334 #'libiomp5md.dll', 'libifcoremd.dll', 'libmmd.dll', 'svml_dispmd.dll','libifportMD.dll', 332 335 # microsoft C runtime (not allowed to ship with the app; need to ship vcredist 333 336 'msvcp90.dll', … … 340 343 ] 341 344 345 # extra dlls not found automatically 346 python_root = os.path.dirname(os.path.abspath(sys.executable)) 347 dll_path = os.path.join(python_root, 'Library', 'bin') 348 # the following are found already: 'mkl_intel_thread', 'libmmd', 'libifcoremd' 349 dll_includes = ['mkl_core', 'mkl_def', 'libiomp5md'] 350 dll_includes = [os.path.join(dll_path, dll+'.dll') for dll in dll_includes] 351 dll_includes = [dll for dll in dll_includes if os.path.exists(dll)] 352 if dll_includes: 353 DATA_FILES.append(('.', dll_includes)) 354 342 355 target_wx_client = Target( 343 356 description = 'SasView', 344 script = 's tartup.py',357 script = 'sasview_gui.py', 345 358 icon_resources = [(1, local_config.SetupIconFile_win)], 346 359 other_resources = [(24, 1, manifest)], 347 360 dest_base = "SasView" 348 361 ) 362 363 target_console_client = Target( 364 description = 'SasView console', 365 script = 'sasview_console.py', 366 icon_resources = [(1, local_config.SetupIconFile_win)], 367 other_resources = [(24, 1, manifest)], 368 dest_base = "SasViewCom" 369 ) 349 370 350 371 bundle_option = 2 … … 358 379 setup( 359 380 windows=[target_wx_client], 360 console=[ ],381 console=[target_console_client], 361 382 options={ 362 383 'py2exe': { -
sasview/setup_mac.py
refe730d r899e084 175 175 APPNAME = "SasView "+VERSION 176 176 DMGNAME = "SasView-"+VERSION+"-MacOSX" 177 APP = ['sasview .py']177 APP = ['sasview_gui.py'] 178 178 179 179 EXCLUDES = ['PyQt4', 'sip', 'QtGui'] -
setup.py
refe730d r899e084 56 56 # file_path = os.path.join(f_path, f) 57 57 # os.remove(file_path) 58 if os.path.exists(SASVIEW_BUILD): 59 print "Removing existing build directory", SASVIEW_BUILD, "for a clean build" 60 shutil.rmtree(SASVIEW_BUILD) 58 59 if os.path.exists(SASVIEW_BUILD): 60 print "Removing existing build directory", SASVIEW_BUILD, "for a clean build" 61 shutil.rmtree(SASVIEW_BUILD) 61 62 62 63 # 'sys.maxsize' and 64bit: Not supported for python2.5 63 is_64bits = False 64 if sys.version_info >= (2, 6): 65 is_64bits = sys.maxsize > 2**32 66 64 is_64bits = sys.maxsize > 2**32 67 65 enable_openmp = False 68 66 … … 338 336 zip_safe = False, 339 337 entry_points = { 340 'console_scripts':[341 "sasview = sas.sasview.sasview:run",342 ]343 },344 cmdclass = {'build_ext': build_ext_subclass,345 'docs': BuildSphinxCommand,346 'disable_openmp': DisableOpenMPCommand}338 'console_scripts': ["sasview = sas.sasview.sasview:run_cli"] 339 }, 340 cmdclass = { 341 'build_ext': build_ext_subclass, 342 'docs': BuildSphinxCommand, 343 'disable_openmp': DisableOpenMPCommand, 344 } 347 345 ) -
src/sas/sasview/__init__.py
refe730d r899e084 1 __version__ = "4.0.0 -a3"1 __version__ = "4.0.0a4" 2 2 __build__ = "1" -
src/sas/sasview/sasview.py
refe730d r899e084 16 16 import traceback 17 17 18 log_file = os.path.join(os.path.expanduser("~"), 'sasview.log') 19 logging.basicConfig(level=logging.INFO, 20 format='%(asctime)s %(levelname)s %(message)s', 21 filename=log_file, 22 ) 23 logging.captureWarnings(True) 18 19 reload(sys) 20 sys.setdefaultencoding("iso-8859-1") 21 24 22 25 23 class StreamToLogger(object): … … 41 39 self.logger.log(self.log_level, line.rstrip()) 42 40 43 stderr_logger = logging.getLogger('STDERR')44 sl = StreamToLogger(stderr_logger, logging.ERROR)45 sys.stderr = sl46 47 # Log the start of the session48 logging.info(" --- SasView session started ---")49 50 # Log the python version51 logging.info("Python: %s" % sys.version)52 53 # Allow the dynamic selection of wxPython via an environment variable, when devs54 # who have multiple versions of the module installed want to pick between them.55 # This variable does not have to be set of course, and through normal usage will56 # probably not be, but this can make things a little easier when upgrading to a57 # new version of wx.58 WX_ENV_VAR = "SASVIEW_WX_VERSION"59 if WX_ENV_VAR in os.environ:60 logging.info("You have set the %s environment variable to %s." % \61 (WX_ENV_VAR, os.environ[WX_ENV_VAR]))62 import wxversion63 if wxversion.checkInstalled(os.environ[WX_ENV_VAR]):64 logging.info("Version %s of wxPython is installed, so using that version." % os.environ[WX_ENV_VAR])65 wxversion.select(os.environ[WX_ENV_VAR])66 else:67 logging.error("Version %s of wxPython is not installed, so using default version." % os.environ[WX_ENV_VAR])68 else:69 logging.info("You have not set the %s environment variable, so using default version of wxPython." % WX_ENV_VAR)70 71 import wx72 73 try:74 logging.info("Wx version: %s" % wx.__version__)75 except:76 logging.error("Wx version: error reading version")77 78 from . import wxcruft79 wxcruft.call_later_fix()80 #wxcruft.trace_new_id()81 #Always use private .matplotlib setup to avoid conflicts with other82 #uses of matplotlib83 84 import sas.sasgui85 mplconfigdir = os.path.join(sas.sasgui.get_user_dir(), '.matplotlib')86 if not os.path.exists(mplconfigdir):87 os.mkdir(mplconfigdir)88 os.environ['MPLCONFIGDIR'] = mplconfigdir89 reload(sys)90 sys.setdefaultencoding("iso-8859-1")91 92 93 from sas.sasgui.guiframe import gui_manager94 from .welcome_panel import WelcomePanel95 41 PLUGIN_MODEL_DIR = 'plugin_models' 96 42 APP_NAME = 'SasView' … … 103 49 """ 104 50 """ 105 #from gui_manager importViewApp106 self.gui = gui_manager.SasViewApp(0)51 from sas.sasgui.guiframe.gui_manager import SasViewApp 52 self.gui = SasViewApp(0) 107 53 # Set the application manager for the GUI 108 54 self.gui.set_manager(self) … … 116 62 # Fitting perspective 117 63 try: 118 import sas.sasgui.perspectives.fitting as module 64 import sas.sasgui.perspectives.fitting as module 119 65 fitting_plug = module.Plugin() 120 66 self.gui.add_perspective(fitting_plug) … … 142 88 logging.error(traceback.format_exc()) 143 89 144 #Calculator perspective 90 #Calculator perspective 145 91 try: 146 92 import sas.sasgui.perspectives.calculator as module … … 154 100 155 101 # Add welcome page 102 from .welcome_panel import WelcomePanel 156 103 self.gui.set_welcome_panel(WelcomePanel) 157 104 … … 164 111 165 112 166 def run(): 113 def setup_logging(): 114 log_file = os.path.join(os.path.expanduser("~"), 'sasview.log') 115 logging.basicConfig(level=logging.INFO, 116 format='%(asctime)s %(levelname)s %(message)s', 117 filename=log_file, 118 ) 119 logging.captureWarnings(True) 120 121 stderr_logger = logging.getLogger('STDERR') 122 sl = StreamToLogger(stderr_logger, logging.ERROR) 123 sys.stderr = sl 124 125 # Log the start of the session 126 logging.info(" --- SasView session started ---") 127 128 # Log the python version 129 logging.info("Python: %s" % sys.version) 130 131 132 def setup_wx(): 133 # Allow the dynamic selection of wxPython via an environment variable, when devs 134 # who have multiple versions of the module installed want to pick between them. 135 # This variable does not have to be set of course, and through normal usage will 136 # probably not be, but this can make things a little easier when upgrading to a 137 # new version of wx. 138 WX_ENV_VAR = "SASVIEW_WX_VERSION" 139 if WX_ENV_VAR in os.environ: 140 logging.info("You have set the %s environment variable to %s." % \ 141 (WX_ENV_VAR, os.environ[WX_ENV_VAR])) 142 import wxversion 143 if wxversion.checkInstalled(os.environ[WX_ENV_VAR]): 144 logging.info("Version %s of wxPython is installed, so using that version." % os.environ[WX_ENV_VAR]) 145 wxversion.select(os.environ[WX_ENV_VAR]) 146 else: 147 logging.error("Version %s of wxPython is not installed, so using default version." % os.environ[WX_ENV_VAR]) 148 else: 149 logging.info("You have not set the %s environment variable, so using default version of wxPython." % WX_ENV_VAR) 150 151 import wx 152 153 try: 154 logging.info("Wx version: %s" % wx.__version__) 155 except: 156 logging.error("Wx version: error reading version") 157 158 from . import wxcruft 159 wxcruft.call_later_fix() 160 #wxcruft.trace_new_id() 161 #Always use private .matplotlib setup to avoid conflicts with other 162 #uses of matplotlib 163 164 165 def setup_mpl(): 166 import sas.sasgui 167 mplconfigdir = os.path.join(sas.sasgui.get_user_dir(), '.matplotlib') 168 if not os.path.exists(mplconfigdir): 169 os.mkdir(mplconfigdir) 170 os.environ['MPLCONFIGDIR'] = mplconfigdir 171 # Set backend to WXAgg; this overrides matplotlibrc, but shouldn't override 172 # mpl.use(). Note: Don't import matplotlib here since the script that 173 # we are running may not actually need it; also, putting as little on the 174 # path as we can 175 os.environ['MPLBACKEND'] = 'WXAgg' 176 177 178 def run_gui(): 167 179 """ 168 180 __main__ method for loading and running SasView … … 170 182 from multiprocessing import freeze_support 171 183 freeze_support() 172 if len(sys.argv) > 1: 173 ## Run sasview as an interactive python interpreter 174 if sys.argv[1] == "-i": 175 sys.argv = ["ipython", "--pylab"] 176 from IPython import start_ipython 177 sys.exit(start_ipython()) 184 setup_logging() 185 setup_wx() 186 setup_mpl() 187 SasView() 188 189 190 def run_cli(): 191 setup_mpl() 192 if len(sys.argv) == 1: 193 # Run sasview as an interactive python interpreter 194 sys.argv = ["ipython", "--pylab"] 195 from IPython import start_ipython 196 sys.exit(start_ipython()) 197 else: 198 # Run sasview as a python script interpreter 178 199 thing_to_run = sys.argv[1] 179 200 sys.argv = sys.argv[1:] … … 183 204 else: 184 205 runpy.run_module(thing_to_run, run_name="__main__") 185 else:186 SasView()187 206 188 207 if __name__ == "__main__": 189 run ()190 208 run_gui() 209
Note: See TracChangeset
for help on using the changeset viewer.