def __init__(self, parent, cfg, colors, lang, app_q): self.__app_q = app_q self.__password = tk.StringVar() self.__remember_pass = tk.IntVar() self.__installed_version = tk.StringVar() self.__candidate_version = tk.StringVar() self.__status = tk.StringVar() self.__install = False self.__installation_started = False self.__installed = False super().__init__(parent, 300, 140, cfg, colors, lang, UniversalText("update-title"), UniversalText("update-ok-search"))
def __init__(self, parent, cfg, colors, lang, streams): self.__streams = streams width = 200 if self.__streams.streams else 600 height = (len(self.__streams.streams) * 20) if self.__streams.streams else 24 super().__init__(parent, width, height, cfg, colors, lang, UniversalText("config-title"))
def __init__(self, parent, cfg, colors, lang): super().__init__(parent, 200, (len(lang.supp_langs) * 12), cfg, colors, lang, UniversalText(text="lang-title", single=True), parent_waits=True)
def __init__(self, parent, width, height, cfg, colors, lang, title, ok_button_text=UniversalText(text="OK", single=True), parent_waits=False): self._parent = parent self._cfg = cfg self._colors = colors self._lang = lang self.cancelled = False if parent is None: self._window = tk.Tk() else: self._window = tk.Toplevel(parent) self._window.transient(parent) self._window.grab_set() setup_window(self._window, self._lang.universal_text(title), self._cfg, self.__cancel) height += 32 # for the button line if self._parent is None: ws = self._window.winfo_screenwidth() hs = self._window.winfo_screenheight() x = (ws / 2) - (width / 2) y = (hs / 2) - (height / 2) else: x = self._parent.winfo_rootx( ) + self._parent.winfo_width() / 2 - width / 2 y = self._parent.winfo_rooty( ) + self._parent.winfo_height() / 2 - height / 2 self._window.geometry("%dx%d+%d+%d" % (width, height, x, y)) #################### self._init_body() #################### self._okb_text = tk.StringVar() self._okb = tk.Button(self._window, textvariable=self._okb_text, command=self.__ok) self._okb_text.set(self._lang.universal_text(ok_button_text)) self._okb.pack() self._colors.set_widget(self._window) if parent is None: self._window.mainloop() elif parent_waits: # the parent window stops until the dialog closed self._parent.wait_window(self._window)