/usr/share/pyshared/wxglade/widgets/MenuTree.py is in python-wxglade 0.6.8-1.
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 68 69 70 71 72 73 74 75 | # MenuTree.py: A class to represent a menu on a wxMenuBar
# $Id: MenuTree.py,v 1.12 2007/03/27 07:02:05 agriggio Exp $
#
# Copyright (c) 2002-2007 Alberto Griggio <agriggio@users.sourceforge.net>
# License: MIT (see license.txt)
# THIS PROGRAM COMES WITH NO WARRANTY
class MenuTree:
"""\
A class to represent a menu on a wxMenuBar
"""
class Node:
def __init__(self, label="", id="", name="", help_str="",
checkable="", radio="", handler=""):
self.label = label
self.id = id
self.name = name
self.help_str = help_str
self.checkable = checkable
self.radio = radio
self.handler = handler
self.children = []
self.parent = None
def write(self, outfile, tabs, top=False):
from xml.sax.saxutils import escape, quoteattr
import common
fwrite = outfile.write
tstr = ' ' * (tabs+1)
label = common._encode_to_xml(self.label)
help_str = common._encode_to_xml(self.help_str)
if not top and not self.children:
fwrite('%s<item>\n' % (' ' * tabs))
label = escape(label)
if label: fwrite('%s<label>%s</label>\n' % (tstr, label))
id = escape(self.id)
if id: fwrite('%s<id>%s</id>\n' % (tstr, id))
name = escape(self.name)
if name: fwrite('%s<name>%s</name>\n' % (tstr, name))
help_str = escape(help_str)
if help_str: fwrite('%s<help_str>%s</help_str>\n' % (tstr,
help_str))
try: checkable = int(self.checkable)
except: checkable = 0
if checkable:
fwrite('%s<checkable>%s</checkable>\n' % (tstr, checkable))
try: radio = int(self.radio)
except: radio = 0
if radio:
fwrite('%s<radio>%s</radio>\n' % (tstr, radio))
# ALB 2004-12-05
handler = escape(self.handler.strip())
if handler:
fwrite('%s<handler>%s</handler>\n' % (tstr, handler))
fwrite('%s</item>\n' % (' ' * tabs))
else:
name = quoteattr(self.name)
fwrite(' ' * tabs + '<menu name=%s ' % name)
if self.id:
fwrite('itemid=%s ' % quoteattr(self.id))
if self.handler:
fwrite('handler=%s ' % quoteattr(self.handler))
fwrite('label=%s>\n' % (quoteattr(label)))
for c in self.children: c.write(outfile, tabs+1)
fwrite(' ' * tabs + '</menu>\n')
#end of class Node
def __init__(self, name, label, id="", help_str="", handler=""):
self.root = self.Node(label, id, name, help_str, handler=handler)
def write(self, outfile, tabs):
self.root.write(outfile, tabs, top=True)
#end of class MenuTree
|