mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 08:44:19 -04:00
Merge branch 'release/1.10.x' into master
This commit is contained in:
commit
fda898807a
@ -77,9 +77,11 @@ class DirectScrolledFrame(DirectFrame):
|
|||||||
self.initialiseoptions(DirectScrolledFrame)
|
self.initialiseoptions(DirectScrolledFrame)
|
||||||
|
|
||||||
def setScrollBarWidth(self):
|
def setScrollBarWidth(self):
|
||||||
|
if self.fInit: return
|
||||||
|
|
||||||
w = self['scrollBarWidth']
|
w = self['scrollBarWidth']
|
||||||
self.verticalScroll["frameSize"] = (-w / 2.0, w / 2.0, -1, 1)
|
self.verticalScroll["frameSize"] = (-w / 2.0, w / 2.0, self.verticalScroll["frameSize"][2], self.verticalScroll["frameSize"][3])
|
||||||
self.horizontalScroll["frameSize"] = (-1, 1, -w / 2.0, w / 2.0)
|
self.horizontalScroll["frameSize"] = (self.horizontalScroll["frameSize"][0], self.horizontalScroll["frameSize"][1], -w / 2.0, w / 2.0)
|
||||||
|
|
||||||
def setCanvasSize(self):
|
def setCanvasSize(self):
|
||||||
f = self['canvasSize']
|
f = self['canvasSize']
|
||||||
|
@ -4806,7 +4806,7 @@ if (PkgSkip("DIRECT")==0):
|
|||||||
OPTS=['DIR:direct/src/dcparser', 'BUILDING:DIRECT_DCPARSER', 'WITHINPANDA', 'BISONPREFIX_dcyy']
|
OPTS=['DIR:direct/src/dcparser', 'BUILDING:DIRECT_DCPARSER', 'WITHINPANDA', 'BISONPREFIX_dcyy']
|
||||||
CreateFile(GetOutputDir()+"/include/dcParser.h")
|
CreateFile(GetOutputDir()+"/include/dcParser.h")
|
||||||
TargetAdd('p3dcparser_dcParser.obj', opts=OPTS, input='dcParser.yxx')
|
TargetAdd('p3dcparser_dcParser.obj', opts=OPTS, input='dcParser.yxx')
|
||||||
#TargetAdd('dcParser.h', input='p3dcparser_dcParser.obj', opts=['DEPENDENCYONLY'])
|
TargetAdd('dcParser.h', input='p3dcparser_dcParser.obj', opts=['DEPENDENCYONLY'])
|
||||||
TargetAdd('p3dcparser_dcLexer.obj', opts=OPTS, input='dcLexer.lxx')
|
TargetAdd('p3dcparser_dcLexer.obj', opts=OPTS, input='dcLexer.lxx')
|
||||||
TargetAdd('p3dcparser_composite1.obj', opts=OPTS, input='p3dcparser_composite1.cxx')
|
TargetAdd('p3dcparser_composite1.obj', opts=OPTS, input='p3dcparser_composite1.cxx')
|
||||||
TargetAdd('p3dcparser_composite2.obj', opts=OPTS, input='p3dcparser_composite2.cxx')
|
TargetAdd('p3dcparser_composite2.obj', opts=OPTS, input='p3dcparser_composite2.cxx')
|
||||||
|
@ -1265,7 +1265,7 @@ load_image_data(const Filename &filename) {
|
|||||||
cocoadisplay_cat.info()
|
cocoadisplay_cat.info()
|
||||||
<< "Loading NSImage from file " << resolved << "\n";
|
<< "Loading NSImage from file " << resolved << "\n";
|
||||||
|
|
||||||
PT(VirtualFile) vfile = vfs->get_file(filename);
|
PT(VirtualFile) vfile = vfs->get_file(resolved);
|
||||||
if (vfile == NULL) {
|
if (vfile == NULL) {
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
36
tests/gui/test_DirectScrolledFrame.py
Normal file
36
tests/gui/test_DirectScrolledFrame.py
Normal file
@ -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)
|
Loading…
x
Reference in New Issue
Block a user