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


Python QtGui.QMdiArea方法代码示例

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


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

示例1: clearActiveDocument

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMdiArea [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

示例2: closeActiveCodeWindow

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMdiArea [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

示例3: setActiveWindowTitle

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMdiArea [as 别名]
def setActiveWindowTitle(title):
    """Sets the title of the currently active MDI window, as long as it is a scripting window"""

    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()

    if mdiWin == 0 or ".py" not in mdiWin.windowTitle():
        subList = mdi.subWindowList()

        for sub in subList:
            if sub.windowTitle() == mdiWin.windowTitle() + ".py":
                mdiWin = sub

    # Change the window title if there is something there to change
    if (mdiWin != 0):
        mdiWin.setWindowTitle(title)

        cqCodePane = mdiWin.findChild(QtGui.QPlainTextEdit)
        cqCodePane.setObjectName("cqCodePane_" + title.split('.')[0]) 
开发者ID:jmwright,项目名称:cadquery-freecad-module,代码行数:24,代码来源:Shared.py

示例4: Activated

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMdiArea [as 别名]
def Activated(self):
        doc = FreeCAD.activeDocument()
        try:
            doc.save()
            FreeCAD.closeDocument(doc.Name)
        except:
            FreeCADGui.SendMsgToActiveView("Save")
            if not FreeCADGui.activeDocument().Modified: # user really saved the file           
                FreeCAD.closeDocument(doc.Name)
        #
        mw = FreeCADGui.getMainWindow()
        mdi = mw.findChild(QtGui.QMdiArea)
        sub = mdi.activeSubWindow()
        if sub != None:
            sub.showMaximized() 
开发者ID:kbwbe,项目名称:A2plus,代码行数:17,代码来源:a2p_importpart.py

示例5: __init__

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMdiArea [as 别名]
def __init__(self):
            super(type(self), self).__init__()
            self.mdiarea = QtGui.QMdiArea()
            self.mdiarea.setSizePolicy(QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding);
            self.setCentralWidget(self.mdiarea) 
开发者ID:mwisslead,项目名称:vfp2py,代码行数:7,代码来源:vfpfunc.py

示例6: getActiveCodePane

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMdiArea [as 别名]
def getActiveCodePane():
    """Gets the currently active code pane, even if its 3D view is selected."""

    # Grab our code editor so we can interact with it
    mw = FreeCADGui.getMainWindow()
    mdi = mw.findChild(QtGui.QMdiArea)

    # If our current subwindow doesn't contain a script, we need to find the one that does
    mdiWin = mdi.currentSubWindow()
    if mdiWin == None: return None # We need to warn the caller that there is no code pane

    windowTitle = mdiWin.windowTitle()

    if mdiWin == 0 or ".py" not in mdiWin.windowTitle():
        if '__' in mdiWin.windowTitle():
            windowTitle = mdiWin.windowTitle().replace("__", '-')

        subList = mdi.subWindowList()

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

    winName = mdiWin.windowTitle().split('.')[0]
    cqCodePane = mw.findChild(QtGui.QPlainTextEdit, "cqCodePane_" + winName)

    return cqCodePane 
开发者ID:jmwright,项目名称:cadquery-freecad-module,代码行数:29,代码来源:Shared.py

示例7: open

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMdiArea [as 别名]
def open(filename):
    #All of the CQGui.* calls in the Python console break after opening if we don't do this
    FreeCADGui.doCommand("import FreeCADGui as CQGui")

    # Make sure that we enforce a specific version (2.7) of the Python interpreter
    ver = hex(sys.hexversion)
    interpreter = "python%s.%s" % (ver[2], ver[4])  # => 'python2.7'

    # The extra version numbers won't work on Windows
    if sys.platform.startswith('win'):
        interpreter = 'python'

    # Set up so that we can import from our embedded packages
    module_base_path = module_locator.module_path()
    libs_dir_path = os.path.join(module_base_path, 'Libs')

    # Make sure we get the right libs under the FreeCAD installation
    fc_base_path = os.path.dirname(os.path.dirname(module_base_path))
    fc_lib_path = os.path.join(fc_base_path, 'lib')

    #Getting the main window will allow us to find the children we need to work with
    mw = FreeCADGui.getMainWindow()

    # Grab just the file name from the path/file that's being executed
    docname = os.path.basename(filename)

    # Pull the font size from the FreeCAD-stored settings
    fontSize = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/cadquery-freecad-module").GetInt("fontSize")

    # Set up the code editor
    codePane = CodeEditor()
    codePane.setFont(QtGui.QFont('SansSerif', fontSize))
    codePane.setObjectName("cqCodePane_" + os.path.splitext(os.path.basename(filename))[0])

    mdi = mw.findChild(QtGui.QMdiArea)
    # add a code editor widget to the mdi area
    sub = mdi.addSubWindow(codePane)
    sub.setWindowTitle(docname)
    sub.setWindowIcon(QtGui.QIcon(':/icons/applications-python.svg'))
    sub.show()
    mw.update()

    #Pull the text of the CQ script file into our code pane
    codePane.open(filename)

    msg = QtGui.QApplication.translate(
            "cqCodeWidget",
            "Opened ",
            None)
    FreeCAD.Console.PrintMessage(msg + filename + "\r\n")

    return 
开发者ID:jmwright,项目名称:cadquery-freecad-module,代码行数:54,代码来源:ImportCQ.py

示例8: getDrawingPageGUIVars

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMdiArea [as 别名]
def getDrawingPageGUIVars():
    '''
    Get the FreeCAD window, graphicsScene, drawing page object, ...
    '''
    # get the active window
    mw = QtGui.QApplication.activeWindow()
    MdiArea = [c for c in mw.children() if isinstance(c,QtGui.QMdiArea)][0]

    try:
        subWinMW = MdiArea.activeSubWindow().children()[3]
    except AttributeError:
        QtGui.QMessageBox.information( QtGui.QApplication.activeWindow(), notDrawingPage_title, notDrawingPage_msg  )
        raise ValueError(notDrawingPage_title)

    # The drawing 'page' is really a group in the model tree
    # The objectName for the group object is not the same as the name shown in
    # the model view, this is the 'Label' property, it *should* be unique.
    # To find the page we are on, we get all the pages which have the same label as
    # the current object. In theory there should therefore only be one page in the list
    # returned by getObjectsByLabel, so we'll just take the first in the list
    pages = App.ActiveDocument.getObjectsByLabel( encode_if_py2(subWinMW.objectName()) )

    # raise an error explaining that the page wasn't found if the list is empty
    if len(pages) != 1:
        QtGui.QMessageBox.information( QtGui.QApplication.activeWindow(), notDrawingPage_title, notDrawingPage_msg  )
        raise ValueError(notDrawingPage_title)

    # get the page from the list
    page = pages[0]

    try:
        graphicsView = [ c for c in subWinMW.children() if isinstance(c,QtGui.QGraphicsView)][0]
    except IndexError:
        QtGui.QMessageBox.information( QtGui.QApplication.activeWindow(), notDrawingPage_title, notDrawingPage_msg  )
        raise ValueError(notDrawingPage_title)
    graphicsScene = graphicsView.scene()
    pageRect = graphicsScene.items()[0] #hope this index does not change!
    width = pageRect.rect().width()
    height = pageRect.rect().height()
    #ViewResult has an additional tranform on it [VRT].
    #if width > 1400: #then A3 # or == 1488 in FreeCAD v 0.15
    #    VRT_scale = width / 420.0 #VRT = view result transform, where 420mm is the width of an A3 page.
    #else: #assuming A4
    #    VRT_scale = width / 297.0
    VRT_scale = 3.542 #i wonder where this number comes from

    VRT_ox = pageRect.rect().left() / VRT_scale
    VRT_oy = pageRect.rect().top() / VRT_scale

    transform = QtGui.QTransform()
    transform.translate(VRT_ox, VRT_oy)
    transform.scale(VRT_scale, VRT_scale)

    return DrawingPageGUIVars(locals()) 
开发者ID:hamish2014,项目名称:FreeCAD_drawing_dimensioning,代码行数:56,代码来源:core.py


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