diff --git a/python/mine/ri_cmd.py b/python/mine/ri_cmd.py
index f58c849..3a0ef96 100644
--- a/python/mine/ri_cmd.py
+++ b/python/mine/ri_cmd.py
@@ -46,7 +46,9 @@ def mount_list_init():
''' initialize mount list '''
l = []
for m in ri_data.MountPoint.list:
- s = m.device.ljust(10) + m.directory.ljust(20) + m.filesystem.ljust(10)
+ # get size from Partition info
+ sz = ri_data.Partition.get_size(m.device)
+ s = m.device.ljust(10) + m.directory.ljust(10) + m.filesystem.ljust(10) + m.format.ljust(4) + sz.ljust(6)
l.append(s)
display.var_dict['mount.list'].set(value=tuple([str(i) for i in l]))
@@ -56,16 +58,17 @@ def mount_list_quit():
if not s: return
tpl = eval(s)
for i in range(len(tpl)):
- dev, dir, fs = tpl[i].split()
- ri_data.MountPoint.list[i].directory = dir
+ dev, dir, fs, fm, sz= tpl[i].split()
+ ri_data.MountPoint.list[i].directory = dir
ri_data.MountPoint.list[i].filesystem = fs
+ ri_data.MountPoint.list[i].format = fm
def mount_list_modify(*args):
''' modify an item in mount list '''
tw = ri_widget.TopWindow.dict['mount_list_modify']
tw.show()
-def mp_top_fs_init():
+def mp_top_init():
''' mount dir top window initialize '''
ml_win = ri_widget.Widget.dict['mount.list'].tk_widget
idxs = ml_win.curselection()
@@ -74,6 +77,66 @@ def mp_top_fs_init():
s = display.var_dict['mount.list'].get()
if not s: return
tpl = eval(s)
- dev, dir, fs = tpl[idx].split()
- print dev, dir, fs
+ dev, dir, fs, fm, sz = tpl[idx].split()
+ display.var_dict['mp_top_dev'].set(value=dev)
+ display.var_dict['mp_top_dir'].set(value=dir)
+ if fm == 'yes':
+ ri_widget.Widget.dict['mp_top_format'].tk_widget.select()
+ else:
+ ri_widget.Widget.dict['mp_top_not_format'].tk_widget.select()
+
+ fs_values = eval(display.var_dict['mp_top_fs'].get())
+ for i in range(len(fs_values)):
+ if fs == fs_values[i]:
+ ri_widget.Widget.dict['mp_top_fs'].tk_widget.selection_set(i)
+
+def mp_top_ok():
+ ''' mount dir top window OK '''
+ l = []
+ for itm in eval(display.var_dict['mount.list'].get()):
+ dev, dir, fs, fm, sz = itm.split()
+ dev2 = display.var_dict['mp_top_dev'].get()
+ if dev == dev2:
+ dir = display.var_dict['mp_top_dir'].get()
+ fm = display.var_dict['mp_top_format'].get()
+ idxs2 = ri_widget.Widget.dict['mp_top_fs'].tk_widget.curselection()
+ idx2 = int(idxs2[0])
+ fs = eval(display.var_dict['mp_top_fs'].get())[idx2]
+ s2 = dev.ljust(10) + dir.ljust(10) + fs.ljust(10) + fm.ljust(4) + sz.ljust(6)
+ l.append(s2)
+ else:
+ l.append(itm)
+
+ display.var_dict['mount.list'].set(value=tuple(l))
+ ri_widget.TopWindow.dict['mount_list_modify'].hide()
+
+def mp_top_cancel():
+ ''' mount dir top window cancel '''
+ ri_widget.TopWindow.dict['mount_list_modify'].hide()
+ pass
+
+def network_init():
+ ''' network initialize '''
+ display.var_dict['network_host_name']. set(value=ri_data.Network.hostname)
+ ri_widget.Widget.dict['network_config_%s' %(ri_data.Network.configuration,)].tk_widget.select()
+ display.var_dict['network_domain_name']. set(value=ri_data.Network.domain)
+ display.var_dict['network_ip']. set(value=ri_data.Network.ip)
+ display.var_dict['network_subnet_mask']. set(value=ri_data.Network.mask)
+ display.var_dict['network_gateway']. set(value=ri_data.Network.gateway)
+ display.var_dict['network_primary_dns']. set(value=ri_data.Network.primary_dns)
+ display.var_dict['network_secondary_dns'].set(value=ri_data.Network.secondary_dns)
+
+def network_quit():
+ ''' network quit '''
+ ri_data.Network.hostname = display.var_dict['network_host_name'].get()
+ ri_data.Network.configuration = display.var_dict['network_config_method'].get()
+ ri_data.Network.domain = display.var_dict['network_domain_name'].get()
+ ri_data.Network.ip = display.var_dict['network_ip'].get()
+ ri_data.Network.mask = display.var_dict['network_subnet_mask'].get()
+ ri_data.Network.gateway = display.var_dict['network_gateway'].get()
+ ri_data.Network.primary_dns = display.var_dict['network_primary_dns'].get()
+ ri_data.Network.secondary_dns = display.var_dict['network_secondary_dns'].get()
+
+
+
diff --git a/python/mine/ri_data.py b/python/mine/ri_data.py
index f34a6e6..b42880f 100644
--- a/python/mine/ri_data.py
+++ b/python/mine/ri_data.py
@@ -53,6 +53,7 @@ class Partition:
def init_from_os():
''' create a Partition instance from hardware info'''
# cmd = 'sfdisk -d'
+ # has problem on raid detection
cmd = 'cat /home/zhi/work/new_install/python/mine/sfdisk.txt'
st, o = commands.getstatusoutput(cmd)
if st:
@@ -109,6 +110,12 @@ p_node - xml node (parent node)'''
pt.setAttributeNode(id_attr)
pts.appendChild(pt)
p_node.appendChild(pts)
+
+ @staticmethod
+ def get_size(dev):
+ for p in Partition.list:
+ if p.device == dev:
+ return p.size
class Raid:
''' raid information '''
@@ -187,10 +194,11 @@ p_node - xml node (parent node) '''
class MountPoint:
''' mount-points '''
list=[]
- def __init__(self, dev, dir, fs):
- self.device = dev
- self.directory = dir
+ def __init__(self, dev, dir='', fs='', fm='no'):
+ self.device = dev
+ self.directory = dir
self.filesystem = fs
+ self.format = fm
MountPoint.list.append(self)
@staticmethod
@@ -205,7 +213,7 @@ class MountPoint:
devs.append(r.raid_device)
for dev in devs:
- MountPoint(dev, '', '')
+ MountPoint(dev)
@staticmethod
def init_from_xml(node):
@@ -214,7 +222,8 @@ class MountPoint:
if m.nodeType == node.ELEMENT_NODE and m.nodeName == 'mount-point':
MountPoint(m.attributes['device'].value.encode('ascii'), \
m.attributes['directory'].value.encode('ascii'), \
- m.attributes['file-system'].value.encode('ascii'))
+ m.attributes['file-system'].value.encode('ascii'), \
+ m.attributes['format'].value.encode('ascii') )
@staticmethod
def to_xml(doc, p_node):
@@ -227,12 +236,15 @@ p_node - xml node (parent node)'''
dev_attr = doc.createAttribute('device')
dir_attr = doc.createAttribute('directory')
fs_attr = doc.createAttribute('file-system')
+ fm_attr = doc.createAttribute('format')
dev_attr.value = m.device
dir_attr.value = m.directory
fs_attr.value = m.filesystem
+ fm_attr.value = m.format
mp.setAttributeNode(dev_attr)
mp.setAttributeNode(dir_attr)
mp.setAttributeNode(fs_attr)
+ mp.setAttributeNode(fm_attr)
mps.appendChild(mp)
p_node.appendChild(mps)
@@ -240,12 +252,12 @@ class Network:
''' network '''
hostname =''
configuration =''
+ domain = ''
ip = ''
mask = ''
gateway = ''
primary_dns = ''
secondary_dns = ''
- domain = ''
@staticmethod
def init_from_xml(node):
diff --git a/python/mine/ri_tk.py b/python/mine/ri_tk.py
index 3b1684d..96fac75 100644
--- a/python/mine/ri_tk.py
+++ b/python/mine/ri_tk.py
@@ -68,10 +68,6 @@ def create_widget_sub(w, p_win):
# if not yet in dict, create it
var_dict[v_n] = getattr(Tkinter, v_t)(value=v_v)
- # process action init
- if 'action' in dir(w) and 'init' in w.action.dict:
- getattr(sys.modules['ri_cmd'], w.action.dict['init'])()
-
# change attr, if needed to suit tk
tk_attr = dict(w.attr)
modify_attributes(tk_attr)
@@ -115,6 +111,11 @@ def create_widget_sub(w, p_win):
# save tk widget instance into w (widget instance)
setattr(w, 'tk_widget', w_win)
+
+ # process action init
+ if 'action' in dir(w) and 'init' in w.action.dict:
+ getattr(sys.modules['ri_cmd'], w.action.dict['init'])()
+
return w_win
# When creating widget, I have to create each sub widget.
@@ -176,3 +177,7 @@ w - TopWindow instance '''
w_win.wait_window()
return w_win
+
+def destroy_top_window(w):
+ ''' w - Toplevel instance '''
+ w.tk_widget.destroy()
diff --git a/xml/install.xml b/xml/install.xml
index 3a0eb43..ac6eed7 100644
--- a/xml/install.xml
+++ b/xml/install.xml
@@ -18,8 +18,8 @@
-
-
+
+
diff --git a/xml/interface_t.xml b/xml/interface_t.xml
index 57f2d44..0f28ded 100644
--- a/xml/interface_t.xml
+++ b/xml/interface_t.xml
@@ -274,6 +274,7 @@ row 4 | |
+
@@ -286,29 +287,120 @@ row 4 | |
-
+
+
-
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -318,6 +410,7 @@ row 4 | |
+
@@ -336,23 +429,30 @@ row 4 | |
-
-
+
+
-
-
+
+
-
+
-
+
+
+
+
+
+
+
+