Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Jam
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2011-07-31 22:16:41 (GMT)
committer Aleksey Lim <alsroot@sugarlabs.org>2011-07-31 22:34:59 (GMT)
commite2d511e81772ac8ae69a8a664f03d9d576e0c26a (patch)
tree97386075e0561651dd1de062fa773b05d5e084ed /Jam
parent97c158551a2d289772a67d29c062d0a90282a5da (diff)
moving playback buttons to main toolbar to make room for more beats
The playback toolbar cannot properly handle all of the beats when the run on smaller displays. This patch moves the playback button and mute button to the main toolbar to make room for more beats. (In the case of the old-style toolbars, the beat buttons are moved to a new toolbar, aptly named "beats"). Somewhat alleviates the problem, but 12 beats still does not fit on an 800x600 screen. Still awaiting a icon for the beats toolbar.
Diffstat (limited to 'Jam')
-rw-r--r--Jam/JamMain.py55
-rw-r--r--Jam/Toolbars.py54
2 files changed, 71 insertions, 38 deletions
diff --git a/Jam/JamMain.py b/Jam/JamMain.py
index e72d275..053fda3 100644
--- a/Jam/JamMain.py
+++ b/Jam/JamMain.py
@@ -19,6 +19,8 @@ import Jam.Picker as Picker
import Jam.Block as Block
from Jam.Toolbars import JamToolbar
from Jam.Toolbars import PlaybackToolbar
+from Jam.Toolbars import common_playback_buttons
+from Jam.Toolbars import BeatToolbar
from Jam.Toolbars import DesktopToolbar
from Jam.Toolbars import RecordToolbar
@@ -254,14 +256,14 @@ class JamMain(gtk.EventBox):
jam_toolbar_button.show()
self.activity.toolbox.toolbar.insert(jam_toolbar_button, -1)
- self.playbackToolbar = PlaybackToolbar(self)
- playback_toolbar_button = ToolbarButton(label=_('Playback'),
- page=self.playbackToolbar,
+ self.beatToolbar = BeatToolbar(self)
+ beat_toolbar_button = ToolbarButton(label=_('Beat'),
+ page=self.beatToolbar,
# Fixme: need an icon
icon_name='activity-start')
- self.playbackToolbar.show()
- playback_toolbar_button.show()
- self.activity.toolbox.toolbar.insert(playback_toolbar_button, -1)
+ self.beatToolbar.show()
+ beat_toolbar_button.show()
+ self.activity.toolbox.toolbar.insert(beat_toolbar_button, -1)
self.desktopToolbar = DesktopToolbar(self)
desktop_toolbar_button = ToolbarButton(label=_('Desktop'),
@@ -280,6 +282,14 @@ class JamMain(gtk.EventBox):
record_toolbar_button.show()
self.activity.toolbox.toolbar.insert(record_toolbar_button, -1)
+ separator = gtk.SeparatorToolItem()
+ separator.props.draw = True
+ separator.set_expand(False)
+ self.activity.toolbox.toolbar.insert(separator, -1)
+ separator.show()
+
+ common_playback_buttons(self.activity.toolbox.toolbar, self)
+
self.activity.add_stop_button()
else:
self.jamToolbar = JamToolbar(self)
@@ -289,6 +299,10 @@ class JamMain(gtk.EventBox):
self.activity.toolbox.add_toolbar(_("Playback"),
self.playbackToolbar)
+ self.beatToolbar = BeatToolbar(self)
+ self.activity.toolbox.add_toolbar(_("Beat"),
+ self.beatToolbar)
+
self.desktopToolbar = DesktopToolbar(self)
self.activity.toolbox.add_toolbar(_("Desktop"),
self.desktopToolbar)
@@ -438,10 +452,7 @@ class JamMain(gtk.EventBox):
#-- Final Set Up --------------------------------------
self.setVolume(self.volume)
self.setTempo(self.tempo)
- if self.activity.have_toolbox:
- # jam_toolbar_button.set_expanded(True)
- pass
- else:
+ if not self.activity.have_toolbox:
self.activity.toolbox.set_current_toolbar(1) # JamToolbar
self.setDesktop(0, True)
@@ -729,8 +740,26 @@ class JamMain(gtk.EventBox):
def removeMetronome(self, page):
self.noteDB.deleteNotesByTrack([page], [1])
+ def handleStopButton(self, widget):
+ self.setStopped()
+
+ def handleMuteButton(self, widget):
+ if widget.get_active():
+ self._setMuted(True)
+ else:
+ self._setMuted(False)
+
def setMuted(self, muted):
- self.playbackToolbar.setMuted(muted)
+ if self.activity.have_toolbox:
+ toolbar = self.activity.toolbox.toolbar
+ else:
+ toolbar = self.playbackToolbar
+
+ if toolbar.muteButton.get_active() == muted:
+ return
+
+ toolbar.muteButton.set_active(muted)
+ toolbar.playbackToolbar.setMuted(muted)
def _setMuted(self, muted):
if self.muted == muted:
@@ -1269,7 +1298,7 @@ class JamMain(gtk.EventBox):
# Sync
def setSyncBeats(self, beats):
- self.playbackToolbar.setSyncBeats(beats)
+ self.beatToolbar.setSyncBeats(beats)
def _setSyncBeats(self, beats):
if beats == self.syncBeats:
@@ -1319,7 +1348,7 @@ class JamMain(gtk.EventBox):
def updateBeatWheel(self):
curTick = self.csnd.loopGetTick(self.heartbeatLoop) % self.syncTicks
self.curBeat = int(curTick) // Config.TICKS_PER_BEAT
- self.playbackToolbar.updateBeatWheel(self.curBeat)
+ self.beatToolbar.updateBeatWheel(self.curBeat)
return True
def correctedHeartbeat(self):
diff --git a/Jam/Toolbars.py b/Jam/Toolbars.py
index 3b2f32f..d33e0ae 100644
--- a/Jam/Toolbars.py
+++ b/Jam/Toolbars.py
@@ -141,6 +141,24 @@ class JamToolbar(gtk.Toolbar):
self.owner.sendSyncQuery()
+def common_playback_buttons(toolbar, owner):
+ """ Playback and mute buttons are either on the main toolbar or
+ the Playback toolbar, depending upon whether or not the new
+ toolbars are available. """
+
+ toolbar.stopButton = ToolButton('media-playback-stop')
+ toolbar.stopButton.connect('clicked', owner.handleStopButton)
+ toolbar.insert(toolbar.stopButton, -1)
+ toolbar.stopButton.show()
+ toolbar.stopButton.set_tooltip(_('Stop Loops'))
+
+ toolbar.muteButton = ToggleToolButton('mute')
+ toolbar.muteButton.connect('clicked', owner.handleMuteButton)
+ toolbar.insert(toolbar.muteButton, -1)
+ toolbar.muteButton.show()
+ toolbar.muteButton.set_tooltip(_('Mute Loops'))
+
+
class PlaybackToolbar(gtk.Toolbar):
def __init__(self, owner):
@@ -150,17 +168,18 @@ class PlaybackToolbar(gtk.Toolbar):
self.toolItem = {}
- self.stopButton = ToolButton('media-playback-stop')
- self.stopButton.connect('clicked', self.handleStopButton)
- self.insert(self.stopButton, -1)
- self.stopButton.show()
- self.stopButton.set_tooltip(_('Stop Loops'))
+ common_playback_buttons(self, owner)
+
+ self.show_all()
- self.muteButton = ToggleToolButton('mute')
- self.muteButton.connect('clicked', self.handleMuteButton)
- self.insert(self.muteButton, -1)
- self.muteButton.show()
- self.muteButton.set_tooltip(_('Mute Loops'))
+class BeatToolbar(gtk.Toolbar):
+
+ def __init__(self, owner):
+ gtk.Toolbar.__init__(self)
+
+ self.owner = owner
+
+ self.toolItem = {}
self._insert_separator(True)
@@ -249,21 +268,6 @@ class PlaybackToolbar(gtk.Toolbar):
self.owner._setSyncBeats(beats)
- def handleStopButton(self, widget):
- self.owner.setStopped()
-
- def setMuted(self, muted):
- if self.muteButton.get_active() == muted:
- return
-
- self.muteButton.set_active(muted)
-
- def handleMuteButton(self, widget):
- if widget.get_active():
- self.owner._setMuted(True)
- else:
- self.owner._setMuted(False)
-
class DesktopToolbar(gtk.Toolbar):