2019-06-09 14:39:42 +00:00
|
|
|
import sys
|
|
|
|
import os
|
2019-01-03 19:25:08 +00:00
|
|
|
|
2019-09-12 19:21:19 +00:00
|
|
|
from PyQt5 import QtWidgets, QtGui
|
2019-02-18 14:11:24 +00:00
|
|
|
from PyQt5.QtCore import QSettings, Qt
|
2019-01-03 19:25:08 +00:00
|
|
|
from FlatCAMApp import App
|
2019-03-11 10:23:26 +00:00
|
|
|
from flatcamGUI import VisPyPatches
|
2019-01-27 01:32:09 +00:00
|
|
|
|
2019-08-27 00:59:36 +00:00
|
|
|
from multiprocessing import freeze_support
|
2019-09-30 16:10:46 +00:00
|
|
|
# import copyreg
|
|
|
|
# import types
|
2019-08-27 00:59:36 +00:00
|
|
|
|
2019-01-03 19:25:08 +00:00
|
|
|
if sys.platform == "win32":
|
|
|
|
# cx_freeze 'module win32' workaround
|
2019-03-11 10:23:26 +00:00
|
|
|
pass
|
2019-01-03 19:25:08 +00:00
|
|
|
|
2019-06-09 14:39:42 +00:00
|
|
|
|
2019-01-03 19:25:08 +00:00
|
|
|
def debug_trace():
|
|
|
|
"""
|
|
|
|
Set a tracepoint in the Python debugger that works with Qt
|
|
|
|
:return: None
|
|
|
|
"""
|
|
|
|
from PyQt5.QtCore import pyqtRemoveInputHook
|
2019-06-09 14:39:42 +00:00
|
|
|
# from pdb import set_trace
|
2019-01-03 19:25:08 +00:00
|
|
|
pyqtRemoveInputHook()
|
2019-06-09 14:39:42 +00:00
|
|
|
# set_trace()
|
2019-01-03 19:25:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2019-06-09 14:39:42 +00:00
|
|
|
# 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.
|
2019-01-03 19:25:08 +00:00
|
|
|
freeze_support()
|
|
|
|
|
|
|
|
debug_trace()
|
|
|
|
VisPyPatches.apply_patches()
|
|
|
|
|
2019-02-18 14:11:24 +00:00
|
|
|
# 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"
|
|
|
|
|
2019-01-03 19:25:08 +00:00
|
|
|
app = QtWidgets.QApplication(sys.argv)
|
2019-10-08 01:17:08 +00:00
|
|
|
|
2019-02-18 14:11:24 +00:00
|
|
|
# apply style
|
|
|
|
settings = QSettings("Open Source", "FlatCAM")
|
|
|
|
if settings.contains("style"):
|
|
|
|
style = settings.value('style', type=str)
|
|
|
|
app.setStyle(style)
|
|
|
|
|
|
|
|
if hdpi_support == 2:
|
|
|
|
app.setAttribute(Qt.AA_EnableHighDpiScaling, True)
|
|
|
|
else:
|
|
|
|
app.setAttribute(Qt.AA_EnableHighDpiScaling, False)
|
|
|
|
|
2019-01-03 19:25:08 +00:00
|
|
|
fc = App()
|
2019-09-15 10:37:06 +00:00
|
|
|
|
2019-01-03 19:25:08 +00:00
|
|
|
sys.exit(app.exec_())
|