Philipp Hörist pushed to branch gajim_1.1 at gajim / gajim

Commits:

4 changed files:

Changes:

  • gajim/common/i18n.py
    ... ... @@ -158,8 +158,9 @@ try:
    158 158
         if os.name == 'nt':
    
    159 159
             # Set the env var on Windows because gettext.find() uses it to
    
    160 160
             # find the translation
    
    161
    -        os.environ['LANG'] = LANG
    
    162
    -    print('Found default language: %s' % LANG)
    
    161
    +        # Use LANGUAGE instead of LANG, LANG sets LC_ALL and thus
    
    162
    +        # doesn't retain other region settings like LC_TIME
    
    163
    +        os.environ['LANGUAGE'] = LANG
    
    163 164
     except Exception as error:
    
    164 165
         print('Failed to determine default language', file=sys.stderr)
    
    165 166
         import traceback
    

  • gajim/common/modules/presence.py
    ... ... @@ -175,6 +175,10 @@ class Presence:
    175 175
         def get_presence(self, to=None, typ=None, priority=None,
    
    176 176
                          show=None, status=None, nick=None, caps=True,
    
    177 177
                          sign=None, idle_time=None):
    
    178
    +        if show not in ('chat', 'away', 'xa', 'dnd'):
    
    179
    +            # Gajim sometimes passes invalid show values here
    
    180
    +            # until this is fixed this is a workaround
    
    181
    +            show = None
    
    178 182
             presence = nbxmpp.Presence(to, typ, priority, show, status)
    
    179 183
             if nick is not None:
    
    180 184
                 nick_tag = presence.setTag('nick', namespace=nbxmpp.NS_NICK)
    

  • gajim/data/gui/httpupload_progress_dialog.ui
    1 1
     <?xml version="1.0" encoding="UTF-8"?>
    
    2
    -<!-- Generated with glade 3.20.1 -->
    
    2
    +<!-- Generated with glade 3.22.1 -->
    
    3 3
     <interface>
    
    4
    -  <requires lib="gtk+" version="3.14"/>
    
    4
    +  <requires lib="gtk+" version="3.20"/>
    
    5 5
       <object class="GtkBox" id="box">
    
    6
    +    <property name="width_request">300</property>
    
    6 7
         <property name="visible">True</property>
    
    7 8
         <property name="can_focus">False</property>
    
    9
    +    <property name="border_width">18</property>
    
    8 10
         <property name="orientation">vertical</property>
    
    11
    +    <property name="spacing">6</property>
    
    9 12
         <child>
    
    10
    -      <object class="GtkAlignment" id="alignment1">
    
    13
    +      <object class="GtkImage">
    
    11 14
             <property name="visible">True</property>
    
    12 15
             <property name="can_focus">False</property>
    
    13
    -        <property name="top_padding">8</property>
    
    14
    -        <property name="bottom_padding">4</property>
    
    15
    -        <property name="left_padding">8</property>
    
    16
    -        <property name="right_padding">8</property>
    
    17
    -        <child>
    
    18
    -          <object class="GtkLabel" id="label">
    
    19
    -            <property name="visible">True</property>
    
    20
    -            <property name="can_focus">False</property>
    
    21
    -            <attributes>
    
    22
    -              <attribute name="weight" value="bold"/>
    
    23
    -              <attribute name="variant" value="normal"/>
    
    24
    -            </attributes>
    
    25
    -          </object>
    
    26
    -        </child>
    
    16
    +        <property name="icon_name">document-send-symbolic</property>
    
    17
    +        <property name="icon_size">6</property>
    
    27 18
           </object>
    
    28 19
           <packing>
    
    29 20
             <property name="expand">False</property>
    
    ... ... @@ -32,21 +23,14 @@
    32 23
           </packing>
    
    33 24
         </child>
    
    34 25
         <child>
    
    35
    -      <object class="GtkAlignment" id="alignment2">
    
    26
    +      <object class="GtkLabel" id="label">
    
    36 27
             <property name="visible">True</property>
    
    37 28
             <property name="can_focus">False</property>
    
    38
    -        <property name="top_padding">4</property>
    
    39
    -        <property name="bottom_padding">4</property>
    
    40
    -        <property name="left_padding">8</property>
    
    41
    -        <property name="right_padding">8</property>
    
    42
    -        <child>
    
    43
    -          <object class="GtkProgressBar" id="progressbar">
    
    44
    -            <property name="visible">True</property>
    
    45
    -            <property name="can_focus">False</property>
    
    46
    -            <property name="pulse_step">0.10000000149</property>
    
    47
    -            <property name="show_text">True</property>
    
    48
    -          </object>
    
    49
    -        </child>
    
    29
    +        <property name="margin_top">6</property>
    
    30
    +        <property name="label">&lt;placeholder&gt;</property>
    
    31
    +        <style>
    
    32
    +          <class name="bold"/>
    
    33
    +        </style>
    
    50 34
           </object>
    
    51 35
           <packing>
    
    52 36
             <property name="expand">False</property>
    
    ... ... @@ -54,5 +38,52 @@
    54 38
             <property name="position">1</property>
    
    55 39
           </packing>
    
    56 40
         </child>
    
    41
    +    <child>
    
    42
    +      <object class="GtkLabel" id="progress_label">
    
    43
    +        <property name="visible">True</property>
    
    44
    +        <property name="can_focus">False</property>
    
    45
    +        <property name="label">&lt;progress&gt;</property>
    
    46
    +        <style>
    
    47
    +          <class name="dim-label"/>
    
    48
    +        </style>
    
    49
    +      </object>
    
    50
    +      <packing>
    
    51
    +        <property name="expand">False</property>
    
    52
    +        <property name="fill">True</property>
    
    53
    +        <property name="position">2</property>
    
    54
    +      </packing>
    
    55
    +    </child>
    
    56
    +    <child>
    
    57
    +      <object class="GtkProgressBar" id="progressbar">
    
    58
    +        <property name="visible">True</property>
    
    59
    +        <property name="can_focus">False</property>
    
    60
    +        <property name="margin_top">6</property>
    
    61
    +        <property name="pulse_step">0.10000000149</property>
    
    62
    +      </object>
    
    63
    +      <packing>
    
    64
    +        <property name="expand">False</property>
    
    65
    +        <property name="fill">True</property>
    
    66
    +        <property name="position">3</property>
    
    67
    +      </packing>
    
    68
    +    </child>
    
    69
    +    <child>
    
    70
    +      <object class="GtkButton" id="cancel_upload_button">
    
    71
    +        <property name="label" translatable="yes">Cancel Upload</property>
    
    72
    +        <property name="visible">True</property>
    
    73
    +        <property name="can_focus">True</property>
    
    74
    +        <property name="receives_default">True</property>
    
    75
    +        <property name="halign">center</property>
    
    76
    +        <property name="margin_top">6</property>
    
    77
    +        <signal name="clicked" handler="on_cancel_upload_button_clicked" swapped="no"/>
    
    78
    +        <style>
    
    79
    +          <class name="destructive-action"/>
    
    80
    +        </style>
    
    81
    +      </object>
    
    82
    +      <packing>
    
    83
    +        <property name="expand">False</property>
    
    84
    +        <property name="fill">True</property>
    
    85
    +        <property name="position">4</property>
    
    86
    +      </packing>
    
    87
    +    </child>
    
    57 88
       </object>
    
    58 89
     </interface>

  • gajim/dialogs.py
    ... ... @@ -55,6 +55,7 @@ from gajim.common.exceptions import GajimGeneralException
    55 55
     # Compat with Gajim 1.0.3 for plugins
    
    56 56
     from gajim.gtk.dialogs import *
    
    57 57
     from gajim.gtk.add_contact import AddNewContactWindow
    
    58
    +from gajim.gtk.util import get_builder
    
    58 59
     
    
    59 60
     
    
    60 61
     log = logging.getLogger('gajim.dialogs')
    
    ... ... @@ -1733,22 +1734,18 @@ class ProgressWindow(Gtk.ApplicationWindow):
    1733 1734
             self.set_position(Gtk.WindowPosition.CENTER)
    
    1734 1735
             self.set_show_menubar(False)
    
    1735 1736
             self.set_title(_('File Transfer'))
    
    1736
    -        self.set_default_size(250, -1)
    
    1737 1737
     
    
    1738 1738
             self.event = file.event
    
    1739 1739
             self.file = file
    
    1740
    -        self.xml = gtkgui_helpers.get_gtk_builder(
    
    1741
    -            'httpupload_progress_dialog.ui')
    
    1742
    -
    
    1743
    -        self.label = self.xml.get_object('label')
    
    1744
    -        self.progressbar = self.xml.get_object('progressbar')
    
    1740
    +        self._ui = get_builder('httpupload_progress_dialog.ui')
    
    1745 1741
     
    
    1746
    -        self.add(self.xml.get_object('box'))
    
    1742
    +        self.add(self._ui.box)
    
    1747 1743
     
    
    1748 1744
             self.pulse = GLib.timeout_add(100, self._pulse_progressbar)
    
    1749 1745
             self.show_all()
    
    1750 1746
     
    
    1751 1747
             self.connect('destroy', self._on_destroy)
    
    1748
    +        self._ui.connect_signals(self)
    
    1752 1749
             app.ged.register_event_handler('httpupload-progress', ged.CORE,
    
    1753 1750
                                            self._on_httpupload_progress)
    
    1754 1751
     
    
    ... ... @@ -1756,20 +1753,23 @@ class ProgressWindow(Gtk.ApplicationWindow):
    1756 1753
             if self.file != obj.file:
    
    1757 1754
                 return
    
    1758 1755
             if obj.status == 'request':
    
    1759
    -            self.label.set_text(_('Requesting HTTP Upload Slot…'))
    
    1756
    +            self._ui.label.set_text(_('Requesting HTTP Upload Slot…'))
    
    1760 1757
             elif obj.status == 'close':
    
    1761 1758
                 self.destroy()
    
    1762 1759
             elif obj.status == 'upload':
    
    1763
    -            self.label.set_text(_('Uploading file via HTTP File Upload…'))
    
    1760
    +            self._ui.label.set_text(_('Uploading file via HTTP File Upload…'))
    
    1764 1761
             elif obj.status == 'update':
    
    1765 1762
                 self.update_progress(obj.seen, obj.total)
    
    1766 1763
             elif obj.status == 'encrypt':
    
    1767
    -            self.label.set_text(_('Encrypting file…'))
    
    1764
    +            self._ui.label.set_text(_('Encrypting file…'))
    
    1768 1765
     
    
    1769 1766
         def _pulse_progressbar(self):
    
    1770
    -        self.progressbar.pulse()
    
    1767
    +        self._ui.progressbar.pulse()
    
    1771 1768
             return True
    
    1772 1769
     
    
    1770
    +    def on_cancel_upload_button_clicked(self, widget):
    
    1771
    +        self.destroy()
    
    1772
    +
    
    1773 1773
         def _on_destroy(self, *args):
    
    1774 1774
             self.event.set()
    
    1775 1775
             if self.pulse:
    
    ... ... @@ -1783,6 +1783,9 @@ class ProgressWindow(Gtk.ApplicationWindow):
    1783 1783
             if self.pulse:
    
    1784 1784
                 GLib.source_remove(self.pulse)
    
    1785 1785
                 self.pulse = None
    
    1786
    -        pct = (float(seen) / total) * 100.0
    
    1787
    -        self.progressbar.set_fraction(float(seen) / total)
    
    1788
    -        self.progressbar.set_text(str(int(pct)) + "%")
    1786
    +        self._ui.progressbar.set_fraction(float(seen) / total)
    
    1787
    +        size_total = round(total / (1024 * 1024), 1)
    
    1788
    +        size_progress = round(seen / (1024 * 1024), 1)
    
    1789
    +        self._ui.progress_label.set_text(
    
    1790
    +            _('%(progress)s of %(total)s MiB sent') % \
    
    1791
    +            {'progress': str(size_progress), 'total': str(size_total)})