Re: [jokosher-devel] [PATCH] new project complains if project dir doesn't exist



Found a few more places where the same issue existed, this time diff is attached :)

-josh

Laszlo Pandy wrote:
Josh Steiner wrote:
Hey guys, my first of hopefully many patches (created with "svn diff") is below.

The new proj dialog seems to try to default to the last folder you saved a project to, but if it doesn't exist the GtkFileChooserButton complains in an ugly fashion... this just checks if it exists, if not it defaults to the users home dir.

-Josh

---

Index: NewProjectDialog.py
===================================================================
--- NewProjectDialog.py    (revision 1477)
+++ NewProjectDialog.py    (working copy)
@@ -92,7 +92,10 @@
         self.okbutton.grab_default()
# Set the default folder of 'folder' (a FileChooserButton) - self.folder.set_current_folder(Globals.settings.general["projectfolder"])
+        if os.path.exists(Globals.settings.general["projectfolder"]):
+ self.folder.set_current_folder(Globals.settings.general["projectfolder"])
+        else:
+            self.folder.set_current_folder(os.path.expanduser("~"))
self.dlg.resize(350, 300)
         self.dlg.set_icon(self.parent.icon)


Committed. Thanks dude. :)
Next time can you send the patch as a file attachment. It looks like your text wrapping mangled the patch above and I had to apply it by hand.

Laszlo
_______________________________________________
jokosher-devel-list mailing list
jokosher-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/jokosher-devel-list


--
________________________________________________________________
tasty electronic music vittles      --  bluevitriol.com
the only music blog you need        --  playtherecords.com
you are the dj.  interactive music  --  improbableorchestra.com
random observations of the bizarre  --  vitriolix.com

Index: MixdownActions.py
===================================================================
--- MixdownActions.py	(revision 1478)
+++ MixdownActions.py	(working copy)
@@ -358,7 +358,10 @@
 			widget -- reserved for GTK callbacks, don't use it explicitly.
 		"""
 		chooser = gtk.FileChooserDialog((_('Select Export Location')), None, gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER, (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN, gtk.RESPONSE_OK))
-		chooser.set_current_folder(Globals.settings.general["projectfolder"])
+		if os.path.exists(Globals.settings.general["projectfolder"]):
+			chooser.set_current_folder(Globals.settings.general["projectfolder"])
+		else:
+			chooser.set_current_folder(os.path.expanduser("~"))
 		chooser.set_icon(self.dialogIcon)
 
 		chooser.set_default_response(gtk.RESPONSE_OK)
@@ -476,7 +479,10 @@
 		See MixdownAction.ConfigureAction.
 		"""
 		chooser = gtk.FileChooserDialog((_("Run External Script")), None, gtk.FILE_CHOOSER_ACTION_OPEN, (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN, gtk.RESPONSE_OK))
-		chooser.set_current_folder(Globals.settings.general["projectfolder"])
+		if os.path.exists(Globals.settings.general["projectfolder"]):
+			chooser.set_current_folder(Globals.settings.general["projectfolder"])
+		else:
+			chooser.set_current_folder(os.path.expanduser("~"))
 		chooser.set_icon(self.dialogIcon)
 
 		chooser.set_default_response(gtk.RESPONSE_OK)
@@ -513,4 +519,4 @@
 				
 	#_____________________________________________________________________
 	
-#=========================================================================
\ No newline at end of file
+#=========================================================================
Index: JokosherApp.py
===================================================================
--- JokosherApp.py	(revision 1478)
+++ JokosherApp.py	(working copy)
@@ -601,7 +601,10 @@
 		"""
 		buttons = (gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_SAVE,gtk.RESPONSE_OK)
 		chooser = gtk.FileChooserDialog(_("Mixdown Project"), self.window, gtk.FILE_CHOOSER_ACTION_SAVE, buttons)
-		chooser.set_current_folder(Globals.settings.general["projectfolder"])
+		if os.path.exists(Globals.settings.general["projectfolder"]):
+			chooser.set_current_folder(Globals.settings.general["projectfolder"])
+		else:
+			chooser.set_current_folder(os.path.expanduser("~"))
 		chooser.set_do_overwrite_confirmation(True)
 		chooser.set_default_response(gtk.RESPONSE_OK)
 		chooser.set_current_name(self.project.name)
@@ -724,7 +727,10 @@
 								dialog gets destroyed.
 		"""
 		chooser = gtk.FileChooserDialog((_('Choose a Jokosher project file')), None, gtk.FILE_CHOOSER_ACTION_OPEN, (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN, gtk.RESPONSE_OK))
-		chooser.set_current_folder(Globals.settings.general["projectfolder"])
+		if os.path.exists(Globals.settings.general["projectfolder"]):
+			chooser.set_current_folder(Globals.settings.general["projectfolder"])
+		else:
+			chooser.set_current_folder(os.path.expanduser("~"))
 
 		chooser.set_default_response(gtk.RESPONSE_OK)
 		chooser.set_transient_for(self.window)
@@ -787,8 +793,12 @@
 		chooser.set_do_overwrite_confirmation(True)
 		chooser.set_current_name(self.project.name)
 		chooser.set_default_response(gtk.RESPONSE_OK)
-		chooser.set_current_folder(Globals.settings.general["projectfolder"])
+		if os.path.exists(Globals.settings.general["projectfolder"]):
+			chooser.set_current_folder(Globals.settings.general["projectfolder"])
+		else:
+			chooser.set_current_folder(os.path.expanduser("~"))
 
+
 		response = chooser.run()
 		if response == gtk.RESPONSE_OK:
 			filename = chooser.get_filename()
@@ -1855,7 +1865,10 @@
 		dlg = gtk.FileChooserDialog(_("Add Audio File..."), action=gtk.FILE_CHOOSER_ACTION_OPEN, buttons=buttons)
 		dlg.set_default_response(gtk.RESPONSE_OK)
 		dlg.set_icon(self.icon)
-		dlg.set_current_folder(Globals.settings.general["projectfolder"])
+		if os.path.exists(Globals.settings.general["projectfolder"]):
+			dlg.set_current_folder(Globals.settings.general["projectfolder"])
+		else:
+			dlg.set_current_folder(os.path.expanduser("~"))
 		dlg.set_extra_widget(copyfile)
 		dlg.set_select_multiple(True)
 		


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