save last file path
parent
0b8855781c
commit
3273f5cc4c
|
@ -37,6 +37,7 @@ class Tee(object):
|
||||||
class PronterWindow(wx.Frame,pronsole.pronsole):
|
class PronterWindow(wx.Frame,pronsole.pronsole):
|
||||||
def __init__(self, filename=None,size=winsize):
|
def __init__(self, filename=None,size=winsize):
|
||||||
pronsole.pronsole.__init__(self)
|
pronsole.pronsole.__init__(self)
|
||||||
|
self.settings.last_file_path = ""
|
||||||
self.filename=filename
|
self.filename=filename
|
||||||
os.putenv("UBUNTU_MENUPROXY","0")
|
os.putenv("UBUNTU_MENUPROXY","0")
|
||||||
wx.Frame.__init__(self,None,title="Printer Interface",size=size);
|
wx.Frame.__init__(self,None,title="Printer Interface",size=size);
|
||||||
|
@ -616,11 +617,13 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
|
||||||
thread(target=self.skein_monitor).start()
|
thread(target=self.skein_monitor).start()
|
||||||
|
|
||||||
def loadfile(self,event):
|
def loadfile(self,event):
|
||||||
basedir="."
|
basedir=self.settings.last_file_path
|
||||||
try:
|
if not os.path.exists(basedir):
|
||||||
basedir=os.path.split(self.filename)[0]
|
basedir = "."
|
||||||
except:
|
try:
|
||||||
pass
|
basedir=os.path.split(self.filename)[0]
|
||||||
|
except:
|
||||||
|
pass
|
||||||
dlg=wx.FileDialog(self,"Open file to print",basedir,style=wx.FD_OPEN|wx.FD_FILE_MUST_EXIST)
|
dlg=wx.FileDialog(self,"Open file to print",basedir,style=wx.FD_OPEN|wx.FD_FILE_MUST_EXIST)
|
||||||
dlg.SetWildcard("STL and GCODE files (;*.gcode;*.g;*.stl;)")
|
dlg.SetWildcard("STL and GCODE files (;*.gcode;*.g;*.stl;)")
|
||||||
if(dlg.ShowModal() == wx.ID_OK):
|
if(dlg.ShowModal() == wx.ID_OK):
|
||||||
|
@ -628,6 +631,9 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
|
||||||
if not(os.path.exists(name)):
|
if not(os.path.exists(name)):
|
||||||
self.status.SetStatusText("File not found!")
|
self.status.SetStatusText("File not found!")
|
||||||
return
|
return
|
||||||
|
path = os.path.split(name)[0]
|
||||||
|
if path != self.settings.last_file_path:
|
||||||
|
self.set("last_file_path",path)
|
||||||
if name.endswith(".stl"):
|
if name.endswith(".stl"):
|
||||||
self.skein(name)
|
self.skein(name)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue