text mode usage pythondialog show install progress
modified: ri_inst_cli.py modified: ri_install.py new file: ri_progress.py Signed-off-by: gdzhang <gdzhang@linx-info.com>
This commit is contained in:
@@ -17,15 +17,17 @@
|
||||
#
|
||||
|
||||
import time
|
||||
import ri_progress
|
||||
from ri_oper import language, Rate
|
||||
import dialog
|
||||
def set_task(task_name):
|
||||
print task_name
|
||||
ri_progress.i_operation = task_name
|
||||
|
||||
def set_sub_task(sub_task):
|
||||
print sub_task
|
||||
ri_progress.i_operation = sub_task
|
||||
|
||||
def set_task_scale():
|
||||
print "%.2f" %float(Rate.value)
|
||||
ri_progress.i_percent = int(Rate.value)
|
||||
|
||||
def set_task_over():
|
||||
f = open('/proc/cmdline', 'r')
|
||||
@@ -37,9 +39,12 @@ def set_task_over():
|
||||
time.sleep(10)
|
||||
return True
|
||||
else:
|
||||
string = raw_input("Rocky system installation successfully, do you want to reboot?[Y/n]")
|
||||
if string.lower() == "y" or string == "":
|
||||
ifreboot=dialog.Dialog()
|
||||
ret=ifreboot.yesno("Rocky system installation successfully, do you want to reboot?")
|
||||
if ret == 0:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
return False
|
||||
|
||||
def root_destroy():
|
||||
|
||||
@@ -22,6 +22,10 @@ import ri_oper
|
||||
import os
|
||||
import os.path
|
||||
import ri_data
|
||||
import time
|
||||
import dialog
|
||||
import ri_progress
|
||||
import thread
|
||||
sys.path.append('../new_partition/')
|
||||
import partition_data as p_d
|
||||
|
||||
@@ -33,10 +37,22 @@ def install_over(ret):
|
||||
else:
|
||||
display.root_destroy()
|
||||
|
||||
def show_progress():
|
||||
d = dialog.Dialog()
|
||||
d.add_persistent_args(["--backtitle","Installing Rocky4.2 ...."])
|
||||
d.gauge_start("Progress: %0", title = "installing")
|
||||
while True:
|
||||
if ri_progress.i_percent >= 98:
|
||||
break
|
||||
d.gauge_update(ri_progress.i_percent, "%s" % ri_progress.i_operation, update_text=1)
|
||||
time.sleep(0.1)
|
||||
d.gauge_stop()
|
||||
|
||||
def main():
|
||||
global has_run
|
||||
if has_run: return
|
||||
has_run = True
|
||||
thread.start_new_thread(show_progress,())
|
||||
for instance in oper_list:
|
||||
ret = instance.install()
|
||||
if ret:
|
||||
|
||||
4
interface/ri_progress.py
Normal file
4
interface/ri_progress.py
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
#show installing progress in python dialog
|
||||
i_percent=0
|
||||
i_operation="Waiting..."
|
||||
Reference in New Issue
Block a user