Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/ShareStats.py
diff options
context:
space:
mode:
Diffstat (limited to 'ShareStats.py')
-rw-r--r--ShareStats.py30
1 files changed, 24 insertions, 6 deletions
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. '''