From 0f94be4e687d5eb6aef6f4af11eb53f32092c984 Mon Sep 17 00:00:00 2001 From: Matt Clapp Date: Tue, 1 Aug 2017 21:09:53 -0700 Subject: [PATCH] fixing code snippet - open even if contentNotSaved --- .../python/converted/wx.FileDialog.1.py | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/wx.FileDialog.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.FileDialog.1.py index 97c2e808..50e053b9 100644 --- a/docs/sphinx/rest_substitutions/snippets/python/converted/wx.FileDialog.1.py +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.FileDialog.1.py @@ -7,21 +7,21 @@ wx.ICON_QUESTION | wx.YES_NO, self) == wx.NO: return - # else: proceed asking to the user the new file to open + # else: proceed asking to the user the new file to open + + openFileDialog = wx.FileDialog(self, "Open XYZ file", "", "", + "XYZ files (*.xyz)|*.xyz", wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) + + if openFileDialog.ShowModal() == wx.ID_CANCEL: + return # the user changed idea... - openFileDialog = wx.FileDialog(self, "Open XYZ file", "", "", - "XYZ files (*.xyz)|*.xyz", wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) - - if openFileDialog.ShowModal() == wx.ID_CANCEL: - return # the user changed idea... - - # proceed loading the file chosen by the user - # this can be done with e.g. wxPython input streams: - input_stream = wx.FileInputStream(openFileDialog.GetPath()) - - if not input_stream.IsOk(): - - wx.LogError("Cannot open file '%s'."%openFileDialog.GetPath()) - return - - \ No newline at end of file + # proceed loading the file chosen by the user + # this can be done with e.g. wxPython input streams: + input_stream = wx.FileInputStream(openFileDialog.GetPath()) + + if not input_stream.IsOk(): + + wx.LogError("Cannot open file '%s'."%openFileDialog.GetPath()) + return + +