From 3fb5b6c7f220976bd89d3f2f77360c5743bd5c83 Mon Sep 17 00:00:00 2001 From: Ghislain Antony Vaillant Date: Mon, 24 Jul 2017 09:54:09 +0100 Subject: [PATCH 1/9] Add docs to the release tarball The PyPI tarball is the canonical source for building packages on Linux distributions such as Debian. It would be desirable to have the docs shipped in the sdist, so that a corresponding documentation package can be built on the Debian side. --- MANIFEST.in | 1 + 1 file changed, 1 insertion(+) diff --git a/MANIFEST.in b/MANIFEST.in index 41c49fb8..9a7cc9a7 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -7,6 +7,7 @@ recursive-include wx ** recursive-include license *.txt include LICENSE.txt +graft docs recursive-exclude wx .git recursive-exclude wx *.pyc From 526d216e6cf27a61744dd8c7d44365ff7d2c6654 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Mon, 31 Jul 2017 10:31:52 -0700 Subject: [PATCH 2/9] Fixed copy/paste error in wx.BusyInfo.__exit__ --- CHANGES.rst | 5 ++++- etg/busyinfo.py | 2 +- unittests/test_busyinfo.py | 5 +++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 92a2b8ef..77c77ef5 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -13,7 +13,7 @@ wxPython Changelog ------- * (not yet released) -PyPI: https://pypi.python.org/pypi/wxPython/4.0.0b1 +PyPI: https://pypi.python.org/pypi/wxPython/4.0.0b2 Extras: https://extras.wxPython.org/wxPython4/extras/ Changes in this release include the following: @@ -26,6 +26,9 @@ Changes in this release include the following: * Add missing wx.VScrolledWindow methods listed in the docs as deprecated but still present. (#441) +* Fixed copy/paste error in wx.BusyInfo.__exit__ (#449) + + 4.0.0b1 diff --git a/etg/busyinfo.py b/etg/busyinfo.py index 38d00435..1fc68a43 100644 --- a/etg/busyinfo.py +++ b/etg/busyinfo.py @@ -38,7 +38,7 @@ def run(): # context manager methods c.addPyMethod('__enter__', '(self)', 'return self') - c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'self.Destroy()') + c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'return False') #----------------------------------------------------------------- diff --git a/unittests/test_busyinfo.py b/unittests/test_busyinfo.py index 042628d8..9b398e8c 100644 --- a/unittests/test_busyinfo.py +++ b/unittests/test_busyinfo.py @@ -12,6 +12,11 @@ class busyinfo_Tests(wtc.WidgetTestCase): del busy + def test_busyinfo2(self): + with wx.BusyInfo('This is a busy info message'): + self.waitFor(250) + + #--------------------------------------------------------------------------- if __name__ == '__main__': From 0f94be4e687d5eb6aef6f4af11eb53f32092c984 Mon Sep 17 00:00:00 2001 From: Matt Clapp Date: Tue, 1 Aug 2017 21:09:53 -0700 Subject: [PATCH 3/9] 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 + + From e2d043acb513e724f131b193c52b81a5aff88bc0 Mon Sep 17 00:00:00 2001 From: Ghislain Antony Vaillant Date: Thu, 3 Aug 2017 08:34:23 +0100 Subject: [PATCH 4/9] Exclude the Sphinx build directory from sdist --- MANIFEST.in | 1 + 1 file changed, 1 insertion(+) diff --git a/MANIFEST.in b/MANIFEST.in index 9a7cc9a7..0ad1c303 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -8,6 +8,7 @@ recursive-include wx ** recursive-include license *.txt include LICENSE.txt graft docs +prune docs/sphinx/build recursive-exclude wx .git recursive-exclude wx *.pyc From 6104c898b0d12413c74bdf7027e50317d0e95d62 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Thu, 3 Aug 2017 11:22:54 -0700 Subject: [PATCH 5/9] Add note about where the real file selection and archiving happens. --- MANIFEST.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MANIFEST.in b/MANIFEST.in index 0ad1c303..0f8652cb 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -3,6 +3,8 @@ # still an easy way to specify what data files (non *.py files) should be # included in the package dirs. # +# See cmd_sdist() in build.py for the actual building of the source dist. +# recursive-include wx ** recursive-include license *.txt From 052e19116a0f751245a42e382a86ddf6e1263e6b Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Thu, 3 Aug 2017 16:41:39 -0700 Subject: [PATCH 6/9] Add the sphinx source files to the source tarball --- build.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/build.py b/build.py index eab9baac..c0aaaf62 100755 --- a/build.py +++ b/build.py @@ -1766,10 +1766,16 @@ def cmd_sdist(options, args): getWafCmd() copyFile('bin/waf-%s' % wafCurrentVersion, os.path.join(PDEST, 'bin')) - # and the REV.txt if there is one + # And the REV.txt if there is one if os.path.exists('REV.txt'): copyFile('REV.txt', PDEST) + # Copy the Sphinx source files in the docs tree, excluding the html and + # sphinx/build folders, if present. + shutil.rmtree(opj(PDEST, 'docs'), ignore_errors=True) + shutil.copytree('docs', opj(PDEST, 'docs'), + ignore=shutil.ignore_patterns('html', 'build', '__pycache__', 'cpp')) + # Add some extra stuff to the root folder cmd_egg_info(options, args, egg_base=PDEST) copyFile(opj(PDEST, '{}.egg-info/PKG-INFO'.format(baseName)), From 9c26b68783acf259d47abd49675dcfcbdcf9dd02 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Thu, 3 Aug 2017 16:43:22 -0700 Subject: [PATCH 7/9] Run the wxlib command for sdist builds --- buildbot/master.cfg | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/buildbot/master.cfg b/buildbot/master.cfg index a4f09185..53b1943e 100644 --- a/buildbot/master.cfg +++ b/buildbot/master.cfg @@ -213,7 +213,7 @@ def makeFactory(port, buildType='buildOnly', pyVer='2.7'): factory = BuildFactory() # Was the build started from the force build form with a "fullclean" - # property set? If so, clobber the git workspace and start fresh. + # property set? If so, fully clobber the git workspace and start fresh. cmd = ['bash', '-c', WithProperties('if [ %(fullclean:-no)s == yes ]; then rm -rf ../Phoenix; echo fully cleaned; fi'), ] @@ -226,7 +226,7 @@ def makeFactory(port, buildType='buildOnly', pyVer='2.7'): clean = '' # Start from a clean build tree for the daily "dist" builds - if buildType in ['dist', 'docs', 'vagrant']: + if buildType in ['dist', 'sdist', 'docs', 'vagrant']: mode = 'full' method = 'clobber' @@ -246,7 +246,7 @@ def makeFactory(port, buildType='buildOnly', pyVer='2.7'): if buildType == 'sdist': cmd = 'python -u build.py %s setrev dox touch etg sip build '\ - 'sdist sdist_demo --upload' % pyVer + 'wxlib sdist sdist_demo --upload' % pyVer elif buildType == 'docs': cmd = 'python -u build.py %s setrev dox touch etg sip build wxlib ' \ From 2e07a611f5ce9a4a3680a4ada5648dac9f9a2da1 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Fri, 4 Aug 2017 10:39:19 -0700 Subject: [PATCH 8/9] Make the snippet a little more pythonic. Update the save dialog snippet too. --- .../python/converted/wx.FileDialog.1.py | 38 +++++++++---------- .../python/converted/wx.FileDialog.2.py | 32 ++++++++-------- 2 files changed, 33 insertions(+), 37 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 50e053b9..b375fede 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 @@ -1,27 +1,23 @@ - + def OnOpen(self, event): - + if self.contentNotSaved: - if wx.MessageBox("Current content has not been saved! Proceed?", "Please confirm", wx.ICON_QUESTION | wx.YES_NO, self) == wx.NO: return - - # 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... - - # 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 - - + # otherwise ask the user what new file to open + with wx.FileDialog(self, "Open XYZ file", wildcard="XYZ files (*.xyz)|*.xyz", + style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) as fileDialog: + + if fileDialog.ShowModal() == wx.ID_CANCEL: + return # the user changed their mind + + # Proceed loading the file chosen by the user + pathname = fileDialog.GetPath() + try: + with open(pathname, 'r') as file: + self.doLoadDataOrWhatever(file) + except IOError: + wx.LogError("Cannot open file '%s'." % newfile) + diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/wx.FileDialog.2.py b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.FileDialog.2.py index e47a38d6..1ea9c7a2 100644 --- a/docs/sphinx/rest_substitutions/snippets/python/converted/wx.FileDialog.2.py +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.FileDialog.2.py @@ -1,17 +1,17 @@ - + def OnSaveAs(self, event): - - saveFileDialog = wx.FileDialog(self, "Save XYZ file", "", "", - "XYZ files (*.xyz)|*.xyz", wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT) - - if saveFileDialog.ShowModal() == wx.ID_CANCEL: - return # the user changed idea... - - # save the current contents in the file - # this can be done with e.g. wxPython output streams: - output_stream = wx.FileOutputStream(saveFileDialog.GetPath()) - - if not output_stream.IsOk(): - wx.LogError("Cannot save current contents in file '%s'."%saveFileDialog.GetPath()) - return - + + with wx.FileDialog(self, "Save XYZ file", wildcard="XYZ files (*.xyz)|*.xyz", + style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT) as fileDialog: + + if fileDialog.ShowModal() == wx.ID_CANCEL: + return # the user changed their mind + + # save the current contents in the file + pathname = fileDialog.GetPath() + try: + with open(pathname, 'w') as file: + self.doSaveData(file) + except IOError: + wx.LogError("Cannot save current data in file '%s'." % pathname) + From 97002a8803779d046a82c567c98bb22796a36784 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Fri, 4 Aug 2017 17:19:48 -0700 Subject: [PATCH 9/9] Not sure why it was commented out, but the taskbar icon needs to be destroyed in order for the MainLoop to exit normally. --- demo/Main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/demo/Main.py b/demo/Main.py index 79364bfc..f8c737d1 100644 --- a/demo/Main.py +++ b/demo/Main.py @@ -2478,8 +2478,8 @@ class wxPythonDemo(wx.Frame): self.mainmenu = None self.StopDownload() - # if self.tbicon is not None: - # self.tbicon.Destroy() + if self.tbicon is not None: + self.tbicon.Destroy() config = GetConfig() config.Write('ExpansionState', str(self.tree.GetExpansionState()))