Skip to content

Commit

Permalink
Use groups to show/hide "Stop capture" button.
Browse files Browse the repository at this point in the history
Made mono capture work.
Don't support rgb24 capture (the code for this doesn't exist in Vrec either!).
  • Loading branch information
gvanrossum committed May 6, 1993
1 parent b7e3cc1 commit e17c6c3
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 13 deletions.
34 changes: 23 additions & 11 deletions Demo/sgi/video/Vb.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def main():

StopCapture = 'StopCapture'

formats = ['rgb24', 'rgb8', 'grey8', 'grey4', 'grey2', \
formats = ['rgb8', 'grey8', 'grey4', 'grey2', \
'grey2_dith', 'mono_dith', 'mono_thresh']
formatmap = {'rgb24': 'rgb', 'grey8': 'grey'}

Expand All @@ -42,12 +42,12 @@ class VideoBagOfTricks:
def init(self):
formdef = flp.parse_form('VbForm', 'form')
flp.create_full_form(self, formdef)
self.g_stop.hide_object()
self.setdefaults()
self.openvideo()
self.makewindow()
self.bindvideo()
self.capturing = 0
self.b_stop.hide_object()
self.form.show_form(FL.PLACE_SIZE, FL.TRUE, \
'Video Bag Of Tricks')
fl.set_event_call_back(self.do_event)
Expand Down Expand Up @@ -223,6 +223,7 @@ def cb_stop(self, *args):

def cb_capture(self, *args):
self.setwatch()
self.g_main.hide_object()
self.cb_file() # Make sure filename is OK
filename = self.in_file.get_input()
format = self.getformat()
Expand All @@ -246,6 +247,7 @@ def cb_capture(self, *args):
convertor = imageop.grey2grey4
elif greybits == -2:
convertor = imageop.dither2grey2
mono = (format == 'mono')
vformat = SV.RGB8_FRAMES
qsize = 0
rate = eval(self.in_rate.get_input())
Expand All @@ -254,13 +256,12 @@ def cb_capture(self, *args):
tpf = 50
self.video.InitContinuousCapture(info)
self.capturing = 1
self.g_stop.show_object()
self.setarrow()
self.b_stop.show_object()
while 1:
try:
void = fl.check_forms()
except StopCapture:
self.capturing = 0
break
try:
cd, id = self.video.GetCaptureData()
Expand All @@ -274,16 +275,27 @@ def cb_capture(self, *args):
t = id*tpf
if convertor:
data = convertor(data, len(data), 1)
## elif mono and monotreshold >= 0:
## data = imageop.grey2mono(data, len(data), 1,\
## monotreshold)
## elif mono:
## data = imageop.dither2mono(data, len(data), 1)
vout.writeframe(t, data, None)
elif mono:
if self.mono_use_thresh:
data = imageop.grey2mono(data, \
len(data), 1,\
self.mono_thresh)
else:
data = imageop.dither2mono(data, \
len(data), 1)
try:
vout.writeframe(t, data, None)
except IOError, msg:
if msg == (0, 'Error 0'):
msg = 'disk full??'
fl.show_message('IOError: ' + str(msg))
break
self.setwatch()
self.g_stop.hide_object()
self.capturing = 0
vout.close()
self.b_stop.hide_object()
self.video.EndContinuousCapture()
self.g_main.show_object()
self.setarrow()

def cb_quit(self, *args):
Expand Down
64 changes: 62 additions & 2 deletions Demo/sgi/video/VbForm.fd
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Number of forms: 1
Name: form
Width: 350.000000
Height: 240.000000
Number of Objects: 17
Number of Objects: 21

--------------------
class: 1
Expand All @@ -26,6 +26,21 @@ name:
callback:
argument:

--------------------
class: 10000
type: 0
box: 0.000000 0.000000 0.000000 0.000000
boxtype: 0
colors: 0 0
alignment: 4
style: 0
size: 11.000000
lcol: 0
label:
name: g_main
callback:
argument:

--------------------
class: 1
type: 2
Expand Down Expand Up @@ -251,10 +266,40 @@ name: c_format
callback: cb_format
argument: 0

--------------------
class: 20000
type: 0
box: 0.000000 0.000000 0.000000 0.000000
boxtype: 0
colors: 0 0
alignment: 4
style: 0
size: 11.000000
lcol: 0
label:
name:
callback:
argument:

--------------------
class: 10000
type: 0
box: 0.000000 0.000000 0.000000 0.000000
boxtype: 0
colors: 0 0
alignment: 4
style: 0
size: 11.000000
lcol: 0
label:
name: g_stop
callback:
argument:

--------------------
class: 11
type: 0
box: 0.000000 0.000000 350.000000 240.000000
box: 10.000000 10.000000 330.000000 220.000000
boxtype: 1
colors: 47 47
alignment: 4
Expand All @@ -266,5 +311,20 @@ name: b_stop
callback: cb_stop
argument: 0

--------------------
class: 20000
type: 0
box: 0.000000 0.000000 0.000000 0.000000
boxtype: 0
colors: 0 0
alignment: 4
style: 0
size: 11.000000
lcol: 0
label:
name:
callback:
argument:

==============================
create_the_forms

0 comments on commit e17c6c3

Please sign in to comment.