/usr/share/pyshared/kiwi/ui/gaxmlloader.py is in python-kiwi 1.9.22-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | #
# Kiwi: a Framework and Enhanced Widgets for Python
#
# Copyright (C) 2007 Async Open Source
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA
#
# Author(s): Johan Dahlin <jdahlin@async.com.br>
#
from gaxml.parser import GAXParser
from kiwi.log import Logger
log = Logger('gaxmlparser')
class GAXMLWidgetTree(object):
def __init__(self, view, gladefile, domain=None):
self._view = view
self._gladefile = gladefile
self._parser = GAXParser()
self._parser.parse_file(gladefile)
self._widgets = [o.get_name() for o in self._parser.get_objects()]
self._attach_widgets()
def _attach_widgets(self):
# Attach widgets in the widgetlist to the view specified, so
# widgets = [label1, button1] -> view.label1, view.button1
for w in self._widgets:
widget = self._parser.get_object(name=w)
if widget is not None:
setattr(self._view, w, widget)
else:
log.warn("Widget %s was not found in glade widget tree." % w)
def get_widget(self, name):
"""Retrieves the named widget from the View (or glade tree)"""
if name.endswith('_ui'):
name = name[:-3]
name = name.replace('.', '_')
widget = self._parser.get_object(name=name)
if widget is None:
raise AttributeError(
"Widget %s not found in view %s" % (name, self._view))
return widget
def get_widgets(self):
return self._parser.get_objects()
def get_sizegroups(self):
return []
def signal_autoconnect(self, signals):
pass
|