Changeset fef38e8 in sasview for src/sas/qtgui
- Timestamp:
- Sep 13, 2017 4:24:34 AM (7 years ago)
- Branches:
- 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
- Children:
- 3c8242c
- Parents:
- 9909967
- Location:
- src/sas/qtgui
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Calculators/GenericScatteringCalculator.py
r4d1eff2 rfef38e8 8 8 from PyQt4 import QtCore 9 9 from twisted.internet import threads 10 from mpl_toolkits.mplot3d import Axes3D11 10 12 11 import sas.qtgui.Utilities.GuiUtils as GuiUtils 13 14 12 from sas.qtgui.Utilities.GenericReader import GenReader 15 16 13 from sas.sascalc.dataloader.data_info import Detector 17 14 from sas.sascalc.dataloader.data_info import Source 18 15 from sas.sascalc.calculator import sas_gen 19 20 from sas.qtgui.Plotting.Arrow3D import Arrow3D21 16 from sas.qtgui.Plotting.PlotterBase import PlotterBase 22 17 from sas.qtgui.Plotting.Plotter2D import Plotter2D 23 18 from sas.qtgui.Plotting.Plotter import Plotter 19 24 20 from sas.qtgui.Plotting.PlotterData import Data1D 25 21 from sas.qtgui.Plotting.PlotterData import Data2D … … 704 700 if data is None: 705 701 return 702 # This import takes forever - place it here so the main UI starts faster 703 from mpl_toolkits.mplot3d import Axes3D 706 704 color_dic = {'H': 'blue', 'D': 'purple', 'N': 'orange', 707 705 'O': 'red', 'C': 'green', 'P': 'cyan', 'Other': 'k'} … … 781 779 if has_arrow and len(pos_x) > 0: 782 780 def _draw_arrow(input=None, update=None): 781 # import moved here for performance reasons 782 from sas.qtgui.Plotting.Arrow3D import Arrow3D 783 783 """ 784 784 draw magnetic vectors w/arrow -
src/sas/qtgui/MainWindow/DataExplorer.py
r38eb433 rfef38e8 451 451 model = self.model if plot_to_show.is_data else self.theory_model 452 452 plots = GuiUtils.plotsFromFilename(filename, model) 453 _ = [self.plotData([(None, plot)]) for plot in plots] 453 for plot in plots: 454 plot_id = plot.id 455 if plot_id in self.active_plots.keys(): 456 self.active_plots[plot_id].replacePlot(plot_id, plot_to_show) 457 else: 458 self.plotData([(None, plot)]) 454 459 455 460 def addDataPlot2D(self, plot_set, item): -
src/sas/qtgui/MainWindow/GuiManager.py
rb0c5e8c rfef38e8 11 11 12 12 from twisted.internet import reactor 13 14 13 # General SAS imports 15 14 from sas.qtgui.Utilities.ConnectionProxy import ConnectionProxy 16 15 from sas.qtgui.Utilities.SasviewLogger import XStream 17 from sas.qtgui.Utilities.IPythonWidget import IPythonWidget 16 18 17 import sas.qtgui.Utilities.LocalConfig as LocalConfig 19 18 import sas.qtgui.Utilities.GuiUtils as GuiUtils 19 20 20 import sas.qtgui.Utilities.ObjectLibrary as ObjectLibrary 21 22 21 from sas.qtgui.MainWindow.UI.AcknowledgementsUI import Ui_Acknowledgements 23 22 from sas.qtgui.MainWindow.AboutBox import AboutBox 24 23 from sas.qtgui.MainWindow.WelcomePanel import WelcomePanel 24 25 25 from sas.qtgui.MainWindow.DataManager import DataManager 26 26 … … 96 96 self._helpView = QtWebKit.QWebView() 97 97 # Needs URL like path, so no path.join() here 98 GuiUtils._init() 98 99 self._helpLocation = GuiUtils.HELP_DIRECTORY_LOCATION + "/index.html" 99 100 … … 568 569 Display the Jupyter console as a docked widget. 569 570 """ 571 # Import moved here for startup performance reasons 572 from sas.qtgui.Utilities.IPythonWidget import IPythonWidget 570 573 terminal = IPythonWidget() 571 574 -
src/sas/qtgui/Plotting/Fittings.py
- Property mode changed from 100755 to 100644
rdc5ef15 rfef38e8 14 14 15 15 """ 16 from scipy import optimize17 18 19 16 class Parameter(object): 20 17 """ … … 84 81 sum += item * item 85 82 return sum 86 83 # This import takes a long time, which is why it's here not in the top of file 84 from scipy.optimize import leastsq 87 85 p = [param() for param in pars] 86 #out, cov_x, info, mesg, success = optimize.leastsq(f, p, full_output=1) 88 87 out, cov_x, info, mesg, success = optimize.leastsq(f, p, full_output=1) 89 88 # Calculate chi squared -
src/sas/qtgui/Plotting/Plotter.py
rdc5ef15 rfef38e8 3 3 import functools 4 4 import copy 5 6 5 import matplotlib.pyplot as plt 7 6 from matplotlib.font_manager import FontProperties 8 9 7 from sas.qtgui.Plotting.PlotterData import Data1D 10 11 8 from sas.qtgui.Plotting.PlotterBase import PlotterBase 12 9 from sas.qtgui.Plotting.AddText import AddText … … 390 387 Deletes the selected plot from the chart 391 388 """ 392 if id not in self.plot_dict :389 if id not in self.plot_dict.keys(): 393 390 return 394 391 -
src/sas/qtgui/Utilities/GuiUtils.py
r38eb433 rfef38e8 18 18 19 19 from periodictable import formula as Formula 20 21 20 from sas.qtgui.Plotting import DataTransform 22 21 from sas.qtgui.Plotting.ConvertUnits import convertUnit 23 24 22 from sas.qtgui.Plotting.PlotterData import Data1D 25 23 from sas.qtgui.Plotting.PlotterData import Data2D 26 27 24 from sas.sascalc.dataloader.loader import Loader 28 25 from sas.qtgui.Utilities import CustomDir 29 26 27 ## TODO: CHANGE FOR SHIPPED PATH IN RELEASE 28 if os.path.splitext(sys.argv[0])[1].lower() != ".py": 29 HELP_DIRECTORY_LOCATION = "doc" 30 else: 31 HELP_DIRECTORY_LOCATION = "docs/sphinx-docs/build/html" 32 IMAGES_DIRECTORY_LOCATION = HELP_DIRECTORY_LOCATION + "/_images" 30 33 31 34 def get_app_dir(): … … 91 94 return config_module 92 95 93 # Get APP folder 94 PATH_APP = get_app_dir() 95 DATAPATH = PATH_APP 96 97 ## TODO: CHANGE FOR SHIPPED PATH IN RELEASE 98 if os.path.splitext(sys.argv[0])[1].lower() != ".py": 99 HELP_DIRECTORY_LOCATION = "doc" 100 else: 101 HELP_DIRECTORY_LOCATION = "docs/sphinx-docs/build/html" 102 IMAGES_DIRECTORY_LOCATION = HELP_DIRECTORY_LOCATION + "/_images" 103 104 # GUI always starts from the App folder 105 #os.chdir(PATH_APP) 106 # Read in the local config, which can either be with the main 107 # application or in the installation directory 108 config = _find_local_config('local_config', PATH_APP) 109 110 if config is None: 111 config = _find_local_config('local_config', os.getcwd()) 112 #if config is None: 113 # # Didn't find local config, load the default 114 # import sas.sasgui.guiframe.config as config 115 # #logging.info("using default local_config") 116 #else: 117 # pass 118 # #logging.info("found local_config in %s", os.getcwd()) 119 else: 120 pass 121 #logging.info("found local_config in %s", PATH_APP) 122 123 c_conf_dir = CustomDir.setup_conf_dir(PATH_APP) 124 125 custom_config = _find_local_config('custom_config', c_conf_dir) 126 if custom_config is None: 127 custom_config = _find_local_config('custom_config', os.getcwd()) 128 if custom_config is None: 129 msgConfig = "Custom_config file was not imported" 130 #logging.info(msgConfig) 96 def _init(): 97 # Get APP folder 98 PATH_APP = get_app_dir() 99 DATAPATH = PATH_APP 100 101 # Read in the local config, which can either be with the main 102 # application or in the installation directory 103 config = _find_local_config('local_config', PATH_APP) 104 105 if config is None: 106 config = _find_local_config('local_config', os.getcwd()) 131 107 else: 132 108 pass 133 #logging.info("using custom_config in %s", os.getcwd()) 134 else: 135 pass 136 #logging.info("using custom_config from %s", c_conf_dir) 137 138 #read some constants from config 139 APPLICATION_STATE_EXTENSION = config.APPLICATION_STATE_EXTENSION 140 APPLICATION_NAME = config.__appname__ 141 SPLASH_SCREEN_PATH = config.SPLASH_SCREEN_PATH 142 WELCOME_PANEL_ON = config.WELCOME_PANEL_ON 143 SPLASH_SCREEN_WIDTH = config.SPLASH_SCREEN_WIDTH 144 SPLASH_SCREEN_HEIGHT = config.SPLASH_SCREEN_HEIGHT 145 SS_MAX_DISPLAY_TIME = config.SS_MAX_DISPLAY_TIME 146 if not WELCOME_PANEL_ON: 147 WELCOME_PANEL_SHOW = False 148 else: 149 WELCOME_PANEL_SHOW = True 150 try: 151 DATALOADER_SHOW = custom_config.DATALOADER_SHOW 152 TOOLBAR_SHOW = custom_config.TOOLBAR_SHOW 153 FIXED_PANEL = custom_config.FIXED_PANEL 154 if WELCOME_PANEL_ON: 155 WELCOME_PANEL_SHOW = custom_config.WELCOME_PANEL_SHOW 156 PLOPANEL_WIDTH = custom_config.PLOPANEL_WIDTH 157 DATAPANEL_WIDTH = custom_config.DATAPANEL_WIDTH 158 GUIFRAME_WIDTH = custom_config.GUIFRAME_WIDTH 159 GUIFRAME_HEIGHT = custom_config.GUIFRAME_HEIGHT 160 CONTROL_WIDTH = custom_config.CONTROL_WIDTH 161 CONTROL_HEIGHT = custom_config.CONTROL_HEIGHT 162 DEFAULT_PERSPECTIVE = custom_config.DEFAULT_PERSPECTIVE 163 CLEANUP_PLOT = custom_config.CLEANUP_PLOT 164 # custom open_path 165 open_folder = custom_config.DEFAULT_OPEN_FOLDER 166 if open_folder != None and os.path.isdir(open_folder): 167 DEFAULT_OPEN_FOLDER = os.path.abspath(open_folder) 109 110 c_conf_dir = CustomDir.setup_conf_dir(PATH_APP) 111 112 custom_config = _find_local_config('custom_config', c_conf_dir) 113 if custom_config is None: 114 custom_config = _find_local_config('custom_config', os.getcwd()) 115 if custom_config is None: 116 msgConfig = "Custom_config file was not imported" 117 118 #read some constants from config 119 APPLICATION_STATE_EXTENSION = config.APPLICATION_STATE_EXTENSION 120 APPLICATION_NAME = config.__appname__ 121 SPLASH_SCREEN_PATH = config.SPLASH_SCREEN_PATH 122 WELCOME_PANEL_ON = config.WELCOME_PANEL_ON 123 SPLASH_SCREEN_WIDTH = config.SPLASH_SCREEN_WIDTH 124 SPLASH_SCREEN_HEIGHT = config.SPLASH_SCREEN_HEIGHT 125 SS_MAX_DISPLAY_TIME = config.SS_MAX_DISPLAY_TIME 126 if not WELCOME_PANEL_ON: 127 WELCOME_PANEL_SHOW = False 168 128 else: 129 WELCOME_PANEL_SHOW = True 130 try: 131 DATALOADER_SHOW = custom_config.DATALOADER_SHOW 132 TOOLBAR_SHOW = custom_config.TOOLBAR_SHOW 133 FIXED_PANEL = custom_config.FIXED_PANEL 134 if WELCOME_PANEL_ON: 135 WELCOME_PANEL_SHOW = custom_config.WELCOME_PANEL_SHOW 136 PLOPANEL_WIDTH = custom_config.PLOPANEL_WIDTH 137 DATAPANEL_WIDTH = custom_config.DATAPANEL_WIDTH 138 GUIFRAME_WIDTH = custom_config.GUIFRAME_WIDTH 139 GUIFRAME_HEIGHT = custom_config.GUIFRAME_HEIGHT 140 CONTROL_WIDTH = custom_config.CONTROL_WIDTH 141 CONTROL_HEIGHT = custom_config.CONTROL_HEIGHT 142 DEFAULT_PERSPECTIVE = custom_config.DEFAULT_PERSPECTIVE 143 CLEANUP_PLOT = custom_config.CLEANUP_PLOT 144 # custom open_path 145 open_folder = custom_config.DEFAULT_OPEN_FOLDER 146 if open_folder != None and os.path.isdir(open_folder): 147 DEFAULT_OPEN_FOLDER = os.path.abspath(open_folder) 148 else: 149 DEFAULT_OPEN_FOLDER = PATH_APP 150 except AttributeError: 151 DATALOADER_SHOW = True 152 TOOLBAR_SHOW = True 153 FIXED_PANEL = True 154 WELCOME_PANEL_SHOW = False 155 PLOPANEL_WIDTH = config.PLOPANEL_WIDTH 156 DATAPANEL_WIDTH = config.DATAPANEL_WIDTH 157 GUIFRAME_WIDTH = config.GUIFRAME_WIDTH 158 GUIFRAME_HEIGHT = config.GUIFRAME_HEIGHT 159 CONTROL_WIDTH = -1 160 CONTROL_HEIGHT = -1 161 DEFAULT_PERSPECTIVE = None 162 CLEANUP_PLOT = False 169 163 DEFAULT_OPEN_FOLDER = PATH_APP 170 except AttributeError: 171 DATALOADER_SHOW = True 172 TOOLBAR_SHOW = True 173 FIXED_PANEL = True 174 WELCOME_PANEL_SHOW = False 175 PLOPANEL_WIDTH = config.PLOPANEL_WIDTH 176 DATAPANEL_WIDTH = config.DATAPANEL_WIDTH 177 GUIFRAME_WIDTH = config.GUIFRAME_WIDTH 178 GUIFRAME_HEIGHT = config.GUIFRAME_HEIGHT 179 CONTROL_WIDTH = -1 180 CONTROL_HEIGHT = -1 181 DEFAULT_PERSPECTIVE = None 182 CLEANUP_PLOT = False 183 DEFAULT_OPEN_FOLDER = PATH_APP 184 185 #DEFAULT_STYLE = config.DEFAULT_STYLE 186 187 PLUGIN_STATE_EXTENSIONS = config.PLUGIN_STATE_EXTENSIONS 188 OPEN_SAVE_MENU = config.OPEN_SAVE_PROJECT_MENU 189 VIEW_MENU = config.VIEW_MENU 190 EDIT_MENU = config.EDIT_MENU 191 extension_list = [] 192 if APPLICATION_STATE_EXTENSION is not None: 193 extension_list.append(APPLICATION_STATE_EXTENSION) 194 EXTENSIONS = PLUGIN_STATE_EXTENSIONS + extension_list 195 try: 196 PLUGINS_WLIST = '|'.join(config.PLUGINS_WLIST) 197 except AttributeError: 198 PLUGINS_WLIST = '' 199 APPLICATION_WLIST = config.APPLICATION_WLIST 200 IS_WIN = True 201 IS_LINUX = False 202 CLOSE_SHOW = True 203 TIME_FACTOR = 2 204 NOT_SO_GRAPH_LIST = ["BoxSum"] 164 165 #DEFAULT_STYLE = config.DEFAULT_STYLE 166 167 PLUGIN_STATE_EXTENSIONS = config.PLUGIN_STATE_EXTENSIONS 168 OPEN_SAVE_MENU = config.OPEN_SAVE_PROJECT_MENU 169 VIEW_MENU = config.VIEW_MENU 170 EDIT_MENU = config.EDIT_MENU 171 extension_list = [] 172 if APPLICATION_STATE_EXTENSION is not None: 173 extension_list.append(APPLICATION_STATE_EXTENSION) 174 EXTENSIONS = PLUGIN_STATE_EXTENSIONS + extension_list 175 try: 176 PLUGINS_WLIST = '|'.join(config.PLUGINS_WLIST) 177 except AttributeError: 178 PLUGINS_WLIST = '' 179 APPLICATION_WLIST = config.APPLICATION_WLIST 180 IS_WIN = True 181 IS_LINUX = False 182 CLOSE_SHOW = True 183 TIME_FACTOR = 2 184 NOT_SO_GRAPH_LIST = ["BoxSum"] 205 185 206 186 class Communicate(QtCore.QObject): -
src/sas/qtgui/Utilities/IPythonWidget.py
r985ad94 rfef38e8 1 from PyQt4 import QtCore, QtGui, QtSvg 2 1 3 def new_load_qt(api_options): 2 from PyQt4 import QtCore, QtGui, QtSvg3 4 return QtCore, QtGui, QtSvg, 'pyqt' 4 5 5 6 def qtconsole_new_load_qt(api_options): 6 from PyQt4 import QtCore, QtGui, QtSvg7 8 7 # Alias PyQt-specific functions for PySide compatibility. 9 8 QtCore.Signal = QtCore.pyqtSignal … … 11 10 return QtCore, QtGui, QtSvg, 'pyqt' 12 11 12 from IPython.external import qt_loaders 13 from qtconsole import qt_loaders as qtconsole_qt_loaders 13 14 # Do some monkey patching to satisfy pyinstaller complaining 14 15 # about pyside/pyqt confusion 15 from IPython.external import qt_loaders16 16 qt_loaders.load_qt = new_load_qt 17 18 from qtconsole import qt_loaders as qtconsole_qt_loaders19 17 qtconsole_qt_loaders.load_qt = qtconsole_new_load_qt 20 18 21 22 19 from qtconsole.rich_jupyter_widget import RichJupyterWidget 23 from qtconsole.inprocess import QtInProcessKernelManager24 from IPython.lib import guisupport25 20 26 21 MODULES_TO_IMPORT = [ … … 32 27 def __init__(self, parent=None, **kwargs): 33 28 super(self.__class__, self).__init__(parent) 29 from qtconsole.inprocess import QtInProcessKernelManager 30 from IPython.lib import guisupport 34 31 app = guisupport.get_app_qt4() 35 32 36 # Create an in-process kernel33 # Create an in-process kernel 37 34 kernel_manager = QtInProcessKernelManager() 38 35 kernel_manager.start_kernel()
Note: See TracChangeset
for help on using the changeset viewer.