Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Bender <walter@sugarlabs.org>2013-08-02 21:19:16 (GMT)
committer Walter Bender <walter@sugarlabs.org>2013-08-02 21:19:16 (GMT)
commit0ada10158aee1d8b8e8f0e6e3e505b3846c81148 (patch)
tree62bc59254f0a5d5ff6860a5df7fb47ddd12867a9
parent3e0e4421c3097e00b43b5524c11358dce52f01f9 (diff)
clean upHEADmaster
-rw-r--r--ShareStats.py30
-rw-r--r--activity/activity-stats.svg129
-rw-r--r--chart.py3
3 files changed, 97 insertions, 65 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. '''
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 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
- <!ENTITY fill_color "#808080">
- <!ENTITY stroke_color "#FFFFFF">
+ <!ENTITY fill_color "#FFFFFF">
+ <!ENTITY stroke_color "#010101">
]>
<svg
xmlns="http://www.w3.org/2000/svg"
version="1.1"
- width="62"
- height="60"
- viewBox="0 0 62 60"
- id="svg2"
- xml:space="preserve"><g
- transform="translate(60.127119,11.292373)"
+ width="55"
+ height="55"
+ viewBox="0 0 55 55"
+ id="svg3059"
+ style="fill:&fill_color;;stroke:&stroke_color;;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round">
+<g>
+<path
+ d="M 45.866,44.669 C 45.866,47.18 44.338,49 41.534,49 H 12.077 V 6 h 29.458 c 2.15,0 4.332,2.154 4.332,4.33 l -10e-4,34.339 0,0 z"
+ id="path4"
+ style="fill:&fill_color;;fill-opacity:1;stroke:&stroke_color;;stroke-width:3.5;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><line
+ id="line6"
+ style="fill:&fill_color;;fill-opacity:1;stroke:&stroke_color;;stroke-width:3.5;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ x1="21.341"
+ x2="21.341"
+ y1="6.1209998"
+ y2="48.881001" /><path
+ d="m 7.384,14.464 c 0,0 2.084,0.695 4.17,0.695 2.086,0 4.173,-0.695 4.173,-0.695"
+ id="path8"
+ style="fill:&fill_color;;fill-opacity:1;stroke:&stroke_color;;stroke-width:3.5;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><path
+ d="m 7.384,28.021 c 0,0 1.912,0.695 4.345,0.695 2.433,0 3.999,-0.695 3.999,-0.695"
+ id="path10"
+ style="fill:&fill_color;;fill-opacity:1;stroke:&stroke_color;;stroke-width:3.5;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><path
+ d="m 7.384,41.232 c 0,0 1.736,0.695 4.518,0.695 2.781,0 3.825,-0.695 3.825,-0.695"
+ id="path12"
+ style="fill:&fill_color;;fill-opacity:1;stroke:&stroke_color;;stroke-width:3.5;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><g
+ transform="matrix(0.47158488,0,0,0.47158488,54.235909,30.621153)"
id="activity-browse"
- style="display:block">
-
- <g
- transform="translate(-128.87712,-22.838983)"
- id="g7"
- style="display:inline">
-
-
-
-
-
-
- <g
- transform="matrix(0.10822504,0,0,0.09945444,61.358446,34.085169)"
- id="g6167"><g
- transform="translate(2.7213003,-2.9469823)"
- id="g3798"
- style="fill:&fill_color;;fill-opacity:1"><rect
- width="81.443176"
- height="272.19876"
- rx="4.3524833"
- ry="6.0284276"
- x="373.97116"
- y="55.900478"
- id="rect2987"
- style="color:#000000;fill:&fill_color;;fill-opacity:1;stroke:&stroke_color;;stroke-width:33.73588181;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" /><rect
- width="81.443077"
- height="360.47952"
- rx="4.3524833"
- ry="6.0284276"
- x="499.32275"
- y="-32.380226"
- id="rect3757"
- style="color:#000000;fill:&fill_color;;fill-opacity:1;stroke:&stroke_color;;stroke-width:33.73588181;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" /><rect
- width="81.443077"
- height="500.25723"
- rx="4.3524833"
- ry="6.0284276"
- x="248.61969"
- y="-172.15802"
- id="rect3759"
- style="color:#000000;fill:&fill_color;;fill-opacity:1;stroke:&stroke_color;;stroke-width:33.73588181;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" /><rect
- width="81.443314"
- height="215.79736"
- rx="4.3524833"
- ry="6.0284276"
- x="123.26795"
- y="112.30204"
- id="rect3761"
- style="color:#000000;fill:&fill_color;;fill-opacity:1;stroke:&stroke_color;;stroke-width:33.73588181;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" /></g></g></g>
-</g></svg> \ 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"><g
+ transform="translate(-128.87712,-22.838983)"
+ id="g7"
+ style="fill:&fill_color;;fill-opacity:1;stroke:&stroke_color;;stroke-width:3.5;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"><g
+ transform="matrix(0.10822504,0,0,0.09945444,61.358446,34.085169)"
+ id="g6167"
+ style="fill:&fill_color;;fill-opacity:1;stroke:&stroke_color;;stroke-width:33.73588181;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"><g
+ transform="translate(2.7213003,-2.9469823)"
+ id="g3798"
+ style="fill:&fill_color;;fill-opacity:1;stroke:&stroke_color;;stroke-width:33.73588181;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"><rect
+ width="81.443176"
+ height="272.19876"
+ rx="4.3524833"
+ ry="6.0284276"
+ x="373.97116"
+ y="55.900478"
+ id="rect2987"
+ style="color:&stroke_color;;fill:&fill_color;;fill-opacity:1;stroke:&stroke_color;;stroke-width:33.73588181;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><rect
+ width="81.443077"
+ height="360.47952"
+ rx="4.3524833"
+ ry="6.0284276"
+ x="499.32275"
+ y="-32.380226"
+ id="rect3757"
+ style="color:&stroke_color;;fill:&fill_color;;fill-opacity:1;stroke:&stroke_color;;stroke-width:33.73588181;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><rect
+ width="81.443077"
+ height="500.25723"
+ rx="4.3524833"
+ ry="6.0284276"
+ x="248.61969"
+ y="-172.15802"
+ id="rect3759"
+ style="color:&stroke_color;;fill:&fill_color;;fill-opacity:1;stroke:&stroke_color;;stroke-width:33.73588181;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><rect
+ width="81.443314"
+ height="215.79736"
+ rx="4.3524833"
+ ry="6.0284276"
+ x="123.26795"
+ y="112.30204"
+ id="rect3761"
+ style="color:&stroke_color;;fill:&fill_color;;fill-opacity:1;stroke:&stroke_color;;stroke-width:33.73588181;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g></g></g></g></svg>
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)