Exemplo n.º 1
0
	def quit(self, widget=None, event=None):
		## Quits the program.
		# Stop the player first to avoid tracebacks.
		player.stopCompletely()
		# Restore the screensaver.
		useful.resumeScr()
		# Save the configuration to the file.
		cfg.save()
		gtk.main_quit()
Exemplo n.º 2
0
	def onPlayerStateChange(self, message):
		# On a state change.
		msg = message.parse_state_changed()
		# Store the old and new states.
		old, new = msg[0], msg[1]
	
		if (old == gst.STATE_READY and new == gst.STATE_PAUSED):
			# The player has gone from stopped to paused.
			# Get the array of audio tracks.
			self.audioTracks = playerTools.getAudioLangArray(player)
			# Only enable the audio track menu item if there's more than one audio track.
			self.wTree.get_object('mnuiAudioTrack').set_sensitive(len(self.audioTracks) > 1)
		
		elif (old == gst.STATE_PAUSED and new == gst.STATE_PLAYING):
			# The player has just started.
			# Set the play/pause image to pause.
			self.playPauseChange(True)
			# Create the timers.
			self.createPlayTimers()
			
		elif (old == gst.STATE_PLAYING and new == gst.STATE_PAUSED):
			# It's just been paused or stopped.
			self.playPauseChange(False)
			# Destroy the play timers.
			self.destroyPlayTimers()
			# Restore the screensaver (if inhibited)
			useful.resumeScr()
			# Update the progress bar.
			self.progressUpdate()
			
		elif (old == gst.STATE_PAUSED and new == gst.STATE_READY):
			# Stop message (goes through paused when stopping).
			# Draw the background image.
			self.drawvideoWindowImage()
			# Reset the progress bar.
			self.progressUpdate()
			# Clear the title.
			self.setPlayingTitle(None)