Improved the open and close script functionality to help ensure a better and more integrated workflow.
This commit is contained in:
parent
544faacaf2
commit
3d3f640dae
|
@ -75,18 +75,7 @@ class CadQueryCloseScript:
|
|||
if filename is not None:
|
||||
ExportCQ.save(filename)
|
||||
|
||||
# Close the matching 3D view if it's open
|
||||
if cqCodePane.file.path is not None:
|
||||
docname = os.path.splitext(os.path.basename(cqCodePane.file.path))[0]
|
||||
|
||||
try:
|
||||
FreeCAD.closeDocument(docname)
|
||||
except:
|
||||
# Assume that the document has already been closed
|
||||
pass
|
||||
|
||||
# Clear our script and whatever was rendered by it out
|
||||
cqCodePane.file.close()
|
||||
Shared.closeActiveCodeWindow()
|
||||
|
||||
class CadQueryExecuteExample:
|
||||
exFile = None
|
||||
|
@ -214,9 +203,6 @@ class CadQueryOpenScript:
|
|||
|
||||
# Make sure the user didn't click cancel
|
||||
if filename[0]:
|
||||
# We need to close any file that's already open in the editor window
|
||||
CadQueryCloseScript().Activated()
|
||||
|
||||
self.previousPath = filename[0]
|
||||
|
||||
# Append this script's directory to sys.path
|
||||
|
|
|
@ -45,9 +45,7 @@ def getActiveCodePane():
|
|||
return cqCodePane
|
||||
|
||||
|
||||
def getActiveCodeWindow():
|
||||
"""Gets the currently active code window (that holds the pane), even if the associated 3D view window has focus"""
|
||||
|
||||
def closeActiveCodeWindow():
|
||||
mw = FreeCADGui.getMainWindow()
|
||||
mdi = mw.findChild(QtGui.QMdiArea)
|
||||
|
||||
|
@ -59,11 +57,11 @@ def getActiveCodeWindow():
|
|||
subList = mdi.subWindowList()
|
||||
|
||||
for sub in subList:
|
||||
if sub.windowTitle() == mdiWin.windowTitle() + ".py":
|
||||
mdiWin = sub
|
||||
|
||||
return mdiWin
|
||||
if sub.windowTitle() == mdiWin.windowTitle().split(" ")[0] + ".py":
|
||||
sub.close()
|
||||
return
|
||||
|
||||
mdiWin.close()
|
||||
|
||||
def setActiveWindowTitle(title):
|
||||
"""Sets the title of the currently active MDI window, as long as it is a scripting window"""
|
||||
|
|
Loading…
Reference in New Issue
Block a user