From e332f9de9ce7ea7de43583e28bd8507d70ae8df1 Mon Sep 17 00:00:00 2001 From: fling Date: Tue, 7 Dec 2010 14:44:36 +0800 Subject: [PATCH] modified: ri_cmd.py modified: ri_data.py modified: ../xml/interface.xml add check network hostname ip netmask DNS. --- interface/ri_cmd.py | 21 +++++++++++++++++++-- interface/ri_data.py | 7 +++++++ xml/interface.xml | 6 ++++++ 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/interface/ri_cmd.py b/interface/ri_cmd.py index ad8f8c1..49d1e06 100644 --- a/interface/ri_cmd.py +++ b/interface/ri_cmd.py @@ -4,6 +4,8 @@ import ri_widget import os import ri_tk +from ri_data import Network +from ri_tk_cmd import network_quit as network_update def quit(): ''' correspond to quit button ''' @@ -28,6 +30,10 @@ def previous(): def next(): ''' correspond to next button ''' q, t = ri_widget.Sequence.current() + + if not check_date(t): + return + wid_name = ri_widget.Sequence.next() if wid_name is not None: ri_widget.Widget.dict[t].hide() @@ -37,6 +43,17 @@ def next(): code = ri_widget.MessageBox.dict["next"].show() if code == True: os.execl('/usr/bin/python','python','ri_install.py', "-d","tk","-l",ri_tk.language) -from ri_tk_cmd import * - +def check_date(operate): + '''check date ''' + if operate == "network" : + network_update() + if not Network.hostname: + ri_widget.MessageBox.dict['check_ip_hostname'].show() + return False + if Network.configuration == "static" and not Network.check_ip() : + ri_widget.MessageBox.dict['check_ip_hostname'].show() + return False + return True + +from ri_tk_cmd import * diff --git a/interface/ri_data.py b/interface/ri_data.py index ac7e88c..20cd39a 100644 --- a/interface/ri_data.py +++ b/interface/ri_data.py @@ -450,6 +450,13 @@ p_node - xml node (parent node)''' to_xml_attr(doc, ntwk, Network, nm) p_node.appendChild(ntwk) + @staticmethod + def check_ip() : + """check network ip""" + if Network.ip and Network.mask and Network.gateway and Network.primary_dns: + return True + return False + class Group: ''' software package group ''' dict = {} diff --git a/xml/interface.xml b/xml/interface.xml index 812f32a..662377b 100644 --- a/xml/interface.xml +++ b/xml/interface.xml @@ -796,6 +796,7 @@ row 4 | | +