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

Skip to content

Commit 43df862

Browse files
committed
Mostly cosmetics, e.g. change window titles so icon titles are better,
size window back to last size when going from 24bits to 8bits mode, etc.
1 parent 2055ee8 commit 43df862

1 file changed

Lines changed: 25 additions & 19 deletions

File tree

Demo/sgi/video/Vb.py

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,7 @@ def showform(self):
9999
y1 = y2 - int(self.form.h) + 1
100100
# Position and show form window
101101
gl.prefposition(x1, x2, y1, y2)
102-
self.form.show_form(FL.PLACE_FREE, FL.TRUE, \
103-
'Video Bag Of Tricks')
102+
self.form.show_form(FL.PLACE_FREE, FL.TRUE, 'Vb Control')
104103

105104
def setdefaults(self):
106105
self.vcr = None
@@ -164,22 +163,27 @@ def openvideo(self):
164163
print 'Unknown video standard:', param[1]
165164
sys.exit(1)
166165
self.maxx, self.maxy = x, y
166+
self.curx = 256
167+
self.cury = 256*3/4
167168

168169
def makewindow(self):
169170
x, y = self.maxx, self.maxy
170171
gl.foreground()
171172
gl.maxsize(x, y)
172173
gl.keepaspect(x, y)
173174
gl.stepunit(8, 6)
174-
width = 256 # XXX
175-
if width:
176-
height = width*3/4
175+
width = self.curx
176+
height = self.cury
177+
if width and height:
178+
# Place the window at (150, 150) from top left
179+
# (the video board likes this location...)
177180
x1 = 150
178-
x2 = x1 + width-1
179-
y2 = 768-150
181+
x2 = x1+width-1
182+
SCRHEIGHT = 768
183+
y2 = SCRHEIGHT-1-150
180184
y1 = y2-height+1
181185
gl.prefposition(x1, x2, y1, y2)
182-
self.window = gl.winopen('Vb: initializing')
186+
self.window = gl.winopen('Vb video')
183187
self.settitle()
184188
if width:
185189
gl.maxsize(x, y)
@@ -194,23 +198,27 @@ def optfullsizewindow(self):
194198
if not self.window:
195199
return
196200
gl.winset(self.window)
197-
x, y = self.maxx, self.maxy
198-
gl.keepaspect(x, y)
199-
gl.stepunit(8, 6)
200-
if not self.use_24:
201-
gl.maxsize(x, y)
202-
gl.winconstraints()
203-
return
201+
if self.use_24:
202+
x, y = self.maxx, self.maxy
203+
else:
204+
x, y = self.curx, self.cury
204205
left, bottom = gl.getorigin()
205206
width, height = gl.getsize()
206207
bottom = bottom+height-y
207208
gl.prefposition(left, left+x-1, bottom, bottom+y-1)
208209
gl.winconstraints()
210+
if not self.use_24:
211+
gl.keepaspect(x, y)
212+
gl.stepunit(8, 6)
213+
gl.maxsize(self.maxx, self.maxy)
214+
gl.winconstraints()
209215
self.bindvideo()
210216

211217
def bindvideo(self):
212218
if not self.video: return
213219
x, y = gl.getsize()
220+
if not self.use_24:
221+
self.curx, self.cury = x, y
214222
self.video.SetSize(x, y)
215223
drop = self.b_drop.get_button()
216224
if drop:
@@ -607,7 +615,7 @@ def end_cont(self):
607615
def settitle(self):
608616
gl.winset(self.window)
609617
x, y = gl.getsize()
610-
title = 'Vb:' + self.vfile + ' (%dx%d)' % (x, y)
618+
title = 'Vb ' + self.vfile + ' (%dx%d)' % (x, y)
611619
gl.wintitle(title)
612620

613621
def get_vformat(self):
@@ -622,7 +630,6 @@ def get_vformat(self):
622630
self.g_burst.hide_object()
623631
self.g_single.hide_object()
624632
self.form.unfreeze_form()
625-
return
626633
else:
627634
self.g_video.show_object()
628635
if self.vmode == VM_CONT:
@@ -636,8 +643,7 @@ def get_vformat(self):
636643
self.mono = (format == 'mono')
637644
self.grey = (format[:4] == 'grey')
638645
self.use_24 = (format in ('rgb', 'jpeg'))
639-
# Does not work.... if self.use_24:
640-
if 0:
646+
if self.use_24 and 0: ### quarter/sixteenth decoding not impl.
641647
self.g_rgb24.show_object()
642648
else:
643649
self.g_rgb24.hide_object()

0 commit comments

Comments
 (0)