Ticket #120: 0002-Change-opacity-to-transparency.patch

File 0002-Change-opacity-to-transparency.patch, 7.8 KB (added by SnapShot, 3 years ago)
  • data/guake.schemas

    From 98d138e730290fd3f41adb9825a7eab8c8613f9c Mon Sep 17 00:00:00 2001
    From: Aleksandar Krsteski <alekrsteski@gmail.com>
    Date: Tue, 24 Mar 2009 17:27:32 +0100
    Subject: [PATCH 2/2] Change opacity to transparency
    
    Change the opacity option in preferences dialog to transparency to make
    it more logical and intuitive.
    ---
     data/guake.schemas |    6 +++---
     data/prefs.glade   |   10 +++++-----
     src/guake.py       |   16 ++++++++--------
     src/prefs.py       |   10 +++++-----
     4 files changed, 21 insertions(+), 21 deletions(-)
    
    diff --git a/data/guake.schemas b/data/guake.schemas
    index 1f69379..dd6065f 100644
    a b  
    218218        </schema> 
    219219 
    220220        <schema> 
    221             <key>/schemas/apps/guake/style/background/opacity</key> 
    222             <applyto>/apps/guake/style/background/opacity</applyto> 
     221            <key>/schemas/apps/guake/style/background/transparency</key> 
     222            <applyto>/apps/guake/style/background/transparency</applyto> 
    223223            <owner>guake</owner> 
    224224            <type>int</type> 
    225225            <default>80</default> 
    226226            <locale name="C"> 
    227                 <short>Background opacity.</short> 
     227                <short>Background transparency.</short> 
    228228                <long>Alpha that will be applied to the terminal 
    229229                background.</long> 
    230230            </locale> 
  • data/prefs.glade

    diff --git a/data/prefs.glade b/data/prefs.glade
    index 06b8f52..69e8c0a 100644
    a b  
    736736                                  <packing> 
    737737                                    <property name="expand">False</property> 
    738738                                    <property name="fill">False</property> 
    739                                     <property name="position">1</property> 
     739                                    <property name="position">2</property> 
    740740                                  </packing> 
    741741                                </child> 
    742742                                <child> 
     
    747747                                        <property name="width_request">140</property> 
    748748                                        <property name="visible">True</property> 
    749749                                        <property name="xalign">0</property> 
    750                                         <property name="label" translatable="yes">Opacity:</property> 
     750                                        <property name="label" translatable="yes">Transparency:</property> 
    751751                                        <property name="use_markup">True</property> 
    752752                                      </widget> 
    753753                                      <packing> 
     
    756756                                      </packing> 
    757757                                    </child> 
    758758                                    <child> 
    759                                       <widget class="GtkHScale" id="background_opacity"> 
     759                                      <widget class="GtkHScale" id="background_transparency"> 
    760760                                        <property name="visible">True</property> 
    761761                                        <property name="can_focus">True</property> 
    762762                                        <property name="adjustment">0 0 100 1 10 10</property> 
    763763                                        <property name="draw_value">False</property> 
    764764                                        <property name="value_pos">GTK_POS_RIGHT</property> 
    765                                         <signal name="value_changed" handler="on_opacity_value_changed"/> 
     765                                        <signal name="value_changed" handler="on_transparency_value_changed"/> 
    766766                                      </widget> 
    767767                                      <packing> 
    768768                                        <property name="position">1</property> 
     
    771771                                  </widget> 
    772772                                  <packing> 
    773773                                    <property name="expand">False</property> 
    774                                     <property name="position">2</property> 
     774                                    <property name="position">1</property> 
    775775                                  </packing> 
    776776                                </child> 
    777777                              </widget> 
  • src/guake.py

    diff --git a/src/guake.py b/src/guake.py
    index bfc79a3..a71cb04 100644
    a b  
    105105        notify_add(KEY('/style/font/color'), self.fcolor_changed) 
    106106        notify_add(KEY('/style/background/color'), self.bgcolor_changed) 
    107107        notify_add(KEY('/style/background/image'), self.bgimage_changed) 
    108         notify_add(KEY('/style/background/opacity'), self.bgopacity_changed) 
     108        notify_add(KEY('/style/background/transparency'), self.bgtransparency_changed) 
    109109 
    110110        notify_add(KEY('/general/compat_backspace'), self.backspace_changed) 
    111111        notify_add(KEY('/general/compat_delete'), self.delete_changed) 
     
    256256                else: 
    257257                    i.set_background_transparent(True) 
    258258 
    259     def bgopacity_changed(self, client, connection_id, entry, data): 
    260         """If the gconf var style/background/opacity be changed, this 
    261         method will be called and will set the saturation and opacity 
     259    def bgtransparency_changed(self, client, connection_id, entry, data): 
     260        """If the gconf var style/background/transparency be changed, this 
     261        method will be called and will set the saturation and transparency 
    262262        properties in all terminals open. 
    263263        """ 
    264         opacity = entry.value.get_int() 
     264        transparency = entry.value.get_int() 
    265265        for i in self.guake.term_list: 
    266             i.set_background_saturation(opacity / 100.0) 
     266            i.set_background_saturation(transparency / 100.0) 
    267267            if self.guake.has_argb: 
    268                 i.set_opacity(65535 / 100 * abs(opacity - 100)) 
     268                i.set_opacity(int((100 - transparency) / 100.0 * 65535)) 
    269269 
    270270    def backspace_changed(self, client, connection_id, entry, data): 
    271271        """If the gconf var compat_backspace be changed, this method 
     
    747747        self.client.notify(KEY('/style/font/color')) 
    748748        self.client.notify(KEY('/style/background/color')) 
    749749        self.client.notify(KEY('/style/background/image')) 
    750         self.client.notify(KEY('/style/background/opacity')) 
     750        self.client.notify(KEY('/style/background/transparency')) 
    751751        self.client.notify(KEY('/general/use_default_font')) 
    752752 
    753753    def accel_add(self, *args): 
  • src/prefs.py

    diff --git a/src/prefs.py b/src/prefs.py
    index 3045c0b..0afc5fb 100644
    a b  
    198198        if os.path.isfile(filename or ''): 
    199199            self.client.set_string(KEY('/style/background/image'), filename) 
    200200 
    201     def on_opacity_value_changed(self, hscale): 
    202         """Changes the value of background_opacity in gconf 
     201    def on_transparency_value_changed(self, hscale): 
     202        """Changes the value of background_transparency in gconf 
    203203        """ 
    204204        value = hscale.get_value() 
    205         self.client.set_int(KEY('/style/background/opacity'), int(value)) 
     205        self.client.set_int(KEY('/style/background/transparency'), int(value)) 
    206206 
    207207    # compatibility tab 
    208208 
     
    447447        if os.path.isfile(value or ''): 
    448448            self.get_widget('background_image').set_filename(value) 
    449449 
    450         value = self.client.get_int(KEY('/style/background/opacity')) 
    451         self.get_widget('background_opacity').set_value(value) 
     450        value = self.client.get_int(KEY('/style/background/transparency')) 
     451        self.get_widget('background_transparency').set_value(value) 
    452452 
    453453        # it's a separated method, to be reused. 
    454454        self.reload_erase_combos()