# slim_project_item.py # # Copyright 2025 Pavel Baksy # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # SPDX-License-Identifier: GPL-3.0-or-later from gi.repository import Gtk, GObject @Gtk.Template(resource_path='/cz/vesp/roster/widgets/slim-project-item.ui') class SlimProjectItem(Gtk.Button): """Slim widget showing only project icon (for folded sidebar).""" __gtype_name__ = 'SlimProjectItem' project_icon = Gtk.Template.Child() __gsignals__ = { 'project-clicked': (GObject.SIGNAL_RUN_FIRST, None, ()), } def __init__(self, project): super().__init__() self.project = project self.project_icon.set_from_icon_name(project.icon) self.set_tooltip_text(project.name) @Gtk.Template.Callback() def on_clicked(self, button): """Handle click - unfold sidebar and show this project.""" self.emit('project-clicked')