Configtool: enforce correct configuration file names.
Previously one could save a board or printer configuration with a name which wouldn't allow to load it again.
This commit is contained in:
parent
706ccf0637
commit
73f7e43227
|
|
@ -422,6 +422,14 @@ class BoardPanel(wx.Panel):
|
|||
dlg.Destroy()
|
||||
return False
|
||||
|
||||
if not os.path.basename(path).startswith("board."):
|
||||
dlg = wx.MessageDialog(self, "Illegal file name: %s.\n"
|
||||
"File name must begin with \"board.\"" % path,
|
||||
"Illegal file name", wx.OK + wx.ICON_ERROR)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
return False
|
||||
|
||||
ext = os.path.splitext(os.path.basename(path))[1]
|
||||
self.dir = os.path.dirname(path)
|
||||
|
||||
|
|
|
|||
|
|
@ -301,6 +301,14 @@ class PrinterPanel(wx.Panel):
|
|||
dlg.Destroy()
|
||||
return False
|
||||
|
||||
if not os.path.basename(path).startswith("printer."):
|
||||
dlg = wx.MessageDialog(self, "Illegal file name: %s.\n"
|
||||
"File name must begin with \"printer.\"" % path,
|
||||
"Illegal file name", wx.OK + wx.ICON_ERROR)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
return False
|
||||
|
||||
ext = os.path.splitext(os.path.basename(path))[1]
|
||||
self.dir = os.path.dirname(path)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue