Example #1
0
File: Vb.py Project: carol8421/gosh
	def get_vformat(self):
		i = self.c_vformat.get_choice()
		label = VideoFormatLabels[i-1]
		format = VideoFormats[i-1]
		if format == 'compress' and cl == None:
			fl.show_message('Sorry, no compression library support')
			format = ''
			label = 'Video off'
		self.vformat = format
		if self.vformat == '':
			self.form.freeze_form()
			self.g_video.hide_object()
			self.g_cont.hide_object()
			self.g_burst.hide_object()
			self.g_single.hide_object()
			self.form.unfreeze_form()
		else:
			self.g_video.show_object()
			if self.vmode == VM_CONT:
				self.g_cont.show_object()
			elif self.vmode == VM_BURST:
				self.g_burst.show_object()
			elif self.vmode == VM_SINGLE:
				self.g_single.show_object()
		#
		self.rgb = (format[:3] == 'rgb' or format == 'compress')
		self.mono = (format == 'mono')
		self.grey = (format[:4] == 'grey')
		self.use_24 = (format in ('rgb', 'jpeg', 'compress'))
		if self.use_24:
			self.g_rgb24.show_object()
		else:
			self.g_rgb24.hide_object()
		self.use_jpeg = (format == 'jpeg')
		self.mono_use_thresh = (label == 'mono thresh')
		self.use_compress = (format == 'compress')
		if self.use_compress:
			self.g_compress.show_object()
		else:
			self.g_compress.hide_object()
		s = format[4:]
		if self.grey and s:
			self.greybits = string.atoi(s)
		else:
			self.greybits = 8
		if label == 'grey2 dith':
			self.greybits = -2
		#
		convertor = None
		if self.grey:
			if self.greybits == 2:
				convertor = imageop.grey2grey2
			elif self.greybits == 4:
				convertor = imageop.grey2grey4
			elif self.greybits == -2:
				convertor = imageop.dither2grey2
		self.convertor = convertor
		self.optfullsizewindow()
Example #2
0
	def get_vformat(self):
		i = self.c_vformat.get_choice()
		label = VideoFormatLabels[i-1]
		format = VideoFormats[i-1]
		if format == 'compress' and cl == None:
			fl.show_message('Sorry, no compression library support')
			format = ''
			label = 'Video off'
		self.vformat = format
		if self.vformat == '':
			self.form.freeze_form()
			self.g_video.hide_object()
			self.g_cont.hide_object()
			self.g_burst.hide_object()
			self.g_single.hide_object()
			self.form.unfreeze_form()
		else:
			self.g_video.show_object()
			if self.vmode == VM_CONT:
				self.g_cont.show_object()
			elif self.vmode == VM_BURST:
				self.g_burst.show_object()
			elif self.vmode == VM_SINGLE:
				self.g_single.show_object()
		#
		self.rgb = (format[:3] == 'rgb' or format == 'compress')
		self.mono = (format == 'mono')
		self.grey = (format[:4] == 'grey')
		self.use_24 = (format in ('rgb', 'jpeg', 'compress'))
		if self.use_24:
			self.g_rgb24.show_object()
		else:
			self.g_rgb24.hide_object()
		self.use_jpeg = (format == 'jpeg')
		self.mono_use_thresh = (label == 'mono thresh')
		self.use_compress = (format == 'compress')
		if self.use_compress:
			self.g_compress.show_object()
		else:
			self.g_compress.hide_object()
		s = format[4:]
		if self.grey and s:
			self.greybits = string.atoi(s)
		else:
			self.greybits = 8
		if label == 'grey2 dith':
			self.greybits = -2
		#
		convertor = None
		if self.grey:
			if self.greybits == 2:
				convertor = imageop.grey2grey2
			elif self.greybits == 4:
				convertor = imageop.grey2grey4
			elif self.greybits == -2:
				convertor = imageop.dither2grey2
		self.convertor = convertor
		self.optfullsizewindow()
Example #3
0
File: Vb.py Project: carol8421/gosh
	def close_video(self):
		if not self.vout:
			return
		self.nframes = 0
		self.t_nframes.label = ''
		try:
			self.vout.close()
		except IOError, msg:
			if msg == (0, 'Error 0'):
				msg = 'disk full??'
			fl.show_message('IOError', str(msg), '')
Example #4
0
	def close_video(self):
		if not self.vout:
			return
		self.nframes = 0
		self.t_nframes.label = ''
		try:
			self.vout.close()
		except IOError, msg:
			if msg == (0, 'Error 0'):
				msg = 'disk full??'
			fl.show_message('IOError', str(msg), '')
Example #5
0
	def cb_vformat(self, *args):
		self.reset()
		self.get_vformat()
		if self.mono_use_thresh:
			s = `self.mono_thresh`
			s = fl.show_input('Please enter mono threshold', s)
			if s:
				try:
					self.mono_thresh = string.atoi(s)
				except string.atoi_error:
					fl.show_message('Bad input, using', \
						  `self.mono_thresh`, '')
		self.rebindvideo()
Example #6
0
File: Vb.py Project: carol8421/gosh
	def burst_capture(self):
		self.setwatch()
		gl.winset(self.window)
		x, y = gl.getsize()
		if self.use_24:
			fl.show_message('Sorry, no 24 bit continuous capture yet', '', '')
			return
		vformat = SV.RGB8_FRAMES
		nframes = self.getint(self.in_nframes, 0)
		if nframes == 0:
			maxmem = self.getint(self.in_maxmem, 1.0)
			memsize = int(maxmem * 1024 * 1024)
			nframes = self.calcnframes(memsize)
		info = (vformat, x, y, nframes, 1)
		try:
			info2, data, bitvec = self.video.CaptureBurst(info)
		except sv.error, msg:
			self.b_capture.set_button(0)
			self.setarrow()
			fl.show_message('Capture error:', str(msg), '')
			return
Example #7
0
	def burst_capture(self):
		self.setwatch()
		gl.winset(self.window)
		x, y = gl.getsize()
		if self.use_24:
			fl.show_message('Sorry, no 24 bit continuous capture yet', '', '')
			return
		vformat = SV.RGB8_FRAMES
		nframes = self.getint(self.in_nframes, 0)
		if nframes == 0:
			maxmem = self.getint(self.in_maxmem, 1.0)
			memsize = int(maxmem * 1024 * 1024)
			nframes = self.calcnframes(memsize)
		info = (vformat, x, y, nframes, 1)
		try:
			info2, data, bitvec = self.video.CaptureBurst(info)
		except sv.error, msg:
			self.b_capture.set_button(0)
			self.setarrow()
			fl.show_message('Capture error:', str(msg), '')
			return
Example #8
0
File: Vb.py Project: carol8421/gosh
	def write_frame(self, t, data):
		t = t * self.speed_factor
		if not self.vout:
			gl.ringbell()
			return 0
		if self.convertor:
			data = self.convertor(data, len(data), 1)
		elif self.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:
			self.vout.writeframe(int(t), data, None)
		except IOError, msg:
			self.reset()
			if msg == (0, 'Error 0'):
				msg = 'disk full??'
			fl.show_message('IOError', str(msg), '')
			return 0
Example #9
0
	def write_frame(self, t, data):
		t = t * self.speed_factor
		if not self.vout:
			gl.ringbell()
			return 0
		if self.convertor:
			data = self.convertor(data, len(data), 1)
		elif self.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:
			self.vout.writeframe(int(t), data, None)
		except IOError, msg:
			self.reset()
			if msg == (0, 'Error 0'):
				msg = 'disk full??'
			fl.show_message('IOError', str(msg), '')
			return 0
Example #10
0
#! /usr/bin/env python
Example #11
0
File: Vb.py Project: carol8421/gosh
	def vcr_error(self, msg):
		self.reset()
		fl.show_message('VCR error:', str(msg), '')
Example #12
0
	def vcr_error(self, msg):
		self.reset()
		fl.show_message('VCR error:', str(msg), '')
Example #13
0
#! /usr/bin/env python
Example #14
0
	def helpcallback(b, dummy):
		attrdef = MMAttrdefs.attrdefs[b.name]
		fl.show_message('attribute: ' + b.name, \
			'default: ' + b.valuerepr(b.defaultvalue), \
			attrdef[4])
Example #15
0
			'default: ' + b.valuerepr(b.defaultvalue), \
			attrdef[4])
		# 
	#
	def valuecallback(b, dummy):
		newtext = b.value.get_input()[:INPUT_MAX-1]
		if newtext = b.currenttext[:INPUT_MAX-1]:
			return # No change
		try:
			value = b.parsevalue(newtext)
		except (EOFError, SyntaxError, TypeError), msg:
			if type(msg) <> type(''):
				found, expected = msg
				msg = 'found ' + `found` + \
					', expected ' + expected
			fl.show_message('Type/Syntax error', msg, '')
			b.update()
			return
		b.changed = b.attreditor.changed = 1
		b.currentvalue = value
		b.isdefault = 0
		b.update()
	#
	def resetcallback(b, dummy):
		b.changed = b.attreditor.changed = 1
		b.isdefault = b.reset.get_button()
		if b.isdefault:
			b.lastvalue = b.currentvalue
			b.currentvalue = b.defaultvalue
		else:
			b.currentvalue = b.lastvalue