From c2951bc6d163c1c7c5a7f1a10feddfcb19aaa9bc Mon Sep 17 00:00:00 2001
From: Gonzalo Odiard <godiard@gmail.com>
Date: Wed, 21 Nov 2012 10:41:53 -0300
Subject: [PATCH] Move title widget to the top, to enable use with osk - SL
#4106
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
---
record.py | 33 +++++++++++++++++++++++++++------
1 file changed, 27 insertions(+), 6 deletions(-)
diff --git a/record.py b/record.py
index 5c06f20..f5c8a9d 100644
a
|
b
|
class Record(activity.Activity): |
214 | 214 | self._title_entry.connect('changed', self._title_changed) |
215 | 215 | self._controls_hbox.pack_start(self._title_entry, expand=True, fill=True, padding=10) |
216 | 216 | |
217 | | container = RecordContainer(self._media_view, self._controls_hbox) |
218 | | main_box.pack_start(container, expand=True, fill=True, padding=6) |
219 | | container.show() |
| 217 | self._record_container = RecordContainer(self._media_view, self._controls_hbox) |
| 218 | main_box.pack_start(self._record_container, expand=True, fill=True, |
| 219 | padding=6) |
| 220 | self._record_container.show() |
220 | 221 | |
221 | 222 | self._thumb_tray = HTray() |
222 | 223 | self._thumb_tray.set_size_request(-1, 150) |
… |
… |
class Record(activity.Activity): |
332 | 333 | self._title_entry.set_text(recd.title) |
333 | 334 | self._title_entry.show() |
334 | 335 | self._title_label.show() |
| 336 | self._record_container.set_title_visible(True) |
335 | 337 | |
336 | 338 | func(recd.recorderName, recd.colorStroke, recd.colorFill, utils.getDateString(recd.time), recd.tags) |
337 | 339 | |
… |
… |
class Record(activity.Activity): |
374 | 376 | self._active_recd = None |
375 | 377 | self._title_entry.hide() |
376 | 378 | self._title_label.hide() |
| 379 | self._record_container.set_title_visible(False) |
377 | 380 | self._play_button.hide() |
378 | 381 | self._playback_scale.hide() |
379 | 382 | self._progress.hide() |
… |
… |
class Record(activity.Activity): |
468 | 471 | self._title_entry.set_text(recd.title) |
469 | 472 | self._title_entry.show() |
470 | 473 | self._title_label.show() |
| 474 | self._record_container.set_title_visible(True) |
471 | 475 | self._shutter_button.hide() |
472 | 476 | self._progress.hide() |
473 | 477 | |
… |
… |
class Record(activity.Activity): |
476 | 480 | self._shutter_button.hide() |
477 | 481 | self._title_entry.hide() |
478 | 482 | self._title_label.hide() |
| 483 | self._record_container.set_title_visible(False) |
479 | 484 | self._play_button.show() |
480 | 485 | self._playback_scale.show() |
481 | 486 | path = recd.getAudioImageFilepath() |
… |
… |
class Record(activity.Activity): |
488 | 493 | self._shutter_button.hide() |
489 | 494 | self._title_entry.hide() |
490 | 495 | self._title_label.hide() |
| 496 | self._record_container.set_title_visible(False) |
491 | 497 | self._play_button.show() |
492 | 498 | self._playback_scale.show() |
493 | 499 | self._media_view.show_video() |
… |
… |
class RecordContainer(gtk.Container): |
562 | 568 | def __init__(self, media_view, controls_hbox): |
563 | 569 | self._media_view = media_view |
564 | 570 | self._controls_hbox = controls_hbox |
| 571 | self._show_title = False |
565 | 572 | self._controls_hbox_height = 0 |
566 | 573 | super(RecordContainer, self).__init__() |
567 | 574 | |
… |
… |
class RecordContainer(gtk.Container): |
641 | 648 | media_view_x = self._center_in_plane(self.allocation.width, media_view_width) |
642 | 649 | media_view_y = self._center_in_plane(remaining_height, media_view_height) |
643 | 650 | |
| 651 | if self._show_title: |
| 652 | # position the controls hbox at the top of the window |
| 653 | # and the same width as the media view |
| 654 | controls_box_y = 0 |
| 655 | # put the mediaview after the title |
| 656 | media_view_y = media_view_y + self._controls_hbox_height |
| 657 | else: |
| 658 | # position hbox at the bottom of the window, |
| 659 | # with the requested height, |
| 660 | # and the same width as the media view |
| 661 | controls_box_y = self.allocation.height - self._controls_hbox_height |
| 662 | |
644 | 663 | # send allocation to mediaview |
645 | 664 | alloc = gdk.Rectangle() |
646 | 665 | alloc.width = media_view_width |
… |
… |
class RecordContainer(gtk.Container): |
649 | 668 | alloc.y = media_view_y |
650 | 669 | self._media_view.size_allocate(alloc) |
651 | 670 | |
652 | | # position hbox at the bottom of the window, with the requested height, |
653 | | # and the same width as the media view |
654 | 671 | alloc = gdk.Rectangle() |
655 | 672 | alloc.x = media_view_x |
656 | | alloc.y = self.allocation.height - self._controls_hbox_height |
| 673 | alloc.y = controls_box_y |
657 | 674 | alloc.width = media_view_width |
658 | 675 | alloc.height = self._controls_hbox_height |
659 | 676 | self._controls_hbox.size_allocate(alloc) |
… |
… |
class RecordContainer(gtk.Container): |
665 | 682 | for widget in (self._media_view, self._controls_hbox): |
666 | 683 | callback(widget, data) |
667 | 684 | |
| 685 | def set_title_visible(self, visible): |
| 686 | self._show_title = visible |
| 687 | self.queue_draw() |
| 688 | |
668 | 689 | class PlaybackScale(gtk.HScale): |
669 | 690 | def __init__(self, model): |
670 | 691 | self.model = model |