This file is indexed.

/usr/share/pyshared/PythonCard/components/choice.py is in python-pythoncard 0.8.2-3.

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
76
"""
__version__ = "$Revision: 1.20 $"
__date__ = "$Date: 2004/07/21 20:09:04 $"
"""

import wx
from PythonCard import event, widget
from list import ContainerMixin

class ChoiceSelectEvent(event.SelectEvent):
    binding = wx.EVT_CHOICE
    id = wx.wxEVT_COMMAND_CHOICE_SELECTED

ChoiceEvents = (ChoiceSelectEvent,)

class ChoiceSpec(widget.WidgetSpec):
    def __init__(self):        
        events = list(ChoiceEvents)
##        events = [ event.SelectEvent ]
        attributes = { 
            'items' : { 'presence' : 'optional', 'default' : [] },
            'stringSelection' : { 'presence' : 'optional', 'default' : None } }
        widget.WidgetSpec.__init__(self, 'Choice', 'Widget', events, attributes )


class Choice(widget.Widget, wx.Choice, ContainerMixin):
    """
    A popup menu.
    """

    _spec = ChoiceSpec()

    def __init__( self, aParent, aResource ) :
        wx.Choice.__init__(
            self,
            aParent, 
            widget.makeNewId(aResource.id), 
            aResource.position, 
            aResource.size, 
            aResource.items,
            style =  wx.CLIP_SIBLINGS | wx.NO_FULL_REPAINT_ON_RESIZE,
            name = aResource.name 
        )
        
        widget.Widget.__init__( self, aParent, aResource )        
        
        if aResource.stringSelection:
            self._setStringSelection(aResource.stringSelection)
        
        self._bindEvents(event.WIDGET_EVENTS + ChoiceEvents)

    def _getItems(self):
        if self.IsEmpty():
            return []
        else:
            items = []
            for i in range(self.GetCount()):
                items.append(self.GetString(i))
            return items

    def _setItems(self, items):
        self.Clear()
        self.AppendItems(items)

    def append(self, aString):
        self.Append(aString)

    def appendItems(self, aList):
        self.AppendItems(aList)

    items = property(_getItems, _setItems)


import sys
from PythonCard import registry
registry.Registry.getInstance().register(sys.modules[__name__].Choice)