Esempio n. 1
0
 def _on_closing(self):
     """Order the window to close and set confirmation variables to indicate that the file load was cancelled."""
     ws.on_close(self, self._parent_window
                 )  # self.destroy() is covered within this method
     self._prev = None
     self._confirmation = Confirmation.CANCEL
     print("Cancelled file load.")
Esempio n. 2
0
 def _final_load(self):
     """Order the window to close and set confirmation variables to indicate that the file load is complete."""
     ws.on_close(self, self._parent_window
                 )  # self.destroy() is covered within this method
     self._prev = None
     if self._file_type == FileType.OBJECTS:
         self._objects_confirmation = Confirmation.DONE
         # print("OBJECTS FILE LOADED.")
     elif self._file_type == FileType.RANKS:
         self._ranks_confirmation = Confirmation.DONE
         # print("RANKS FILE LOADED.")
     elif self._file_type == FileType.SINGLE:
         self._single_confirmation = Confirmation.DONE
Esempio n. 3
0
 def _on_closing(self):
     """Order the window to close and set confirmation variables to indicate that the file load was cancelled."""
     ws.on_close(self, self._parent_window
                 )  # self.destroy() is covered within this method
     self._prev = None
     if self._file_type == FileType.OBJECTS:
         self._objects_confirmation = Confirmation.CANCEL
         print("Cancelled objects file load.")
     elif self._file_type == FileType.RANKS:
         self._ranks_confirmation = Confirmation.CANCEL
         print("Cancelled ranks file load.")
     else:  # FileType.SINGLE
         self._single_confirmation = Confirmation.CANCEL
         print("Cancelled single file load.")
Esempio n. 4
0
    def _last_things(self):
        """Finish aborting the experiment (if its execution is not yet complete) and close the ProgressWindow

        This method always waits for the experiment execution thread to join the main (GUI) thread (an thus stop)
        before closing the ProgressWindow.

        In order to avoid deadlock between threads, this method first lets any prior call to :meth:`self.update_gui()`
        from :attr:`self._exec_thread` finish off by checking if :attr:`self._wait` is False; if not, it tries again
        after 1 second (and so on).
        """
        if self._wait:
            # delay again to avoid deadlock by letting any prior call to update_gui() from exec_thread to finish
            self.after(1000, self._last_things)
        else:
            # wait for exec thread to join us before being able to run a new experiment!
            if self._exec_thread is not None:
                print("Waiting to join thread to main thread...")
                self._exec_thread.join()
                print("Done joining thread.")

            # close this window and restore the parent window
            ws.on_close(self, self._parent_window)
Esempio n. 5
0
 def _on_close_safe(self):
     """Safely close the window by making sure to call :meth:`self._unbind_mousewheel()` before unstacking."""
     # self._pl_algo.clean_up() # do any final clean ups required by the pl algorithm class
     # ^ now handled by Experiment.run()
     self._unbind_mousewheel(None)
     ws.on_close(self, self._parent_window)
Esempio n. 6
0
 def _final_load(self):
     """Order the window to close and set confirmation variables to indicate that the file load is complete."""
     ws.on_close(self, self._parent_window
                 )  # self.destroy() is covered within this method
     self._prev = None
     self._confirmation = Confirmation.DONE