[jokosher-devel] [PATCH] Deleting recent projects



Often when I use Jokosher I'm not making a serious project but just opening it quickly to mess around with or test something out.

There's currently no quick way of deleting the project files from these tests (and hence separating them from stuff that I want to keep) when I open Jokosher. I've attached a quick patch to demonstrate what I mean, there is now a button on the initial dialog that allows you to delete project files that are in the recent project menu. Do people think this is necessary/useful?

Index: Jokosher.glade
===================================================================
--- Jokosher.glade	(revision 1464)
+++ Jokosher.glade	(working copy)
@@ -2745,6 +2745,86 @@
 		</packing>
 	      </child>
 
+	<child>
+		<widget class="GtkButton" id="button2">
+		  <property name="visible">True</property>
+		  <property name="tooltip" translatable="yes">Delete the highlighted project from the system</property>
+		  <property name="can_focus">True</property>
+		  <property name="relief">GTK_RELIEF_NORMAL</property>
+		  <property name="focus_on_click">True</property>
+		  <signal name="clicked" handler="on_removeproject_clicked"/>
+
+		  <child>
+		    <widget class="GtkAlignment" id="alignment6">
+		      <property name="visible">True</property>
+		      <property name="xalign">0.5</property>
+		      <property name="yalign">0.5</property>
+		      <property name="xscale">0</property>
+		      <property name="yscale">0</property>
+		      <property name="top_padding">0</property>
+		      <property name="bottom_padding">0</property>
+		      <property name="left_padding">0</property>
+		      <property name="right_padding">0</property>
+
+		      <child>
+			<widget class="GtkHBox" id="hbox7">
+			  <property name="visible">True</property>
+			  <property name="homogeneous">False</property>
+			  <property name="spacing">2</property>
+
+			  <child>
+			    <widget class="GtkImage" id="image32">
+			      <property name="visible">True</property>
+			      <property name="stock">gtk-delete</property>
+			      <property name="icon_size">4</property>
+			      <property name="xalign">0.5</property>
+			      <property name="yalign">0.5</property>
+			      <property name="xpad">0</property>
+			      <property name="ypad">0</property>
+			    </widget>
+			    <packing>
+			      <property name="padding">0</property>
+			      <property name="expand">False</property>
+			      <property name="fill">False</property>
+			    </packing>
+			  </child>
+
+			  <child>
+			    <widget class="GtkLabel" id="label26">
+			      <property name="visible">True</property>
+			      <property name="label" translatable="yes">_Delete Selected Project</property>
+			      <property name="use_underline">True</property>
+			      <property name="use_markup">False</property>
+			      <property name="justify">GTK_JUSTIFY_LEFT</property>
+			      <property name="wrap">False</property>
+			      <property name="selectable">False</property>
+			      <property name="xalign">0.5</property>
+			      <property name="yalign">0.5</property>
+			      <property name="xpad">0</property>
+			      <property name="ypad">0</property>
+			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			      <property name="width_chars">-1</property>
+			      <property name="single_line_mode">False</property>
+			      <property name="angle">0</property>
+			    </widget>
+			    <packing>
+			      <property name="padding">0</property>
+			      <property name="expand">False</property>
+			      <property name="fill">False</property>
+			    </packing>
+			  </child>
+			</widget>
+		      </child>
+		    </widget>
+		  </child>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
+
 	      <child>
 		<widget class="GtkButton" id="button3">
 		  <property name="visible">True</property>
Index: WelcomeDialog.py
===================================================================
--- WelcomeDialog.py	(revision 1464)
+++ WelcomeDialog.py	(working copy)
@@ -38,6 +38,7 @@
 		self.signals = {
 			"on_newproject_clicked" : self.OnNewProject,
 			"on_openproject_clicked" : self.OnOpenProject,
+			"on_removeproject_clicked" : self.OnRemoveProject,
 			"on_preferences_clicked" : self.OnPreferences,
 			"on_openrecentprojectbutton_clicked" : self.OnOpenRecentProjectButton,
 			"on_quit_clicked" : self.OnQuit,
@@ -103,10 +104,26 @@
 			button -- reserved for GTK callbacks, don't use it explicitly.
 		"""
 
-		# hide the welcome dislog and call OnOpenProject() from JokosherApp		
+		# hide the welcome dialog and call OnOpenProject() from JokosherApp		
 		self.window.hide()
 		self.mainwindow.OnOpenProject(self, self.OnDialogClose)
+
+	#_____________________________________________________________________
+			
+	def OnRemoveProject(self, button=None):
+		"""
+		Deletes the highlighted project.
 		
+		Parameters:
+			button -- reserved for GTK callbacks, don't use it explicitly.
+		"""
+
+		# Delete the project and refresh the list dialog		
+		item = self.model[self.tree.get_cursor()[0]]
+		os.remove(item[2])
+		self.mainwindow.OpenRecentProjects()
+		self.PopulateRecentProjects()
+		
 	#_____________________________________________________________________
 	
 	def OnPreferences(self, button):
@@ -221,4 +238,4 @@
 		Globals.settings.write()
 	
 	#_____________________________________________________________________
-#=========================================================================
\ No newline at end of file
+#=========================================================================


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