1
# Copyright (C) 2008 Valmantas Paliksa <walmis at balticum-tv dot lt>
2
# Copyright (C) 2008 Tadas Dailyda <tadas at dailyda dot com>
4
# Licensed under the GNU General Public License Version 3
6
# This program is free software: you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation, either version 3 of the License, or
9
# (at your option) any later version.
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
16
# You should have received a copy of the GNU General Public License
17
# along with this program. If not, see <http://www.gnu.org/licenses/>.
20
from gi.repository import Gtk
24
def __init__(self, percol=2, spacingx=1, spacingy=1, size=24):
26
self.spacingx=spacingx
27
self.spacingy=spacingy
38
if len(self.pixbuffs) == 0:
45
self.cols = int(math.ceil(float(len(self.pixbuffs)) / self.percol))
48
spacing_width = (self.cols -1) * self.spacingx
52
if len(self.pixbuffs) >= self.percol:
53
self.rows = self.percol
55
self.rows = len(self.pixbuffs)
57
spacing_height = (self.rows -1) * self.spacingy
59
self.total_width = self.cols * self.size + spacing_width
60
self.total_height = self.rows * self.size + spacing_height
65
def set(self, name, pixbuf):
67
self.pixbuffs[name] = pixbuf
69
if name in self.pixbuffs:
70
del self.pixbuffs[name]