/
mainwindow.py
53 lines (45 loc) · 1.6 KB
/
mainwindow.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import sys
#sys.path.append("")
from PySide import QtCore, QtGui
import FreeCAD, FreeCADGui
from ui_mainwindow import Ui_MainWindow
class MainWindow(QtGui.QMainWindow):
def __init__(self, parent = None):
super(MainWindow, self).__init__(parent)
from PySide import QtNetwork
# Webkit is used to create icons from SVG files. This could cause a deadlock
# when setting up the internally used network interface. Doing this before
# creating the icons fixes the issue.
QtNetwork.QNetworkConfigurationManager()
def showEvent(self, event):
FreeCADGui.showMainWindow()
self.setCentralWidget(FreeCADGui.getMainWindow())
# Need version >= 0.16.5949
class BlankWorkbench(FreeCADGui.Workbench):
MenuText = "Blank"
ToolTip = "Blank workbench"
def Initialize(self):
return
def GetClassName(self):
return "Gui::BlankWorkbench"
FreeCADGui.addWorkbench(BlankWorkbench)
FreeCADGui.activateWorkbench("BlankWorkbench")
@QtCore.Slot()
def on_actionEmbed_triggered(self):
return
@QtCore.Slot()
def on_actionDocument_triggered(self):
FreeCAD.newDocument()
@QtCore.Slot()
def on_actionCube_triggered(self):
FreeCAD.ActiveDocument.addObject("Part::Box")
FreeCAD.ActiveDocument.recompute()
FreeCADGui.ActiveDocument.ActiveView.fitAll()
app=QtGui.QApplication(sys.argv)
ui=Ui_MainWindow()
mw=MainWindow()
ui.setupUi(mw)
ui.actionEmbed.setVisible(False)
mw.resize(1200,800)
mw.show()
app.exec_()