Home | History | Annotate | Download | only in gui
      1 ## mappingsPage.py - show selinux mappings
      2 ## Copyright (C) 2006 Red Hat, Inc.
      3 
      4 ## This program is free software; you can redistribute it and/or modify
      5 ## it under the terms of the GNU General Public License as published by
      6 ## the Free Software Foundation; either version 2 of the License, or
      7 ## (at your option) any later version.
      8 
      9 ## This program is distributed in the hope that it will be useful,
     10 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
     11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     12 ## GNU General Public License for more details.
     13 
     14 ## You should have received a copy of the GNU General Public License
     15 ## along with this program; if not, write to the Free Software
     16 ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     17 
     18 ## Author: Dan Walsh
     19 import string
     20 import gtk
     21 import gtk.glade
     22 import os
     23 import gobject
     24 import sys
     25 import seobject
     26 
     27 ##
     28 ## I18N
     29 ##
     30 PROGNAME = "policycoreutils"
     31 import gettext
     32 gettext.bindtextdomain(PROGNAME, "/usr/share/locale")
     33 gettext.textdomain(PROGNAME)
     34 try:
     35     gettext.install(PROGNAME,
     36                     localedir="/usr/share/locale",
     37                     unicode=False,
     38                     codeset='utf-8')
     39 except IOError:
     40     import __builtin__
     41     __builtin__.__dict__['_'] = unicode
     42 
     43 
     44 class loginsPage:
     45 
     46     def __init__(self, xml):
     47         self.xml = xml
     48         self.view = xml.get_widget("mappingsView")
     49         self.store = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING)
     50         self.store.set_sort_column_id(0, gtk.SORT_ASCENDING)
     51         self.view.set_model(self.store)
     52         self.login = loginRecords()
     53         dict = self.login.get_all(0)
     54         keys = dict.keys()
     55         keys.sort()
     56         for k in keys:
     57             print "%-25s %-25s %-25s" % (k, dict[k][0], translate(dict[k][1]))
     58