def run(self): """Loads, displays results. :return: `None` means "go back to import options.", `True` means continue, `False` means quit to main menu """ task = LoadTask(self._filename, self._total_rows, self._parse_settings, self) self._view = process_file_view.LoadFullFile(self._parent, task) locator.get("pool").submit(task) self._view.wait_window(self._view) if self._view.cancelled: return None self._view = process_file_view.DisplayResult(self._parent, self.model, self._mode) self._view.wait_window(self._view) if self._view.result == "back": return None elif self._view.result == "go": return True elif self._view.result == "quit": return False else: raise ValueError()
def _finalise_loading(self, data): if data is None: return view = analysis_view.FurtherWait(self._root) def task(): self.model.load_settings_slow(data) def done(input=None): self.model.reset_settings_dict() self._init() self.view.update_run_analysis_results() view.destroy() locator.get("pool").submit(task, done) self.view.wait_window(view)
def load_saved_run(self, filename): view = analysis_view.Saving(self.view, loading=True) def load(): self.model.load_analysis_run(filename) def done(result): view.destroy() if isinstance(result, Exception): self.view.alert( analysis_view._text["r_load_fail"].format(result)) else: self.view.update_run_analysis_results() locator.get("pool").submit(load, done) view.wait_window(view)
def save_run(self, run_index, filename): view = analysis_view.Saving(self.view) def save(): self.model.save_analysis_run(run_index, filename) def done(out=None): view.destroy() if out is not None and isinstance(out, Exception): self.view.alert(analysis_view._text["r_save_fail"].format( type(out), out)) else: self.view.update_run_analysis_results() locator.get("pool").submit(save, done) view.wait_window(view)
def __init__(self, parent, width=None, height=None): super().__init__(parent) util.stretchy_rows_cols(self, [0], [0]) self._canvas = tk.Canvas(self, borderwidth=0, selectborderwidth=0, highlightthickness=0) if width is not None: self._canvas["width"] = width if height is not None: self._canvas["height"] = height self._canvas.grid(sticky=tk.NSEW, row=0, column=0) self._pool = _locator.get("pool") self._canvas_image = None self._image = None self._size = (1,1) self._rlock = _threading.RLock() self.bind("<Configure>", self._resize)
def _load_file(self): self.view = import_file_view.LoadFileProgress() pool = locator.get("pool") pool.submit(self._process_file, self._done_process_file) self.view.wait_window(self.view)
def __init__(self): self.settings = locator.get("settings") self._populate_sessions()
def __init__(self): self._logger = _logging.getLogger(__name__) self.settings = locator.get("settings")