Exemple #1
0
    def update_after_finished(self):
        self.cli_tree_output(self.uni_controler)
        new_html = self.uni_controler.get_html_report()
        new_img_json = self.uni_controler.get_datablock_path()
        new_ref_pikl = self.uni_controler.get_reflections_path()

        print "\n new_html =", new_html, "\n"
        print " new_img_json =", new_img_json, "\n"
        print " new_ref_pikl =", new_ref_pikl, "\n"

        if (self.cur_html != new_html):
            self.cur_html = new_html
            try:
                self.web_view.update_page(new_html)

            except:
                print "No HTML here"

        if (self.cur_pick != new_ref_pikl):
            self.cur_pick = new_ref_pikl
            self.img_view.ini_reflection_table(self.cur_pick)

        if (self.cur_json != new_img_json):
            self.cur_json = new_img_json
            self.img_view.ini_datablock(self.cur_json)

        tmp_curr = self.uni_controler.step_list[self.uni_controler.current]
        nxt_cmd = get_next_step(tmp_curr)
        cur_success = tmp_curr.success

        if (tmp_curr.command[0] != "reindex"):
            try:
                self.my_pop.close()

            except:
                print "no need to close reindex table"

        if (nxt_cmd == "refine_bravais_settings"):
            if (cur_success == None):
                self.cmd_launch("refine_bravais_settings")

            else:
                self.centre_widget.set_widget("refine")

        elif (nxt_cmd == "reindex"):
            self.my_pop = MyReindexOpts()
            self.my_pop.set_ref(in_json_path=tmp_curr.prev_step.json_file_out)
            self.my_pop.my_inner_table.cellClicked.connect(self.opt_clicked)

        else:
            self.centre_widget.set_widget(nxt_cmd)

        self.tree_out.update_me(self.uni_controler.step_list[0],
                                self.uni_controler.current)

        with open('bkp.pickle', 'wb') as bkp_out:
            pickle.dump(self.uni_controler, bkp_out)
Exemple #2
0
def update_pbar_msg(main_obj):
    tmp_curr = main_obj.idials_runner.current_node
    txt = str(tmp_curr.command_lst[0])

    #TODO try to change the background when giving advice

    if (tmp_curr.success == False):
        txt = "click << Retry >> or navigate backwards in the tree"

    elif ((txt == "integrate" or txt == "refine_bravais_settings")
          and tmp_curr.success == True):

        txt = "click << Retry >> or navigate elsewhere in the tree"

    elif (txt == "reindex" and tmp_curr.success == None):
        txt = "click the blue row to run reindex"

    elif (tmp_curr.success == None):
        if (tmp_curr.lin_num == 1):
            print "tmp_curr.lin_num == 1"
            templ_text = main_obj.centre_widget.step_param_widg.currentWidget(
            ).my_widget.simple_lin.text()
            print "templ_text =", templ_text
            if (templ_text == " ? "):
                txt = "click << Select File(s) >> or edit input line "

            else:
                txt = "click dials icon to run import"

        else:
            txt = "click dials icon to run " + txt

    else:
        nxt_cmd = get_next_step(tmp_curr)

        if (nxt_cmd == None):
            txt = "Done"

        else:

            lab_nxt_cmd = get_lab_txt(nxt_cmd)

            txt = "click <<" + lab_nxt_cmd + ">> to go ahead, or click << Retry >>"

    main_obj.txt_bar.setText(txt)
    print "update_pbar_msg =", txt
Exemple #3
0
def update_pbar_msg(main_obj):
    tmp_curr = main_obj.idials_runner.current_node
    txt = str(tmp_curr.ll_command_lst[0][0])

    if tmp_curr.success is False:
        txt = "click << Retry >> or navigate backwards in the tree"
    elif txt == "refine_bravais_settings" and tmp_curr.success:
        txt = "click << Retry >> or navigate elsewhere in the tree"
    elif txt == "reindex" and tmp_curr.success is None:
        txt = "click the blue row to run reindex"
    elif tmp_curr.success is None:
        if tmp_curr.lin_num == 1:
            logger.debug("tmp_curr.lin_num == 1")
            current_widget = main_obj.centre_par_widget.step_param_widg.currentWidget(
            )
            templ_text = current_widget.my_widget.simple_lin.text()
            logger.debug("templ_text = %s", templ_text)
            if templ_text == " ? ":
                txt = "click << Select File(s) >> or edit input line "

            else:
                txt = "click dials icon to run import"

        else:
            txt = "click dials icon to run " + txt

    else:
        nxt_cmd = get_next_step(tmp_curr)

        try:
            if nxt_cmd is None:
                txt = "Done"

            else:
                lab_nxt_cmd = ACTIONS[nxt_cmd].label
                txt = "click <<" + lab_nxt_cmd + ">> to go ahead, or click << Retry >>"

        except KeyError:
            txt = "Done"

    #main_obj.txt_bar.setText(txt)
    main_obj.txt_bar.setText(" \n ")
Exemple #4
0
    def recursive_node(self, root_node, item_in):
        if (type(root_node.next_step_list) is list):
            for child_node in root_node.next_step_list:
                if (child_node.command != [None]):
                    child_node_name = str(child_node.command[0])
                else:
                    child_node_name = "* " + get_next_step(child_node) + " *"

                try:
                    child_node_tip = str(child_node.command[1:])
                except:
                    child_node_tip = "None"

                new_item = QStandardItem(child_node_name)
                new_item.setToolTip(child_node_tip)
                new_item.idials_node = child_node
                #new_item.success = child_node.success

                if (self.lst_idx == child_node.lin_num):
                    new_item.setBackground(Qt.blue)
                    if (child_node_name[0:2] == "* "):
                        new_item.setForeground(Qt.green)

                    else:
                        new_item.setForeground(Qt.white)

                else:
                    new_item.setBackground(Qt.white)
                    if (child_node_name[0:2] == "* "):
                        new_item.setForeground(Qt.green)

                    else:
                        new_item.setForeground(Qt.blue)

                new_item.setEditable(False)  # not letting the user edit it

                self.recursive_node(child_node, new_item)
                item_in.appendRow(new_item)
Exemple #5
0
 def get_next_step(self):
     return get_next_step(self)