当前位置: 首页>>代码示例>>Python>>正文


Python FreeCADGui.getMainWindow方法代码示例

本文整理汇总了Python中FreeCADGui.getMainWindow方法的典型用法代码示例。如果您正苦于以下问题:Python FreeCADGui.getMainWindow方法的具体用法?Python FreeCADGui.getMainWindow怎么用?Python FreeCADGui.getMainWindow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FreeCADGui的用法示例。


在下文中一共展示了FreeCADGui.getMainWindow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setEdit

# 需要导入模块: import FreeCADGui [as 别名]
# 或者: from FreeCADGui import getMainWindow [as 别名]
def setEdit(self):
        """ViewProvider setEdit example"""
        self.ed = VPEditor()
        self.group1 = self.ed.add_layout("Face 1")
        proped_11 = VectorListWidget() # PropEditor() #self.Object,"ScaleList1")
        proped_12 = VectorListWidget() #self.Object,"Continuity1")
        #proped_11.fillTable(((0.0,1.0),(0.4,1.5),(1.0,0.8)))
        proped_12.fillTable()
        self.ed.add_propeditor(proped_11, self.group1)
        #ed.add_propeditor(proped_12, self.group1)
        self.group2 = self.ed.add_layout("Face 2")
        proped_21 = VectorListWidget() #self.Object,"ScaleList2")
        #proped_22 = VectorListWidget() #self.Object,"Continuity2")
        self.ed.add_propeditor(proped_21, self.group2)
        #ed.add_propeditor(proped_22, self.group2)
        self.ed.add_close_button()

        self.mw = FreeCADGui.getMainWindow()
        self.ed.comboview = getComboView(self.mw)
        self.ed.tabIndex = self.ed.comboview.addTab(self.ed.widget,"Table")
        self.ed.comboview.setCurrentIndex(self.ed.tabIndex)
        self.ed.widget.show() 
开发者ID:tomate44,项目名称:CurvesWB,代码行数:24,代码来源:property_editor.py

示例2: setEdit

# 需要导入模块: import FreeCADGui [as 别名]
# 或者: from FreeCADGui import getMainWindow [as 别名]
def setEdit(self,vobj,mode=0):
        if mode == 0:
            debug("Start Edit")
            self.ed = property_editor.VPEditor()
            self.group1 = self.ed.add_layout("Face 1")
            proped_11 = property_editor.VectorListWidget(self.Object,"ScaleList1")
            #proped_12 = property_editor.VectorListWidget() #self.Object,"Continuity1")
            #proped_11.fillTable(((0.0,1.0),(0.4,1.5),(1.0,0.8)))
            #proped_12.fillTable()
            self.ed.add_propeditor(proped_11, self.group1)
            #ed.add_propeditor(proped_12, self.group1)
            self.group2 = self.ed.add_layout("Face 2")
            proped_21 = property_editor.VectorListWidget(self.Object,"ScaleList2")
            #proped_22 = VectorListWidget() #self.Object,"Continuity2")
            self.ed.add_propeditor(proped_21, self.group2)
            #ed.add_propeditor(proped_22, self.group2)
            self.ed.add_close_button()

            self.mw = FreeCADGui.getMainWindow()
            self.ed.comboview = property_editor.getComboView(self.mw)
            self.ed.tabIndex = self.ed.comboview.addTab(self.ed.widget,"Table")
            self.ed.comboview.setCurrentIndex(self.ed.tabIndex)
            self.ed.widget.show()
            return True
        return False 
开发者ID:tomate44,项目名称:CurvesWB,代码行数:27,代码来源:blendSurfaceFP.py

示例3: getMoveDistToStoredPosition

# 需要导入模块: import FreeCADGui [as 别名]
# 或者: from FreeCADGui import getMainWindow [as 别名]
def getMoveDistToStoredPosition(widg):
    if CONSTRAINT_DIALOG_STORED_POSITION == QtCore.QPoint(-1,-1):
        mw = FreeCADGui.getMainWindow()
        fcFrame = QtGui.QDesktopWidget.geometry(mw)
        x = fcFrame.x()
        y = fcFrame.y()
        width = fcFrame.width()
        height = fcFrame.height()

        centerX = x + width/2
        centerY = y + height/2
        fcCenter = QtCore.QPoint(centerX,centerY)

        return fcCenter- widg.rect().center()
    else:
        widgetFrame = widg.frameGeometry()
        x = widgetFrame.x()
        y = widgetFrame.y()
        widgetCorner = QtCore.QPoint(x,y)

        return CONSTRAINT_DIALOG_STORED_POSITION - widgetCorner
#============================================================================== 
开发者ID:kbwbe,项目名称:A2plus,代码行数:24,代码来源:a2p_constraintDialog.py

示例4: __init__

# 需要导入模块: import FreeCADGui [as 别名]
# 或者: from FreeCADGui import getMainWindow [as 别名]
def __init__(self):
        super(a2p_ConstraintPanel,self).__init__()
        self.resize(200,250)
        cc = a2p_ConstraintCollection(None)
        self.setWidget(cc)
        self.setWindowTitle("Constraint Tools")
        #
        mw = FreeCADGui.getMainWindow()
        mw.addDockWidget(QtCore.Qt.RightDockWidgetArea,self)
        #
        self.setFloating(True)
        self.activateWindow()
        self.setAllowedAreas(QtCore.Qt.NoDockWidgetArea)
        self.move(getMoveDistToStoredPosition(self))

        a2plib.setConstraintDialogRef(self)
        #
        self.timer = QtCore.QTimer()
        QtCore.QObject.connect(self.timer, QtCore.SIGNAL("timeout()"), self.onTimer)
        self.timer.start(100) 
开发者ID:kbwbe,项目名称:A2plus,代码行数:22,代码来源:a2p_constraintDialog.py

示例5: Activated

# 需要导入模块: import FreeCADGui [as 别名]
# 或者: from FreeCADGui import getMainWindow [as 别名]
def Activated(self):
        # So we can open the "Open File" dialog
        mw = FreeCADGui.getMainWindow()

        # Try to keep track of the previous path used to open as a convenience to the user
        if self.previousPath is None:
            # Start off defaulting to the Examples directory
            module_base_path = module_locator.module_path()
            exs_dir_path = os.path.join(module_base_path, 'Libs/cadquery/examples/FreeCAD')

            self.previousPath = exs_dir_path

        filename = QtGui.QFileDialog.getOpenFileName(mw, mw.tr("Open CadQuery Script"), self.previousPath,
                                                     mw.tr("CadQuery Files (*.py)"))

        # Make sure the user didn't click cancel
        if filename[0]:
            self.previousPath = filename[0]

            # Append this script's directory to sys.path
            sys.path.append(os.path.dirname(filename[0]))

            # We've created a library that FreeCAD can use as well to open CQ files
            ImportCQ.open(filename[0]) 
开发者ID:jmwright,项目名称:cadquery-freecad-module,代码行数:26,代码来源:Command.py

示例6: clearActiveDocument

# 需要导入模块: import FreeCADGui [as 别名]
# 或者: from FreeCADGui import getMainWindow [as 别名]
def clearActiveDocument():
    """Clears the currently active 3D view so that we can re-render"""

    # Grab our code editor so we can interact with it
    mw = FreeCADGui.getMainWindow()
    mdi = mw.findChild(QtGui.QMdiArea)
    currentWin = mdi.currentSubWindow()
    if currentWin == None:
        return
    winName = currentWin.windowTitle().split(" ")[0].split('.')[0]

    # Translate dashes so that they can be safetly used since theyare common
    if '-' in winName:
        winName= winName.replace('-', "__")

    try:
        doc = FreeCAD.getDocument(winName)

        # Make sure we have an active document to work with
        if doc is not None:
            for obj in doc.Objects:
                doc.removeObject(obj.Name)
    except:
        pass 
开发者ID:jmwright,项目名称:cadquery-freecad-module,代码行数:26,代码来源:Shared.py

示例7: closeActiveCodeWindow

# 需要导入模块: import FreeCADGui [as 别名]
# 或者: from FreeCADGui import getMainWindow [as 别名]
def closeActiveCodeWindow():
    mw = FreeCADGui.getMainWindow()
    mdi = mw.findChild(QtGui.QMdiArea)

    # We cannot trust the current subwindow to be a script window, it may be the associated 3D view
    mdiWin = mdi.currentSubWindow()

    # We have a 3D view selected so we need to find the corresponding script window
    if mdiWin == 0 or ".py" not in mdiWin.windowTitle():
        subList = mdi.subWindowList()

        for sub in subList:
            if sub.windowTitle() == mdiWin.windowTitle().split(" ")[0] + ".py":
                sub.close()
                return

    mdiWin.close() 
开发者ID:jmwright,项目名称:cadquery-freecad-module,代码行数:19,代码来源:Shared.py

示例8: restore_Main_Tools

# 需要导入模块: import FreeCADGui [as 别名]
# 或者: from FreeCADGui import getMainWindow [as 别名]
def restore_Main_Tools():

    #Getting the main window will allow us to start setting things up the way we want
    mw = FreeCADGui.getMainWindow()

    #Adjust the docks as usual
    dockWidgets = mw.findChildren(QtGui.QDockWidget)
    for widget in dockWidgets:
        if (widget.objectName() == "Report view") or (widget.objectName() == "Python console") or (widget.objectName() == "Combo View"):
            widget.setVisible(True)
        if (widget.objectName()=="cqCodeView"):
            widget.setVisible(False)

    return 0


###################################################################
# z_RotateObject()  maui
#   Function to z-rotate an object
#
################################################################### 
开发者ID:easyw,项目名称:kicad-3d-models-in-freecad,代码行数:23,代码来源:cq_cad_tools.py

示例9: toggleToolbars

# 需要导入模块: import FreeCADGui [as 别名]
# 或者: from FreeCADGui import getMainWindow [as 别名]
def toggleToolbars(mcs):
        hgrp = mcs.getToolbarParams()
        show = False
        for toolbar in mcs._HiddenToolbars:
            if not hgrp.GetBool(toolbar,True):
                show = True
                break
        mw = FreeCADGui.getMainWindow()
        for toolbar in mcs._HiddenToolbars:
            if show != hgrp.GetBool(toolbar,True):
                hgrp.SetBool(toolbar,show)
                tb = mw.findChild(QtGui.QToolBar,toolbar)
                if not tb:
                    logger.error('cannot find toolbar "{}"',toolbar)
                tb.setVisible(show) 
开发者ID:realthunder,项目名称:FreeCAD_assembly3,代码行数:17,代码来源:gui.py

示例10: getMainWindow

# 需要导入模块: import FreeCADGui [as 别名]
# 或者: from FreeCADGui import getMainWindow [as 别名]
def getMainWindow():
   "returns the main window"
   # using QtGui.qApp.activeWindow() isn't very reliable because if another
   # widget than the mainwindow is active (e.g. a dialog) the wrong widget is
   # returned
   toplevel = QtGui.qApp.topLevelWidgets()
   for i in toplevel:
       if i.metaObject().className() == "Gui::MainWindow":
           return i
   raise Exception("No main window found") 
开发者ID:tomate44,项目名称:CurvesWB,代码行数:12,代码来源:sublink_edit.py

示例11: __init__

# 需要导入模块: import FreeCADGui [as 别名]
# 或者: from FreeCADGui import getMainWindow [as 别名]
def __init__(self, obj):
        self.obj = obj
        self.main_win = FreeCADGui.getMainWindow()
        self.widget = QtGui.QDockWidget()
        self.widget.ui = myWidget_Ui(obj)
        self.widget.ui.setupUi(self.widget)
        
        self.widget.ui.pushButton_7.clicked.connect(self.accept)
        
        self.main_win.addDockWidget(QtCore.Qt.RightDockWidgetArea,self.widget)
        self.widget.setFloating(True)
        
        self.initial_visibility = self.obj.ViewObject.Visibility
        self.obj.ViewObject.Visibility = False 
开发者ID:tomate44,项目名称:CurvesWB,代码行数:16,代码来源:sublink_edit.py

示例12: getMainWindow

# 需要导入模块: import FreeCADGui [as 别名]
# 或者: from FreeCADGui import getMainWindow [as 别名]
def getMainWindow():
   "returns the main window"
   # using QtGui.qApp.activeWindow() isn't very reliable because if another
   # widget than the mainwindow is active (e.g. a dialog) the wrong widget is
   # returned
   return(FreeCADGui.getMainWindow())
   toplevel = QtGui.qApp.topLevelWidgets()
   for i in toplevel:
       if i.metaObject().className() == "Gui::MainWindow":
           return i
   raise Exception("No main window found") 
开发者ID:tomate44,项目名称:CurvesWB,代码行数:13,代码来源:ZebraTool.py

示例13: do

# 需要导入模块: import FreeCADGui [as 别名]
# 或者: from FreeCADGui import getMainWindow [as 别名]
def do(self):
        mw=FreeCADGui.getMainWindow()
        mw.hide()
        mw.show() 
开发者ID:microelly2,项目名称:NodeEditor,代码行数:6,代码来源:ComputeTool.py

示例14: run_shelfToy

# 需要导入模块: import FreeCADGui [as 别名]
# 或者: from FreeCADGui import getMainWindow [as 别名]
def run_shelfToy(self):
    '''the implementation of the toy shelf tool'''
    
    nodes=FreeCAD.PF.graphManager.get().getAllNodes()
    nodes2 = sorted(nodes, key=lambda node: node.x)
    say("selected Nodes ...")
    for n in nodes2:
     if n.getWrapper().isSelected():
        say(n,n.x)

    mw=FreeCADGui.getMainWindow()
    say(mw)
    mw.hide()
    mw.show()
    say("!no action") 
开发者ID:microelly2,项目名称:NodeEditor,代码行数:17,代码来源:dev.py

示例15: clearReportView

# 需要导入模块: import FreeCADGui [as 别名]
# 或者: from FreeCADGui import getMainWindow [as 别名]
def clearReportView(name="noname"):
    from PySide import QtGui
    mw=FreeCADGui.getMainWindow()
    r=mw.findChild(QtGui.QTextEdit, "Report view")
    r.clear()
    import time
    now = time.ctime(int(time.time()))
    #FreeCAD.Console.PrintWarning("Cleared Report view " +str(now)+" by " + name+"\n") 
开发者ID:microelly2,项目名称:NodeEditor,代码行数:10,代码来源:Commands.py


注:本文中的FreeCADGui.getMainWindow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。