def __init__(self, parent_frame): self.__state = State() self.__settings = Settings.get_settings() Window.__init__(self, parent_frame, WINDOW_TITLE) HasCommonSetup.__init__(self) # Protect from closing this window while solving. self.protocol('WM_DELETE_WINDOW', lambda: self.__solve_frame.on_close(self))
def __init__(self, parent_frame: ttk.Frame): self.__state = State() self.__settings = Settings.get_settings() Window.__init__(self, parent_frame, WINDOW_TITLE) HasCommonSetup.__init__(self) # Prevent from closing parent window when solving is in progress self.protocol('WM_DELETE_WINDOW', lambda: self.__solve_frame.on_close(self))
def __init__(self, parent_frame, callback: Callable): self.__state = State() self.__settings = Settings.get_settings() self.__callback = callback self.__has_recent_projects = len( self.__settings.recently_opened_projects) > 0 Window.__init__(self, parent_frame, WINDOW_TITLE) HasCommonSetup.__init__(self)
def on_close(self, window: Window) -> None: """Prevents from closing the parent window of this frame, whenever solving is in progress. :param window: Window, prevented from closing. """ if self.is_solving(): answer = messagebox.askyesno( 'Stop', 'Solving is currently in progress. Are you sure you want to cancel?', parent=window) if answer: self.__on_stopped_callback = lambda: window.destroy() self.stop_solving() else: window.destroy()
def __init__(self, parent_frame, selected_port: Port, ports_right: List[Port], ports_left: List[Port], callback: Callable[[List[Port]], Any]): self.__state: State = State() self.__callback: Callable[[List[Port]], Any] = callback self.__ports_right: List[Port] = ports_right self.__ports_left: List[Port] = ports_left self.__selected_port_left: Optional[Port] = None self.__selected_port_right: Optional[Port] = None Window.__init__(self, parent_frame, WINDOW_TITLE.format(selected_port.name)) HasCommonSetup.__init__(self)
def __init__(self, parent_frame, callback: Callable[[str], Any], window_title: str = WINDOW_TITLE, prompt_text: str = PROMPT, string: str = ''): self.__callback = callback self.__prompt_text = prompt_text self.__string = string Window.__init__(self, parent_frame, window_title, bind_enter_callback=self.__ok) HasCommonSetup.__init__(self)
def __init__(self, parent_frame, callback: Optional[Callable], constraint: Optional[SimpleConstraint] = None): self.__state = State() self.__callback = callback self.__constraint: SimpleConstraint = copy.deepcopy(constraint) if constraint is not None \ else SimpleConstraint() self.__components_ids = [] if constraint is None else [ *constraint.components_ids ] # Deep copy of component ids self.__selected_taxonomy_tree_item: Optional[Component] = None self.__selected_listbox_item: Optional[Component] = None Window.__init__(self, parent_frame, WINDOW_TITLE) HasCommonSetup.__init__(self)
def __init__(self, parent_frame, callback: Callable[[Any], Any], constraint: Optional[ComplexConstraint] = None): self.__callback = callback self.__constraint: ComplexConstraint = copy.deepcopy(constraint) if constraint is not None \ else ComplexConstraint() self.__antecedent: List[ SimpleConstraint] = [] if constraint is None else [ copy.deepcopy(sc) for sc in constraint.antecedent ] self.__consequent: List[ SimpleConstraint] = [] if constraint is None else [ copy.deepcopy(sc) for sc in constraint.consequent ] self.__selected_antecedent: Optional[SimpleConstraint] = None self.__selected_consequent: Optional[SimpleConstraint] = None Window.__init__(self, parent_frame, WINDOW_TITLE) HasCommonSetup.__init__(self)
def __init__(self, parent_frame): pass Window.__init__(self, parent_frame, WINDOW_TITLE) HasCommonSetup.__init__(self)
def __init__(self, parent_frame): self.__state = State() self.__settings = Settings.get_settings() Window.__init__(self, parent_frame, WINDOW_TITLE) HasCommonSetup.__init__(self)
def __init__(self, parent_frame, callback): self.__callback = callback self.__state = State() Window.__init__(self, parent_frame, WINDOW_TITLE) HasCommonSetup.__init__(self)