Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Edit/MainWindow.py
diff options
context:
space:
mode:
Diffstat (limited to 'Edit/MainWindow.py')
-rw-r--r--Edit/MainWindow.py62
1 files changed, 39 insertions, 23 deletions
diff --git a/Edit/MainWindow.py b/Edit/MainWindow.py
index 4351985..8cb015f 100644
--- a/Edit/MainWindow.py
+++ b/Edit/MainWindow.py
@@ -44,9 +44,14 @@ from Edit.TuneInterface import TuneInterface, TuneInterfaceParasite
from common.Generation.Generator import generator1, GenerationParameters
+
Tooltips = Config.Tooltips()
KEY_MAP_PIANO = Config.KEY_MAP_PIANO
+TRACK_SIZE = Config.scale(132)
+DRUM_TRACK_SIZE = Config.scale(165)
+
+
#-----------------------------------
# The main TamTam window
#-----------------------------------
@@ -133,9 +138,11 @@ class MainWindow(gtk.EventBox):
self.GUI["2instrumentIcons"] = {}
for i in instruments:
try:
- self.GUI["2instrumentIcons"][i.name] = gtk.gdk.pixbuf_new_from_file(i.img)
+ pixbuf = gtk.gdk.pixbuf_new_from_file(i.img)
except:
- self.GUI["2instrumentIcons"][i.name] = gtk.gdk.pixbuf_new_from_file(Config.IMAGE_ROOT + 'generic.png')
+ pixbuf = gtk.gdk.pixbuf_new_from_file(
+ imagefile('generic.png'))
+ self.GUI['2instrumentIcons'][i.name] = pixbuf
TP.ProfileBegin("init_GUI::instrument icons")
draw_inst_icons()
TP.ProfileEnd("init_GUI::instrument icons")
@@ -154,7 +161,7 @@ class MainWindow(gtk.EventBox):
self.GUI["2page"].pack_start( self.GUI["2instrumentPanel"], True )
# + + instrument 1 box
self.GUI["2instrument1Box"] = formatRoundBox( RoundHBox(), Config.BG_COLOR )
- self.GUI["2instrument1Box"].set_size_request( -1, 132 )
+ self.GUI["2instrument1Box"].set_size_request(-1, TRACK_SIZE)
self.GUI["2instrument1volBox"] = gtk.VBox()
#self.GUI["2instrument1volumeAdjustment"] = gtk.Adjustment( self._data["track_volume"][1], 0, 100, 1, 1, 0 )
#self.GUI["2instrument1volumeAdjustment"].connect( "value_changed", self.onTrackVolumeChanged, 0 )
@@ -163,7 +170,8 @@ class MainWindow(gtk.EventBox):
#self.GUI["2instrument1volumeSlider"].set_inverted(True)
#self.GUI["2instrument1volumeSlider"].set_size_request( 30, -1 )
#self.GUI["2instrument1volumeAdjustment"].connect( "value-changed", self.handleTrackVolume, 0 )
- self.GUI["2instrument1muteButton"] = ImageToggleButton(Config.IMAGE_ROOT+"checkOff.svg",Config.IMAGE_ROOT+"checkOn.svg")
+ self.GUI["2instrument1muteButton"] = ImageToggleButton(
+ 'checkOff.png', 'checkOn.png')
self.GUI["2instrument1muteButton"].connect("toggled",self.handlemuteButton,0)
self.GUI["2instrument1muteButton"].connect("button-press-event",self.handlemuteButtonRightClick,0)
self.GUI["2instrument1muteButton"].set_active(True)
@@ -177,7 +185,7 @@ class MainWindow(gtk.EventBox):
self.GUI["2instrumentPanel"].pack_start( self.GUI["2instrument1Box"] )
# + + instrument 2 box
self.GUI["2instrument2Box"] = formatRoundBox( RoundHBox(), Config.BG_COLOR )
- self.GUI["2instrument2Box"].set_size_request( -1, 132 )
+ self.GUI["2instrument2Box"].set_size_request(-1, TRACK_SIZE)
self.GUI["2instrument2volBox"] = gtk.VBox()
#self.GUI["2instrument2volumeAdjustment"] = gtk.Adjustment( self._data["track_volume"][1], 0, 100, 1, 1, 0 )
#self.GUI["2instrument2volumeAdjustment"].connect( "value_changed", self.onTrackVolumeChanged, 1 )
@@ -186,7 +194,8 @@ class MainWindow(gtk.EventBox):
#self.GUI["2instrument2volumeSlider"].set_inverted(True)
#self.GUI["2instrument2volumeSlider"].set_size_request( 30, -1 )
#self.GUI["2instrument2volumeAdjustment"].connect( "value-changed", self.handleTrackVolume, 1 )
- self.GUI["2instrument2muteButton"] = ImageToggleButton(Config.IMAGE_ROOT+"checkOff.svg",Config.IMAGE_ROOT+"checkOn.svg")
+ self.GUI["2instrument2muteButton"] = ImageToggleButton(
+ 'checkOff.png', 'checkOn.png')
self.GUI["2instrument2muteButton"].connect("toggled",self.handlemuteButton,1)
self.GUI["2instrument2muteButton"].connect("button-press-event",self.handlemuteButtonRightClick,1)
self.GUI["2instrument2muteButton"].set_active(True)
@@ -200,7 +209,7 @@ class MainWindow(gtk.EventBox):
self.GUI["2instrumentPanel"].pack_start( self.GUI["2instrument2Box"] )
# + + instrument 3 box
self.GUI["2instrument3Box"] = formatRoundBox( RoundHBox(), Config.BG_COLOR )
- self.GUI["2instrument3Box"].set_size_request( -1, 132 )
+ self.GUI["2instrument3Box"].set_size_request(-1, TRACK_SIZE)
self.GUI["2instrument3volBox"] = gtk.VBox()
#self.GUI["2instrument3volumeAdjustment"] = gtk.Adjustment( self._data["track_volume"][2], 0, 100, 1, 1, 0 )
#self.GUI["2instrument3volumeAdjustment"].connect( "value_changed", self.onTrackVolumeChanged, 2 )
@@ -209,7 +218,8 @@ class MainWindow(gtk.EventBox):
#self.GUI["2instrument3volumeSlider"].set_inverted(True)
#elf.GUI["2instrument3volumeSlider"].set_size_request( 30, -1 )
#self.GUI["2instrument3volumeAdjustment"].connect( "value-changed", self.handleTrackVolume, 2 )
- self.GUI["2instrument3muteButton"] = ImageToggleButton(Config.IMAGE_ROOT+"checkOff.svg",Config.IMAGE_ROOT+"checkOn.svg")
+ self.GUI["2instrument3muteButton"] = ImageToggleButton(
+ 'checkOff.png', 'checkOn.png')
self.GUI["2instrument3muteButton"].connect("toggled",self.handlemuteButton,2)
self.GUI["2instrument3muteButton"].connect("button-press-event",self.handlemuteButtonRightClick,2)
self.GUI["2instrument3muteButton"].set_active(True)
@@ -223,7 +233,7 @@ class MainWindow(gtk.EventBox):
self.GUI["2instrumentPanel"].pack_start( self.GUI["2instrument3Box"] )
# + + instrument 4 box
self.GUI["2instrument4Box"] = formatRoundBox( RoundHBox(), Config.BG_COLOR )
- self.GUI["2instrument4Box"].set_size_request( -1, 132 )
+ self.GUI["2instrument4Box"].set_size_request(-1, TRACK_SIZE)
self.GUI["2instrument4volBox"] = gtk.VBox()
#self.GUI["2instrument4volumeAdjustment"] = gtk.Adjustment( self._data["track_volume"][3], 0, 100, 1, 1, 0 )
#self.GUI["2instrument4volumeAdjustment"].connect( "value_changed", self.onTrackVolumeChanged, 3 )
@@ -232,7 +242,8 @@ class MainWindow(gtk.EventBox):
#self.GUI["2instrument4volumeSlider"].set_inverted(True)
#self.GUI["2instrument4volumeSlider"].set_size_request( 30, -1 )
#self.GUI["2instrument4volumeAdjustment"].connect( "value-changed", self.handleTrackVolume, 3 )
- self.GUI["2instrument4muteButton"] = ImageToggleButton(Config.IMAGE_ROOT+"checkOff.svg",Config.IMAGE_ROOT+"checkOn.svg")
+ self.GUI["2instrument4muteButton"] = ImageToggleButton(
+ 'checkOff.png', 'checkOn.png')
self.GUI["2instrument4muteButton"].connect("toggled",self.handlemuteButton,3)
self.GUI["2instrument4muteButton"].connect("button-press-event",self.handlemuteButtonRightClick,3)
self.GUI["2instrument4muteButton"].set_active(True)
@@ -246,7 +257,7 @@ class MainWindow(gtk.EventBox):
self.GUI["2instrumentPanel"].pack_start( self.GUI["2instrument4Box"] )
# + + drum box
self.GUI["2drumBox"] = formatRoundBox( RoundHBox(), Config.BG_COLOR )
- self.GUI["2drumBox"].set_size_request( -1, 165 )
+ self.GUI["2drumBox"].set_size_request(-1, DRUM_TRACK_SIZE)
self.GUI["2drumVolBox"] = gtk.VBox()
self.GUI["2drumvolumeAdjustment"] = gtk.Adjustment( self._data["track_volume"][4], 0, 100, 1, 1, 0 )
self.GUI["2drumvolumeAdjustment"].connect( "value_changed", self.onTrackVolumeChanged, 4 )
@@ -255,14 +266,17 @@ class MainWindow(gtk.EventBox):
#self.GUI["2drumvolumeSlider"].set_inverted(True)
#self.GUI["2drumvolumeSlider"].set_size_request( 30, -1 )
self.GUI["2drumvolumeAdjustment"].connect( "value-changed", self.handleTrackVolume, 4 )
- self.GUI["2drumMuteButton"] = ImageToggleButton(Config.IMAGE_ROOT+"checkOff.svg",Config.IMAGE_ROOT+"checkOn.svg")
+ self.GUI["2drumMuteButton"] = ImageToggleButton(
+ 'checkOff.png', 'checkOn.png')
self.GUI["2drumMuteButton"].connect("toggled",self.handlemuteButton,4)
self.GUI["2drumMuteButton"].connect("button-press-event",self.handlemuteButtonRightClick,4)
self.GUI["2drumMuteButton"].set_active(True)
#self.GUI["2drumVolBox"].pack_start( self.GUI["2drumvolumeSlider"], True, True, 0 )
#self.GUI["2drumVolBox"].pack_start( self.GUI["2drumMuteButton"], False, False, 5 )
self.GUI["2drumBox"].pack_start( self.GUI["2drumVolBox"], False, False, 0 )
- self.GUI["2drumButton"] = ImageToggleButton(Config.IMAGE_ROOT + self.trackInstrument[4].name + '.png', Config.IMAGE_ROOT + self.trackInstrument[4].name + '.png')
+ self.GUI["2drumButton"] = ImageToggleButton(
+ self.trackInstrument[4].name + '.png',
+ self.trackInstrument[4].name + '.png')
self.GUI["2drumPalette"] = drumPalette(_('Track 5 Properties'), self, 4)
self.GUI["2drumButton"].connect("toggled", self.pickDrum)
self.GUI["2drumButton"].connect('button-release-event',self.GUI["2drumPalette"].setBlock)
@@ -270,10 +284,11 @@ class MainWindow(gtk.EventBox):
self.GUI["2instrumentPanel"].pack_start( self.GUI["2drumBox"] )
self.GUI["2page"].pack_start( self.GUI["2instrumentPanel"], True )
# + track interface
- tracks_width = gtk.gdk.screen_width() - 140
- self.trackInterface = TrackInterface( self.noteDB, self, self.getScale, tracks_width )
+ tracks_width = gtk.gdk.screen_width() - TRACK_SIZE * 1.25
+ self.trackInterface = TrackInterface( self.noteDB, self,
+ self.getScale, tracks_width)
self.noteDB.addListener( self.trackInterface, TrackInterfaceParasite, True )
- self.trackInterface.set_size_request( tracks_width, -1 )
+ self.trackInterface.set_size_request(tracks_width, -1)
self.GUI["2page"].pack_start( self.trackInterface, False )
#------------------------------------------------------------------------
@@ -284,7 +299,8 @@ class MainWindow(gtk.EventBox):
self.noteDB.addListener( self.tuneInterface, TuneInterfaceParasite, True )
self.GUI["2tuneScrolledWindow"].set_viewport( self.tuneInterface )
self.tuneInterface.get_parent().set_shadow_type( gtk.SHADOW_NONE )
- self.GUI["2tuneScrolledWindow"].set_size_request(-1, 100)
+ self.GUI["2tuneScrolledWindow"].set_size_request(-1,
+ Config.PAGE_THUMBNAIL_HEIGHT + style.DEFAULT_PADDING * 2)
self.GUI["2tuneScrolledWindow"].modify_bg(gtk.STATE_NORMAL,
style.Color(Config.TOOLBAR_BCK_COLOR).get_gdk_color())
self.GUI["2main"].pack_start( self.GUI["2tuneScrolledWindow"], False, True )
@@ -907,7 +923,7 @@ class MainWindow(gtk.EventBox):
self._data["volume"] = round(widget.get_value())
self.csnd.setMasterVolume(self._data["volume"])
img = min(3,int(4*self._data["volume"]/100)) # volume 0-3
- #self.GUI["2volumeImage"].set_from_file( Config.IMAGE_ROOT+"volume"+str(img)+".png" )
+ #self.GUI["2volumeImage"].set_from_file(imagefile('volume' + str(img) + '.png'))
def initTrackVolume(self):
for i in range(Config.NUMBER_OF_TRACKS):
@@ -926,7 +942,7 @@ class MainWindow(gtk.EventBox):
def handleTempo(self, widget):
self._data['tempo'] = round(widget.get_value())
img = min(7,int(8*(self._data["tempo"]-widget.lower)/(widget.upper-widget.lower)))+1 # tempo 1-8
- #self.GUI["2tempoImage"].set_from_file( Config.IMAGE_ROOT+"tempo"+str(img)+".png" )
+ #self.GUI["2tempoImage"].set_from_file(imagefile('tempo' + str(img) + '.png'))
if self.playing:
self.csnd.setTempo(self._data['tempo'])
@@ -2202,9 +2218,9 @@ class instrumentPalette(Popup):
self.categories = Config.CATEGORIES
self.categoryBox = BigComboBox()
for category in self.categories:
- image = Config.IMAGE_ROOT + category.lower() + '.png'
+ image = imagefile(category.lower() + '.png')
if not os.path.isfile(image):
- image = Config.IMAGE_ROOT + 'generic.png'
+ image = imagefile('generic.png')
self.categoryBox.append_item(category, category.capitalize(),
icon_name = image, size = instrumentPalette.ICON_SIZE)
self.categoryBox.connect('changed', self.handleCategoryChange)
@@ -2355,9 +2371,9 @@ class drumPalette(Popup):
def loadDrumMenu(self, instruments):
self.drumBox.remove_all()
for instrument in instruments:
- image = Config.IMAGE_ROOT + instrument + '.png'
+ image = imagefile(instrument + '.png')
if not os.path.isfile(image):
- image = Config.IMAGE_ROOT + 'generic.png'
+ image = imagefile('generic.png')
self.drumBox.append_item(instrument, text = None, icon_name = image, size = instrumentPalette.ICON_SIZE)
def getDrums(self):