SF.net SVN: morphix: [2359] trunk/morphixinstaller2
[email protected] Mon, 17 Jul 2006 17:55:16 -0700
| Newsgroups | gmane.linux.morphix.cvs |
|---|---|
| Message-ID | <[email protected]> |
Revision: 2359
Author: alextreme
Date: 2006-07-17 17:55:12 -0700 (Mon, 17 Jul 2006)
ViewCVS: http://svn.sourceforge.net/morphix/?rev=2359&view=rev
Log Message:
-----------
* getting to grips with pygtk
Modified Paths:
--------------
trunk/morphixinstaller2/lib_install.py
trunk/morphixinstaller2/morphixinstaller.py
Modified: trunk/morphixinstaller2/lib_install.py
===================================================================
--- trunk/morphixinstaller2/lib_install.py 2006-07-16 23:22:05 UTC (rev 2358)
+++ trunk/morphixinstaller2/lib_install.py 2006-07-18 00:55:12 UTC (rev 2359)
@@ -1,61 +1,164 @@
+import os
-def getKernelVersion():
+class Installer:
-def getHarddiskList():
+ def __init__(self):
+ self.max_expert_mounts = 4
+ self.path_mnt_dir = '/mnt'
+ self.grub_menu_location = '/boot/grub/menu.lst'
+ self.grub_dir = '/grub'
+ self.proc_cmdline = '/proc/cmdline'
+ self.proc_partitions = '/proc/partitions'
+ self.proc_modules = '/proc/modules'
-def getPartitionList():
+ self.cfdisk_path = '/sbin/cfdisk'
+ self.pm_path = '/usr/sbin/partitionmorpher'
+ self.qtparted_path = '/usr/bin/qtparted'
+ self.gparted_path = '/usr/bin/gparted'
+ self.parted_path = '/sbin/parted'
-def getExpertPartitionList():
+ self.selected_harddisk = None
+ self.selected_swap = None
+ self.selected_root = None
+
+ self.do_debug = 0
-def unmountHarddiskPartitions(harddisk):
+ def debug(self, string):
+ if self.do_debug == 1:
+ print(string)
-def initInstallProcess():
+ def executeCommand(self, command):
+ fd = os.popen(command)
+ data = fd.read()
+ fd.close()
+ return data
-def startPartitioner(harddisk, partitioner, xfree86):
+ def getContents(self, file):
+ fd = open(file, "r")
+ if fd == None or fd == False:
+ return None
+ data = fd.read()
+ fd.close()
+ return data
-def getPartitionerCommands(harddisk, xfree86):
+ def getKernelVersion(self):
+ return self.executeCommand('uname -r')
+
+ def getHarddiskList(self):
+ hdd_list = []
-def getPartitionerNames(xfree86):
+ part_data = self.getContents(self.proc_partitions)
+ part_list = part_data.split("\n")
+ part_list = part_list[2:]
-def makeSwap():
+ for part_item in part_list:
+ data = part_item.split()
+ if len(data) < 3:
+ continue
+ print data
+ size = float(data[2]) / 1024
+ name = data[3]
+ if name[:2] != "hd" and name[:2] != "md" and name[:2] != "sd":
+ continue
+ if name[-1:].isalpha() == False:
+ continue
-def makeFilesystem(partition, filesystem):
+ # TODO: md drives
-def makeRoot():
+ if name[:2] == "hd":
+ media = self.getContents("/proc/ide/" + str(name) + "/model")
+ if media == None:
+ hdd_name = "RAID: " + str(name)
+ else:
+ hdd_name = str(name) + " with " + str(size) + " MiB, " + str(media)
+
+ if name[:2] == "sd":
+ hdd_name = str(name) + " with " + str(size) + " MiB, SCSI"
-def getTotalPartitionSize():
+ hdd_list += [[name, hdd_name]]
-def getCdromSize():
+ return hdd_list
-def getPartitionSizeUsed():
+ def getPartitionList():
+ return
-def getCurrentPercentage():
+ def getExpertPartitionList():
+ return []
-def executeMinimoduleInstallscripts():
+ def unmountHarddiskPartitions(harddisk):
+ return
-def mountPartition(partition, destination):
+ def initInstallProcess():
+ return
-def umountTarget():
+ def startPartitioner(harddisk, partitioner, xfree86):
+ return
-def buildRoot():
+ def getPartitionerCommands(harddisk, xfree86):
+ return
-def copyKernel():
+ def getPartitionerNames(xfree86):
+ return
-def setupEtcFiles(hostname):
+ def makeSwap():
+ return
-def setRootPassword(password):
+ def makeFilesystem(partition, filesystem):
+ return
-def setupHomeDirectory(username, password):
+ def makeRoot():
+ return
-def getKernelArguments():
+ def getTotalPartitionSize():
+ return
+
+ def getCdromSize():
+ return
-def setupGrub(grub_mode):
+ def getPartitionSizeUsed():
+ return
-def setupDMA():
+ def getCurrentPercentage():
+ return
-def execPreinstallScript():
+ def executeMinimoduleInstallscripts():
+ return
-def execPostinstallScript():
+ def mountPartition(partition, destination):
+ return
-def makeGrubBootfloppy():
+ def umountTarget():
+ return
+ def buildRoot():
+ return
+
+ def copyKernel():
+ return
+
+ def setupEtcFiles(hostname):
+ return
+
+ def setRootPassword(password):
+ return
+
+ def setupHomeDirectory(username, password):
+ return
+
+ def getKernelArguments():
+ return
+
+ def setupGrub(grub_mode):
+ return
+
+ def setupDMA():\
+ return
+
+ def execPreinstallScript():
+ return
+
+ def execPostinstallScript():
+ return
+
+ def makeGrubBootfloppy():
+ return
Modified: trunk/morphixinstaller2/morphixinstaller.py
===================================================================
--- trunk/morphixinstaller2/morphixinstaller.py 2006-07-16 23:22:05 UTC (rev 2358)
+++ trunk/morphixinstaller2/morphixinstaller.py 2006-07-18 00:55:12 UTC (rev 2359)
@@ -1,6 +1,7 @@
#!/usr/bin/python
-import sys
+import sys, lib_install
+
try:
import pygtk
pygtk.require("2.0")
@@ -15,7 +16,8 @@
class MorphixInstaller:
def __init__(self):
-
+ self.installer = lib_install.Installer()
+
self.gladefile = "morphixinstaller.glade"
self.StartScreen = gtk.glade.XML(self.gladefile, "StartScreen")
self.SelectHarddisk = gtk.glade.XML(self.gladefile, "SelectHarddisk")
@@ -57,6 +59,19 @@
screen = self.SelectHarddisk.get_widget("SelectHarddisk")
screen.set_property("visible", True)
+ next = self.SelectHarddisk.get_widget("okbuttonHarddisk")
+ combo = self.SelectHarddisk.get_widget("comboHarddisk")
+
+ 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)
+
def displaySelectSwap(self, widget):
screen = self.SelectHarddisk.get_widget("SelectHarddisk")
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