[jokosher-devel] [PATCH] active project menu item removed from recentprojectitems. time sig value gets written to disk. user informed of unsaved changes if a new or recent project is opened.



Hello everyone,

This patch will remove the active project menu item from
recentprojectitems. Its no longer a recent project so it shouldnt be
there. The time signature value now gets written to disk. 

When selecting a recent project or opening a new project, Jokosher will
now warn the user if there are unsaved changes on the current project.
Jokosher will then offer the user the ability to save the changes, close
the project without saving the changes or cancel opening a new project
or a recent project.

John
Index: TimeLineBar.py
===================================================================
--- TimeLineBar.py	(revision 1017)
+++ TimeLineBar.py	(working copy)
@@ -64,7 +64,7 @@
 
 		self.siglabel = gtk.Label()
 		self.siglabel.set_use_markup(True)
-		self.siglabel.set_markup("<span foreground='#0b410b'><b>%d/%d</b></span>"%(self.project.transport.meter_nom, self.project.transport.meter_denom))
+		self.siglabel.set_markup("<span foreground='#0b410b'><b>%d/%d</b></span>"%(self.project.transportnom, self.project.transportdenom))
 		self.siglabel.set_padding(5, 5)
 		self.sigeventbox.add(self.siglabel)
 		self.sigframe.add(self.sigeventbox)
@@ -206,12 +206,12 @@
 			try:
 				nom=int(sig[0])
 			except (ValueError,IndexError):
-				nom=self.project.transport.meter_nom
+				nom=self.project.transportnom
 
 			try:
 				denom=int(sig[1])
 			except (ValueError,IndexError):
-				denom=self.project.transport.meter_denom
+				denom=self.project.transport.denom
 			
 			if not self.sigedit.get_text() or nom == 0:
 				nom = 4
@@ -222,6 +222,8 @@
 				self.sigeditPacked = False
 								 
 			self.project.transport.SetMeter(nom, denom)
+			self.project.transportnom = nom
+			self.project.transportdenom = denom
 			
 			self.sigframe.add(self.sigeventbox)
 			self.sigedit.destroy()
@@ -230,7 +232,7 @@
 		
 		#Do this outside the if statement so that it gets updated if someone else changes the sig
 		self.siglabel.set_use_markup(True)
-		self.siglabel.set_markup("<span foreground='#0b410b'><b>%d/%d</b></span>"%(self.project.transport.meter_nom, self.project.transport.meter_denom))
+		self.siglabel.set_markup("<span foreground='#0b410b'><b>%d/%d</b></span>"%(self.project.transportnom, self.project.transportdenom))
 		self.projectview.UpdateSize()
 			
 	#_____________________________________________________________________
Index: Project.py
===================================================================
--- Project.py	(revision 1017)
+++ Project.py	(working copy)
@@ -133,6 +133,7 @@
 	# Hack to set the transport mode
 	p.transport.SetMode(p.transportMode)
 	p.transport.SetBPM(p.transportbpm)
+	p.transport.SetMeter(p.transportnom, p.transportdenom)
 	
 	try:
 		undo = doc.getElementsByTagName("Undo")[0]
@@ -419,6 +420,8 @@
 		self.transport = TransportManager.TransportManager(self.transportMode, self.mainpipeline)
 		
 		self.transportbpm = self.transport.bpm
+		self.transportnom = self.transport.meter_nom
+		self.transportdenom = self.transport.meter_denom
 
 		self.PrepareClick()
 
@@ -786,6 +789,8 @@
 		#sync the transport's mode with the one which will be saved
 		self.transportMode = self.transport.mode
 		self.transportbpm = self.transport.bpm
+		self.transportnom = self.transport.meter_nom
+		self.transportdenom = self.transport.meter_denom
 		
 		
 		self.unsavedChanges = False
@@ -805,7 +810,7 @@
 		params = doc.createElement("Parameters")
 		head.appendChild(params)
 		
-		items = ["viewScale", "viewStart", "name", "author", "transportMode", "transportbpm"]
+		items = ["viewScale", "viewStart", "name", "author", "transportMode", "transportbpm", "transportnom", "transportdenom"]
 		
 		StoreParametersToXML(self, doc, params, items)
 			
Index: JokosherApp.py
===================================================================
--- JokosherApp.py	(revision 1017)
+++ JokosherApp.py	(working copy)
@@ -731,6 +731,7 @@
 				Globals.settings.general["projectfolder"] = os.path.dirname(filename)
 				Globals.settings.write()
 				if self.OpenProjectFromPath(filename,chooser):
+					self.PopulateRecentProjects()
 					break
 				
 			elif response == gtk.RESPONSE_CANCEL or response == gtk.RESPONSE_DELETE_EVENT:
@@ -992,6 +993,7 @@
 		
 		if self.recentprojectitems:
 			tooltips = gtk.Tooltips()
+			
 			for item in self.recentprojectitems:
 				mitem = gtk.MenuItem(item[1])
 				tooltips.set_tip(mitem, item[0], None)
@@ -1009,6 +1011,8 @@
 			
 			self.recentprojects.set_sensitive(True)
 			self.recentprojectsmenu.show_all()
+			child = self.recentprojectsmenu.get_children()[0]
+			self.recentprojectsmenu.remove(child)
 		else:
 			#there are no items, so just make it insensitive
 			self.recentprojects.set_sensitive(False)
@@ -1052,7 +1056,12 @@
 			path -- path to the project file.
 			name -- name of the project being opened.
 		"""
-		return self.OpenProjectFromPath(path)
+		
+		if self.CloseProject() == 1:
+			return
+		else:
+			return self.OpenProjectFromPath(path)
+		
 
 	#_____________________________________________________________________
 


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