Reverted old change where library loading was moved to InitGui.py.

This commit is contained in:
Jeremy Mack Wright 2018-06-02 01:26:09 -04:00
parent 2adf43fbf4
commit c7850e3f97
4 changed files with 42 additions and 39 deletions

34
Init.py
View File

@ -1,2 +1,36 @@
"""FreeCAD init script of the CadQuery module""" """FreeCAD init script of the CadQuery module"""
# (c) 2014-2018 Jeremy Wright Apache 2.0 License # (c) 2014-2018 Jeremy Wright Apache 2.0 License
import os
import sys
try:
from . import module_locator
except:
import module_locator
# Set up so that we can import from our embedded packages
module_base_path = module_locator.module_path()
libs_dir_path = os.path.join(module_base_path, 'Libs')
sys.path.insert(0, libs_dir_path)
# Tack on our CadQuery library git subtree
cq_lib_path = os.path.join(libs_dir_path, 'cadquery')
sys.path.insert(1, cq_lib_path)
# Add our third party libraries so that they can be used in scripts
third_party_path = os.path.join(module_base_path, 'ThirdParty')
sys.path.append(third_party_path)
# Make sure we get the right libs under the FreeCAD installation
fc_base_path = os.path.dirname(os.path.dirname(module_base_path))
fc_lib_path = os.path.join(fc_base_path, 'lib')
fc_bin_path = os.path.join(fc_base_path, 'bin')
# Make sure that the directories exist before we add them to sys.path
# This could cause problems or solve them by overriding what CQ is setting for the paths
if os.path.exists(fc_lib_path):
sys.path.insert(1, fc_lib_path)
if os.path.exists(fc_bin_path):
sys.path.insert(1, fc_bin_path)
# Need to set this for PyQode
os.environ['QT_API'] = 'pyside'

View File

@ -1,6 +1,6 @@
"""CadQuery GUI init module for FreeCAD """CadQuery GUI init module for FreeCAD
This adds a workbench with a scripting editor to FreeCAD's GUI.""" This adds a workbench with a scripting editor to FreeCAD's GUI."""
# (c) 2014-2016 Jeremy Wright Apache 2.0 License # (c) 2014-2018 Jeremy Wright Apache 2.0 License
import FreeCAD, FreeCADGui import FreeCAD, FreeCADGui
try: try:
from CadQuery.CQGui.Command import * from CadQuery.CQGui.Command import *
@ -8,41 +8,6 @@ except:
from CQGui.Command import * from CQGui.Command import *
import CadQuery_rc import CadQuery_rc
import os
import sys
try:
from . import module_locator
except:
import module_locator
# Set up so that we can import from our embedded packages
module_base_path = module_locator.module_path()
libs_dir_path = os.path.join(module_base_path, 'Libs')
sys.path.insert(0, libs_dir_path)
# Tack on our CadQuery library git subtree
cq_lib_path = os.path.join(libs_dir_path, 'cadquery')
sys.path.insert(1, cq_lib_path)
# Add our third party libraries so that they can be used in scripts
third_party_path = os.path.join(module_base_path, 'ThirdParty')
sys.path.append(third_party_path)
# Make sure we get the right libs under the FreeCAD installation
fc_base_path = os.path.dirname(os.path.dirname(module_base_path))
fc_lib_path = os.path.join(fc_base_path, 'lib')
fc_bin_path = os.path.join(fc_base_path, 'bin')
# Make sure that the directories exist before we add them to sys.path
# This could cause problems or solve them by overriding what CQ is setting for the paths
if os.path.exists(fc_lib_path):
sys.path.insert(1, fc_lib_path)
if os.path.exists(fc_bin_path):
sys.path.insert(1, fc_bin_path)
# Need to set this for PyQode
os.environ['QT_API'] = 'pyside'
class CadQueryWorkbench (Workbench): class CadQueryWorkbench (Workbench):
"""CadQuery workbench for FreeCAD""" """CadQuery workbench for FreeCAD"""
"""CadQuery workbench for FreeCAD""" """CadQuery workbench for FreeCAD"""

View File

@ -12,9 +12,9 @@ RUN apt-get update --fix-missing && apt-get install -y wget bzip2 ca-certificate
git mercurial subversion git mercurial subversion
RUN echo 'export PATH=/opt/conda/bin:$PATH' > /etc/profile.d/conda.sh && \ RUN echo 'export PATH=/opt/conda/bin:$PATH' > /etc/profile.d/conda.sh && \
wget --quiet https://repo.continuum.io/archive/Anaconda2-5.0.0-Linux-x86_64.sh -O ~/anaconda.sh && \ wget --quiet https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh -O ~/miniconda.sh && \
/bin/bash ~/anaconda.sh -b -p /opt/conda && \ /bin/bash ~/miniconda.sh -b -p /opt/conda && \
rm ~/anaconda.sh rm ~/miniconda.sh
RUN apt-get install -y curl grep sed dpkg && \ RUN apt-get install -y curl grep sed dpkg && \
TINI_VERSION=`curl https://github.com/krallin/tini/releases/latest | grep -o "/v.*\"" | sed 's:^..\(.*\).$:\1:'` && \ TINI_VERSION=`curl https://github.com/krallin/tini/releases/latest | grep -o "/v.*\"" | sed 's:^..\(.*\).$:\1:'` && \
@ -42,6 +42,10 @@ COPY tests $CQ_HOME/tests
RUN pip install -r /opt/cadquery/requirements-dev.txt RUN pip install -r /opt/cadquery/requirements-dev.txt
RUN cd $CQ_HOME && python ./setup.py install RUN cd $CQ_HOME && python ./setup.py install
RUN pip install cqparts
RUN pip install cqparts-bearings
RUN pip install cqparts-fasteners
RUN pip install cqparts-misc
RUN chmod +x $CQ_HOME/cq_cmd.sh RUN chmod +x $CQ_HOME/cq_cmd.sh
RUN useradd -ms /bin/bash cq RUN useradd -ms /bin/bash cq
USER cq USER cq

0
Libs/cadquery/build_docker.sh Normal file → Executable file
View File