[jokosher-devel] [PATCH] undo/redo/loading for transport mode



Small patch that adds undo/redo and loading for the transport mode.


Jens
Index: Jokosher.py
===================================================================
--- Jokosher.py	(revision 571)
+++ Jokosher.py	(working copy)
@@ -493,14 +493,18 @@
 	#_____________________________________________________________________
 	
 	def OnShowBarsBeats(self, widget):
-		if self.project and self.project.transport:
-			self.project.transport.SetMode(self.project.transport.MODE_BARS_BEATS)
+		if self.settingButtons:
+			return
+		if widget.get_active() and self.project and self.project.transport:
+			self.project.SetTransportMode(self.project.transport.MODE_BARS_BEATS)
 		
 	#_____________________________________________________________________
 	
 	def OnShowHoursMins(self, widget):
-		if self.project and self.project.transport:
-			self.project.transport.SetMode(self.project.transport.MODE_HOURS_MINS_SECS)
+		if self.settingButtons:
+			return
+		if widget.get_active() and self.project and self.project.transport:
+			self.project.SetTransportMode(self.project.transport.MODE_HOURS_MINS_SECS)
 		
 	#_____________________________________________________________________
 	
Index: Project.py
===================================================================
--- Project.py	(revision 571)
+++ Project.py	(working copy)
@@ -92,6 +92,9 @@
 	
 	LoadParametersFromXML(p, params)
 	
+	# Hack to set the transport mode
+	p.transport.SetMode(p.transportMode)
+	
 	try:
 		undo = doc.getElementsByTagName("Undo")[0]
 	except IndexError:
@@ -931,8 +934,18 @@
 			raise InvalidProjectError(unknownfiles,unknownimages)
 
 		return True
+	
+	#_____________________________________________________________________
+	
+	def SetTransportMode(self, val):
+		"""
+			Sets the Mode in the Transportmanager. Used to enable Undo/Redo.
+			
+			undo : SetTransportMode(%(temp)d)
+		"""
+		self.temp = self.transport.mode
+		self.transport.SetMode(val)
 
-
 #=========================================================================
 	
 class OpenProjectError(EnvironmentError):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]