/usr/share/pyshared/PythonCard/components/gauge.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 | """
__version__ = "$Revision: 1.12 $"
__date__ = "$Date: 2004/05/04 17:15:42 $"
"""
import wx
from PythonCard import event, widget
class GaugeSpec(widget.WidgetSpec):
def __init__(self):
events = []
attributes = {
'layout' : { 'presence' : 'optional', 'default' : 'horizontal', 'values' : [ 'horizontal', 'vertical' ] },
'max' : { 'presence' : 'optional', 'default' : 100 },
'value' : { 'presence' : 'optional', 'default' : 0 }
}
widget.WidgetSpec.__init__(self, 'Gauge', 'Widget', events, attributes)
class Gauge(widget.Widget, wx.Gauge):
"""
A gauge component.
"""
_spec = GaugeSpec()
def __init__( self, aParent, aResource ) :
wx.Gauge.__init__(
self,
aParent,
widget.makeNewId(aResource.id),
aResource.max,
aResource.position,
aResource.size,
style= self.__getLayout( aResource.layout ) | wx.GA_SMOOTH |
wx.NO_FULL_REPAINT_ON_RESIZE | wx.CLIP_SIBLINGS,
name = aResource.name
)
widget.Widget.__init__( self, aParent, aResource )
self.SetValue(aResource.value)
self._layout = aResource.layout
self._bindEvents(event.WIDGET_EVENTS)
def __getLayout( self, aString ) :
if aString == 'horizontal' :
return wx.GA_HORIZONTAL
elif aString == 'vertical' :
return wx.GA_VERTICAL
else :
raise 'invalid Gauge.layout value: ', aString
def _getLayout( self ) :
return self._layout
def _setLayout( self, aString ) :
raise AttributeError, "layout attribute is read-only"
layout = property(_getLayout, _setLayout)
max = property(wx.Gauge.GetRange, wx.Gauge.SetRange)
value = property(wx.Gauge.GetValue, wx.Gauge.SetValue)
import sys
from PythonCard import registry
registry.Registry.getInstance().register(sys.modules[__name__].Gauge)
|