From 2b632c8e20df20b4fb049d43cd0e708424ef24ed Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 1 Feb 2020 09:49:35 +0100 Subject: [PATCH 1/3] cocoa: use resolved filename to load cursor image (thanks treamous) --- panda/src/cocoadisplay/cocoaGraphicsWindow.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm index 84a722e5c6..ebb35589df 100644 --- a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm +++ b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm @@ -1351,7 +1351,7 @@ load_image_data(const Filename &filename) { cocoadisplay_cat.info() << "Loading NSImage from file " << resolved << "\n"; - PT(VirtualFile) vfile = vfs->get_file(filename); + PT(VirtualFile) vfile = vfs->get_file(resolved); if (vfile == NULL) { return nil; } From 5d9323738611568968f7121c9a19673f75d28d1a Mon Sep 17 00:00:00 2001 From: Fireclaw Date: Fri, 7 Feb 2020 21:49:33 +0100 Subject: [PATCH 2/3] dgui: fix regression in DirectScrolledFrame (see #699) Made initialization ignore the setScrollBarWidth function Respect the length/height of the scrollbar and only change the actual width in the setScrollBarWidth function Added a very basic unittest class for the scrolledFrame Closes #864 --- direct/src/gui/DirectScrolledFrame.py | 6 +++-- tests/gui/test_DirectScrolledFrame.py | 36 +++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 tests/gui/test_DirectScrolledFrame.py diff --git a/direct/src/gui/DirectScrolledFrame.py b/direct/src/gui/DirectScrolledFrame.py index 7b30ba499e..c860797b74 100644 --- a/direct/src/gui/DirectScrolledFrame.py +++ b/direct/src/gui/DirectScrolledFrame.py @@ -77,9 +77,11 @@ class DirectScrolledFrame(DirectFrame): self.initialiseoptions(DirectScrolledFrame) def setScrollBarWidth(self): + if self.fInit: return + w = self['scrollBarWidth'] - self.verticalScroll["frameSize"] = (-w / 2.0, w / 2.0, -1, 1) - self.horizontalScroll["frameSize"] = (-1, 1, -w / 2.0, w / 2.0) + self.verticalScroll["frameSize"] = (-w / 2.0, w / 2.0, self.verticalScroll["frameSize"][2], self.verticalScroll["frameSize"][3]) + self.horizontalScroll["frameSize"] = (self.horizontalScroll["frameSize"][0], self.horizontalScroll["frameSize"][1], -w / 2.0, w / 2.0) def setCanvasSize(self): f = self['canvasSize'] diff --git a/tests/gui/test_DirectScrolledFrame.py b/tests/gui/test_DirectScrolledFrame.py new file mode 100644 index 0000000000..85ad8a53d4 --- /dev/null +++ b/tests/gui/test_DirectScrolledFrame.py @@ -0,0 +1,36 @@ +from direct.gui.DirectScrolledFrame import DirectScrolledFrame +import pytest + + +def test_set_scrollbar_width(): + w = 1 + + frm = DirectScrolledFrame(scrollBarWidth=w) + + assert frm['scrollBarWidth'] == 1 + + assert frm.verticalScroll['frameSize'] == (-w / 2.0, w / 2.0, -1, 1) + assert frm.horizontalScroll['frameSize'] == (-1, 1, -w / 2.0, w / 2.0) + + # manual changes to the framesize + frm.verticalScroll['frameSize'] = (-2, 2, -4, 4) + frm.horizontalScroll['frameSize'] = (-4, 4, -2, 2) + assert frm.verticalScroll['frameSize'] == (-2, 2, -4, 4) + assert frm.horizontalScroll['frameSize'] == (-4, 4, -2, 2) + + # change scrollbar width to a new value + w = 2 + frm['scrollBarWidth'] = w + + # check, new value is set correct + assert frm['scrollBarWidth'] == 2 + + # check if new size is set correct + assert frm.verticalScroll['frameSize'] == (-w / 2.0, w / 2.0, -4, 4) + assert frm.horizontalScroll['frameSize'] == (-4, 4, -w / 2.0, w / 2.0) + + +def test_set_scrollbar_width_on_init(): + frm = DirectScrolledFrame(verticalScroll_frameSize=(-2, 2, -4, 4), horizontalScroll_frameSize=(-4, 4, -2, 2)) + assert frm.verticalScroll['frameSize'] == (-2, 2, -4, 4) + assert frm.horizontalScroll['frameSize'] == (-4, 4, -2, 2) From 59608c9079f01327ef2f7f4a9c89aa610615f9ca Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 10 Feb 2020 13:48:38 +0100 Subject: [PATCH 3/3] makepanda: force flex step for dcParser to occur after bison step This fixes an erratic build failure reported by the Travis GCC builder. --- makepanda/makepanda.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 58949531d3..39cffbd924 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -5421,7 +5421,7 @@ if (PkgSkip("DIRECT")==0): CreateFile(GetOutputDir()+"/include/dcParser.h") PyTargetAdd('p3dcparser_dcParser.obj', opts=OPTS, input='dcParser.yxx') #TargetAdd('dcParser.h', input='p3dcparser_dcParser.obj', opts=['DEPENDENCYONLY']) - PyTargetAdd('p3dcparser_dcLexer.obj', opts=OPTS, input='dcLexer.lxx') + PyTargetAdd('p3dcparser_dcLexer.obj', opts=OPTS, input='dcLexer.lxx', dep='p3dcparser_dcParser.obj') PyTargetAdd('p3dcparser_composite1.obj', opts=OPTS, input='p3dcparser_composite1.cxx') PyTargetAdd('p3dcparser_composite2.obj', opts=OPTS, input='p3dcparser_composite2.cxx')