示例#1
0
 def __init__(self, *args):
     apply(QtGui.QMainWindow.__init__,(self,)+args)
     self.canva = qtViewer3d(self)
     self.setWindowTitle("pythonOCC-%s 3d viewer ('qt' backend)"%VERSION)
     self.resize(1024,768)
     self.setCentralWidget(self.canva)
     self.menuBar = self.menuBar()
     self._menus = {}
     self._menu_methods = {}
示例#2
0
 def __init__(self, *args):
     apply(QtGui.QMainWindow.__init__, (self, ) + args)
     self.canva = qtViewer3d(self)
     self.setWindowTitle("pythonOCC-%s 3d viewer ('qt' backend)" %
                         VERSION)
     self.resize(1024, 768)
     self.setCentralWidget(self.canva)
     self.menuBar = self.menuBar()
     self._menus = {}
     self._menu_methods = {}
示例#3
0
 def __init__(self, *args):
     apply(QtGui.QMainWindow.__init__, (self,)+args)
     self.canva = qtViewer3d(self)
     self.setWindowTitle("pythonOCC-%s 3d viewer ('qt' backend)" % VERSION)
     self.resize(1024, 768)
     self.setCentralWidget(self.canva)
     if not sys.platform == 'darwin':
         self.menu_bar = self.menuBar()
     else:
         # create a parentless menubar
         # see: http://stackoverflow.com/questions/11375176/qmenubar-and-qmenu-doesnt-show-in-mac-os-x?lq=1
         # noticeable is that the menu ( alas ) is created in the topleft of the screen, just
         # next to the apple icon
         # still does ugly things like showing the "Python" menu in bold
         self.menu_bar = QtGui.QMenuBar()
     self._menus = {}
     self._menu_methods = {}
     # place the window in the center of the screen, at half the screen size
     self.centerOnScreen()
示例#4
0
 def __init__(self, *args):
     apply(QtGui.QMainWindow.__init__, (self, ) + args)
     self.canva = qtViewer3d(self)
     self.setWindowTitle("pythonOCC-%s 3d viewer ('qt' backend)" %
                         VERSION)
     self.resize(1024, 768)
     self.setCentralWidget(self.canva)
     if not sys.platform == 'darwin':
         self.menu_bar = self.menuBar()
     else:
         # create a parentless menubar
         # see: http://stackoverflow.com/questions/11375176/qmenubar-and-qmenu-doesnt-show-in-mac-os-x?lq=1
         # noticeable is that the menu ( alas ) is created in the topleft of the screen, just
         # next to the apple icon
         # still does ugly things like showing the "Python" menu in bold
         self.menu_bar = QtGui.QMenuBar()
     self._menus = {}
     self._menu_methods = {}
     # place the window in the center of the screen, at half the screen size
     self.centerOnScreen()
 def __init__(self, *args):
     QtWidgets.QMainWindow.__init__(self, *args)
     self.canva = qtViewer3d(self)
     self.setWindowTitle("666666")
     self.setCentralWidget(self.canva)
     if sys.platform != 'darwin':
         self.menu_bar = self.menuBar()
     else:
         # create a parentless menubar
         # see: http://stackoverflow.com/questions/11375176/qmenubar-and-qmenu-doesnt-show-in-mac-os-x?lq=1
         # noticeable is that the menu ( alas ) is created in the
         # topleft of the screen, just
         # next to the apple icon
         # still does ugly things like showing the "Python" menu in
         # bold
         self.menu_bar = QtWidgets.QMenuBar()
     self._menus = {}
     self._menu_methods = {}
     # place the window in the center of the screen, at half the
     # screen size
     self.centerOnScreen()
    def __init__(self, *args):
        ''' 初始化界面 '''
        # 中心控件
        # 中心控件
        QMainWindow.__init__(self, *args)
        layout = QHBoxLayout()  # 水平布局
        self.canva = qtViewer3d(self)
        # 显示设置
        self.canva.InitDriver()  # canva的驱动,设置驱动后,才能成功display
        display = self.canva._display
        display.set_bg_gradient_color([206, 215, 222],
                                      [128, 128, 128])  # 设置背景渐变色
        display.display_triedron = True  # display black trihedron
        self.setWindowTitle("Aim")
        # self.setWindowIcon(QIcon('./icons/aim.png'))        #设置程序图标
        self.setCentralWidget(self.canva)
        self.resize(1024, 768)
        self.centerOnScreen()

        # 容器控件
        # 容器控件
        self.items = QDockWidget('功能区', self)
        self.listWidget = QListWidget()
        self.listWidget.addItem('item1')
        self.listWidget.addItem('item2')
        self.listWidget.addItem('item3')
        self.items.setWidget(self.listWidget)
        self.items.setFloating(False)
        print(())
        print(type(QtCore.Qt.RightDockWidgetArea))
        print(type(self.items))

        self.addDockWidget(QtCore.Qt.RightDockWidgetArea, self.items)

        # #### 菜单栏
        # #### 菜单栏

        menubar = self.menuBar()
        # 第一个菜单栏‘打开文件’
        file = menubar.addMenu('&打开文件')
        file.addAction('模型导入')
        file.addAction('打开表格文件')
        file.addAction('打开图片')

        # #### 工具栏

        #工具一:打开文件
        exitAction = QAction(QIcon('./icons/open.gif'), '打开文件', self)
        exitAction.setShortcut('Ctrl+Q')
        exitAction.triggered.connect(QFileDialog.getOpenFileName)
        self.toolbar = self.addToolBar('Exit')
        self.toolbar.addAction(exitAction)

        # #### label标签
        label = QLabel(self)
        label.move(900, 0)
        label.setText(
            "<a href='https://blog.csdn.net/weixin_42755384/article/details/87893697'>PythonOCC帮助</a>"
        )
        label.setOpenExternalLinks(True)
        self.setLayout(layout)
        # 临时读入一个文件
        P0 = gp_Pnt(0, 0, 1)
        P1 = gp_Pnt(0, 30, 20)
        display.DisplayShape(P0)
        display.DisplayShape(P1)