Exemplo n.º 1
0
 def _do_teacher_popup(self):
     self.controls.timer.paused = True
     if not self.teacher_settings_popup:
         self.teacher_settings_popup = I18NPopup(
             title_key="teacher settings",
             size=[dp(800), dp(700)],
             content=ConfigTeacherPopup(self)).__self__
         self.teacher_settings_popup.content.popup = self.teacher_settings_popup
     self.teacher_settings_popup.open()
Exemplo n.º 2
0
 def _do_ai_popup(self):
     self.controls.timer.paused = True
     if not self.ai_settings_popup:
         self.ai_settings_popup = I18NPopup(
             title_key="ai settings",
             size=[dp(600), dp(650)],
             content=ConfigAIPopup(self)).__self__
         self.ai_settings_popup.content.popup = self.ai_settings_popup
     self.ai_settings_popup.open()
Exemplo n.º 3
0
 def _do_new_game_popup(self):
     self.controls.timer.paused = True
     if not self.new_game_popup:
         self.new_game_popup = I18NPopup(
             title_key="New Game title",
             size=[dp(800), dp(800)],
             content=NewGamePopup(self)).__self__
         self.new_game_popup.content.popup = self.new_game_popup
     self.new_game_popup.open()
Exemplo n.º 4
0
 def _do_config_popup(self):
     self.controls.timer.paused = True
     if not self.config_popup:
         self.config_popup = I18NPopup(
             title_key="general settings title", size=[dp(1200), dp(950)], content=ConfigPopup(self)
         ).__self__
         self.config_popup.content.popup = self.config_popup
         self.config_popup.title += ": " + self.config_file
     self.config_popup.open()
Exemplo n.º 5
0
 def _do_timer_popup(self):
     self.controls.timer.paused = True
     if not self.timer_settings_popup:
         self.timer_settings_popup = I18NPopup(
             title_key="timer settings",
             size=[350, 350],
             content=ConfigTimerPopup(self)).__self__
         self.timer_settings_popup.content.popup = self.timer_settings_popup
     self.timer_settings_popup.open()
Exemplo n.º 6
0
 def _do_engine_recovery_popup(self, error_message, code):
     current_open = self.popup_open
     if current_open and isinstance(current_open.content, EngineRecoveryPopup):
         self.log(f"Not opening engine recovery popup with {error_message} as one is already open", OUTPUT_DEBUG)
         return
     popup = I18NPopup(
         title_key="engine recovery",
         size=[dp(600), dp(700)],
         content=EngineRecoveryPopup(self, error_message=error_message, code=code),
     ).__self__
     popup.content.popup = popup
     popup.open()
Exemplo n.º 7
0
    def _do_analyze_sgf_popup(self):
        if not self.fileselect_popup:
            popup_contents = LoadSGFPopup()
            popup_contents.filesel.path = os.path.abspath(os.path.expanduser(self.config("general/sgf_load", ".")))
            self.fileselect_popup = I18NPopup(
                title_key="load sgf title", size=[dp(1200), dp(800)], content=popup_contents
            ).__self__

            def readfile(*_args):
                filename = popup_contents.filesel.filename
                self.fileselect_popup.dismiss()
                path, file = os.path.split(filename)
                settings_path = self.config("general/sgf_load")
                if path != settings_path:
                    self.log(f"Updating sgf load path default to {path}", OUTPUT_INFO)
                    self._config["general"]["sgf_load"] = path
                    self.save_config("general")
                self.load_sgf_file(filename, popup_contents.fast.active, popup_contents.rewind.active)

            popup_contents.filesel.on_success = readfile
            popup_contents.filesel.on_submit = readfile
        self.fileselect_popup.open()
Exemplo n.º 8
0
    def _do_save_game_as_popup(self):
        popup_contents = SaveSGFPopup(suggested_filename=self.game.generate_filename())
        save_game_popup = I18NPopup(
            title_key="save sgf title", size=[dp(1200), dp(800)], content=popup_contents
        ).__self__

        def readfile(*_args):
            filename = popup_contents.filesel.filename
            if not filename.lower().endswith(".sgf"):
                filename += ".sgf"
            save_game_popup.dismiss()
            path, file = os.path.split(filename.strip())
            if not path:
                path = popup_contents.filesel.path  # whatever dir is shown
            if path != self.config("general/sgf_save"):
                self.log(f"Updating sgf save path default to {path}", OUTPUT_DEBUG)
                self._config["general"]["sgf_save"] = path
                self.save_config("general")
            self._do_save_game(os.path.join(path, file))

        popup_contents.filesel.on_success = readfile
        popup_contents.filesel.on_submit = readfile
        save_game_popup.open()
Exemplo n.º 9
0
 def open_game_analysis_popup(self, *_args):
     analysis_popup = I18NPopup(title_key="analysis:game", size=[dp(500), dp(350)], content=ReAnalyzeGamePopup())
     analysis_popup.content.popup = analysis_popup
     analysis_popup.content.katrain = MDApp.get_running_app().gui
     analysis_popup.open()