Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 1347 use screensize #1548

Merged
merged 5 commits into from
Sep 22, 2015
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Packages/vcs/Lib/VTKPlots.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,9 +406,11 @@ def portrait(self, W, H, x, y, clear):
self.renWin.SetSize(W, H)

def initialSize(self):
# screenSize = self.renWin.GetScreenSize()
self.renWin.SetSize(self.canvas.bgX, self.canvas.bgY)
self._lastSize = (self.canvas.bgX, self.canvas.bgY)
screenSize = self.renWin.GetScreenSize()
bgX = int(screenSize[0]*.6)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what are these magic numbers? (0.6). It would be nice if you can add a comment here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

60% of the screen size, I thought it was obvious... That's a reasonable size but if you come up with a percentage you prefer feel free to update 😉

bgY = int(bgX/self.canvas.size)
self.renWin.SetSize(bgX, bgY)
self._lastSize = (bgX, bgY)

def open(self):
self.createRenWin(open=True)
Expand Down
20 changes: 20 additions & 0 deletions testing/test_vcs_init_size_keyword.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import vcs
import numpy

x=vcs.init()
x.open()
i = x.canvasinfo()
r = float(i["width"])/i["height"]
assert(numpy.allclose(r,1.29438202247))

x=vcs.init(size=4)
x.open()
i = x.canvasinfo()
r = float(i["width"])/i["height"]
assert(numpy.allclose(r,4.))

x=vcs.init(size="A4")
x.open()
i = x.canvasinfo()
r = float(i["width"])/i["height"]
assert(numpy.allclose(r,1.41523341523))
4 changes: 4 additions & 0 deletions testing/vcs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ cdat_add_test(vcs_verify_create_get
"${PYTHON_EXECUTABLE}"
${cdat_SOURCE_DIR}/testing/vcs/test_create_get.py
)
cdat_add_test(vcs_verify_size_init)
"${PYTHON_EXECUTABLE}"
${cdat_SOURCE_DIR}/testing/vcs/test_vcs_init_size_keyword.py
)
if (NOT EXISTS /etc/redhat-release)
cdat_add_test(vcs_test_antialiasing
"${PYTHON_EXECUTABLE}"
Expand Down