Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGonzalo Odiard <godiard@gmail.com>2012-11-27 05:15:10 (GMT)
committer Gonzalo Odiard <godiard@gmail.com>2012-11-27 05:15:10 (GMT)
commit53f65e36d87f0e13b8a3c36fa2ca4e1d6fc348c1 (patch)
treeaa40abc078f82637e87ae1002caf762bc8e17525
parente377a85e2155b2d0b7903fd4711a3c24dc90f34f (diff)
Draw the piano at the bottom of the screen
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
-rw-r--r--activity.py13
-rwxr-xr-xdraw_piano.py1
2 files changed, 12 insertions, 2 deletions
diff --git a/activity.py b/activity.py
index 9f300f0..759a619 100644
--- a/activity.py
+++ b/activity.py
@@ -24,6 +24,7 @@ from sugar3.activity import activity
from sugar3.graphics.toolbarbox import ToolbarBox
from sugar3.activity.widgets import ActivityToolbarButton
from sugar3.graphics.radiotoolbutton import RadioToolButton
+from sugar3.graphics import style
from sugar3.activity.widgets import StopButton
from draw_piano import PianoKeyboard
@@ -147,8 +148,16 @@ class SimplePianoActivity(activity.Activity):
self.piano.connect('key_pressed', self.__key_pressed_cb)
self.piano.connect('key_released', self.__key_released_cb)
- self.piano.show()
- self.set_canvas(self.piano)
+ vbox = Gtk.VBox()
+ vbox.set_homogeneous(False)
+ label = Gtk.Label('')
+ vbox.pack_end(self.piano, True, True, 0)
+ vbox.pack_start(label, False, False, 0)
+ vbox.show_all()
+ self.set_canvas(vbox)
+ piano_height = Gdk.Screen.width() / 2
+ label.set_size_request(-1,
+ Gdk.Screen.height() - piano_height - style.GRID_CELL_SIZE)
def set_notes_labels_cb(self, widget):
self.piano.font_size = 14
diff --git a/draw_piano.py b/draw_piano.py
index 260a042..137581e 100755
--- a/draw_piano.py
+++ b/draw_piano.py
@@ -78,6 +78,7 @@ class PianoKeyboard(Gtk.DrawingArea):
logging.error('key_width %s', self._key_width)
self._black_keys_height = self._height * 2 / 3
self._octave_width = self._key_width * 7
+ self.set_size_request(-1, self._height)
def __event_cb(self, widget, event):
if event.type in (Gdk.EventType.TOUCH_BEGIN,