New class syntax.
This commit is contained in:
parent
decc4b99e1
commit
ce08448165
|
@ -10,7 +10,7 @@
|
|||
# For historical reasons, button creation methods are called
|
||||
# define() while split creation methods are called create().
|
||||
|
||||
class AbstractParent():
|
||||
class AbstractParent:
|
||||
#
|
||||
# Upcalls from child to parent
|
||||
#
|
||||
|
@ -33,7 +33,7 @@ class AbstractParent():
|
|||
def scroll(self, (area, (dh, dv))): unimpl()
|
||||
def settimer(self, itimer): unimpl()
|
||||
|
||||
class AbstractChild():
|
||||
class AbstractChild:
|
||||
#
|
||||
# Downcalls from parent to child
|
||||
#
|
||||
|
@ -59,5 +59,5 @@ class AbstractChild():
|
|||
# Certain upcalls and downcalls can be handled transparently, but
|
||||
# for others (e.g., all geometry related calls) this is not possible.
|
||||
|
||||
class AbstractSplit() = AbstractChild(), AbstractParent():
|
||||
class AbstractSplit(AbstractChild, AbstractParent):
|
||||
pass
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from TransParent import TransParent
|
||||
|
||||
class BoxParent() = TransParent():
|
||||
class BoxParent(TransParent):
|
||||
#
|
||||
def create(self, (parent, (dh, dv))):
|
||||
self = TransParent.create(self, parent)
|
||||
|
|
|
@ -22,7 +22,7 @@ _MASK = 3
|
|||
# disabled --> crossed out
|
||||
# hilited --> inverted
|
||||
#
|
||||
class LabelAppearance():
|
||||
class LabelAppearance:
|
||||
#
|
||||
# Initialization
|
||||
#
|
||||
|
@ -143,7 +143,7 @@ class LabelAppearance():
|
|||
|
||||
# A Strut is a label with no width of its own.
|
||||
|
||||
class StrutAppearance() = LabelAppearance():
|
||||
class StrutAppearance(LabelAppearance):
|
||||
#
|
||||
def getminsize(self, (m, (width, height))):
|
||||
height = max(height, m.lineheight() + 6)
|
||||
|
@ -156,7 +156,7 @@ class StrutAppearance() = LabelAppearance():
|
|||
# disabled --> crossed out
|
||||
# hilited --> inverted
|
||||
#
|
||||
class ButtonAppearance() = LabelAppearance():
|
||||
class ButtonAppearance(LabelAppearance):
|
||||
#
|
||||
def drawpict(self, d):
|
||||
d.box(_rect.inset(self.bounds, (1, 1)))
|
||||
|
@ -173,7 +173,7 @@ class ButtonAppearance() = LabelAppearance():
|
|||
# disabled --> whole button crossed out
|
||||
# hilited --> box is inverted
|
||||
#
|
||||
class CheckAppearance() = LabelAppearance():
|
||||
class CheckAppearance(LabelAppearance):
|
||||
#
|
||||
def getminsize(self, (m, (width, height))):
|
||||
minwidth = m.textwidth(self.text) + 6
|
||||
|
@ -207,7 +207,7 @@ class CheckAppearance() = LabelAppearance():
|
|||
# disabled --> whole button crossed out
|
||||
# hilited --> indicator is inverted
|
||||
#
|
||||
class RadioAppearance() = CheckAppearance():
|
||||
class RadioAppearance(CheckAppearance):
|
||||
#
|
||||
def drawpict(self, d):
|
||||
(left, top), (right, bottom) = self.boxbounds
|
||||
|
@ -221,7 +221,7 @@ class RadioAppearance() = CheckAppearance():
|
|||
|
||||
# NoReactivity ignores mouse events.
|
||||
#
|
||||
class NoReactivity():
|
||||
class NoReactivity:
|
||||
def init_reactivity(self): pass
|
||||
|
||||
|
||||
|
@ -237,7 +237,7 @@ class NoReactivity():
|
|||
# There are usually extra conditions, e.g., hooks are only called
|
||||
# when the button is enabled, or active, or selected (on).
|
||||
#
|
||||
class BaseReactivity():
|
||||
class BaseReactivity:
|
||||
#
|
||||
def init_reactivity(self):
|
||||
self.down_hook = self.move_hook = self.up_hook = \
|
||||
|
@ -279,7 +279,7 @@ class BaseReactivity():
|
|||
# ToggleReactivity acts like a simple pushbutton.
|
||||
# It toggles its hilite state on mouse down events.
|
||||
#
|
||||
class ToggleReactivity() = BaseReactivity():
|
||||
class ToggleReactivity(BaseReactivity):
|
||||
#
|
||||
def mouse_down(self, detail):
|
||||
if self.enabled and self.mousetest(detail[_HV]):
|
||||
|
@ -308,7 +308,7 @@ class ToggleReactivity() = BaseReactivity():
|
|||
# TriggerReactivity acts like a fancy pushbutton.
|
||||
# It hilites itself while the mouse is down within its bounds.
|
||||
#
|
||||
class TriggerReactivity() = BaseReactivity():
|
||||
class TriggerReactivity(BaseReactivity):
|
||||
#
|
||||
def mouse_down(self, detail):
|
||||
if self.enabled and self.mousetest(detail[_HV]):
|
||||
|
@ -336,7 +336,7 @@ class TriggerReactivity() = BaseReactivity():
|
|||
# CheckReactivity handles mouse events like TriggerReactivity,
|
||||
# It overrides the up_trigger method to flip its selected state.
|
||||
#
|
||||
class CheckReactivity() = TriggerReactivity():
|
||||
class CheckReactivity(TriggerReactivity):
|
||||
#
|
||||
def up_trigger(self):
|
||||
self.select(not self.selected)
|
||||
|
@ -350,7 +350,7 @@ class CheckReactivity() = TriggerReactivity():
|
|||
# RadioReactivity turns itself on and the other buttons in its group
|
||||
# off when its up_trigger method is called.
|
||||
#
|
||||
class RadioReactivity() = TriggerReactivity():
|
||||
class RadioReactivity(TriggerReactivity):
|
||||
#
|
||||
def init_reactivity(self):
|
||||
TriggerReactivity.init_reactivity(self)
|
||||
|
@ -370,7 +370,7 @@ class RadioReactivity() = TriggerReactivity():
|
|||
# Auxiliary class for 'define' method.
|
||||
# Call the initializers in the right order.
|
||||
#
|
||||
class Define():
|
||||
class Define:
|
||||
#
|
||||
def define(self, parent):
|
||||
self.parent = parent
|
||||
|
@ -403,9 +403,9 @@ def _xorcross(d, bounds):
|
|||
|
||||
# Ready-made button classes.
|
||||
#
|
||||
class Label() = NoReactivity(), LabelAppearance(), Define(): pass
|
||||
class Strut() = NoReactivity(), StrutAppearance(), Define(): pass
|
||||
class PushButton() = TriggerReactivity(), ButtonAppearance(), Define(): pass
|
||||
class CheckButton() = CheckReactivity(), CheckAppearance(), Define(): pass
|
||||
class RadioButton() = RadioReactivity(), RadioAppearance(), Define(): pass
|
||||
class ToggleButton() = ToggleReactivity(), ButtonAppearance(), Define(): pass
|
||||
class Label(NoReactivity, LabelAppearance, Define): pass
|
||||
class Strut(NoReactivity, StrutAppearance, Define): pass
|
||||
class PushButton(TriggerReactivity, ButtonAppearance, Define): pass
|
||||
class CheckButton(CheckReactivity, CheckAppearance, Define): pass
|
||||
class RadioButton(RadioReactivity, RadioAppearance, Define): pass
|
||||
class ToggleButton(ToggleReactivity, ButtonAppearance, Define): pass
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
from math import pi, sin, cos
|
||||
from Split import Split
|
||||
|
||||
class CSplit() = Split():
|
||||
class CSplit(Split):
|
||||
#
|
||||
def getminsize(self, (m, (width, height))):
|
||||
# Since things look best if the children are spaced evenly
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
from Split import Split
|
||||
|
||||
class FormSplit() = Split():
|
||||
class FormSplit(Split):
|
||||
#
|
||||
def create(self, parent):
|
||||
self.next_left = self.next_top = 0
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
from Split import Split
|
||||
|
||||
class HVSplit() = Split():
|
||||
class HVSplit(Split):
|
||||
#
|
||||
def create(self, (parent, hv)):
|
||||
# hv is 0 for HSplit, 1 for VSplit
|
||||
|
@ -53,10 +53,10 @@ class HVSplit() = Split():
|
|||
# XXX too-small
|
||||
#
|
||||
|
||||
class HSplit() = HVSplit():
|
||||
class HSplit(HVSplit):
|
||||
def create(self, parent):
|
||||
return HVSplit.create(self, (parent, 0))
|
||||
|
||||
class VSplit() = HVSplit():
|
||||
class VSplit(HVSplit):
|
||||
def create(self, parent):
|
||||
return HVSplit.create(self, (parent, 1))
|
||||
|
|
|
@ -4,7 +4,7 @@ from Buttons import *
|
|||
|
||||
# A Histogram displays a histogram of numeric data.
|
||||
#
|
||||
class HistogramAppearance() = LabelAppearance(), Define():
|
||||
class HistogramAppearance(LabelAppearance, Define):
|
||||
#
|
||||
def define(self, parent):
|
||||
Define.define(self, (parent, ''))
|
||||
|
@ -33,4 +33,4 @@ class HistogramAppearance() = LabelAppearance(), Define():
|
|||
d.paint((h0, v0), (h1, v1))
|
||||
#
|
||||
|
||||
class Histogram() = NoReactivity(), HistogramAppearance(): pass
|
||||
class Histogram(NoReactivity, HistogramAppearance): pass
|
||||
|
|
|
@ -22,7 +22,7 @@ _MASK = 3
|
|||
# It does not support any of the triggers or hooks defined by Buttons,
|
||||
# but defines its own setval_trigger and setval_hook.
|
||||
#
|
||||
class DragSliderReactivity() = BaseReactivity():
|
||||
class DragSliderReactivity(BaseReactivity):
|
||||
#
|
||||
def mouse_down(self, detail):
|
||||
h, v = hv = detail[_HV]
|
||||
|
@ -43,7 +43,7 @@ class DragSliderReactivity() = BaseReactivity():
|
|||
self.active = 0
|
||||
#
|
||||
|
||||
class DragSliderAppearance() = ButtonAppearance():
|
||||
class DragSliderAppearance(ButtonAppearance):
|
||||
#
|
||||
# INVARIANTS maintained by the setval method:
|
||||
#
|
||||
|
@ -94,14 +94,14 @@ class DragSliderAppearance() = ButtonAppearance():
|
|||
self.settext(self.pretext + `self.val` + self.postext)
|
||||
#
|
||||
|
||||
class DragSlider() = DragSliderReactivity(), DragSliderAppearance(), Define():
|
||||
class DragSlider(DragSliderReactivity, DragSliderAppearance, Define):
|
||||
def definetext(self, (parent, text)):
|
||||
raise RuntimeError, 'DragSlider.definetext() not supported'
|
||||
|
||||
|
||||
# Auxiliary class for PushButton incorporated in ComplexSlider
|
||||
#
|
||||
class _StepButton() = PushButton():
|
||||
class _StepButton(PushButton):
|
||||
def define(self, parent):
|
||||
self = PushButton.define(self, parent)
|
||||
self.step = 0
|
||||
|
@ -130,7 +130,7 @@ class _StepButton() = PushButton():
|
|||
# A complex slider is an HSplit initialized to three buttons:
|
||||
# one to step down, a dragslider, and one to step up.
|
||||
#
|
||||
class ComplexSlider() = HSplit():
|
||||
class ComplexSlider(HSplit):
|
||||
#
|
||||
# Override Slider define() method
|
||||
#
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import audio
|
||||
from Histogram import Histogram
|
||||
|
||||
class Soundogram() = Histogram():
|
||||
class Soundogram(Histogram):
|
||||
#
|
||||
def define(self, (win, chunk)):
|
||||
width, height = corner = win.getwinsize()
|
||||
|
|
|
@ -8,7 +8,7 @@ Error = 'Split.Error' # Exception
|
|||
import rect
|
||||
from stdwinevents import *
|
||||
|
||||
class Split():
|
||||
class Split:
|
||||
#
|
||||
# Calls from creator
|
||||
# NB derived classes may add parameters to create()
|
||||
|
|
|
@ -6,7 +6,7 @@ from Buttons import LabelAppearance, NoReactivity
|
|||
# A StripChart doesn't really look like a label but it needs a base class.
|
||||
# LabelAppearance allows it to be disabled and hilited.
|
||||
|
||||
class StripChart() = LabelAppearance(), NoReactivity():
|
||||
class StripChart(LabelAppearance, NoReactivity):
|
||||
#
|
||||
def define(self, (parent, scale)):
|
||||
self.parent = parent
|
||||
|
|
|
@ -6,7 +6,7 @@ from StripChart import StripChart
|
|||
K = 1024
|
||||
Rates = [0, 32*K, 16*K, 8*K]
|
||||
|
||||
class VUMeter() = StripChart():
|
||||
class VUMeter(StripChart):
|
||||
#
|
||||
# Override define() and timer() methods
|
||||
#
|
||||
|
|
|
@ -12,7 +12,7 @@ from TransParent import ManageOneChild
|
|||
|
||||
Error = 'WindowParent.Error' # Exception
|
||||
|
||||
class WindowParent() = ManageOneChild():
|
||||
class WindowParent(ManageOneChild):
|
||||
#
|
||||
def create(self, (title, size)):
|
||||
self.title = title
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# Of course, no multi-threading is implied -- hence the funny interface
|
||||
# for lock, where a function is called once the lock is aquired.
|
||||
#
|
||||
class mutex():
|
||||
class mutex:
|
||||
#
|
||||
# Create a new mutex -- initially unlocked
|
||||
#
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
# XXX instead of having to define a module or class just to hold
|
||||
# XXX the global state of your particular time and delay functtions.
|
||||
|
||||
class scheduler():
|
||||
class scheduler:
|
||||
#
|
||||
# Initialize a new instance, passing the time and delay functions
|
||||
#
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# For historical reasons, button creation methods are called
|
||||
# define() while split creation methods are called create().
|
||||
|
||||
class AbstractParent():
|
||||
class AbstractParent:
|
||||
#
|
||||
# Upcalls from child to parent
|
||||
#
|
||||
|
@ -33,7 +33,7 @@ class AbstractParent():
|
|||
def scroll(self, (area, (dh, dv))): unimpl()
|
||||
def settimer(self, itimer): unimpl()
|
||||
|
||||
class AbstractChild():
|
||||
class AbstractChild:
|
||||
#
|
||||
# Downcalls from parent to child
|
||||
#
|
||||
|
@ -59,5 +59,5 @@ class AbstractChild():
|
|||
# Certain upcalls and downcalls can be handled transparently, but
|
||||
# for others (e.g., all geometry related calls) this is not possible.
|
||||
|
||||
class AbstractSplit() = AbstractChild(), AbstractParent():
|
||||
class AbstractSplit(AbstractChild, AbstractParent):
|
||||
pass
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from TransParent import TransParent
|
||||
|
||||
class BoxParent() = TransParent():
|
||||
class BoxParent(TransParent):
|
||||
#
|
||||
def create(self, (parent, (dh, dv))):
|
||||
self = TransParent.create(self, parent)
|
||||
|
|
|
@ -22,7 +22,7 @@ _MASK = 3
|
|||
# disabled --> crossed out
|
||||
# hilited --> inverted
|
||||
#
|
||||
class LabelAppearance():
|
||||
class LabelAppearance:
|
||||
#
|
||||
# Initialization
|
||||
#
|
||||
|
@ -143,7 +143,7 @@ class LabelAppearance():
|
|||
|
||||
# A Strut is a label with no width of its own.
|
||||
|
||||
class StrutAppearance() = LabelAppearance():
|
||||
class StrutAppearance(LabelAppearance):
|
||||
#
|
||||
def getminsize(self, (m, (width, height))):
|
||||
height = max(height, m.lineheight() + 6)
|
||||
|
@ -156,7 +156,7 @@ class StrutAppearance() = LabelAppearance():
|
|||
# disabled --> crossed out
|
||||
# hilited --> inverted
|
||||
#
|
||||
class ButtonAppearance() = LabelAppearance():
|
||||
class ButtonAppearance(LabelAppearance):
|
||||
#
|
||||
def drawpict(self, d):
|
||||
d.box(_rect.inset(self.bounds, (1, 1)))
|
||||
|
@ -173,7 +173,7 @@ class ButtonAppearance() = LabelAppearance():
|
|||
# disabled --> whole button crossed out
|
||||
# hilited --> box is inverted
|
||||
#
|
||||
class CheckAppearance() = LabelAppearance():
|
||||
class CheckAppearance(LabelAppearance):
|
||||
#
|
||||
def getminsize(self, (m, (width, height))):
|
||||
minwidth = m.textwidth(self.text) + 6
|
||||
|
@ -207,7 +207,7 @@ class CheckAppearance() = LabelAppearance():
|
|||
# disabled --> whole button crossed out
|
||||
# hilited --> indicator is inverted
|
||||
#
|
||||
class RadioAppearance() = CheckAppearance():
|
||||
class RadioAppearance(CheckAppearance):
|
||||
#
|
||||
def drawpict(self, d):
|
||||
(left, top), (right, bottom) = self.boxbounds
|
||||
|
@ -221,7 +221,7 @@ class RadioAppearance() = CheckAppearance():
|
|||
|
||||
# NoReactivity ignores mouse events.
|
||||
#
|
||||
class NoReactivity():
|
||||
class NoReactivity:
|
||||
def init_reactivity(self): pass
|
||||
|
||||
|
||||
|
@ -237,7 +237,7 @@ class NoReactivity():
|
|||
# There are usually extra conditions, e.g., hooks are only called
|
||||
# when the button is enabled, or active, or selected (on).
|
||||
#
|
||||
class BaseReactivity():
|
||||
class BaseReactivity:
|
||||
#
|
||||
def init_reactivity(self):
|
||||
self.down_hook = self.move_hook = self.up_hook = \
|
||||
|
@ -279,7 +279,7 @@ class BaseReactivity():
|
|||
# ToggleReactivity acts like a simple pushbutton.
|
||||
# It toggles its hilite state on mouse down events.
|
||||
#
|
||||
class ToggleReactivity() = BaseReactivity():
|
||||
class ToggleReactivity(BaseReactivity):
|
||||
#
|
||||
def mouse_down(self, detail):
|
||||
if self.enabled and self.mousetest(detail[_HV]):
|
||||
|
@ -308,7 +308,7 @@ class ToggleReactivity() = BaseReactivity():
|
|||
# TriggerReactivity acts like a fancy pushbutton.
|
||||
# It hilites itself while the mouse is down within its bounds.
|
||||
#
|
||||
class TriggerReactivity() = BaseReactivity():
|
||||
class TriggerReactivity(BaseReactivity):
|
||||
#
|
||||
def mouse_down(self, detail):
|
||||
if self.enabled and self.mousetest(detail[_HV]):
|
||||
|
@ -336,7 +336,7 @@ class TriggerReactivity() = BaseReactivity():
|
|||
# CheckReactivity handles mouse events like TriggerReactivity,
|
||||
# It overrides the up_trigger method to flip its selected state.
|
||||
#
|
||||
class CheckReactivity() = TriggerReactivity():
|
||||
class CheckReactivity(TriggerReactivity):
|
||||
#
|
||||
def up_trigger(self):
|
||||
self.select(not self.selected)
|
||||
|
@ -350,7 +350,7 @@ class CheckReactivity() = TriggerReactivity():
|
|||
# RadioReactivity turns itself on and the other buttons in its group
|
||||
# off when its up_trigger method is called.
|
||||
#
|
||||
class RadioReactivity() = TriggerReactivity():
|
||||
class RadioReactivity(TriggerReactivity):
|
||||
#
|
||||
def init_reactivity(self):
|
||||
TriggerReactivity.init_reactivity(self)
|
||||
|
@ -370,7 +370,7 @@ class RadioReactivity() = TriggerReactivity():
|
|||
# Auxiliary class for 'define' method.
|
||||
# Call the initializers in the right order.
|
||||
#
|
||||
class Define():
|
||||
class Define:
|
||||
#
|
||||
def define(self, parent):
|
||||
self.parent = parent
|
||||
|
@ -403,9 +403,9 @@ def _xorcross(d, bounds):
|
|||
|
||||
# Ready-made button classes.
|
||||
#
|
||||
class Label() = NoReactivity(), LabelAppearance(), Define(): pass
|
||||
class Strut() = NoReactivity(), StrutAppearance(), Define(): pass
|
||||
class PushButton() = TriggerReactivity(), ButtonAppearance(), Define(): pass
|
||||
class CheckButton() = CheckReactivity(), CheckAppearance(), Define(): pass
|
||||
class RadioButton() = RadioReactivity(), RadioAppearance(), Define(): pass
|
||||
class ToggleButton() = ToggleReactivity(), ButtonAppearance(), Define(): pass
|
||||
class Label(NoReactivity, LabelAppearance, Define): pass
|
||||
class Strut(NoReactivity, StrutAppearance, Define): pass
|
||||
class PushButton(TriggerReactivity, ButtonAppearance, Define): pass
|
||||
class CheckButton(CheckReactivity, CheckAppearance, Define): pass
|
||||
class RadioButton(RadioReactivity, RadioAppearance, Define): pass
|
||||
class ToggleButton(ToggleReactivity, ButtonAppearance, Define): pass
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
from math import pi, sin, cos
|
||||
from Split import Split
|
||||
|
||||
class CSplit() = Split():
|
||||
class CSplit(Split):
|
||||
#
|
||||
def getminsize(self, (m, (width, height))):
|
||||
# Since things look best if the children are spaced evenly
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
from Split import Split
|
||||
|
||||
class FormSplit() = Split():
|
||||
class FormSplit(Split):
|
||||
#
|
||||
def create(self, parent):
|
||||
self.next_left = self.next_top = 0
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
from Split import Split
|
||||
|
||||
class HVSplit() = Split():
|
||||
class HVSplit(Split):
|
||||
#
|
||||
def create(self, (parent, hv)):
|
||||
# hv is 0 for HSplit, 1 for VSplit
|
||||
|
@ -53,10 +53,10 @@ class HVSplit() = Split():
|
|||
# XXX too-small
|
||||
#
|
||||
|
||||
class HSplit() = HVSplit():
|
||||
class HSplit(HVSplit):
|
||||
def create(self, parent):
|
||||
return HVSplit.create(self, (parent, 0))
|
||||
|
||||
class VSplit() = HVSplit():
|
||||
class VSplit(HVSplit):
|
||||
def create(self, parent):
|
||||
return HVSplit.create(self, (parent, 1))
|
||||
|
|
|
@ -4,7 +4,7 @@ from Buttons import *
|
|||
|
||||
# A Histogram displays a histogram of numeric data.
|
||||
#
|
||||
class HistogramAppearance() = LabelAppearance(), Define():
|
||||
class HistogramAppearance(LabelAppearance, Define):
|
||||
#
|
||||
def define(self, parent):
|
||||
Define.define(self, (parent, ''))
|
||||
|
@ -33,4 +33,4 @@ class HistogramAppearance() = LabelAppearance(), Define():
|
|||
d.paint((h0, v0), (h1, v1))
|
||||
#
|
||||
|
||||
class Histogram() = NoReactivity(), HistogramAppearance(): pass
|
||||
class Histogram(NoReactivity, HistogramAppearance): pass
|
||||
|
|
|
@ -22,7 +22,7 @@ _MASK = 3
|
|||
# It does not support any of the triggers or hooks defined by Buttons,
|
||||
# but defines its own setval_trigger and setval_hook.
|
||||
#
|
||||
class DragSliderReactivity() = BaseReactivity():
|
||||
class DragSliderReactivity(BaseReactivity):
|
||||
#
|
||||
def mouse_down(self, detail):
|
||||
h, v = hv = detail[_HV]
|
||||
|
@ -43,7 +43,7 @@ class DragSliderReactivity() = BaseReactivity():
|
|||
self.active = 0
|
||||
#
|
||||
|
||||
class DragSliderAppearance() = ButtonAppearance():
|
||||
class DragSliderAppearance(ButtonAppearance):
|
||||
#
|
||||
# INVARIANTS maintained by the setval method:
|
||||
#
|
||||
|
@ -94,14 +94,14 @@ class DragSliderAppearance() = ButtonAppearance():
|
|||
self.settext(self.pretext + `self.val` + self.postext)
|
||||
#
|
||||
|
||||
class DragSlider() = DragSliderReactivity(), DragSliderAppearance(), Define():
|
||||
class DragSlider(DragSliderReactivity, DragSliderAppearance, Define):
|
||||
def definetext(self, (parent, text)):
|
||||
raise RuntimeError, 'DragSlider.definetext() not supported'
|
||||
|
||||
|
||||
# Auxiliary class for PushButton incorporated in ComplexSlider
|
||||
#
|
||||
class _StepButton() = PushButton():
|
||||
class _StepButton(PushButton):
|
||||
def define(self, parent):
|
||||
self = PushButton.define(self, parent)
|
||||
self.step = 0
|
||||
|
@ -130,7 +130,7 @@ class _StepButton() = PushButton():
|
|||
# A complex slider is an HSplit initialized to three buttons:
|
||||
# one to step down, a dragslider, and one to step up.
|
||||
#
|
||||
class ComplexSlider() = HSplit():
|
||||
class ComplexSlider(HSplit):
|
||||
#
|
||||
# Override Slider define() method
|
||||
#
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import audio
|
||||
from Histogram import Histogram
|
||||
|
||||
class Soundogram() = Histogram():
|
||||
class Soundogram(Histogram):
|
||||
#
|
||||
def define(self, (win, chunk)):
|
||||
width, height = corner = win.getwinsize()
|
||||
|
|
|
@ -8,7 +8,7 @@ Error = 'Split.Error' # Exception
|
|||
import rect
|
||||
from stdwinevents import *
|
||||
|
||||
class Split():
|
||||
class Split:
|
||||
#
|
||||
# Calls from creator
|
||||
# NB derived classes may add parameters to create()
|
||||
|
|
|
@ -6,7 +6,7 @@ from Buttons import LabelAppearance, NoReactivity
|
|||
# A StripChart doesn't really look like a label but it needs a base class.
|
||||
# LabelAppearance allows it to be disabled and hilited.
|
||||
|
||||
class StripChart() = LabelAppearance(), NoReactivity():
|
||||
class StripChart(LabelAppearance, NoReactivity):
|
||||
#
|
||||
def define(self, (parent, scale)):
|
||||
self.parent = parent
|
||||
|
|
|
@ -6,7 +6,7 @@ from StripChart import StripChart
|
|||
K = 1024
|
||||
Rates = [0, 32*K, 16*K, 8*K]
|
||||
|
||||
class VUMeter() = StripChart():
|
||||
class VUMeter(StripChart):
|
||||
#
|
||||
# Override define() and timer() methods
|
||||
#
|
||||
|
|
|
@ -12,7 +12,7 @@ from TransParent import ManageOneChild
|
|||
|
||||
Error = 'WindowParent.Error' # Exception
|
||||
|
||||
class WindowParent() = ManageOneChild():
|
||||
class WindowParent(ManageOneChild):
|
||||
#
|
||||
def create(self, (title, size)):
|
||||
self.title = title
|
||||
|
|
|
@ -13,7 +13,7 @@ template = '@'
|
|||
|
||||
# Kludge to hold mutable state
|
||||
|
||||
class Struct(): pass
|
||||
class Struct: pass
|
||||
G = Struct()
|
||||
G.i = 0
|
||||
|
||||
|
|
Loading…
Reference in New Issue