Exemple #1
0
 def __stop(self, stay_alive=True):
     if stay_alive and not messagebox.askyesno(
             self.__lang.text("stop-title"), self.__lang.text("stop-msg")):
         return
     if stay_alive:
         self.__app_q.put(Msg(Type.STOP))
     else:
         self.__app_q.put(Msg(Type.CLOSE))
Exemple #2
0
    def __loop(self):
        try:
            self.__window = tk.Tk()
            self.__main = tk.Frame(self.__window)
        except tk.TclError as e:
            eprint(e)
            self.__app_q.put(Msg(Type.CLOSE))
            return

        setup_window(self.__window, self.__gen_title(), self.__cfg,
                     self.__on_closing)
        self.__set_geometry()

        self.__create_widgets()
        self.__order_widgets()
        self.__colors.set_widget(self.__window)

        self.__state_machine = WindowStateMachine(
            self.__menu_items, self.__menu, self.__dirb, self.__openb,
            self.__open_settingsb, self.__saveb, self.__save_delb,
            self.__startb, self.__stopb, self.__progressbar, self.__elapsede,
            self.__lefte, self.__set_state)

        while self.__window_q_processor():
            self.__state_machine.step()
            self.__window.update_idletasks()
            self.__window.update()
Exemple #3
0
 def __save_delete(self):
     save_file = self.__savee.get_text()
     if save_file is not None and messagebox.askyesno(
             self.__lang.text("del-target-title"),
             self.__lang.text("del-target-msg")):
         self.__app_q.put(Msg(Type.DELETE, save_file))
         self.__state_machine.notify(WindowEvent.OUTPUT_DELETE)
Exemple #4
0
    def __select_language(self):
        prev_selected = self.__lang.selected
        LanguageSelector(self.__window, self.__cfg, self.__colors, self.__lang)
        if self.__lang.selected is None:
            raise RuntimeError(
                "INTERNAL ERROR: There is no selected language!")
        self.__app_q.put(Msg(Type.SET_CFG, "lang", self.__lang.selected))

        if prev_selected != self.__lang.selected:
            self.__rephrase(self.__window)
Exemple #5
0
 def _cancel(self):
     if self.__installation_started:
         if not messagebox.askyesno(
                 self._lang.text("update-cancel-install-title"),
                 self._lang.text("update-cancel-install")):
             return False
     elif self.__install:
         if not messagebox.askyesno(self._lang.text("update-cancel-title"),
                                    self._lang.text("update-cancel")):
             return False
     self.__app_q.put(Msg(Type.UPDATE_STOP))
     return True
Exemple #6
0
 def __select_dir(self):
     saved = self.__dire.get_text()
     if saved is not None:
         d = tk.filedialog.askdirectory(initialdir=saved)
     else:
         d = tk.filedialog.askdirectory()
     if d:
         if ' ' in d:
             self.__set_state("err-space-in-path")
         else:
             self.__set_state()
             self.__dire.set_path(d)
             self.__app_q.put(Msg(Type.SET_CFG, "dir", d))
Exemple #7
0
 def __open_input(self):
     d = self.__dire.get_text()
     if d is not None:
         inp = tk.filedialog.askopenfilename(initialdir=d)
     else:
         inp = tk.filedialog.askopenfilename()
     if inp:
         if ' ' in inp:
             self.__set_state("err-space-in-path")
         else:
             self.__set_state()
             self.__opene.set_path(inp)
             self.__app_q.put(Msg(Type.INPUT_FILE, inp))
             self.__state_machine.notify(WindowEvent.INPUT_PARSING)
Exemple #8
0
 def __save_output(self):
     try:
         out = tk.filedialog.asksaveasfile(
             defaultextension=".avi",
             filetypes=[(self.__lang.text("file-types"), "*.avi")])
         if out:
             if ' ' in out.name:
                 self.__set_state("err-space-in-path")
             else:
                 self.__set_state()
                 self.__savee.set_path(out.name)
                 self.__app_q.put(Msg(Type.OUTPUT_FILE, out.name))
                 self.__state_machine.notify(WindowEvent.OUTPUT_AVAIL)
     except IOError as err:
         eprint(err)
         self.__savee.set_path()
         self.__state_machine.notify(WindowEvent.OUTPUT_PERMISSION_ERROR)
Exemple #9
0
 def __encrypted_sender(self, msg_type, raw_password):
     encrypted_password = Password(raw_password)
     self.__app_q.put(Msg(msg_type, encrypted_password))
Exemple #10
0
 def __start(self):
     self.__app_q.put(Msg(Type.START, self.__streams))
     self.__state_machine.notify(WindowEvent.START)