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 try: 32 import gettext 33 kwargs = {} 34 if sys.version_info < (3,): 35 kwargs['unicode'] = True 36 gettext.install(PROGNAME, 37 localedir="/usr/share/locale", 38 codeset='utf-8', 39 **kwargs) 40 except: 41 try: 42 import builtins 43 builtins.__dict__['_'] = str 44 except ImportError: 45 import __builtin__ 46 __builtin__.__dict__['_'] = unicode 47 48 49 class loginsPage: 50 51 def __init__(self, xml): 52 self.xml = xml 53 self.view = xml.get_widget("mappingsView") 54 self.store = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING) 55 self.store.set_sort_column_id(0, gtk.SORT_ASCENDING) 56 self.view.set_model(self.store) 57 self.login = loginRecords() 58 dict = self.login.get_all(0) 59 for k in sorted(dict.keys()): 60 print("%-25s %-25s %-25s" % (k, dict[k][0], translate(dict[k][1]))) 61