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

« back to all changes in this revision

Viewing changes to tools/geisview/deviceview.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/deviceview.py
 
3
# @brief Device 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 DeviceView(gtk.Window):
 
26
 
 
27
    def __init__(self, devices):
 
28
        gtk.Window.__init__(self)
 
29
        self.set_title("GEIS Devices")
 
30
        self.set_size_request(200, 200)
 
31
 
 
32
        self._devices = devices
 
33
        self._tree_store = gtk.TreeStore(str)
 
34
        for device in devices:
 
35
            it = self._tree_store.append(None, ["%s" % device])
 
36
        self._tree_view = gtk.TreeView(self._tree_store)
 
37
#        self._tree_view.set_mode(gtk.SELECTION_SINGLE)
 
38
        cell = gtk.CellRendererText()
 
39
        col = gtk.TreeViewColumn('Label')
 
40
        col.pack_start(cell, True)
 
41
        col.add_attribute(cell, 'text', 0)
 
42
        self._tree_view.append_column(col)
 
43
 
 
44
        self.add(self._tree_view)
 
45
        self.show_all()
 
46