Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ce08448

Browse files
committed
New class syntax.
1 parent decc4b9 commit ce08448

29 files changed

Lines changed: 81 additions & 81 deletions

Lib/lib-stdwin/Abstract.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# For historical reasons, button creation methods are called
1111
# define() while split creation methods are called create().
1212

13-
class AbstractParent():
13+
class AbstractParent:
1414
#
1515
# Upcalls from child to parent
1616
#
@@ -33,7 +33,7 @@ def change(self, area): unimpl()
3333
def scroll(self, (area, (dh, dv))): unimpl()
3434
def settimer(self, itimer): unimpl()
3535

36-
class AbstractChild():
36+
class AbstractChild:
3737
#
3838
# Downcalls from parent to child
3939
#
@@ -59,5 +59,5 @@ def timer(self): unimpl()
5959
# Certain upcalls and downcalls can be handled transparently, but
6060
# for others (e.g., all geometry related calls) this is not possible.
6161

62-
class AbstractSplit() = AbstractChild(), AbstractParent():
62+
class AbstractSplit(AbstractChild, AbstractParent):
6363
pass

Lib/lib-stdwin/BoxParent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from TransParent import TransParent
22

3-
class BoxParent() = TransParent():
3+
class BoxParent(TransParent):
44
#
55
def create(self, (parent, (dh, dv))):
66
self = TransParent.create(self, parent)

Lib/lib-stdwin/Buttons.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# disabled --> crossed out
2323
# hilited --> inverted
2424
#
25-
class LabelAppearance():
25+
class LabelAppearance:
2626
#
2727
# Initialization
2828
#
@@ -143,7 +143,7 @@ def fliphilite(self, d):
143143

144144
# A Strut is a label with no width of its own.
145145

146-
class StrutAppearance() = LabelAppearance():
146+
class StrutAppearance(LabelAppearance):
147147
#
148148
def getminsize(self, (m, (width, height))):
149149
height = max(height, m.lineheight() + 6)
@@ -156,7 +156,7 @@ def getminsize(self, (m, (width, height))):
156156
# disabled --> crossed out
157157
# hilited --> inverted
158158
#
159-
class ButtonAppearance() = LabelAppearance():
159+
class ButtonAppearance(LabelAppearance):
160160
#
161161
def drawpict(self, d):
162162
d.box(_rect.inset(self.bounds, (1, 1)))
@@ -173,7 +173,7 @@ def drawpict(self, d):
173173
# disabled --> whole button crossed out
174174
# hilited --> box is inverted
175175
#
176-
class CheckAppearance() = LabelAppearance():
176+
class CheckAppearance(LabelAppearance):
177177
#
178178
def getminsize(self, (m, (width, height))):
179179
minwidth = m.textwidth(self.text) + 6
@@ -207,7 +207,7 @@ def recalctextpos(self):
207207
# disabled --> whole button crossed out
208208
# hilited --> indicator is inverted
209209
#
210-
class RadioAppearance() = CheckAppearance():
210+
class RadioAppearance(CheckAppearance):
211211
#
212212
def drawpict(self, d):
213213
(left, top), (right, bottom) = self.boxbounds
@@ -221,7 +221,7 @@ def drawpict(self, d):
221221

222222
# NoReactivity ignores mouse events.
223223
#
224-
class NoReactivity():
224+
class NoReactivity:
225225
def init_reactivity(self): pass
226226

227227

@@ -237,7 +237,7 @@ def init_reactivity(self): pass
237237
# There are usually extra conditions, e.g., hooks are only called
238238
# when the button is enabled, or active, or selected (on).
239239
#
240-
class BaseReactivity():
240+
class BaseReactivity:
241241
#
242242
def init_reactivity(self):
243243
self.down_hook = self.move_hook = self.up_hook = \
@@ -279,7 +279,7 @@ def trigger(self):
279279
# ToggleReactivity acts like a simple pushbutton.
280280
# It toggles its hilite state on mouse down events.
281281
#
282-
class ToggleReactivity() = BaseReactivity():
282+
class ToggleReactivity(BaseReactivity):
283283
#
284284
def mouse_down(self, detail):
285285
if self.enabled and self.mousetest(detail[_HV]):
@@ -308,7 +308,7 @@ def down_trigger(self):
308308
# TriggerReactivity acts like a fancy pushbutton.
309309
# It hilites itself while the mouse is down within its bounds.
310310
#
311-
class TriggerReactivity() = BaseReactivity():
311+
class TriggerReactivity(BaseReactivity):
312312
#
313313
def mouse_down(self, detail):
314314
if self.enabled and self.mousetest(detail[_HV]):
@@ -336,7 +336,7 @@ def mouse_up(self, detail):
336336
# CheckReactivity handles mouse events like TriggerReactivity,
337337
# It overrides the up_trigger method to flip its selected state.
338338
#
339-
class CheckReactivity() = TriggerReactivity():
339+
class CheckReactivity(TriggerReactivity):
340340
#
341341
def up_trigger(self):
342342
self.select(not self.selected)
@@ -350,7 +350,7 @@ def up_trigger(self):
350350
# RadioReactivity turns itself on and the other buttons in its group
351351
# off when its up_trigger method is called.
352352
#
353-
class RadioReactivity() = TriggerReactivity():
353+
class RadioReactivity(TriggerReactivity):
354354
#
355355
def init_reactivity(self):
356356
TriggerReactivity.init_reactivity(self)
@@ -370,7 +370,7 @@ def up_trigger(self):
370370
# Auxiliary class for 'define' method.
371371
# Call the initializers in the right order.
372372
#
373-
class Define():
373+
class Define:
374374
#
375375
def define(self, parent):
376376
self.parent = parent
@@ -403,9 +403,9 @@ def _xorcross(d, bounds):
403403

404404
# Ready-made button classes.
405405
#
406-
class Label() = NoReactivity(), LabelAppearance(), Define(): pass
407-
class Strut() = NoReactivity(), StrutAppearance(), Define(): pass
408-
class PushButton() = TriggerReactivity(), ButtonAppearance(), Define(): pass
409-
class CheckButton() = CheckReactivity(), CheckAppearance(), Define(): pass
410-
class RadioButton() = RadioReactivity(), RadioAppearance(), Define(): pass
411-
class ToggleButton() = ToggleReactivity(), ButtonAppearance(), Define(): pass
406+
class Label(NoReactivity, LabelAppearance, Define): pass
407+
class Strut(NoReactivity, StrutAppearance, Define): pass
408+
class PushButton(TriggerReactivity, ButtonAppearance, Define): pass
409+
class CheckButton(CheckReactivity, CheckAppearance, Define): pass
410+
class RadioButton(RadioReactivity, RadioAppearance, Define): pass
411+
class ToggleButton(ToggleReactivity, ButtonAppearance, Define): pass

Lib/lib-stdwin/CSplit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from math import pi, sin, cos
88
from Split import Split
99

10-
class CSplit() = Split():
10+
class CSplit(Split):
1111
#
1212
def getminsize(self, (m, (width, height))):
1313
# Since things look best if the children are spaced evenly

Lib/lib-stdwin/FormSplit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
from Split import Split
1515

16-
class FormSplit() = Split():
16+
class FormSplit(Split):
1717
#
1818
def create(self, parent):
1919
self.next_left = self.next_top = 0

Lib/lib-stdwin/HVSplit.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from Split import Split
99

10-
class HVSplit() = Split():
10+
class HVSplit(Split):
1111
#
1212
def create(self, (parent, hv)):
1313
# hv is 0 for HSplit, 1 for VSplit
@@ -53,10 +53,10 @@ def setbounds(self, bounds):
5353
# XXX too-small
5454
#
5555

56-
class HSplit() = HVSplit():
56+
class HSplit(HVSplit):
5757
def create(self, parent):
5858
return HVSplit.create(self, (parent, 0))
5959

60-
class VSplit() = HVSplit():
60+
class VSplit(HVSplit):
6161
def create(self, parent):
6262
return HVSplit.create(self, (parent, 1))

Lib/lib-stdwin/Histogram.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# A Histogram displays a histogram of numeric data.
66
#
7-
class HistogramAppearance() = LabelAppearance(), Define():
7+
class HistogramAppearance(LabelAppearance, Define):
88
#
99
def define(self, parent):
1010
Define.define(self, (parent, ''))
@@ -33,4 +33,4 @@ def drawpict(self, d):
3333
d.paint((h0, v0), (h1, v1))
3434
#
3535

36-
class Histogram() = NoReactivity(), HistogramAppearance(): pass
36+
class Histogram(NoReactivity, HistogramAppearance): pass

Lib/lib-stdwin/Sliders.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# It does not support any of the triggers or hooks defined by Buttons,
2323
# but defines its own setval_trigger and setval_hook.
2424
#
25-
class DragSliderReactivity() = BaseReactivity():
25+
class DragSliderReactivity(BaseReactivity):
2626
#
2727
def mouse_down(self, detail):
2828
h, v = hv = detail[_HV]
@@ -43,7 +43,7 @@ def mouse_up(self, detail):
4343
self.active = 0
4444
#
4545

46-
class DragSliderAppearance() = ButtonAppearance():
46+
class DragSliderAppearance(ButtonAppearance):
4747
#
4848
# INVARIANTS maintained by the setval method:
4949
#
@@ -94,14 +94,14 @@ def recalctext(self):
9494
self.settext(self.pretext + `self.val` + self.postext)
9595
#
9696

97-
class DragSlider() = DragSliderReactivity(), DragSliderAppearance(), Define():
97+
class DragSlider(DragSliderReactivity, DragSliderAppearance, Define):
9898
def definetext(self, (parent, text)):
9999
raise RuntimeError, 'DragSlider.definetext() not supported'
100100

101101

102102
# Auxiliary class for PushButton incorporated in ComplexSlider
103103
#
104-
class _StepButton() = PushButton():
104+
class _StepButton(PushButton):
105105
def define(self, parent):
106106
self = PushButton.define(self, parent)
107107
self.step = 0
@@ -130,7 +130,7 @@ def timer(self):
130130
# A complex slider is an HSplit initialized to three buttons:
131131
# one to step down, a dragslider, and one to step up.
132132
#
133-
class ComplexSlider() = HSplit():
133+
class ComplexSlider(HSplit):
134134
#
135135
# Override Slider define() method
136136
#

Lib/lib-stdwin/Soundogram.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import audio
44
from Histogram import Histogram
55

6-
class Soundogram() = Histogram():
6+
class Soundogram(Histogram):
77
#
88
def define(self, (win, chunk)):
99
width, height = corner = win.getwinsize()

Lib/lib-stdwin/Split.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import rect
99
from stdwinevents import *
1010

11-
class Split():
11+
class Split:
1212
#
1313
# Calls from creator
1414
# NB derived classes may add parameters to create()

0 commit comments

Comments
 (0)