SF.net SVN: morphix: [2377] trunk/morphixinstaller2

[email protected] Mon, 31 Jul 2006 08:53:59 -0700
Newsgroups gmane.linux.morphix.cvs
Message-ID <[email protected]>
Revision: 2377
Author:   alextreme
Date:     2006-07-31 08:53:52 -0700 (Mon, 31 Jul 2006)
ViewCVS:  http://svn.sourceforge.net/morphix/?rev=2377&view=rev

Log Message:
-----------
  * attaching signals to the first few screens, minor lib_install and glade modifications (Mostly GtkCombo -> GtkComboBox transitions)

Modified Paths:
--------------
    trunk/morphixinstaller2/lib_install.py
    trunk/morphixinstaller2/morphixinstaller.glade
    trunk/morphixinstaller2/morphixinstaller.py
Modified: trunk/morphixinstaller2/lib_install.py
===================================================================
--- trunk/morphixinstaller2/lib_install.py	2006-07-30 22:17:40 UTC (rev 2376)
+++ trunk/morphixinstaller2/lib_install.py	2006-07-31 15:53:52 UTC (rev 2377)
@@ -26,7 +26,7 @@
 	
 		self.do_debug = 0
 
-		if not os.access(self.mkinitrd_path, X_OK):
+		if not os.access(self.mkinitrd_path, os.X_OK):
 			print("Error: Unable to find yaird, check your dependancies!")
 		
 
@@ -119,16 +119,19 @@
 		partition_array = partition_array[6:]
 		for partition in partition_array:
 			part_item = partition.split()
+			if len(part_item) < 5:
+				continue
 			name = part_item[0]
 			id = part_item[4]
 			size = part_item[3]
 
 			if int(id) <= 0:
 				continue
+			if size[-1] == '+':
+				size = size[:-1]
+			if (id == "83" and do_swap == False) or (id == "82" and do_swap == True):
+				ret_list += [[name, str(name) + " - size: " + str(int(size) / 1024) + " MB"]]
 
-			if (id == 83 and do_swap == False) or (id == 82 and do_swap == True):
-				ret_list += [[name, str(name) + " - size: " + str(size / 1024) + " MB"]]
-
 		if do_swap == True:
 			ret_list += [["none", "No Swap"]]
 

Modified: trunk/morphixinstaller2/morphixinstaller.glade
===================================================================
--- trunk/morphixinstaller2/morphixinstaller.glade	2006-07-30 22:17:40 UTC (rev 2376)
+++ trunk/morphixinstaller2/morphixinstaller.glade	2006-07-31 15:53:52 UTC (rev 2377)
@@ -76,7 +76,7 @@
 	      <property name="relief">GTK_RELIEF_NORMAL</property>
 	      <property name="focus_on_click">True</property>
 	      <property name="response_id">-5</property>
-	      <signal name="clicked" handler="on_okbuttonStart_clicked" last_modification_time="Fri, 31 Jan 2003 22:47:05 GMT"/>
+	      <signal name="clicked" handler="displaySelectHarddisk" last_modification_time="Mon, 31 Jul 2006 15:01:43 GMT"/>
 	    </widget>
 	  </child>
 	</widget>
@@ -367,7 +367,7 @@
 	      <property name="relief">GTK_RELIEF_NORMAL</property>
 	      <property name="focus_on_click">True</property>
 	      <property name="response_id">-11</property>
-	      <signal name="clicked" handler="gtk_widget_show" object="HelpDialog" last_modification_time="Mon, 17 Feb 2003 23:21:32 GMT"/>
+	      <signal name="clicked" handler="displayHelp" object="HelpDialog" last_modification_time="Mon, 31 Jul 2006 15:02:11 GMT"/>
 	    </widget>
 	  </child>
 
@@ -381,7 +381,7 @@
 	      <property name="relief">GTK_RELIEF_NORMAL</property>
 	      <property name="focus_on_click">True</property>
 	      <property name="response_id">-6</property>
-	      <signal name="clicked" handler="gtk_main_quit" last_modification_time="Fri, 31 Jan 2003 22:45:22 GMT"/>
+	      <signal name="clicked" handler="miSignalQuit" last_modification_time="Mon, 31 Jul 2006 15:02:32 GMT"/>
 	    </widget>
 	  </child>
 
@@ -397,7 +397,7 @@
 	      <property name="relief">GTK_RELIEF_NORMAL</property>
 	      <property name="focus_on_click">True</property>
 	      <property name="response_id">-5</property>
-	      <signal name="clicked" handler="on_okbuttonHarddisk_clicked" object="comboHarddisk" last_modification_time="Fri, 31 Jan 2003 22:46:28 GMT"/>
+	      <signal name="clicked" handler="displaySelectSwap" object="comboHarddisk" last_modification_time="Mon, 31 Jul 2006 15:02:49 GMT"/>
 	    </widget>
 	  </child>
 	</widget>
@@ -536,47 +536,6 @@
 		      <property name="column_spacing">4</property>
 
 		      <child>
-			<widget class="GtkCombo" id="comboHarddisk">
-			  <property name="visible">True</property>
-			  <property name="value_in_list">False</property>
-			  <property name="allow_empty">True</property>
-			  <property name="case_sensitive">False</property>
-			  <property name="enable_arrow_keys">True</property>
-			  <property name="enable_arrows_always">False</property>
-
-			  <child internal-child="entry">
-			    <widget class="GtkEntry" id="combo-entry1">
-			      <property name="visible">True</property>
-			      <property name="tooltip" translatable="yes">A list of harddisks, choose the one you want to install Morphix on</property>
-			      <property name="can_focus">True</property>
-			      <property name="editable">False</property>
-			      <property name="visibility">True</property>
-			      <property name="max_length">0</property>
-			      <property name="text" translatable="yes"></property>
-			      <property name="has_frame">True</property>
-			      <property name="invisible_char">*</property>
-			      <property name="activates_default">False</property>
-			      <signal name="activate" handler="on_combo_entrySelectHarddisk_activate" last_modification_time="Mon, 15 Mar 2004 23:46:04 GMT"/>
-			    </widget>
-			  </child>
-
-			  <child internal-child="list">
-			    <widget class="GtkList" id="combo-list1">
-			      <property name="visible">True</property>
-			      <property name="selection_mode">GTK_SELECTION_BROWSE</property>
-			    </widget>
-			  </child>
-			</widget>
-			<packing>
-			  <property name="left_attach">1</property>
-			  <property name="right_attach">2</property>
-			  <property name="top_attach">0</property>
-			  <property name="bottom_attach">1</property>
-			  <property name="y_options"></property>
-			</packing>
-		      </child>
-
-		      <child>
 			<widget class="GtkLabel" id="label45">
 			  <property name="visible">True</property>
 			  <property name="label" translatable="yes">Harddisk: </property>
@@ -633,7 +592,7 @@
 		      </child>
 
 		      <child>
-			<widget class="GtkComboBox" id="optionmenupartitioners">
+			<widget class="GtkComboBox" id="comboPartitioners">
 			  <property name="visible">True</property>
 			  <property name="add_tearoffs">False</property>
 			  <property name="focus_on_click">True</property>
@@ -647,6 +606,22 @@
 			  <property name="y_options">fill</property>
 			</packing>
 		      </child>
+
+		      <child>
+			<widget class="GtkComboBox" id="comboHarddisk">
+			  <property name="visible">True</property>
+			  <property name="add_tearoffs">False</property>
+			  <property name="focus_on_click">True</property>
+			</widget>
+			<packing>
+			  <property name="left_attach">1</property>
+			  <property name="right_attach">2</property>
+			  <property name="top_attach">0</property>
+			  <property name="bottom_attach">1</property>
+			  <property name="x_options">fill</property>
+			  <property name="y_options">fill</property>
+			</packing>
+		      </child>
 		    </widget>
 		    <packing>
 		      <property name="padding">0</property>
@@ -748,7 +723,7 @@
 	      <property name="relief">GTK_RELIEF_NORMAL</property>
 	      <property name="focus_on_click">True</property>
 	      <property name="response_id">-11</property>
-	      <signal name="clicked" handler="gtk_widget_show" object="HelpDialog" last_modification_time="Mon, 17 Feb 2003 23:21:46 GMT"/>
+	      <signal name="clicked" handler="displayHelp" object="HelpDialog" last_modification_time="Mon, 31 Jul 2006 15:03:01 GMT"/>
 	    </widget>
 	  </child>
 
@@ -762,7 +737,7 @@
 	      <property name="relief">GTK_RELIEF_NORMAL</property>
 	      <property name="focus_on_click">True</property>
 	      <property name="response_id">-6</property>
-	      <signal name="clicked" handler="on_cancelbuttonSwap_clicked" last_modification_time="Fri, 31 Jan 2003 22:48:03 GMT"/>
+	      <signal name="clicked" handler="displaySelectHarddisk" last_modification_time="Mon, 31 Jul 2006 15:03:24 GMT"/>
 	    </widget>
 	  </child>
 
@@ -778,7 +753,7 @@
 	      <property name="relief">GTK_RELIEF_NORMAL</property>
 	      <property name="focus_on_click">True</property>
 	      <property name="response_id">-5</property>
-	      <signal name="clicked" handler="on_okbuttonSwap_clicked" object="comboSwap" last_modification_time="Fri, 31 Jan 2003 22:48:36 GMT"/>
+	      <signal name="clicked" handler="displaySelectRoot" object="comboSwap" last_modification_time="Mon, 31 Jul 2006 15:03:34 GMT"/>
 	    </widget>
 	  </child>
 	</widget>
@@ -939,36 +914,10 @@
 		      </child>
 
 		      <child>
-			<widget class="GtkCombo" id="comboSwap">
+			<widget class="GtkComboBox" id="comboSwap">
 			  <property name="visible">True</property>
-			  <property name="value_in_list">False</property>
-			  <property name="allow_empty">True</property>
-			  <property name="case_sensitive">False</property>
-			  <property name="enable_arrow_keys">True</property>
-			  <property name="enable_arrows_always">False</property>
-
-			  <child internal-child="entry">
-			    <widget class="GtkEntry" id="combo-entry2">
-			      <property name="visible">True</property>
-			      <property name="tooltip" translatable="yes">A list of the detected swap partitions, use back if you want to make additional changes to your harddisk</property>
-			      <property name="can_focus">True</property>
-			      <property name="editable">False</property>
-			      <property name="visibility">True</property>
-			      <property name="max_length">0</property>
-			      <property name="text" translatable="yes"></property>
-			      <property name="has_frame">True</property>
-			      <property name="invisible_char">*</property>
-			      <property name="activates_default">False</property>
-			      <signal name="activate" handler="on_combo_entrySelectSwap_activate" last_modification_time="Mon, 15 Mar 2004 23:45:52 GMT"/>
-			    </widget>
-			  </child>
-
-			  <child internal-child="list">
-			    <widget class="GtkList" id="combo-list2">
-			      <property name="visible">True</property>
-			      <property name="selection_mode">GTK_SELECTION_BROWSE</property>
-			    </widget>
-			  </child>
+			  <property name="add_tearoffs">False</property>
+			  <property name="focus_on_click">True</property>
 			</widget>
 			<packing>
 			  <property name="padding">0</property>
@@ -1238,7 +1187,7 @@
 	      <property name="relief">GTK_RELIEF_NORMAL</property>
 	      <property name="focus_on_click">True</property>
 	      <property name="response_id">-11</property>
-	      <signal name="clicked" handler="gtk_widget_show" object="HelpDialog" last_modification_time="Mon, 17 Feb 2003 23:22:24 GMT"/>
+	      <signal name="clicked" handler="displayHelp" object="HelpDialog" last_modification_time="Mon, 31 Jul 2006 15:03:50 GMT"/>
 	    </widget>
 	  </child>
 
@@ -1252,7 +1201,7 @@
 	      <property name="relief">GTK_RELIEF_NORMAL</property>
 	      <property name="focus_on_click">True</property>
 	      <property name="response_id">-6</property>
-	      <signal name="clicked" handler="on_cancelbuttonRoot_clicked" last_modification_time="Fri, 31 Jan 2003 22:50:06 GMT"/>
+	      <signal name="clicked" handler="displaySelectSwap" last_modification_time="Mon, 31 Jul 2006 15:05:04 GMT"/>
 	    </widget>
 	  </child>
 
@@ -1268,7 +1217,7 @@
 	      <property name="relief">GTK_RELIEF_NORMAL</property>
 	      <property name="focus_on_click">True</property>
 	      <property name="response_id">-5</property>
-	      <signal name="clicked" handler="on_okbuttonRoot_clicked" object="comboRoot" last_modification_time="Fri, 31 Jan 2003 22:50:17 GMT"/>
+	      <signal name="clicked" handler="doFilesystem" object="comboRoot" last_modification_time="Mon, 31 Jul 2006 15:04:22 GMT"/>
 	    </widget>
 	  </child>
 	</widget>
@@ -1398,36 +1347,10 @@
 		  </child>
 
 		  <child>
-		    <widget class="GtkCombo" id="comboRoot">
+		    <widget class="GtkComboBox" id="comboRoot">
 		      <property name="visible">True</property>
-		      <property name="value_in_list">False</property>
-		      <property name="allow_empty">True</property>
-		      <property name="case_sensitive">False</property>
-		      <property name="enable_arrow_keys">True</property>
-		      <property name="enable_arrows_always">False</property>
-
-		      <child internal-child="entry">
-			<widget class="GtkEntry" id="combo-entry3">
-			  <property name="visible">True</property>
-			  <property name="tooltip" translatable="yes">A list of available partitions to install Morphix on. Choose back if you want to go back and repartition your harddisk</property>
-			  <property name="can_focus">True</property>
-			  <property name="editable">True</property>
-			  <property name="visibility">True</property>
-			  <property name="max_length">0</property>
-			  <property name="text" translatable="yes"></property>
-			  <property name="has_frame">True</property>
-			  <property name="invisible_char">*</property>
-			  <property name="activates_default">False</property>
-			  <signal name="activate" handler="on_combo_entrySelectRoot_activate" last_modification_time="Mon, 15 Mar 2004 23:45:40 GMT"/>
-			</widget>
-		      </child>
-
-		      <child internal-child="list">
-			<widget class="GtkList" id="combo-list3">
-			  <property name="visible">True</property>
-			  <property name="selection_mode">GTK_SELECTION_BROWSE</property>
-			</widget>
-		      </child>
+		      <property name="add_tearoffs">False</property>
+		      <property name="focus_on_click">True</property>
 		    </widget>
 		    <packing>
 		      <property name="padding">0</property>
@@ -1570,6 +1493,7 @@
 			      <child>
 				<widget class="GtkLabel" id="label42">
 				  <property name="visible">True</property>
+				  <property name="sensitive">False</property>
 				  <property name="label" translatable="yes">Expert: Add additional partitions</property>
 				  <property name="use_underline">True</property>
 				  <property name="use_markup">False</property>

Modified: trunk/morphixinstaller2/morphixinstaller.py
===================================================================
--- trunk/morphixinstaller2/morphixinstaller.py	2006-07-30 22:17:40 UTC (rev 2376)
+++ trunk/morphixinstaller2/morphixinstaller.py	2006-07-31 15:53:52 UTC (rev 2377)
@@ -44,65 +44,144 @@
 		self.SelectSwap.signal_autoconnect(self)
 		self.SelectRoot.signal_autoconnect(self)
 
+	def hide(self, screen, name):
+		s = screen.get_widget(name)
+		s.set_property("visible", False)
+
+	def show(self, screen, name):
+		s = screen.get_widget(name)
+		s.set_property("visible", True)
 		
 	def displaySelectHarddisk(self, widget):
 
-		screen = self.StartScreen.get_widget("StartScreen")
-		screen.set_property("visible", False)
-		screen = self.SelectHarddisk.get_widget("SelectHarddisk")
-		screen.set_property("visible", True)
+		# Show the Harddisk dialog
 
+		self.hide(self.StartScreen,    "StartScreen")
+		self.hide(self.SelectSwap,     "SelectSwap")
+		self.show(self.SelectHarddisk, "SelectHarddisk")
+
+		# Populate the harddisk and partitioner comboboxen
+
 		next = self.SelectHarddisk.get_widget("okbuttonHarddisk")
 		combo = self.SelectHarddisk.get_widget("comboHarddisk")
-		options = self.SelectHarddisk.get_widget("optionmenupartitioners")
+		partitioners = self.SelectHarddisk.get_widget("comboPartitioners")
 
 		hdd_list = self.installer.getHarddiskList()
-		if len(hdd_list) == 0:
-			next.set_property("sensitive", False)
-		else:
-			hdd_strings = []
-			for hdd_item in hdd_list:
-				hdd_strings += [hdd_item[1]]
-			print hdd_strings
-			combo.set_popdown_strings(hdd_strings)
 
+		liststore = gtk.ListStore(gobject.TYPE_STRING)
+		cell = gtk.CellRendererText()
+		combo.set_model(liststore)
+		combo.pack_start(cell, True)
+		combo.add_attribute(cell, 'text', 0)
+		hdd_strings = []
+		liststore.clear()
+		for hdd_item in hdd_list:
+			hdd_strings += [hdd_item[1]]
+			liststore.append([hdd_item[1]])
+		combo.set_active(0)
+		print hdd_strings
+	
 		pr = self.installer.getPartitioners(True)
 		liststore = gtk.ListStore(gobject.TYPE_STRING)
 		cell = gtk.CellRendererText()
-		options.set_model(liststore)
-		options.pack_start(cell, True)
-		options.add_attribute(cell, 'text', 0)
+		partitioners.set_model(liststore)
+		partitioners.pack_start(cell, True)
+		partitioners.add_attribute(cell, 'text', 0)
 		partition_strings = []
 		liststore.clear()
 		for pr_item in pr:
-			partition_strings += [pr_item[0]]
 			liststore.append([pr_item[0]])
-		options.set_active(0)
-		print partition_strings
-		
-		
+		partitioners.set_active(0)
 
 	def displaySelectSwap(self, widget):
 
-		screen = self.SelectHarddisk.get_widget("SelectHarddisk")
-		screen.set_property("visible", False)
-		screen = self.SelectSwap.get_widget("SelectSwap")
-		screen.set_property("visible", True)
+		# Store the selected harddisk and start the partitioner
 
+		hdd_list = self.installer.getHarddiskList()
+		pr = self.installer.getPartitioners(True)
+
+		combo = self.SelectHarddisk.get_widget("comboHarddisk")
+		partitioners = self.SelectHarddisk.get_widget("comboPartitioners")
+		hdd_item = combo.get_active()
+		par_item = partitioners.get_active()
+
+		if (hdd_item != -1 and par_item != -1):
+			harddisk = hdd_list[hdd_item]
+			partitioner = pr[par_item]
+			self.installer.selected_harddisk = harddisk[0]
+			self.installer.executeCommand(partitioner[1] + harddisk[0])
+		
+		# Show the Swap dialog
+
+		self.hide(self.SelectHarddisk, "SelectHarddisk")
+		self.hide(self.SelectRoot,     "SelectRoot")
+		self.show(self.SelectSwap,     "SelectSwap")
+
+		# Populate the swap combobox with swap partitions
+
+		combo = self.SelectSwap.get_widget("comboSwap")
+		part_list = self.installer.getPartitionList(self.installer.selected_harddisk, True)
+		liststore = gtk.ListStore(gobject.TYPE_STRING)
+		cell = gtk.CellRendererText()
+		combo.set_model(liststore)
+		combo.pack_start(cell, True)
+		combo.add_attribute(cell, 'text', 0)
+		liststore.clear()
+		for part_item in part_list:
+			liststore.append([part_item[1]])
+		combo.set_active(0)
+		
+
 	def displaySelectRoot(self, widget):
+		# Store the selected swap partition
 
-		screen = self.SelectSwap.get_widget("SelectSwap")
-		screen.set_property("visible", False)
-		screen = self.SelectRoot.get_widget("SelectRoot")
-		screen.set_property("visible", True)
+		combo = self.SelectSwap.get_widget("comboSwap")
+		part_list = self.installer.getPartitionList(self.installer.selected_harddisk, True)
 
+		part_item = combo.get_active()
+
+		if (part_item != -1):
+			partition = part_list[part_item]
+			self.installer.selected_swap = partition[0]
+
+		# Display the Root dialog
+
+		self.hide(self.SelectSwap, "SelectSwap")
+		self.show(self.SelectRoot, "SelectRoot")
+
+		# Populate the combobox with possible rootpartitions
+
+		combo = self.SelectRoot.get_widget("comboRoot")
+		part_list = self.installer.getPartitionList(self.installer.selected_harddisk)
+		liststore = gtk.ListStore(gobject.TYPE_STRING)
+		cell = gtk.CellRendererText()
+		combo.set_model(liststore)
+		combo.pack_start(cell, True)
+		combo.add_attribute(cell, 'text', 0)
+		partition_strings = []
+		liststore.clear()
+		for part_item in part_list:
+			partition_strings += [part_item[1]]
+			liststore.append([part_item[1]])
+		combo.set_active(0)
+		print partition_strings
+
 	def displayDoFilesystem(self, widget):
 
-		screen = self.SelectRoot.get_widget("SelectRoot")
-		screen.set_property("visible", False)
-		screen = self.DoFilesystem.get_widget("DoFilesystem")
-		screen.set_property("visible", True)
+		# Store the selected root partition
 
+		combo = self.SelectRoot.get_widget("comboRoot")
+		part_list = self.installer.getPartitionList(self.installer.selected_harddisk)
+
+		part_item = combo.get_active()
+
+		if (part_item != -1):
+			partition = part_list[part_item]
+			self.installer.selected_root = partition[0]
+
+		self.hide(self.SelectRoot, "SelectRoot")
+		self.show(self.DoInstall,  "DoInstall")
+
 	def miSignalQuit(self, widget):
 		sys.exit()
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV