- added a new Tcl Command named SetPath which will set a path to be used by the Tcl commands. Once set will serve as a fallback path in case that the files fail to be opened first time. It will be persistent, saved in preferences. - added the GUI for the new Open Example in the FIle -> Scripting menu. - I am modifying all the open ... handlers to add a parameter that will flag if the method was launched from Tcl Shell. This way if the method will fail to open the filename (which include the path) it will try to open from a set fallback path. - fixed issue #406, bug introduced recently (leftover changes). - modified the ImportSVG Tcl command name to OpenSVG (open_svg alias) - added a new Tcl command named OpenDXF (open_dxf alias) - fixed some errors in Scripting features - added a new Tcl command named GetPath as a convenient way to get the current default path stored in App.defaults['global_tcl_path']
90 lines
2.8 KiB
Python
90 lines
2.8 KiB
Python
import sys
|
|
import os
|
|
|
|
from PyQt5 import QtWidgets
|
|
from PyQt5.QtCore import QSettings, Qt
|
|
from FlatCAMApp import App
|
|
from flatcamGUI import VisPyPatches
|
|
|
|
from multiprocessing import freeze_support
|
|
# import copyreg
|
|
# import types
|
|
|
|
if sys.platform == "win32":
|
|
# cx_freeze 'module win32' workaround
|
|
pass
|
|
|
|
MIN_VERSION_MAJOR = 3
|
|
MIN_VERSION_MINOR = 5
|
|
|
|
def debug_trace():
|
|
"""
|
|
Set a tracepoint in the Python debugger that works with Qt
|
|
:return: None
|
|
"""
|
|
from PyQt5.QtCore import pyqtRemoveInputHook
|
|
# from pdb import set_trace
|
|
pyqtRemoveInputHook()
|
|
# set_trace()
|
|
|
|
|
|
if __name__ == '__main__':
|
|
# All X11 calling should be thread safe otherwise we have strange issues
|
|
# QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_X11InitThreads)
|
|
# NOTE: Never talk to the GUI from threads! This is why I commented the above.
|
|
freeze_support()
|
|
|
|
major_v = sys.version_info.major
|
|
minor_v = sys.version_info.minor
|
|
# Supported Python version is >= 3.5
|
|
if major_v >= MIN_VERSION_MAJOR:
|
|
if minor_v >= MIN_VERSION_MINOR:
|
|
pass
|
|
else:
|
|
print("FlatCAM BETA uses PYTHON 3 or later. The version minimum is %s.%s\n"
|
|
"Your Python version is: %s.%s" % (MIN_VERSION_MAJOR, MIN_VERSION_MINOR, str(major_v), str(minor_v)))
|
|
os._exit(0)
|
|
else:
|
|
print("FlatCAM BETA uses PYTHON 3 or later. The version minimum is %s.%s\n"
|
|
"Your Python version is: %s.%s" % (MIN_VERSION_MAJOR, MIN_VERSION_MINOR, str(major_v), str(minor_v)))
|
|
os._exit(0)
|
|
|
|
debug_trace()
|
|
VisPyPatches.apply_patches()
|
|
|
|
# apply High DPI support
|
|
settings = QSettings("Open Source", "FlatCAM")
|
|
if settings.contains("hdpi"):
|
|
hdpi_support = settings.value('hdpi', type=int)
|
|
else:
|
|
hdpi_support = 0
|
|
|
|
if hdpi_support == 2:
|
|
os.environ["QT_AUTO_SCREEN_SCALE_FACTOR"] = "1"
|
|
else:
|
|
os.environ["QT_AUTO_SCREEN_SCALE_FACTOR"] = "0"
|
|
|
|
# if hdpi_support == 2:
|
|
# tst_screen = QtWidgets.QApplication(sys.argv)
|
|
# if tst_screen.screens()[0].geometry().width() > 1930 or tst_screen.screens()[1].geometry().width() > 1930:
|
|
# QGuiApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True)
|
|
# del tst_screen
|
|
# else:
|
|
# QGuiApplication.setAttribute(Qt.AA_EnableHighDpiScaling, False)
|
|
|
|
if hdpi_support == 2:
|
|
QtWidgets.QApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True)
|
|
else:
|
|
QtWidgets.QApplication.setAttribute(Qt.AA_EnableHighDpiScaling, False)
|
|
|
|
app = QtWidgets.QApplication(sys.argv)
|
|
|
|
# apply style
|
|
settings = QSettings("Open Source", "FlatCAM")
|
|
if settings.contains("style"):
|
|
style = settings.value('style', type=str)
|
|
app.setStyle(style)
|
|
|
|
fc = App()
|
|
# sys.exit(app.exec_())
|
|
app.exec_() |