[jokosher-devel] [PATCH] bpm value fix



This patch fixes the problem where the bpm values entered were not
written to disk, when the project was saved.

John
Index: TransportManager.py
===================================================================
--- TransportManager.py	(revision 1014)
+++ TransportManager.py	(working copy)
@@ -45,7 +45,7 @@
 		self.pipeline = mainpipeline
 		self.position = 0
 		self.PrevPosition = 0
-		self.bpm = 120.			# Tempo in BPM
+		self.bpm = 120			# Tempo in BPM
 		self.meter_nom = 4		# Meter nominator
 		self.meter_denom = 4	# Meter denominator
 		
Index: TimeLineBar.py
===================================================================
--- TimeLineBar.py	(revision 1014)
+++ TimeLineBar.py	(working copy)
@@ -48,7 +48,7 @@
 		
 		self.bpmlabel = gtk.Label()
 		self.bpmlabel.set_use_markup(True)
-		self.bpmlabel.set_markup("<span foreground='#0b410b'><b>%s</b></span>"%self.project.transport.bpm)
+		self.bpmlabel.set_markup("<span foreground='#0b410b'><b>%s</b></span>"%self.project.transportbpm)
 		self.bpmlabel.set_padding(5, 5)
 		self.bpmeventbox.add(self.bpmlabel)
 		self.bpmframe.add(self.bpmeventbox)
@@ -98,7 +98,8 @@
 		self.add(self.hbox)
 		self.headerhbox.connect("check-resize", self.projectview.Update)
 		self.connect("size-allocate", self.OnAllocate)
-		self.hbox.pack_start(self.timeline)		
+		self.hbox.pack_start(self.timeline)	
+
 	
 	#_____________________________________________________________________
 
@@ -137,7 +138,6 @@
 			self.Updating = False
 
 		return
-
 	#_____________________________________________________________________
 	
 	def OnEditBPM(self, widget, event):
@@ -179,9 +179,10 @@
 		if self.bpmeditPacked:
 			self.bpmframe.remove(self.bpmedit)
 			#FIXME: find a better way to do project.PrepareClick() it doesn't take a really long time with large bpm
-			newbpm = self.bpmedit.get_text()
+			newbpm = self.bpmedit.get_value_as_int()
 			
 			self.project.transport.SetBPM(float(newbpm))
+			self.project.transportbpm = float(newbpm)
 			self.project.PrepareClick()
 			
 			self.bpmframe.add(self.bpmeventbox)
Index: Project.py
===================================================================
--- Project.py	(revision 1014)
+++ Project.py	(working copy)
@@ -132,6 +132,7 @@
 	
 	# Hack to set the transport mode
 	p.transport.SetMode(p.transportMode)
+	p.transport.SetBPM(p.transportbpm)
 	
 	try:
 		undo = doc.getElementsByTagName("Undo")[0]
@@ -341,7 +342,9 @@
 		self.__performingRedo = False	#True if we are currently in the process of performing a redo command
 		self.__savedUndo = False		#True if we are performing an undo/redo command that was previously saved
 		
+
 		
+		
 		# CREATE GSTREAMER ELEMENTS AND SET PROPERTIES#
 		self.mainpipeline = gst.Pipeline("timeline")
 		self.playbackbin = gst.Bin("playbackbin")
@@ -414,6 +417,8 @@
 		#initialize the transport mode
 		self.transportMode = TransportManager.TransportManager.MODE_BARS_BEATS
 		self.transport = TransportManager.TransportManager(self.transportMode, self.mainpipeline)
+		
+		self.transportbpm = self.transport.bpm
 
 		self.PrepareClick()
 
@@ -781,6 +786,7 @@
 		#sync the transport's mode with the one which will be saved
 		self.transportMode = self.transport.mode
 		
+		
 		self.unsavedChanges = False
 		#purge main undo stack so that it will not prompt to save on exit
 		self.__savedUndoStack.extend(self.__undoStack)
@@ -798,7 +804,7 @@
 		params = doc.createElement("Parameters")
 		head.appendChild(params)
 		
-		items = ["viewScale", "viewStart", "name", "author", "transportMode"]
+		items = ["viewScale", "viewStart", "name", "author", "transportMode", "transportbpm"]
 		
 		StoreParametersToXML(self, doc, params, items)
 			


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