← Back to team overview

openshot.code team mailing list archive

[Branch ~openshot.code/openshot/main] Rev 576: Folders were not setup correctly to handle labels. So, i added "label" and "unique_id" attribute...

 

------------------------------------------------------------
revno: 576
committer: Jonathan Thomas <Jonathan.Oomph@xxxxxxxxx>
branch nick: openshot
timestamp: Wed 2011-09-21 14:34:36 -0500
message:
  Folders were not setup correctly to handle labels.  So, i added "label" and "unique_id" attributes to the OpenShotFolder class, and correctly update the undo/redo history and project file tree.  Now folders can have labels just like files.
modified:
  openshot/classes/files.py
  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/classes/files.py'
--- openshot/classes/files.py	2011-09-21 19:22:20 +0000
+++ openshot/classes/files.py	2011-09-21 19:34:36 +0000
@@ -138,6 +138,9 @@
 		self.location = ""	  # file system location
 		self.parent = None
 		self.project = project
+		
+		self.label = ""		  # user description of the folder
+		self.unique_id = str(uuid.uuid1())
 
 		# init the list of files & folders
 		# this list can contain OpenShotFolder or OpenShotFile objects
@@ -635,3 +638,19 @@
 			
 			# mark project as modified
 			self.project.set_project_modified(is_modified=True, refresh_xml=False, type=_("Removed from folder"))
+			
+	#----------------------------------------------------------------------
+	def __setstate__(self, state):
+		""" This method is called when an OpenShot project file is un-pickled (i.e. opened).  It can
+		    be used to update the structure of old clip classes, to make old project files compatable with
+		    newer versions of OpenShot. """
+	
+		# Check for missing DEBUG attribute (which means it's an old project format)
+		if 'label' not in state:
+			state['label'] = ""
+		if 'unique_id' not in state:
+			state['unique_id'] = str(uuid.uuid1())
+
+		# update the state object with new schema changes
+		self.__dict__.update(state)
+		

=== modified file 'openshot/windows/MainGTK.py'
--- openshot/windows/MainGTK.py	2011-09-15 04:12:34 +0000
+++ openshot/windows/MainGTK.py	2011-09-21 19:34:36 +0000
@@ -1044,7 +1044,7 @@
 				elif isinstance(item, files.OpenShotFolder):
 					#add folders
 					pbThumb = self.treeFiles.render_icon(gtk.STOCK_DIRECTORY, gtk.ICON_SIZE_DIALOG)
-					self.OSTreeFiles.store.append(None, [pbThumb, "%s" % item.name, None, None, None])
+					self.OSTreeFiles.store.append(None, [pbThumb, "%s" % item.name, None, item.label, item.unique_id])
 			
 			# Check for NO files
 			if self.project.project_folder.items.__len__() == 0: