예제 #1
0
def slot_create_screenshots(ui):
    qm = QMessageBox
    ui._p = ui.collect_ui_info()
    p_obj = ui._p
    exe_pvpython = p_obj._exePV
    if not os.path.exists(exe_pvpython):
        QMessageBox.about(ui, "Error", "python module {} doesnot Exist!".format(exe_pvpython))
        return
    # create session config object
    sc = utils.SessionConfig()
    sc.list_case = get_checked_items(p_obj._case, p_obj._sCaseCheck)
    sc.list_alg = get_checked_items(p_obj._alg, p_obj._sAlgCheck)
    sc.list_ver = get_checked_items(p_obj._ver, p_obj._sVerCheck)
    sc.config_map["dir_i"] = p_obj._dirInput
    sc.config_map["dir_o"] = p_obj._dirOutput
    sc.config_map["rep_specular"] = "True"
    sc.config_map["ss_force_update"] = "True"
    if len(sc.list_case) < 1:
        QMessageBox.about(ui, "Error", "No Case checked")
        return
    if len(sc.list_ver) < 1:
        QMessageBox.about(ui, "Error", "No Version checked")
        return
    if len(sc.list_alg) < 1:
        ret = qm.question(ui, "", "No FileNames checked, Continue?", qm.Yes | qm.Cancel)
        if ret == qm.Cancel:
            return
    total_num = utils.call_pvpython(exe_pvpython, sc)
    if total_num > 0:
        ui.add_hist_item("ss", total_num)
    QMessageBox.about(ui, "Message", "Create Screenshots Completed! {} file generated".format(total_num))
예제 #2
0
def generate_proc_docx(ui):
    p_obj = ui._p
    dir_o = p_obj._dirOutput
    dir_doc = os.path.join(dir_o, "doc")
    pdoc_name = p_obj._docName + "_proc"
    str_time = str(datetime.datetime.now().strftime("%Y%m%d_%H%M%S"))
    pdoc_name_final = "{}_{}.xlsx".format(pdoc_name, str_time)
    p_obj._curDocName = pdoc_name_final
    if not os.path.exists(dir_doc):
        os.makedirs(dir_doc)
    file_save = os.path.join(dir_doc, pdoc_name_final)
    l_case = get_checked_items(p_obj._case, p_obj._dCaseCheck)
    l_ver = get_checked_items(p_obj._ver, p_obj._dVerCheck)
    wb = Workbook()
    ws = wb.active
    res = utils.get_compare_table(dir_o, l_case, l_ver, ws, utils.get_sys_table)
    ws_chart = wb.create_sheet("chart", 0)
    f_list = []
    sp_list = []
    utils.create_f_lists(dir_o, l_case, l_ver, f_list, sp_list)
    utils.create_chart(f_list, sp_list, ws_chart)
    try:
        wb.save(file_save)
    except PermissionError:
        res = 1
    if res == 0:
        ui.add_hist_item("doc", 1)
        QMessageBox.about(ui, "Message", "Docx wrote to {}!".format(file_save))
    else:
        QMessageBox.about(ui, "Error", "Cannot wrote to {}!".format(file_save))
예제 #3
0
def slot_build_output(ui):
    ui._p = ui.collect_ui_info()
    p_obj = ui._p
    dir_out = p_obj._dirOutput
    l_case = get_checked_items(p_obj._case, p_obj._sCaseCheck)
    l_ver = get_checked_items(p_obj._ver, p_obj._sVerCheck)
    for c in l_case:
        for v in l_ver:
            n_dir = os.path.join(dir_out, c, v)
            if os.path.exists(n_dir):
                continue
            os.makedirs(n_dir)
예제 #4
0
def generate_hausdorf_docx(ui):
    # create hausdorff shot
    ui._p = ui.collect_ui_info()
    p_obj = ui._p
    exe_pvpython = p_obj._exePV
    if not os.path.exists(exe_pvpython):
        QMessageBox.about(ui, "Error", "python module {} doesnot Exist!".format(exe_pvpython))
        return
    sc = utils.SessionConfig()
    sc.config_map["dir_i"] = p_obj._dirInput
    sc.config_map["dir_o"] = p_obj._dirOutput
    sc.list_case = get_checked_items(p_obj._case, p_obj._dCaseCheck)
    sc.list_ver = ['__hausdorff']
    sc.list_alg.clear()
    total_num = utils.call_pvpython(exe_pvpython, sc)
    if total_num > 0:
        ui.add_hist_item("ss", total_num)
    print(total_num)
    # generate doc
    doc_name = p_obj._docName
    str_time = str(datetime.datetime.now().strftime("%Y%m%d_%H%M%S"))
    doc_name_final = "{}_{}_hd.docx".format(doc_name, str_time)
    p_obj._curDocName = doc_name_final
    dir_doc = os.path.join(p_obj._dirOutput, "doc")
    if not os.path.exists(dir_doc):
        os.makedirs(dir_doc)
    file_save = os.path.join(dir_doc, doc_name_final)
    l_ver = ["hausdorff_A2B", "hausdorff_B2A"]
    l_alg = ["__hd"] # reserved alg_name for hausdorff dist
    gd = generate_docx.DocxGenerator(p_obj._dirInput, p_obj._dirOutput, sc.list_case,
                                     l_ver, l_alg)
    gd.generate_docx(file_save, p_obj._configFile)
    ui.add_hist_item("doc", 1)
    QMessageBox.about(ui, "Message", "Hausdorff Docx wrote to {}!".format(file_save))
예제 #5
0
def generate_ss_docx(ui):
    p_obj = ui._p
    dir_i = p_obj._dirInput
    dir_o = p_obj._dirOutput
    dir_doc = os.path.join(dir_o, "doc")
    doc_name = p_obj._docName
    str_time = str(datetime.datetime.now().strftime("%Y%m%d_%H%M%S"))
    doc_name_final = "{}_{}.docx".format(doc_name, str_time)
    p_obj._curDocName = doc_name_final
    if not os.path.exists(dir_doc):
        os.makedirs(dir_doc)
    file_save = os.path.join(dir_doc, doc_name_final)
    l_case = get_checked_items(p_obj._case, p_obj._dCaseCheck)
    l_ver = get_checked_items(p_obj._ver, p_obj._dVerCheck)
    l_alg = get_checked_items(p_obj._alg, p_obj._dAlgCheck)
    gd = generate_docx.DocxGenerator(dir_i, dir_o, l_case, l_ver, l_alg)
    gd.generate_docx(file_save, p_obj._configFile)
    ui.add_hist_item("doc", 1)
    QMessageBox.about(ui, "Message", "Docx wrote to {}!".format(file_save))
예제 #6
0
def slot_exe_param(ui):
    ui._p = ui.collect_ui_info()
    p_obj = ui._p
    list_case = get_checked_items(p_obj._case, p_obj._eCaseCheck)
    if len(list_case) < 1:
        QMessageBox.about(ui, "Error", "No CheckItem in Input Case!")
        return
    param_list = "ParamLine Preview:"
    for case in list_case:
        param_list += "\n\n"
        param_list += generate_exe_param(p_obj, case)
    QMessageBox.about(ui, "Message", param_list)
예제 #7
0
def slot_exe_run(ui):
    ui._p = ui.collect_ui_info()
    p_obj = ui._p
    exe = p_obj._exeDemo
    param_text = p_obj._exeParam
    if not os.path.exists(exe):
        QMessageBox.about(ui, "Error", "Demo {} does not exist!".format(exe))
        return
    list_case = get_checked_items(p_obj._case, p_obj._eCaseCheck)
    if len(list_case) < 1 and "{i}" in param_text:
        QMessageBox.about(ui, "Error", "No Input Case Checked!!")
        return
    ui._cmdDialog.add_cmd(exe, param_text)
    ui._threadExe = thread_module.ExeRunThread(ui)
    ui._threadExe.setTerminationEnabled()
    ui._threadExe._sigProgress.connect(ui.exe_progress)
    ui._threadExe.finished.connect(ui.exe_finish)
    ui.new_stop_button()
    ui._qlv_all_proj.setDisabled(True)
    ui._threadExe.start()