← Back to team overview

openshot.code team mailing list archive

[Branch ~openshot.code/openshot/main] Rev 658: Code clean up: removed some redundant code (the old slice & shuffle clips code).

 

------------------------------------------------------------
revno: 658
committer: Andy Finch <we.rocked.in79@xxxxxxxxx>
branch nick: openshot
timestamp: Sun 2012-04-29 22:26:55 +0100
message:
  Code clean up: removed some redundant code (the old slice & shuffle clips code).
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	2012-04-29 21:18:25 +0000
+++ openshot/windows/MainGTK.py	2012-04-29 21:26:55 +0000
@@ -4012,151 +4012,7 @@
 			self.project.Render()
 			self.form.refresh()
 		
-	def on_mnuSliceandShuffle_activate(self, event, *args):
-		""" Cut a clip into many small pieces and shuffle them """
-		print "on_mnuSliceandShuffle_activate"
-		import random
-		
-		# get correct gettext method
-		_ = self._
-		
-		# init the list of clips
-		min_random_length = 2.0
-		max_random_length = 2.0
-		list_of_clips = []
-		end_of_clip = False
-		
-		clip_start = self.selected_clip.start_time
-		clip_length = self.selected_clip.length()
-		clip_max_length = self.selected_clip.max_length
-		total_length = float(clip_start)
-		position_on_track = float(self.selected_clip.position_on_track)
-		
-		
-		# check for the minimun length validation
-		if clip_length <= max_random_length:
-			# show error
-			messagebox.show(_("Error!"), _("You must select a clip which is more than %s seconds long." % max_random_length))
-			return
-			
-		# loop through the clip, in increments of 2 to 5 seconds
-		while not end_of_clip:
-						
-			# random number between 2 and 5
-			random_length = float(random.Random().randint(min_random_length, max_random_length))
-
-			# add clip properties to list
-			list_of_clips.append([self.selected_clip.name, self.selected_clip.color, total_length, total_length + random_length, self.selected_clip.file_object, clip_max_length, random_length])
-
-			# increment running total 
-			total_length = total_length + random_length
-
-			# kill loop when we reach the end
-			if total_length + max_random_length >= clip_length:
-				end_of_clip = True
-
-				# add clip properties to list
-				list_of_clips.append([self.selected_clip.name, self.selected_clip.color, total_length, total_length + (clip_length - total_length), self.selected_clip.file_object, clip_max_length, random_length])
-			
-			
-		# shuffle the list of clips
-		random.shuffle(list_of_clips)
-		
-		# actually add the clips to the track
-		for clip in list_of_clips:
-			# add clip
-			Clip1 = self.selected_clip.parent.AddClip(clip[0], clip[1], position_on_track, clip[2], clip[3], clip[4])
-			Clip1.max_length = clip[5]
-			
-			# increment position_on_track
-			position_on_track = position_on_track + clip[6]
-			
-		# remove original clip from the timeline
-		self.selected_clip.parent.clips.remove(self.selected_clip)
-		
-		# mark project as modified
-		self.project.set_project_modified(is_modified=True, refresh_xml=True, type = _("Sliced and shuffled clip"))
-
-		# render timeline
-		self.form.refresh()
-		
-		
-	def on_mnuSliceandCut_activate(self, event, *args):
-		""" Cut a clip into many small pieces and shuffle them """
-		print "on_mnuSliceandCut_activate"
-		import random
-		
-		# get correct gettext method
-		_ = self._
-		
-		# init the list of clips
-		min_random_length = 2
-		max_random_length = 2
-		list_of_clips = []
-		end_of_clip = False
-		
-		clip_start = self.selected_clip.start_time
-		clip_length = self.selected_clip.length()
-		clip_max_length = self.selected_clip.max_length
-		total_length = float(clip_start)
-		position_on_track = float(self.selected_clip.position_on_track)
-		should_add = True
-		
-		# check for the minimun length validation
-		if clip_length <= max_random_length:
-			# show error
-			messagebox.show(_("Error!"), _("You must select a clip which is more than %s seconds long." % max_random_length))
-			return
-			
-		# loop through the clip, in increments of 2 to 5 seconds
-		while not end_of_clip:
-						
-			# random number between 2 and 5
-			#random_length = float(random.Random().randint(min_random_length, max_random_length))
-
-			# add clip properties to list
-			if should_add:
-				random_length = 2
-				list_of_clips.append([self.selected_clip.name, self.selected_clip.color, total_length, total_length + random_length, self.selected_clip.file_object, clip_max_length, random_length])
-				should_add = False
-			else:
-				random_length = 4
-				should_add = True
-
-			# increment running total 
-			total_length = total_length + random_length
-
-			# kill loop when we reach the end
-			if total_length + max_random_length >= clip_length:
-				end_of_clip = True
-
-				# add clip properties to list
-				if should_add:
-					list_of_clips.append([self.selected_clip.name, self.selected_clip.color, total_length, total_length + (clip_length - total_length), self.selected_clip.file_object, clip_max_length, random_length])
-					should_add = False
-				else:
-					should_add = True
-			
-
-		# actually add the clips to the track
-		for clip in list_of_clips:
-			# add clip
-			Clip1 = self.selected_clip.parent.AddClip(clip[0], clip[1], position_on_track, clip[2], clip[3], clip[4])
-			Clip1.max_length = clip[5]
-			
-			# increment position_on_track
-			position_on_track = position_on_track + clip[6]
-			
-		
-		# remove original clip from the timeline
-		self.selected_clip.parent.clips.remove(self.selected_clip)
-		
-		# mark project as modified
-		self.project.set_project_modified(is_modified=True, refresh_xml=True, type = _("Sliced and cut clips"))
-
-		# render timeline
-		self.form.refresh()
-		
+	
 		
 class mnuTree(SimpleGtkBuilderApp):