From 0ada10158aee1d8b8e8f0e6e3e505b3846c81148 Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Fri, 02 Aug 2013 21:19:16 +0000 Subject: clean up --- diff --git a/ShareStats.py b/ShareStats.py index 3744112..281c247 100644 --- a/ShareStats.py +++ b/ShareStats.py @@ -121,20 +121,37 @@ class ShareStats(activity.Activity): def _create_chart(self, data): chart = charts.Chart(charts.HORIZONTAL_BAR) + colors = profile.get_color() + logging.debug(colors) + chart_color = colors.get_fill_color() + logging.debug(chart_color) + chart_line_color = colors.get_stroke_color() + logging.debug(chart_line_color) eventbox = Gtk.EventBox() - self.charts_area = ChartArea(chart) - eventbox.modify_bg(Gtk.StateType.NORMAL, _WHITE) - eventbox.add(self.charts_area) + charts_area = ChartArea(chart) + eventbox.modify_bg(Gtk.StateType.NORMAL, Gdk.color_parse('white')) + eventbox.add(charts_area) + eventbox.show() self._vbox.pack_end(eventbox, True, True, 0) chart_data = [] + i = 0 for entry in data: label = entry[0] value = len(entry[1]) chart_data.append((label, float(value))) - logging.debug(chart_data) + i += 1 + if i > 15: + break chart.data_set(chart_data) + chart.width = Gdk.Screen.width() - 2 * style.GRID_CELL_SIZE + chart.height = Gdk.Screen.height() - 2 * style.GRID_CELL_SIZE + chart.set_color_scheme(color=chart_color) + chart.set_line_color(chart_line_color) + chart.render() + charts_area.queue_draw() + self.show_all() def _create_icon(self, color, name='computer-xo'): return CanvasIcon(icon_name=name, @@ -144,7 +161,8 @@ class ShareStats(activity.Activity): def _add_buddy(self, icon, nick): ''' Add buddies to sharer's canavs to show whom has shared data ''' - if self._buddy_count % 5 == 0: + n = int(Gdk.Screen.width() / (3 * style.STANDARD_ICON_SIZE)) + if self._buddy_count % n == 0: self._hboxes.append(Gtk.HBox(False, 0)) self._hboxes[-1].show() self._vbox.pack_end(self._hboxes[-1], True, False, 0) @@ -238,7 +256,7 @@ class ShareStats(activity.Activity): msg='%s %s' % (_('Received journal statistics from'), nick)) icon = self._create_icon(colors) - self._add_buddy_icon(icon, nick) + self._add_buddy(icon, nick) def _setup_presence_service(self): ''' Setup the Presence Service. ''' diff --git a/activity/activity-stats.svg b/activity/activity-stats.svg index 4d06f10..1f563af 100644 --- a/activity/activity-stats.svg +++ b/activity/activity-stats.svg @@ -1,66 +1,77 @@ - + + ]> + + - - - - - - - - - - \ No newline at end of file + style="fill:&fill_color;;fill-opacity:1;stroke:&stroke_color;;stroke-width:3.5;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:block"> diff --git a/chart.py b/chart.py index 1abc313..64503ac 100644 --- a/chart.py +++ b/chart.py @@ -20,6 +20,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +import logging + import sugarpycha.bar import sugarpycha.line import sugarpycha.pie @@ -120,6 +122,7 @@ class Chart(GObject.GObject): chart = sugarpycha.bar.VerticalBarChart(self.surface, self.options) elif self.type == HORIZONTAL_BAR: + logging.debug(self.options) chart = sugarpycha.bar.HorizontalBarChart(self.surface, self.options) -- cgit v0.9.1