diff --git a/dialog/di_dialog.py b/dialog/di_dialog.py index c92617e..1675817 100644 --- a/dialog/di_dialog.py +++ b/dialog/di_dialog.py @@ -56,7 +56,7 @@ class MountPoint(Dialog): self.height=height self.width=width - def choice_fstype(self,device): + def set_fstype(self,device): #device is sdaX #mp is mount point list=[('ext2','Ext2 is the traditional Linux file system.'),\ @@ -72,23 +72,23 @@ class MountPoint(Dialog): ri_data.MountPoint.dict[device].filesystem=fs return s - def mount_point(self,device): - s,mp=Dialog.dialog.inputbox(text='plase input mount point',height=10,width=30,init='/') + def set_mountpoint(self,device): + s,mp=Dialog.dialog.inputbox(text='plase input mount point',height=10,width=30,init=ri_data.MountPoint.dict[device].directory) if s == 0: ri_data.MountPoint.dict[device].directory=mp - return s - def is_format(self,device): + def set_format(self,device): s = Dialog.dialog.yesno(text='format the device',title='Format') + print s if s == 0 : ri_data.MountPoint.dict[device].format='yes' + self.set_fstype(device) else: ri_data.MountPoint.dict[device].format='no' - return s - def choice_device(self): + def set_data(self): while True: list=[] keys=ri_data.MountPoint.dict.keys() @@ -99,44 +99,14 @@ class MountPoint(Dialog): s,d=Dialog.dialog.menu(text='device map',height=self.height,width=self.width,menu_height=self.height/5*4,choices=list,title='MountPoint') - if s == 0: - count=0 - function_list=[self.choice_fstype,self.mount_point,self.is_format] - while True: - ret = function_list[count](d) - if ret == 1: - count = count - 1 - elif ret == 0 : - count = count + 1 - - if count <0 or count >2 : - break + if s == 0 : + self.set_mountpoint(d) + self.set_format(d) elif s == 1 : break else: print "error" - - def init(self): - count=0 - list=[self.choice_device,self.mount_point,self.is_format] - while True: - list[count](self) - - # s,fs=self.choice_fstype(d) - # if s == 0: - # ri_data.MountPoint.dict[d].filesystem=fs - - # s,mp=self.mount_point() - # if s == 0 : - # ri_data.MountPoint.dict[d].directory=mp - - # if status == 1: - # break - - - - #Welcome(15,50) #Dialog.dict['welcome'].get_welcome() #print Dialog.status @@ -146,10 +116,9 @@ print ri_data.Partition.dict.keys() ri_data.MountPoint.init_from_internal() print ri_data.MountPoint.dict.keys() MountPoint(20,75) -#Dialog.dict['mountpoint'].init_data() -Dialog.dict['mountpoint'].choice_device() -#Dialog.dict['mountpoint'].is_format() -#Dialog.dict['mountpoint'].choice_fstype() +Dialog.dict['mountpoint'].set_data() +#Dialog.dict['mountpoint'].set_format() +#Dialog.dict['mountpoint'].set_fstype() #Dialog.dict['mountpoint'].check_list() #SerialNumber(10,50)