Ticket #1959: 0001-Add-toolbutton-for-the-grab-hands-feature-SL-1959.patch

File 0001-Add-toolbutton-for-the-grab-hands-feature-SL-1959.patch, 3.1 KB (added by manuq, 11 years ago)
  • clock.py

    From 2299287f82afc3aabc3eb5f85f70d4878e26a37f Mon Sep 17 00:00:00 2001
    From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= <manuq@laptop.org>
    Date: Thu, 14 Feb 2013 15:27:21 -0300
    Subject: [PATCH 1/6] Add toolbutton for the grab hands feature - SL #1959
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    Mail-Followup-To: <sugar-devel@lists.sugarlabs.org>
    
    This is just the button, no functionality added to it.
    
    - New icon grab.svg, stolen from Physics activity
    - Add button next to the speak one
    - Disable grab making the button insensitive when the clock is digital
    
    Signed-off-by: Manuel Quiñones <manuq@laptop.org>
    ---
     clock.py       | 17 +++++++++++++++++
     icons/grab.svg |  7 +++++++
     2 files changed, 24 insertions(+)
     create mode 100644 icons/grab.svg
    
    diff --git a/clock.py b/clock.py
    index 48ff674..a8ea8df 100755
    a b class ClockActivity(activity.Activity): 
    310310        button.connect("toggled", self._speak_time_clicked_cb)
    311311        display_toolbar.insert(button, -1)
    312312
     313        # And another button to toggle grabbing the hands
     314        self._grab_button = ToggleToolButton("grab")
     315        self._grab_button.set_tooltip(_('Grab the hands'))
     316        self._grab_button.connect("toggled", self._grab_clicked_cb)
     317        display_toolbar.insert(self._grab_button, -1)
     318
    313319    def _make_display(self):
    314320        """Prepare the display of the clock.
    315321
    class ClockActivity(activity.Activity): 
    360366        """
    361367        self._clock.set_display_mode(display_mode)
    362368
     369        # The hands can't be grabbed in the digital clock mode
     370        is_digital = display_mode == _MODE_DIGITAL_CLOCK
     371        self._grab_button.props.sensitive = not is_digital
     372
    363373    def _write_time_clicked_cb(self, button):
    364374        """The user clicked on the "write time" button to print the
    365375        current time.
    class ClockActivity(activity.Activity): 
    379389        if self._speak_time:
    380390            self._write_and_speak(True)
    381391
     392    def _grab_clicked_cb(self, button):
     393        """The user clicked on the "grab hands" button to toggle
     394        grabbing the hands.
     395        """
     396        # FIXME: implement
     397        pass
     398
    382399    def _minutes_changed_cb(self, clock):
    383400        """Minutes have changed on the clock face: we have to update
    384401        the display of the time in full letters if the user has chosen
  • new file icons/grab.svg

    diff --git a/icons/grab.svg b/icons/grab.svg
    new file mode 100644
    index 0000000..3163347
    - +  
     1<?xml version="1.0" encoding="UTF-8"?>
     2<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
     3  <!ENTITY fill_color "#FFFFFF">
     4  <!ENTITY stroke_color "#FFFFFF">
     5]>
     6<svg xmlns="http://www.w3.org/2000/svg" width="50" height="50">
     7<path d="M11,18 Q13,16 15,19 L15,31 Q16,33 17,31 L17,7 Q19,5 21,7 L21,25 Q22,27 23,25 L23,7 Q25,5 27,7 L27,25 Q28,27 29,25 L29,7 Q31,5 33,7 L33,25 Q34,27 35,25 L35,12 Q37,10 39,12 L39,37 Q39,44 33,45 L17,45 Q11,45 11,37" style="fill:&fill_color;;stroke:&stroke_color;;stroke-width:.3"/></svg>