예제 #1
0
    def clicked_4_navigation(self, node_numb):
        print("\n clicked_4_navigation\n  node_numb =", node_numb)
        self.curr_nod_num = node_numb
        try:
            cur_nod = self.server_nod_lst[node_numb]

        except IndexError:
            cur_nod = self.tree_scene.paint_nod_lst[node_numb]

        cmd_ini = cur_nod["cmd2show"][0]
        key2find = cmd_ini[6:]
        try:
            self.change_widget(key2find)
            self.update_all_param()
            if key2find == "reindex":
                cmd = {
                    "nod_lst":cur_nod["parent_node_lst"],
                    "cmd_lst":["get_bravais_sum"]
                }
                json_data_lst = json_data_request(self.uni_url, cmd)
                self.r_index_widg.add_opts_lst(
                    json_data = json_data_lst[0]
                )
                self.update_reindex_table_header(cur_nod["parent_node_lst"])

        except KeyError:
            print("command widget not there yet")
            return

        self.refresh_output()
        self.display()
예제 #2
0
    def close_event(self, event):
        print("\n destroyed event ... 1\n")
        cmd = {"nod_lst":"", "cmd_lst":["closed"]}
        resp = json_data_request(self.uni_url, cmd)
        print("resp =", resp)

        print("\n destroyed event ... 2\n")
예제 #3
0
    def update_reindex_table_header(self, nod_lst):
        cmd = {"nod_lst":nod_lst, "cmd_lst":["display_log"]}
        json_log = json_data_request(self.uni_url, cmd)
        try:
            lst_log_lines = json_log[0]
            label2update = get_label_from_str_list(lst_log_lines)

        except TypeError:
            label2update = "Error Loading Log"

        self.window.ReindexHeaderLabel.setText(label2update)
예제 #4
0
    def req_stop(self):
        print("req_stop")
        nod_lst = [str(self.curr_nod_num)]
        print("\n nod_lst", nod_lst)
        cmd = {"nod_lst":nod_lst, "cmd_lst":["stop"]}
        print("cmd =", cmd)
        try:
            lst_params = json_data_request(self.uni_url, cmd)

        except requests.exceptions.RequestException:
            print(
                "something went wrong with the request launch"
            )
예제 #5
0
    def nxt_key_clicked(self, str_key):
        print("nxt_clicked ... str_key: ", str_key)

        if str_key == "reindex":
            cmd = {
                "nod_lst":[self.curr_nod_num],
                "cmd_lst":["get_bravais_sum"]
            }
            json_data_lst = json_data_request(self.uni_url, cmd)
            self.r_index_widg.add_opts_lst(
                json_data = json_data_lst[0]
            )
            self.update_reindex_table_header([self.curr_nod_num])

        self.change_widget(str_key)
        self.reset_param()
        self.add_new_node()
        self.check_nxt_btn()
예제 #6
0
파일: outputs.py 프로젝트: ccp4/DUI2
    def __call__(self, nod_p_num = 0, do_request = False, stat = "Busy"):
        print("Do Request =", do_request)
        if do_request:
            found_nod_num = False
            for log_node in self.lst_node_log_out:
                if log_node["number"] == nod_p_num:
                    found_nod_num = True
                    lst_log_lines = log_node["log_line_lst"]

            try:
                if not found_nod_num:
                    cmd = {"nod_lst":[nod_p_num], "cmd_lst":["display_log"]}
                    json_log = json_data_request(self.uni_url, cmd)
                    try:
                        lst_log_lines = json_log[0]
                        self.lst_node_log_out.append(
                            {
                                "number"       : nod_p_num,
                                "log_line_lst"  : lst_log_lines
                            }
                        )

                    except TypeError:
                        lst_log_lines = ["Nothing here"]

                self.main_obj.window.incoming_text.clear()
                if stat == "Busy":
                    self.main_obj.window.incoming_text.setTextColor(self.green_color)

                elif stat == "Succeeded":
                    self.main_obj.window.incoming_text.setTextColor(self.blue_color)

                else:
                    self.main_obj.window.incoming_text.setTextColor(self.red_color)

                for single_log_line in lst_log_lines:
                    self.main_obj.window.incoming_text.insertPlainText(single_log_line)
                    self.main_obj.window.incoming_text.moveCursor(QTextCursor.End)

            except IndexError:
                self.show_ready_log()

        else:
            self.show_ready_log()
예제 #7
0
파일: main_client.py 프로젝트: ccp4/DUI2
def main():
    data_init = ini_data()
    data_init.set_data()
    uni_url = data_init.get_url()
    cmd = {"nod_lst": [""], "cmd_lst": ["display"]}
    dummy_nod_lst = None
    n_secs = 3
    while dummy_nod_lst == None:
        dummy_nod_lst = json_data_request(uni_url, cmd)
        if dummy_nod_lst == None:
            print("dummy_nod_lst =", dummy_nod_lst, ", waiting", n_secs,
                  "secs ...")
            time.sleep(n_secs)

        else:
            print("dummy_nod_lst != None ...\n launching GUI")

    #QCoreApplication.setAttribute(Qt.AA_ShareOpenGLContexts)
    app = QApplication(sys.argv)
    m_obj = MainObject(parent=app)
    sys.exit(app.exec_())
예제 #8
0
 def request_display(self):
     cmd = {"nod_lst":"", "cmd_lst":["display"]}
     self.server_nod_lst = json_data_request(self.uni_url, cmd)
     self.display()