Пример #1
0
	def start (self):
		if len (self.errors) == 0:
			e = operations.FinishedEvent (self, operations.SUCCESSFUL)
			for l in self.listeners:
				l.on_finished (e)
			return
				
		elif len (self.errors) > 1:
			title = "Unsupported file types"
		else:
			title = "Unsupported file type"
			
		filenames = []
		for e in self.errors:
			filenames.append (gnome.vfs.URI(e.uri).short_name)
		del self.__errors
		
		if len (filenames) == 1:
			msg = "The following files were not added:" + "\n"
		else:
			msg = "The following files were not added:" + "\n"
		
		msg +=  " " + filenames[0]
		
		for f in filenames[1:]:
			msg += ", " + f
		gtk_util.dialog_error (title, msg)
		
		e = operations.FinishedEvent (self, operations.SUCCESSFUL)
		for l in self.listeners:
			l.on_finished (e)
Пример #2
0
	def burn (self, *args):
		# Check if we have space available in our cache dir
		secs = 0
		for music in self.masterer.source:
			if not self.preferences.pool.is_available (music['uri']):
				secs += music['duration']
		# 44100hz * 16bit * 2channels / 8bits = 176400 bytes per sec
		size_needed = secs * 176400L
		s = os.statvfs (self.preferences.temporary_dir)
		size_avail = s[statvfs.F_BAVAIL] * long(s[statvfs.F_BSIZE])
		if (size_avail - size_needed) < 0:
			
			gtk_util.dialog_error ("Not enough space on cache directory",
				"Remove some music tracks or make sure your cache location location has enough free space (about %s)." % (self.__hig_bytes(size_needed - size_avail)), self)
			return
	
		if not self.preferences.temporary_dir_is_ok():
			gtk_util.dialog_warn ("Cache directory location unavailable", "Please check if the cache location exists and has writable permissions.", self)
			self.__on_preferences ()
			return
		if gtk_util.dialog_ok_cancel ("Do you want to continue?", "You are about to record a media disk. Canceling a writing operation will make your disk unusable.", self) != gtk.RESPONSE_OK:
			return
		r = RecordingMedia (self.masterer.source, self.preferences, self)
		r.start()