def update_grapejuice(self, *_): if self._updating: return self._updating = True dialog("If the Grapejuice upgrade breaks your installation, please redo the Grapejuice installation according " "to the instructions in the Grapejuice git repository. The upgrade will begin after you close this " "dialog.") background.tasks.add(PerformUpdate(update_provider, reopen=True))
def wine_ok(system_wine: str = None, show_dialog=True): from grapejuice_common.features.settings import settings if settings.ignore_wine_version.value: return True from grapejuice_common.ipc.dbus_client import dbus_connection from grapejuice_common.gtk.gtk_stuff import dialog def prepare_version(s): from packaging import version if "-" in s: match = re.match(r"(wine-.*?)-.*", s) if match: s = match.group(1) if space in s: match = space_version_ptn.match(s) else: match = non_space_version_ptn.match(s) assert match is not None return version.parse(match.group(1)) if system_wine is None: system_wine = prepare_version(dbus_connection().wine_version()) else: system_wine = prepare_version(system_wine) required_wine = prepare_version(variables.required_wine_version()) def version_to_string(v): if v.public: return v.public if v.base_version: return v.base_version return repr(v) if system_wine < required_wine: if show_dialog: msg = "Your system has Wine version {} installed, you need at least Wine version {} in order to run Roblox." \ .format(version_to_string(system_wine), version_to_string(required_wine)) dialog(msg) return False return True
def run_roblox_studio(self, *_): studio_launcher_location = robloxctrl.locate_studio_launcher() if not studio_launcher_location: dialog( "Grapejuice could not locate Roblox Studio. You might have to install it first by going to the " "maintenance tab and clicking 'Install Roblox'") return if not wine_ok(): return run_task_once(RunRobloxStudio, generic_already_running)
def player_main(): from grapejuice_common.features.settings import settings if settings.n_player_dialogs_remain > 0: settings.n_player_dialogs_remain = settings.n_player_dialogs_remain - 1 settings.save() gtk_stuff.dialog("Currently, the Roblox Player is not confirmed to be working properly with Wine and " "therefore is not supported by the Grapejuice project. Grapejuice will still launcher the " "player, but it will most likely not work.") dbus_connection().play_game(grapejuice_common.util.prepare_uri(args.uri))
def run_roblox_studio(self, *_): studio_launcher_location = robloxctrl.locate_studio_launcher() if not studio_launcher_location: dialog("Grapejuice could not locate Roblox Studio. You might have to install it first by going to the " "maintenance tab and clicking 'Install Roblox'") return if not wine_ok(): return if not logged_into_studio() and yes_no_dialog( "Log into Roblox", "You are currently not signed into Roblox Studio. " "Roblox Studio is known to require an account to use. Would you like to sign in now?" ): xdg_open(variables.roblox_return_to_studio()) else: run_task_once(RunRobloxStudio, generic_already_running)
def uninstall_grapejuice(self, *_): do_it = yes_no_dialog("Uninstall Grapejuice", "Are you sure that you want to uninstall Grapejuice?") if not do_it: return params = uninstall.UninstallationParameters( yes_no_dialog( title="Remove Wineprefix?", message="Remove the Wineprefix that contains your installation of Roblox Studio? This will cause all " "configuration of Roblox Studio to be permanently deleted! " ), for_reals=True ) try: dialog("Grapejuice will now uninstall itself, the program will close when the process is finished.") uninstall.go(params) except Exception as e: msg = f"{e.__class__.__name__}: {str(e)}" LOG.error(msg) dialog(f"Failed to uninstall Grapejuice.\n\n{msg}")
def no_wine_dialog() -> None: dialog("Grapejuice could not find a working Wine binary, please install Wine using your operating " "system's package manager in order to install and use Roblox.") return None
def generic_already_running(): dialog("This task is already being performed!")