Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/wirelessgraphactivity.py
blob: f379f34b10884c8ccc58e7a29e9efd794e51b2a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Copyright (C) 2009, Martin Dengler <martin@martindengler.com>
#
# 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 2 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, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

import logging

import gtk

from gettext import gettext as _
from sugar import profile
from sugar.activity import activity

from wirelessgraph import Graph
from wirelessdataseries import WirelessDataSeries

class WirelessGraphActivity(activity.Activity):
    def __init__(self, handle):
        activity.Activity.__init__(self, handle)

        self._logger = logging.getLogger("WirelessGraph")
        self._logger.info("WirelessGraphActivity self.show()")

        self.set_title(_('WirelessGraph'))
        self._build_toolbox()

        vbox = gtk.VBox()
        self.graph = Graph()
        vbox.pack_start(self.graph)
        self.set_canvas(vbox)
        vbox.show_all()

        default_series = WirelessDataSeries(
            series_name=profile.get_nick_name(),
            series_color=profile.get_color())
        self.series = [default_series]
        self.graph.add_series(default_series)

    def _build_toolbox(self):
        toolbox = activity.ActivityToolbox(self)
        toolbox.show()
        self.set_toolbox(toolbox)