From a0aa7de29131f754dcda2d6f594b5ef0463237dc Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 19 Aug 2019 21:26:35 +0200 Subject: [PATCH 1/9] dgui: fix critical regression introduced by 43a5719 --- direct/src/gui/DirectGuiBase.py | 1 + tests/gui/test_DirectButton.py | 6 ++++++ tests/gui/test_DirectEntry.py | 5 +++++ 3 files changed, 12 insertions(+) create mode 100644 tests/gui/test_DirectButton.py diff --git a/direct/src/gui/DirectGuiBase.py b/direct/src/gui/DirectGuiBase.py index e654c455c2..1348b0a2e3 100644 --- a/direct/src/gui/DirectGuiBase.py +++ b/direct/src/gui/DirectGuiBase.py @@ -81,6 +81,7 @@ __all__ = ['DirectGuiBase', 'DirectGuiWidget'] from panda3d.core import * from direct.showbase import ShowBaseGlobal +from direct.showbase import ShowBase from . import DirectGuiGlobals as DGG from .OnscreenText import * from .OnscreenGeom import * diff --git a/tests/gui/test_DirectButton.py b/tests/gui/test_DirectButton.py new file mode 100644 index 0000000000..6f85e72f59 --- /dev/null +++ b/tests/gui/test_DirectButton.py @@ -0,0 +1,6 @@ +from direct.gui.DirectButton import DirectButton + + +def test_button_destroy(): + btn = DirectButton(text="Test") + btn.destroy() diff --git a/tests/gui/test_DirectEntry.py b/tests/gui/test_DirectEntry.py index 4e462ebdbc..3382be3bda 100644 --- a/tests/gui/test_DirectEntry.py +++ b/tests/gui/test_DirectEntry.py @@ -3,6 +3,11 @@ from direct.gui.DirectEntry import DirectEntry import sys +def test_entry_destroy(): + entry = DirectEntry() + entry.destroy() + + def test_entry_get(): entry = DirectEntry() assert isinstance(entry.get(), str) From e69c412c2b24667d30e5442f0e485810554c1a51 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 19 Aug 2019 21:30:46 +0200 Subject: [PATCH 2/9] Bump version to 1.10.4.1 --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 2612b38da8..b63475ad8c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = Panda3D -version = 1.10.4 +version = 1.10.4.1 url = https://www.panda3d.org/ description = Panda3D is a framework for 3D rendering and game development for Python and C++ programs. license = Modified BSD License From d028bebb52878d6ebb812c76325cceb6393b47a2 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 19 Aug 2019 21:37:32 +0200 Subject: [PATCH 3/9] makepanda: change getversion.py to take version from setup.cfg [skip ci] --- makepanda/getversion.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/makepanda/getversion.py b/makepanda/getversion.py index 4595c0d589..09b483eea3 100755 --- a/makepanda/getversion.py +++ b/makepanda/getversion.py @@ -4,13 +4,13 @@ # and returns it on the command-line. This is useful for the # automated scripts that build the Panda3D releases. -from makepandacore import ParsePandaVersion, ParsePluginVersion +from makepandacore import ParsePandaVersion, ParsePluginVersion, GetMetadataValue import sys if '--runtime' in sys.argv: version = ParsePluginVersion("dtool/PandaVersion.pp") else: - version = ParsePandaVersion("dtool/PandaVersion.pp") + version = GetMetadataValue('version') version = version.strip() sys.stdout.write(version) From 2b0a2ea6df73ae186da14b082e73733e0d02c41b Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 19 Aug 2019 21:57:49 +0200 Subject: [PATCH 4/9] makepanda: allow passing in more than 3 digits in version number --- makepanda/makepackage.py | 2 +- makepanda/makepanda.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/makepanda/makepackage.py b/makepanda/makepackage.py index 4c84983045..1094609374 100755 --- a/makepanda/makepackage.py +++ b/makepanda/makepackage.py @@ -1071,7 +1071,7 @@ if __name__ == "__main__": PkgDisable(pkg) # Parse the version. - match = re.match(r'^\d+\.\d+\.\d+', options.version) + match = re.match(r'^\d+\.\d+(\.\d+)+', options.version) if not match: exit("version requires three digits") diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index ffa7c4d6e8..9013c80c55 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -225,7 +225,7 @@ def parseopts(args): elif (option=="--arch"): target_arch = value.strip() elif (option=="--nocolor"): DisableColors() elif (option=="--version"): - match = re.match(r'^\d+\.\d+\.\d+', value) + match = re.match(r'^\d+\.\d+(\.\d+)+', value) if not match: usage("version requires three digits") WHLVERSION = value From 6364485b49d68d8010e15f28774696f0a0c560c1 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 19 Aug 2019 21:58:08 +0200 Subject: [PATCH 5/9] ffmpeg: fix an unprotected debug print --- panda/src/ffmpeg/ffmpegAudioCursor.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/panda/src/ffmpeg/ffmpegAudioCursor.cxx b/panda/src/ffmpeg/ffmpegAudioCursor.cxx index 4b17800c2b..c7ee596220 100644 --- a/panda/src/ffmpeg/ffmpegAudioCursor.cxx +++ b/panda/src/ffmpeg/ffmpegAudioCursor.cxx @@ -132,8 +132,10 @@ FfmpegAudioCursor(FfmpegAudio *src) : // Set up the resample context if necessary. if (_audio_ctx->sample_fmt != AV_SAMPLE_FMT_S16) { #ifdef HAVE_SWRESAMPLE - ffmpeg_cat.debug() - << "Codec does not use signed 16-bit sample format. Setting up swresample context.\n"; + if (ffmpeg_cat.is_debug()) { + ffmpeg_cat.debug() + << "Codec does not use signed 16-bit sample format. Setting up swresample context.\n"; + } _resample_ctx = swr_alloc(); av_opt_set_int(_resample_ctx, "in_channel_count", _audio_channels, 0); From edbdf43f07e5afd014c45817b27c72397709640b Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 19 Aug 2019 22:57:51 +0200 Subject: [PATCH 6/9] makepanda: PANDA_VERSION_STR should contain the full version number --- makepanda/makepanda.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 9013c80c55..9124dc3b2d 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -2707,7 +2707,7 @@ PANDAVERSION_H=""" #define PANDA_SEQUENCE_VERSION $VERSION3 #define PANDA_VERSION $NVERSION #define PANDA_NUMERIC_VERSION $NVERSION -#define PANDA_VERSION_STR "$VERSION1.$VERSION2.$VERSION3" +#define PANDA_VERSION_STR "$VERSION" #define PANDA_ABI_VERSION_STR "$VERSION1.$VERSION2" #define PANDA_DISTRIBUTOR "$DISTRIBUTOR" #define PANDA_PACKAGE_VERSION_STR "$RTDIST_VERSION" @@ -2826,6 +2826,7 @@ def CreatePandaVersionFiles(): pandaversion_h = pandaversion_h.replace("$VERSION1",str(version1)) pandaversion_h = pandaversion_h.replace("$VERSION2",str(version2)) pandaversion_h = pandaversion_h.replace("$VERSION3",str(version3)) + pandaversion_h = pandaversion_h.replace("$VERSION",VERSION) pandaversion_h = pandaversion_h.replace("$NVERSION",str(nversion)) pandaversion_h = pandaversion_h.replace("$DISTRIBUTOR",DISTRIBUTOR) pandaversion_h = pandaversion_h.replace("$RTDIST_VERSION",RTDIST_VERSION) From b19abf1480f6197a22351ad3f6eb026b99c62ea9 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 19 Aug 2019 23:35:35 +0200 Subject: [PATCH 7/9] doc: add release note for 1.10.4.1 [skip ci] --- doc/ReleaseNotes | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/ReleaseNotes b/doc/ReleaseNotes index 71ba7e3f6b..56b4b0d49d 100644 --- a/doc/ReleaseNotes +++ b/doc/ReleaseNotes @@ -1,3 +1,8 @@ +------------------------ RELEASE 1.10.4.1 --------------------- + +This release fixes only one critical regression: calling destroy() +on a DirectGUI item would cause an exception. + ------------------------ RELEASE 1.10.4 ----------------------- This release fixes a regression with DirectScrolledList in 1.10.3, From 062460cbe0e5aaf0e613d01ff51081a64552bdb9 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 20 Aug 2019 01:07:39 +0200 Subject: [PATCH 8/9] dgui: store guiItems on ShowBase class dict instead of module --- direct/src/gui/DirectGuiBase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/direct/src/gui/DirectGuiBase.py b/direct/src/gui/DirectGuiBase.py index 1348b0a2e3..3b47ac1973 100644 --- a/direct/src/gui/DirectGuiBase.py +++ b/direct/src/gui/DirectGuiBase.py @@ -81,7 +81,7 @@ __all__ = ['DirectGuiBase', 'DirectGuiWidget'] from panda3d.core import * from direct.showbase import ShowBaseGlobal -from direct.showbase import ShowBase +from direct.showbase.ShowBase import ShowBase from . import DirectGuiGlobals as DGG from .OnscreenText import * from .OnscreenGeom import * From 1318fd80d7fd48a84394ee86bad6a57c245206e1 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 20 Aug 2019 01:08:56 +0200 Subject: [PATCH 9/9] tests: add unit test for track-gui-items setting in DirectGUI --- tests/gui/test_DirectGuiBase.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/gui/test_DirectGuiBase.py diff --git a/tests/gui/test_DirectGuiBase.py b/tests/gui/test_DirectGuiBase.py new file mode 100644 index 0000000000..c23098081f --- /dev/null +++ b/tests/gui/test_DirectGuiBase.py @@ -0,0 +1,22 @@ +from direct.gui.DirectGuiBase import DirectGuiWidget +from direct.showbase.ShowBase import ShowBase +from direct.showbase import ShowBaseGlobal +from panda3d import core +import pytest + + +@pytest.mark.skipif(not ShowBaseGlobal.__dev__, reason="requires want-dev") +def test_track_gui_items(): + page = core.load_prc_file_data("", "track-gui-items true") + try: + item = DirectGuiWidget() + id = item.guiId + + assert id in ShowBase.guiItems + assert ShowBase.guiItems[id] == item + + item.destroy() + + assert id not in ShowBase.guiItems + finally: + core.unload_prc_file(page)