~ubuntu-branches/ubuntu/trusty/geis/trusty

« back to all changes in this revision

Viewing changes to tools/geisview/classview.py

  • Committer: Package Import Robot
  • Author(s): Chase Douglas
  • Date: 2012-07-30 08:51:42 UTC
  • Revision ID: package-import@ubuntu.com-20120730085142-jrc33ygjvt0ob1wl
Tags: upstream-2.2.11
ImportĀ upstreamĀ versionĀ 2.2.11

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# @file geisview/gesture_classview.py
 
3
# @brief GestureClass viewer for geisview.
 
4
#
 
5
# Copyright (C) 2011 Canonical Ltd
 
6
#
 
7
# This program is free software; you can redistribute it and/or modify
 
8
# it under the terms of the GNU General Public License as published by
 
9
# the Free Software Foundation; either version 3 of the License, or
 
10
# (at your option) any later version.
 
11
#
 
12
# This program is distributed in the hope that it will be useful,
 
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
# GNU General Public License for more details.
 
16
#
 
17
# You should have received a copy of the GNU General Public License
 
18
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
19
#
 
20
 
 
21
import pygtk
 
22
pygtk.require('2.0')
 
23
import gtk
 
24
 
 
25
class GestureClassView(gtk.Window):
 
26
 
 
27
    def __init__(self, gesture_classes):
 
28
        gtk.Window.__init__(self)
 
29
        self.set_title("GEIS GestureClasss")
 
30
        self.set_size_request(200, 200)
 
31
 
 
32
        self._tree_store = gtk.TreeStore(str, str)
 
33
        for (class_id, gclass) in gesture_classes.iteritems():
 
34
            it = self._tree_store.append(None, ["%s" % gclass.id(),
 
35
                                                "%s" % gclass.name()])
 
36
        self._tree_view = gtk.TreeView(self._tree_store)
 
37
#        self._tree_view.set_mode(gtk.SELECTION_SINGLE)
 
38
 
 
39
        cell = gtk.CellRendererText()
 
40
        col = gtk.TreeViewColumn('ID')
 
41
        col.pack_start(cell, True)
 
42
        col.add_attribute(cell, 'text', 0)
 
43
        self._tree_view.append_column(col)
 
44
 
 
45
        cell = gtk.CellRendererText()
 
46
        col = gtk.TreeViewColumn('Name')
 
47
        col.pack_start(cell, True)
 
48
        col.add_attribute(cell, 'text', 1)
 
49
        self._tree_view.append_column(col)
 
50
 
 
51
        self.add(self._tree_view)
 
52
        self.show_all()
 
53