Exemple #1
0
 def join_session(self, session_id):
     self.app.statusbar.progress_bar.start(5)
     task = BackgroundTask(self.app,
                           self.app.core.join_session,
                           args=(session_id, ))
     task.start()
     self.destroy()
Exemple #2
0
 def join_session(self, session_id: int):
     if self.app.core.xml_file:
         self.app.core.xml_file = None
     self.app.statusbar.progress_bar.start(5)
     task = BackgroundTask(self.app,
                           self.app.core.join_session,
                           args=(session_id, ))
     task.start()
     self.destroy()
Exemple #3
0
 def open_xml_task(self, filename):
     if filename:
         self.add_recent_file_to_gui_config(filename)
         self.app.core.xml_file = filename
         self.app.core.xml_dir = str(os.path.dirname(filename))
         self.prompt_save_running_session()
         self.app.statusbar.progress_bar.start(5)
         task = BackgroundTask(self.app,
                               self.app.core.open_xml,
                               args=(filename, ))
         task.start()
Exemple #4
0
 def click_stop(self):
     """
     redraw buttons on the toolbar, send node and link messages to grpc server
     """
     logging.info("Click stop button")
     self.app.canvas.hide_context()
     self.app.statusbar.progress_bar.start(5)
     self.time = time.perf_counter()
     task = BackgroundTask(self, self.app.core.stop_session,
                           self.stop_callback)
     task.start()
Exemple #5
0
 def click_start(self):
     """
     Start session handler redraw buttons, send node and link messages to grpc
     server.
     """
     self.app.canvas.hide_context()
     self.app.statusbar.progress_bar.start(5)
     self.app.canvas.mode = GraphMode.SELECT
     self.time = time.perf_counter()
     task = BackgroundTask(self, self.app.core.start_session,
                           self.start_callback)
     task.start()
Exemple #6
0
 def file_open_xml(self, event=None):
     logging.info("menuaction.py file_open_xml()")
     file_path = filedialog.askopenfilename(
         initialdir=str(XMLS_PATH),
         title="Open",
         filetypes=(("XML Files", "*.xml"), ("All Files", "*")),
     )
     if file_path:
         logging.info("opening xml: %s", file_path)
         self.prompt_save_running_session()
         self.app.statusbar.progress_bar.start(5)
         task = BackgroundTask(self.app,
                               self.app.core.open_xml,
                               args=(file_path, ))
         task.start()
Exemple #7
0
    def prompt_save_running_session(self, quitapp=False):
        """
        Prompt use to stop running session before application is closed

        :return: nothing
        """
        result = True
        if self.app.core.is_runtime():
            result = messagebox.askyesnocancel("Exit",
                                               "Stop the running session?")

        if result:
            callback = None
            if quitapp:
                callback = self.app.quit
            task = BackgroundTask(self.app, self.cleanup_old_session, callback)
            task.start()
        elif quitapp:
            self.app.quit()