Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2055ee8

Browse files
committed
Keep top left corner of window where it was when resizing.
Keep aspect and max size of window at all times. Remove (now unnecessary) sleep(0.1) in vcr capture code. Add messages when initializing VCR. Remove old comments.
1 parent aa895c7 commit 2055ee8

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

Demo/sgi/video/Vb.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,17 @@ def optfullsizewindow(self):
194194
if not self.window:
195195
return
196196
gl.winset(self.window)
197+
x, y = self.maxx, self.maxy
198+
gl.keepaspect(x, y)
199+
gl.stepunit(8, 6)
197200
if not self.use_24:
201+
gl.maxsize(x, y)
198202
gl.winconstraints()
199203
return
200-
gl.prefsize(self.maxx, self.maxy)
204+
left, bottom = gl.getorigin()
205+
width, height = gl.getsize()
206+
bottom = bottom+height-y
207+
gl.prefposition(left, left+x-1, bottom, bottom+y-1)
201208
gl.winconstraints()
202209
self.bindvideo()
203210

@@ -502,21 +509,23 @@ def single_capture(self, stepfunc, timecode):
502509
def vcr_capture(self):
503510
if not self.vcr:
504511
try:
512+
print 'Connecting to VCR ...'
505513
self.vcr = VCR.VCR().init()
514+
print 'Waiting for VCR to come online ...'
506515
self.vcr.wait()
516+
print 'Preparing VCR ...'
507517
if not (self.vcr.fmmode('dnr') and \
508518
self.vcr.dmcontrol('digital slow')):
509519
self.vcr_error('digital slow failed')
510520
return
521+
print 'VCR OK.'
511522
except VCR.error, msg:
512523
self.vcr = None
513524
self.vcr_error(msg)
514525
return
515526
if not self.vcr.still():
516527
self.vcr_error('still failed')
517528
return
518-
# XXX for some reason calling where() too often hangs the VCR,
519-
# XXX so we insert sleep(0.1) before every sense() call.
520529
self.open_if_closed()
521530
rate = self.getint(self.in_rate_vcr, 1)
522531
rate = max(rate, 1)
@@ -541,12 +550,11 @@ def vcr_capture(self):
541550
rate = rate - (here - addr)
542551
addr = here
543552
return
544-
if not self.vcr.fwdshuttle(vcrspeed): # one tenth speed
553+
if not self.vcr.fwdshuttle(vcrspeed):
545554
self.vcr_error('fwd shuttle failed')
546555
return
547556
cycle = 0
548557
while count > 0:
549-
time.sleep(0.1)
550558
try:
551559
here = self.vcr.sense()
552560
except VCR.error, msg:

0 commit comments

Comments
 (0)