Skip to content

Commit 1eafe4f

Browse files
committed
qtvcp -cam_align panel: add window size setting option
Helps with embedding.
1 parent 25b3526 commit 1eafe4f

1 file changed

Lines changed: 20 additions & 6 deletions

File tree

share/qtvcp/panels/cam_align/cam_align_handler.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,27 @@ def __init__(self, halcomp,widgets,paths):
4141
def initialized__(self):
4242
if self.w.PREFS_:
4343
print('Using preference file:',self.w.PREFS_.fn)
44+
number = 0
4445
if self.w.USEROPTIONS_ is not None:
45-
try:
46-
num = int(self.w.USEROPTIONS_[0])
47-
except:
48-
print('Error with cam_align camera selection - not a number - using 0')
49-
num = 0
50-
self.w.camview._camNum = num
46+
for num, i in enumerate(self.w.USEROPTIONS_):
47+
48+
# override the default width and height of the window
49+
if 'size=' in self.w.USEROPTIONS_[num]:
50+
try:
51+
strg = self.w.USEROPTIONS_[num].strip('size=')
52+
arg = strg.split(',')
53+
self.w.resize(int(arg[0]),int(arg[1]))
54+
except Exception as e:
55+
print('Error with cam_align size setting:',self.w.USEROPTIONS_[num])
56+
57+
# camera number to use
58+
else:
59+
if len(self.w.USEROPTIONS_[num]) == 1 and self.w.USEROPTIONS_[num].isdigit():
60+
try:
61+
number = int(self.w.USEROPTIONS_[num])
62+
except:
63+
print('Error with cam_align camera selection - not a number - using 0')
64+
self.w.camview._camNum = number
5165

5266
########################
5367
# callbacks from STATUS #

0 commit comments

Comments
 (0)