diff --git a/interface/ri_inst_cli.py b/interface/ri_inst_cli.py index 3dd20aa..133399c 100644 --- a/interface/ri_inst_cli.py +++ b/interface/ri_inst_cli.py @@ -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(): diff --git a/interface/ri_install.py b/interface/ri_install.py index ebe6c47..cb46418 100644 --- a/interface/ri_install.py +++ b/interface/ri_install.py @@ -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: diff --git a/interface/ri_progress.py b/interface/ri_progress.py new file mode 100644 index 0000000..6c4f41a --- /dev/null +++ b/interface/ri_progress.py @@ -0,0 +1,4 @@ +#!/usr/bin/python +#show installing progress in python dialog +i_percent=0 +i_operation="Waiting..."