Merge pull request #22 from jmwright/open-enhance
Fixed a bug with a blank filename being set for the previous filename an...
This commit is contained in:
commit
925df1f6d3
|
@ -118,6 +118,8 @@ class CadQueryOpenScript():
|
||||||
# return True
|
# return True
|
||||||
|
|
||||||
def Activated(self):
|
def Activated(self):
|
||||||
|
import sys
|
||||||
|
|
||||||
mw = FreeCADGui.getMainWindow()
|
mw = FreeCADGui.getMainWindow()
|
||||||
|
|
||||||
#Try to keep track of the previous path used to open as a convenience to the user
|
#Try to keep track of the previous path used to open as a convenience to the user
|
||||||
|
@ -132,10 +134,13 @@ class CadQueryOpenScript():
|
||||||
filename = QtGui.QFileDialog.getOpenFileName(mw, mw.tr("Open CadQuery Script"), self.previousPath,
|
filename = QtGui.QFileDialog.getOpenFileName(mw, mw.tr("Open CadQuery Script"), self.previousPath,
|
||||||
mw.tr("CadQuery Files (*.py)"))
|
mw.tr("CadQuery Files (*.py)"))
|
||||||
|
|
||||||
self.previousPath = filename[0]
|
|
||||||
|
|
||||||
#Make sure the user didn't click cancel
|
#Make sure the user didn't click cancel
|
||||||
if filename[0]:
|
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
|
#We've created a library that FreeCAD can use as well to open CQ files
|
||||||
ImportCQ.open(filename[0])
|
ImportCQ.open(filename[0])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user