Merge branch 'hugang2'

This commit is contained in:
qin bo
2010-09-27 18:13:55 +08:00
3 changed files with 163 additions and 2 deletions

View File

@@ -1,26 +1,37 @@
#!/usr/bin/python
#! coding: utf-8
ins_xml = './install.xml'
''' file check_oldconf.py
Decide whether to delete the install.xml file'''
import Tkinter
import sys
import subprocess
import getopt
ins_xml = './install.xml'
lang = 'english'
message = {}
message['english'] = 'The system detects the presence of the last\n \
installation to retain the configuration file, whether to use'
message['chinese'] = '系统检测到存在上次安装保留的配置文件,是否使用它'
def print_usages():
print 'Usage: %s [-l|--language language] [-h|--help]' % sys.argv[0]
print 'language [english|chinese]'
print 'default language is english'
def ok():
root.destroy()
def cancel():
''' remove system left install.xml file'''
cmd='rm -rf ' + ins_xml
subprocess.Popen(cmd,shell=True)
root.destroy()
def init(language):
''' implement Widget'''
global root
root = Tkinter.Tk()
root.geometry("%sx%s+%d+%d" % (root.winfo_screenwidth()/2,\
@@ -39,5 +50,19 @@ def init(language):
root.rowconfigure(2,weight=1)
root.mainloop()
init(sys.argv[1])
try:
opts,args = getopt.getopt(sys.argv[1:],"l:",["language="])
except getopt.GetoptError:
print_usages()
sys.exit(1)
for opt,arg in opts:
if opt in ('-l','--language'):
lang = arg
if lang in ('english','chinese'):
init(lang)
else:
print_usages()
sys.exit(1)