Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set SAS_DLL_PATH on sasview startup #1568

Merged
merged 1 commit into from
Jun 1, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/sas/qtgui/MainWindow/MainWindow.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# UNLESS EXEPTIONALLY REQUIRED TRY TO AVOID IMPORTING ANY MODULES HERE
# ESPECIALLY ANYTHING IN SAS, SASMODELS NAMESPACE
import os
import sys

from PyQt5.QtWidgets import QMainWindow
from PyQt5.QtWidgets import QMdiArea
from PyQt5.QtWidgets import QSplashScreen
from PyQt5.QtWidgets import QApplication
from PyQt5.QtGui import QPixmap
from PyQt5.QtCore import Qt
import os
import sys

# Local UI
from sas.qtgui.UI import main_resources_rc
from .UI.MainWindowUI import Ui_SasView
Expand Down Expand Up @@ -61,8 +63,11 @@ def run_sasview():
from sas.logger_config import SetupLogger
SetupLogger(__name__).config_development()

# initialize OpenCL setting
from sas import get_custom_config
# initialize sasmodels settings
from sas import get_custom_config, get_user_dir
if "SAS_DLL_PATH" not in os.environ:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to add SAS_DLL_PATH to the custom config file, like SAS_OPENCL does below?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not really an option that the user needs to change, and there is no support for changing it in the gui, so no need to have it in the user config file.

os.environ["SAS_DLL_PATH"] = os.path.join(
get_user_dir(), "compiled_models")
SAS_OPENCL = get_custom_config().SAS_OPENCL
if SAS_OPENCL and "SAS_OPENCL" not in os.environ:
os.environ["SAS_OPENCL"] = SAS_OPENCL
Expand All @@ -79,7 +84,6 @@ def run_sasview():
#app.setStyle('Fusion')

# fix for pyinstaller packages app to avoid ReactorAlreadyInstalledError
import sys
if 'twisted.internet.reactor' in sys.modules:
del sys.modules['twisted.internet.reactor']

Expand Down