diff --git a/direct/src/gui/DirectGuiBase.py b/direct/src/gui/DirectGuiBase.py index e654c455c2..3b47ac1973 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.ShowBase import ShowBase from . import DirectGuiGlobals as DGG from .OnscreenText import * from .OnscreenGeom import * 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, 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) 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 81c68a114d..c03ac582bf 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -222,7 +222,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 @@ -2684,7 +2684,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" @@ -2803,6 +2803,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) diff --git a/panda/src/ffmpeg/ffmpegAudioCursor.cxx b/panda/src/ffmpeg/ffmpegAudioCursor.cxx index 2fdc10b983..af66ef28d4 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); 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) 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)