當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。