← Back to team overview

openshot.code team mailing list archive

[Branch ~openshot.code/openshot/main] Rev 540: Fixed regression with rev 504, which caused the "Convert to Image Sequence" to stop working. Als...

 

------------------------------------------------------------
revno: 540
committer: Jonathan Thomas <Jonathan.Oomph@xxxxxxxxx>
branch nick: openshot
timestamp: Fri 2011-09-02 00:33:27 -0500
message:
  Fixed regression with rev 504, which caused the "Convert to Image Sequence" to stop working.  Also fixed a related issue where the "please wait" cursor does not appear, due to the GUI being starved by the conversion process.  This feature now works from the Detail View, Thumbnail View, and from the Clip Right Click.
modified:
  openshot/windows/MainGTK.py


--
lp:openshot
https://code.launchpad.net/~openshot.code/openshot/main

Your team OpenShot Code is subscribed to branch lp:openshot.
To unsubscribe from this branch go to https://code.launchpad.net/~openshot.code/openshot/main/+edit-subscription
=== modified file 'openshot/windows/MainGTK.py'
--- openshot/windows/MainGTK.py	2011-09-01 06:16:50 +0000
+++ openshot/windows/MainGTK.py	2011-09-02 05:33:27 +0000
@@ -3847,7 +3847,7 @@
 		print "on_mnuConvertPartToImageSequence_activate"
 		
 		# change cursor to "please wait"
-		self.form.myTree.window.set_cursor(gtk.gdk.Cursor(150))
+		self.form.frmMain.window.set_cursor(gtk.gdk.Cursor(150))
 		
 		# get the clip
 		clip = self.selected_clip
@@ -3857,17 +3857,14 @@
 		start_time = clip.start_time
 		end_time = clip.end_time
 		
-		# make images
-		self.project.project_folder.ConvertFileToImages(f.name, start_time, end_time)
-				
-		# mark the project as modified
-		self.project.set_project_modified(is_modified=True, refresh_xml=True)
-				
-		# refresh the form (i.e. add new items to the treeview)
-		self.form.refresh()
-				
-		# set cursor to normal
-		self.form.myTree.window.set_cursor(None)	
+		# convert to image sequence
+		# Use idle_add() to prevent starving the GUI, so it sets the cursor correctly
+		# This basically queues up each of these commands... and they are executed one after another.
+		gobject.idle_add(self.project.project_folder.ConvertFileToImages, f.name, start_time, end_time)
+		gobject.idle_add(self.form.refresh)
+		gobject.idle_add(self.project.set_project_modified, True, True, _("Video converted to Image Sequence"))
+		gobject.idle_add(self.form.frmMain.window.set_cursor, None)
+
 		
 	def replace_clip(self, selected_clip, new_clip):
 		#this replaces the selected clip with a new clip
@@ -4413,31 +4410,40 @@
 	def on_mnuConvertToImages_activate(self, event, *args):
 		print "on_mnuConvertToImages_activate"
 		
+		# get translation method
+		_ = self._
 		
 		# change cursor to "please wait"
-		self.form.myTree.window.set_cursor(gtk.gdk.Cursor(150))
+		self.form.frmMain.window.set_cursor(gtk.gdk.Cursor(150))
+
+		# determine if detail view is visible
+		detail_view_visible = self.form.scrFileTree.get_property('visible')
 		
 		# loop through all selected files
 		iters = [self.model.get_iter(path) for path in self.selected]
 		for iter in iters:
+
+			unique_id = ""
 			
-			# get the file object
-			unique_id = self.model.get_value(iter, 3)
+			# find the unique id of the file
+			if detail_view_visible:
+				unique_id = self.model.get_value(iter, 4)
+			else:
+				unique_id = self.model.get_value(iter, 3)
+
+			# Get the file object
 			f = self.project.project_folder.FindFileByID(unique_id)
 			
 			# convert to image sequence
-			self.project.project_folder.ConvertFileToImages(f.name)
-
-		#mark the project as modified
-		self.project.set_project_modified(is_modified=True, refresh_xml=True)
-				
-		# refresh the form (i.e. add new items to the treeview)
-		self.form.refresh()
-				
-		# set cursor to normal
-		self.form.myTree.window.set_cursor(None)
-				
-			
+			# Use idle_add() to prevent starving the GUI, so it sets the cursor correctly
+			# This basically queues up each of these commands... and they are executed one after another.
+			gobject.idle_add(self.project.project_folder.ConvertFileToImages, f.name)
+			gobject.idle_add(self.form.refresh)
+			gobject.idle_add(self.project.set_project_modified, True, False, _("Video converted to Image Sequence"))
+			gobject.idle_add(self.form.frmMain.window.set_cursor, None)
+
+
+		
 	def on_mnuAddFile_activate(self, event, *args):
 		self.import_files_dialog = AddFiles.frmAddFiles(form=self.form, project=self.project)