def switch_view(self, view_type): """Switch between grid view and list view.""" self.view.destroy() self.load_icon_type_from_settings(view_type) self.game_store.set_icon_type(self.icon_type) self.view = self.get_view(view_type) self.view.contextual_menu = ContextualMenu( self.game_actions.get_game_actions()) self._connect_signals() scrollwindow_children = self.games_scrollwindow.get_children() if scrollwindow_children: child = scrollwindow_children[0] child.destroy() self.games_scrollwindow.add(self.view) self.set_selected_filter(self.selected_runner, self.selected_platform, self.selected_category) self.set_show_installed_state(self.filter_installed) self.view.show_all() self.zoom_adjustment.props.value = list(IMAGE_SIZES.keys()).index( self.icon_type) self.set_viewtype_icon(view_type) settings.write_setting("view_type", view_type)
def _bind_zoom_adjustment(self): """Bind the zoom slider to the supported banner sizes""" image_sizes = list(IMAGE_SIZES.keys()) self.zoom_adjustment.props.value = image_sizes.index(self.icon_type) self.zoom_adjustment.connect( "value-changed", lambda adj: self._set_icon_type(image_sizes[int(adj.props.value)]), )
def load_icon_type_from_settings(self, view_type): """Return the icon style depending on the type of view.""" if view_type == "list": self.icon_type = settings.read_setting("icon_type_listview") default = "icon" else: self.icon_type = settings.read_setting("icon_type_gridview") default = "banner" if self.icon_type not in IMAGE_SIZES.keys(): self.icon_type = default return self.icon_type
def load_icon_type_from_settings(self, view_type): """Return the icon style depending on the type of view.""" if view_type == "list": self.icon_type = settings.read_setting("icon_type_listview") default = settings.ICON_TYPE_LISTVIEW else: self.icon_type = settings.read_setting("icon_type_gridview") default = settings.ICON_TYPE_GRIDVIEW if self.icon_type not in IMAGE_SIZES.keys(): self.icon_type = default return self.icon_type
def switch_view(self, view_type): """Switch between grid view and list view.""" self.view.destroy() self.load_icon_type_from_settings(view_type) self.game_store.set_icon_type(self.icon_type) self.view = self.get_view(view_type) self.view.contextual_menu = ContextualMenu(self.game_actions.get_game_actions()) self._connect_signals() scrollwindow_children = self.games_scrollwindow.get_children() if scrollwindow_children: child = scrollwindow_children[0] child.destroy() self.games_scrollwindow.add(self.view) self.set_selected_filter(self.selected_runner, self.selected_platform) self.set_show_installed_state(self.filter_installed) self.view.show_all() self.zoom_adjustment.props.value = list(IMAGE_SIZES.keys()).index(self.icon_type) self.set_viewtype_icon(view_type) settings.write_setting("view_type", view_type)