def initialize(self, slug=None, callback=None): self.game = Game(slug) self.callback = callback self.substitute_label(self.builder.get_object('description_label'), 'game', self.game.name) self.substitute_label( self.builder.get_object('remove_from_library_button'), 'game', self.game.name ) remove_contents_button = self.builder.get_object( 'remove_contents_button' ) try: default_path = self.game.runner.default_path except AttributeError: default_path = "/" if not is_removeable(self.game.directory, excludes=[default_path]): remove_contents_button.set_sensitive(False) path = self.game.directory or 'disk' self.substitute_label(remove_contents_button, 'path', path) cancel_button = self.builder.get_object('cancel_button') cancel_button.connect('clicked', self.on_close) apply_button = self.builder.get_object('apply_button') apply_button.connect('clicked', self.on_apply_button_clicked)
def initialize(self, game_id=None, callback=None): self.game = Game(game_id) self.callback = callback runner = self.game.runner self.substitute_label(self.builder.get_object('description_label'), 'game', self.game.name) self.substitute_label( self.builder.get_object('remove_from_library_button'), 'game', self.game.name ) remove_contents_button = self.builder.get_object( 'remove_contents_button' ) if self.game.is_installed: path = self.game.directory or '' if hasattr(runner, 'own_game_remove_method'): remove_contents_button.set_label(runner.own_game_remove_method) remove_contents_button.set_active(True) else: try: default_path = runner.default_path except AttributeError: default_path = "/" if is_removeable(path, excludes=[default_path]): remove_contents_button.set_active(True) else: remove_contents_button.set_sensitive(False) path = 'No game folder' path = reverse_expanduser(path) self.substitute_label(remove_contents_button, 'path', path) label = remove_contents_button.get_child() label.set_use_markup(True) label.set_line_wrap(True) label.set_line_wrap_mode(Pango.WrapMode.WORD_CHAR) else: remove_contents_button.hide() cancel_button = self.builder.get_object('cancel_button') cancel_button.connect('clicked', self.on_close) apply_button = self.builder.get_object('apply_button') apply_button.connect('clicked', self.on_apply_button_clicked)
def initialize(self, slug=None, callback=None): self.game = Game(slug) self.callback = callback runner = self.game.runner self.substitute_label(self.builder.get_object('description_label'), 'game', self.game.name) self.substitute_label( self.builder.get_object('remove_from_library_button'), 'game', self.game.name ) remove_contents_button = self.builder.get_object( 'remove_contents_button' ) if self.game.is_installed: if hasattr(runner, 'own_game_remove_method'): remove_contents_button.set_label(runner.own_game_remove_method) else: try: default_path = runner.default_path except AttributeError: default_path = "/" try: game_path = runner.game_path except AttributeError: game_path = '/' if not is_removeable(game_path, excludes=[default_path]): remove_contents_button.set_sensitive(False) path = self.game.directory or 'disk' self.substitute_label(remove_contents_button, 'path', path) remove_contents_button.get_children()[0].set_use_markup(True) else: remove_contents_button.hide() cancel_button = self.builder.get_object('cancel_button') cancel_button.connect('clicked', self.on_close) apply_button = self.builder.get_object('apply_button') apply_button.connect('clicked', self.on_apply_button_clicked)