Ticket #4106: 0001-Move-title-widget-to-the-top-to-enable-use-with-osk-.patch

File 0001-Move-title-widget-to-the-top-to-enable-use-with-osk-.patch, 4.9 KB (added by godiard, 8 years ago)
  • record.py

    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): 
    214214        self._title_entry.connect('changed', self._title_changed)
    215215        self._controls_hbox.pack_start(self._title_entry, expand=True, fill=True, padding=10)
    216216
    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()
    220221
    221222        self._thumb_tray = HTray()
    222223        self._thumb_tray.set_size_request(-1, 150)
    class Record(activity.Activity): 
    332333        self._title_entry.set_text(recd.title)
    333334        self._title_entry.show()
    334335        self._title_label.show()
     336        self._record_container.set_title_visible(True)
    335337
    336338        func(recd.recorderName, recd.colorStroke, recd.colorFill, utils.getDateString(recd.time), recd.tags)
    337339
    class Record(activity.Activity): 
    374376            self._active_recd = None
    375377            self._title_entry.hide()
    376378            self._title_label.hide()
     379            self._record_container.set_title_visible(False)
    377380            self._play_button.hide()
    378381            self._playback_scale.hide()
    379382            self._progress.hide()
    class Record(activity.Activity): 
    468471        self._title_entry.set_text(recd.title)
    469472        self._title_entry.show()
    470473        self._title_label.show()
     474        self._record_container.set_title_visible(True)
    471475        self._shutter_button.hide()
    472476        self._progress.hide()
    473477
    class Record(activity.Activity): 
    476480        self._shutter_button.hide()
    477481        self._title_entry.hide()
    478482        self._title_label.hide()
     483        self._record_container.set_title_visible(False)
    479484        self._play_button.show()
    480485        self._playback_scale.show()
    481486        path = recd.getAudioImageFilepath()
    class Record(activity.Activity): 
    488493        self._shutter_button.hide()
    489494        self._title_entry.hide()
    490495        self._title_label.hide()
     496        self._record_container.set_title_visible(False)
    491497        self._play_button.show()
    492498        self._playback_scale.show()
    493499        self._media_view.show_video()
    class RecordContainer(gtk.Container): 
    562568    def __init__(self, media_view, controls_hbox):
    563569        self._media_view = media_view
    564570        self._controls_hbox = controls_hbox
     571        self._show_title = False
    565572        self._controls_hbox_height = 0
    566573        super(RecordContainer, self).__init__()
    567574
    class RecordContainer(gtk.Container): 
    641648        media_view_x = self._center_in_plane(self.allocation.width, media_view_width)
    642649        media_view_y = self._center_in_plane(remaining_height, media_view_height)
    643650
     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
    644663        # send allocation to mediaview
    645664        alloc = gdk.Rectangle()
    646665        alloc.width = media_view_width
    class RecordContainer(gtk.Container): 
    649668        alloc.y = media_view_y
    650669        self._media_view.size_allocate(alloc)
    651670
    652         # position hbox at the bottom of the window, with the requested height,
    653         # and the same width as the media view
    654671        alloc = gdk.Rectangle()
    655672        alloc.x = media_view_x
    656         alloc.y = self.allocation.height - self._controls_hbox_height
     673        alloc.y = controls_box_y
    657674        alloc.width = media_view_width
    658675        alloc.height = self._controls_hbox_height
    659676        self._controls_hbox.size_allocate(alloc)
    class RecordContainer(gtk.Container): 
    665682        for widget in (self._media_view, self._controls_hbox):
    666683            callback(widget, data)
    667684
     685    def set_title_visible(self, visible):
     686        self._show_title = visible
     687        self.queue_draw()
     688
    668689class PlaybackScale(gtk.HScale):
    669690    def __init__(self, model):
    670691        self.model = model