コード例 #1
0
ファイル: preferences.py プロジェクト: rscmbbng/minigalaxy
    def save_pressed(self, button):
        self.__save_language_choice()
        Config.set("keep_installers", self.switch_keep_installers.get_active())
        Config.set("stay_logged_in", self.switch_stay_logged_in.get_active())
        Config.set("show_fps", self.switch_show_fps.get_active())

        if self.switch_show_windows_games.get_active() != Config.get(
                "show_windows_games"):
            Config.set("show_windows_games",
                       self.switch_show_windows_games.get_active())
            self.parent.reset_library()

        # Only change the install_dir is it was actually changed
        if self.button_file_chooser.get_filename() != Config.get(
                "install_dir"):
            if self.__save_install_dir_choice():
                DownloadManager.cancel_all_downloads()
                self.parent.reset_library()
            else:
                dialog = Gtk.MessageDialog(
                    parent=self,
                    modal=True,
                    destroy_with_parent=True,
                    message_type=Gtk.MessageType.ERROR,
                    buttons=Gtk.ButtonsType.OK,
                    text=_("{} isn't a usable path").format(
                        self.button_file_chooser.get_filename()))
                dialog.run()
                dialog.destroy()
        self.destroy()
コード例 #2
0
    def save_pressed(self, button):
        self.__save_language_choice()
        Config.set("keep_installers", self.switch_keep_installers.get_active())
        Config.set("stay_logged_in", self.switch_stay_logged_in.get_active())

        if self.switch_show_windows_games.get_active() != Config.get(
                "show_windows_games"):
            if self.switch_show_windows_games.get_active(
            ) and not shutil.which("wine"):
                self.parent.show_error(
                    _("Wine wasn't found. Showing Windows games cannot be enabled."
                      ))
                Config.set("show_windows_games", False)
            else:
                Config.set("show_windows_games",
                           self.switch_show_windows_games.get_active())
                self.parent.reset_library()

        # Only change the install_dir is it was actually changed
        if self.button_file_chooser.get_filename() != Config.get(
                "install_dir"):
            if self.__save_install_dir_choice():
                DownloadManager.cancel_all_downloads()
                self.parent.reset_library()
            else:
                self.parent.show_error(
                    _("{} isn't a usable path").format(
                        self.button_file_chooser.get_filename()))
        self.destroy()