Implement a collapsible sidebar that can be folded to show just project icons in a slim strip, or expanded to show full project details. Projects can now have custom icons selected from a 6x6 grid of 36 symbolic icons. Features: - Foldable sidebar with toggle button (fold/unfold) - Slim sidebar view showing only project icons when folded - Custom project icons with 36 symbolic icon choices - Icon picker dialog with 6x6 grid layout - Edit Project dialog (renamed from Rename) with name and icon selection - Project icons displayed in both full and slim sidebar views - Smooth transitions between folded/unfolded states - Click on slim project icon to unfold sidebar Technical changes: - Add icon field to Project model with default "folder-symbolic" - Create constants.py with PROJECT_ICONS list (36 symbolic icons) - Implement IconPickerDialog with grid layout and selection - Create SlimProjectItem widget for folded sidebar view - Update ProjectManager.update_project() to handle icon changes - Restructure sidebar using GtkStack for full/slim view switching - Update project-item.ui to display project icon - Change "Rename" menu to "Edit Project" with icon picker - Add fold/unfold buttons with sidebar-show icons - Update build system with new files and resources
45 lines
1.5 KiB
Python
45 lines
1.5 KiB
Python
# 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 <https://www.gnu.org/licenses/>.
|
|
#
|
|
# 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')
|