Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/test_canvas.py
blob: 166c13b5c8e3bcece1fb60cc095e703b72d606b8 (plain)
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#!/usr/bin/env python
# -*- coding: utf-8 -*-

#------------------------------------------------------------------------------

# Copyright 2008-2009 : François Sénéquier
# Email : francois.senequier@netcourrier.com

# This file is part of 'Theorie'.
#
# 'Theorie' is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
#
# 'Theorie' is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with 'Theorie'.  If not, see <http://www.gnu.org/licenses/>.

#------------------------------------------------------------------------------

import initialisations

from modele import *
from commun import *
from canvas_flute import *
from canvas_guitare import *
from canvas_harmonica import *
from canvas_piano import *
from canvas_clarinette import *
from canvas_quadrant import *

#------------------------------------------------------------------------------

c_lar = 640
c_hau = 340

def testCanvasFlute(tonalite, notes, lar=c_lar, hau=c_hau):
	window = gtk.Window()
	inst = modele.Flute(tonalite)
	canv = CanvasFlute(inst, lar, hau, notes)
	window.add(canv)
	#window.fullscreen()
	window.connect("destroy", gtk.main_quit)
	window.show_all()
	gtk.main()
	
def testCanvasGuitare(cases, accordage, notes, lar=c_lar, hau=c_hau):
	window = gtk.Window()
	inst = modele.Guitare(cases, accordage)
	canv = CanvasGuitare(inst, lar, hau, notes)
	canv.setDoigte([0,0,0,0,0,0])
	window.add(canv)
	#window.fullscreen()
	window.connect("destroy", gtk.main_quit)
	window.show_all()
	gtk.main()

def testCanvasHarmonica(notes, lar=c_lar, hau=c_hau):
	window = gtk.Window()
	inst = modele.HarmonicaCHR()
	canv = CanvasHarmonica(inst, lar, hau, notes)
	window.add(canv)
	#window.fullscreen()
	window.connect("destroy", gtk.main_quit)
	window.show_all()
	gtk.main()

def testCanvasPiano(notes, lar=c_lar, hau=c_hau):
	window = gtk.Window()
	canv = CanvasPiano(lar, hau, notes)
	window.add(canv)
	#window.fullscreen()
	window.connect("destroy", gtk.main_quit)
	window.show_all()
	gtk.main()

def testCanvasClarinette(notes, lar=c_lar, hau=c_hau):
	window = gtk.Window()
	inst = modele.Clarinette()
	canv = CanvasClarinette(inst, lar, hau, notes)
	window.add(canv)
	#window.fullscreen()
	window.connect("destroy", gtk.main_quit)
	window.show_all()
	gtk.main()

def testCanvasQuadrant(notes, lar=c_lar, hau=c_hau):
	window = gtk.Window()
	canv = CanvasQuadrant(lar, hau, notes)
	window.add(canv)
	#window.fullscreen()
	window.connect("destroy", gtk.main_quit)
	window.show_all()
	gtk.main()

def testCanvasGuitarePiano(cases, accordage, notes, lar=c_lar, hau=c_hau):
	window = gtk.Window()
	inst = modele.Guitare(cases, accordage)
	cnv1 = CanvasGuitare(inst, lar, 3*hau/4, notes)
	cnv1.setDoigte([0,0,0,0,0,0])
	ens = Ensemble("", notes)
	ens = ajouterNotes(ens, 1, 2)
	cnv2 = CanvasPiano(lar, hau/4, ens)
	obj = definirVPANED(cnv1,cnv2)
	window.add(obj)
	#window.fullscreen()
	window.connect("destroy", gtk.main_quit)
	window.show_all()
	gtk.main()

def testCanvasGuitareHarmonica(cases, accordage, notes, lar=c_lar, hau=c_hau):
	window = gtk.Window()
	inst = modele.Guitare(cases, accordage)
	cnv1 = CanvasGuitare(inst, lar, hau/2, notes)
	cnv1.setDoigte([0,0,0,0,0,0])
	inst = modele.HarmonicaCHR()
	ens = Ensemble("", notes)
	ens = ajouterNotes(ens, 0, 3)
	ens.decaler(-12)
	cnv2 = CanvasHarmonica(inst, lar, hau/2, ens)
	obj = definirVPANED(cnv1,cnv2)
	window.add(obj)
	#window.fullscreen()
	window.connect("destroy", gtk.main_quit)
	window.show_all()
	gtk.main()

#------------------------------------------------------------------------------

if __name__ == "__main__":
	SET_AFF(MOD_NOT)
	SET_CMP(MOD_OCT)
	notes = "Sol0 La0 Si0 Do#1 Ré1 Mi1 Fa#1" 
	testCanvasFlute("Do", notes)
	testCanvasGuitare(19, [4,9,14,19,23,28], notes)
	testCanvasHarmonica(notes)
	testCanvasPiano(notes)
	testCanvasClarinette(notes)
	testCanvasGuitarePiano(19, [4,9,14,19,23,28], notes)
	testCanvasGuitareHarmonica(19, [4,9,14,19,23,28], notes)
	testCanvasQuadrant(notes)