Philipp Hörist pushed to branch gajim_1.1 at gajim / gajim
Commits: e01e552f by Daniel Brötzmann at 2019-04-05T19:19:31Z Rework HTTPUpload dialog
- - - - - cb4e60c4 by Philipp Hörist at 2019-04-05T19:27:39Z Dont send invalid presence show value
- - - - - 80f37bb3 by Philipp Hörist at 2019-04-05T19:28:46Z Windows: Dont override format region settings
- - - - -
4 changed files:
- gajim/common/i18n.py - gajim/common/modules/presence.py - gajim/data/gui/httpupload_progress_dialog.ui - gajim/dialogs.py
Changes:
===================================== gajim/common/i18n.py ===================================== @@ -158,8 +158,9 @@ try: if os.name == 'nt': # Set the env var on Windows because gettext.find() uses it to # find the translation - os.environ['LANG'] = LANG - print('Found default language: %s' % LANG) + # Use LANGUAGE instead of LANG, LANG sets LC_ALL and thus + # doesn't retain other region settings like LC_TIME + os.environ['LANGUAGE'] = LANG except Exception as error: print('Failed to determine default language', file=sys.stderr) import traceback
===================================== gajim/common/modules/presence.py ===================================== @@ -175,6 +175,10 @@ class Presence: def get_presence(self, to=None, typ=None, priority=None, show=None, status=None, nick=None, caps=True, sign=None, idle_time=None): + if show not in ('chat', 'away', 'xa', 'dnd'): + # Gajim sometimes passes invalid show values here + # until this is fixed this is a workaround + show = None presence = nbxmpp.Presence(to, typ, priority, show, status) if nick is not None: nick_tag = presence.setTag('nick', namespace=nbxmpp.NS_NICK)
===================================== gajim/data/gui/httpupload_progress_dialog.ui ===================================== @@ -1,29 +1,20 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.20.1 --> +<!-- Generated with glade 3.22.1 --> <interface> - <requires lib="gtk+" version="3.14"/> + <requires lib="gtk+" version="3.20"/> <object class="GtkBox" id="box"> + <property name="width_request">300</property> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="border_width">18</property> <property name="orientation">vertical</property> + <property name="spacing">6</property> <child> - <object class="GtkAlignment" id="alignment1"> + <object class="GtkImage"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="top_padding">8</property> - <property name="bottom_padding">4</property> - <property name="left_padding">8</property> - <property name="right_padding">8</property> - <child> - <object class="GtkLabel" id="label"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <attributes> - <attribute name="weight" value="bold"/> - <attribute name="variant" value="normal"/> - </attributes> - </object> - </child> + <property name="icon_name">document-send-symbolic</property> + <property name="icon_size">6</property> </object> <packing> <property name="expand">False</property> @@ -32,21 +23,14 @@ </packing> </child> <child> - <object class="GtkAlignment" id="alignment2"> + <object class="GtkLabel" id="label"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="top_padding">4</property> - <property name="bottom_padding">4</property> - <property name="left_padding">8</property> - <property name="right_padding">8</property> - <child> - <object class="GtkProgressBar" id="progressbar"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="pulse_step">0.10000000149</property> - <property name="show_text">True</property> - </object> - </child> + <property name="margin_top">6</property> + <property name="label"><placeholder></property> + <style> + <class name="bold"/> + </style> </object> <packing> <property name="expand">False</property> @@ -54,5 +38,52 @@ <property name="position">1</property> </packing> </child> + <child> + <object class="GtkLabel" id="progress_label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label"><progress></property> + <style> + <class name="dim-label"/> + </style> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkProgressBar" id="progressbar"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="margin_top">6</property> + <property name="pulse_step">0.10000000149</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> + <child> + <object class="GtkButton" id="cancel_upload_button"> + <property name="label" translatable="yes">Cancel Upload</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="halign">center</property> + <property name="margin_top">6</property> + <signal name="clicked" handler="on_cancel_upload_button_clicked" swapped="no"/> + <style> + <class name="destructive-action"/> + </style> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">4</property> + </packing> + </child> </object> </interface>
===================================== gajim/dialogs.py ===================================== @@ -55,6 +55,7 @@ from gajim.common.exceptions import GajimGeneralException # Compat with Gajim 1.0.3 for plugins from gajim.gtk.dialogs import * from gajim.gtk.add_contact import AddNewContactWindow +from gajim.gtk.util import get_builder
log = logging.getLogger('gajim.dialogs') @@ -1733,22 +1734,18 @@ class ProgressWindow(Gtk.ApplicationWindow): self.set_position(Gtk.WindowPosition.CENTER) self.set_show_menubar(False) self.set_title(_('File Transfer')) - self.set_default_size(250, -1)
self.event = file.event self.file = file - self.xml = gtkgui_helpers.get_gtk_builder( - 'httpupload_progress_dialog.ui') - - self.label = self.xml.get_object('label') - self.progressbar = self.xml.get_object('progressbar') + self._ui = get_builder('httpupload_progress_dialog.ui')
- self.add(self.xml.get_object('box')) + self.add(self._ui.box)
self.pulse = GLib.timeout_add(100, self._pulse_progressbar) self.show_all()
self.connect('destroy', self._on_destroy) + self._ui.connect_signals(self) app.ged.register_event_handler('httpupload-progress', ged.CORE, self._on_httpupload_progress)
@@ -1756,20 +1753,23 @@ class ProgressWindow(Gtk.ApplicationWindow): if self.file != obj.file: return if obj.status == 'request': - self.label.set_text(_('Requesting HTTP Upload Slot…')) + self._ui.label.set_text(_('Requesting HTTP Upload Slot…')) elif obj.status == 'close': self.destroy() elif obj.status == 'upload': - self.label.set_text(_('Uploading file via HTTP File Upload…')) + self._ui.label.set_text(_('Uploading file via HTTP File Upload…')) elif obj.status == 'update': self.update_progress(obj.seen, obj.total) elif obj.status == 'encrypt': - self.label.set_text(_('Encrypting file…')) + self._ui.label.set_text(_('Encrypting file…'))
def _pulse_progressbar(self): - self.progressbar.pulse() + self._ui.progressbar.pulse() return True
+ def on_cancel_upload_button_clicked(self, widget): + self.destroy() + def _on_destroy(self, *args): self.event.set() if self.pulse: @@ -1783,6 +1783,9 @@ class ProgressWindow(Gtk.ApplicationWindow): if self.pulse: GLib.source_remove(self.pulse) self.pulse = None - pct = (float(seen) / total) * 100.0 - self.progressbar.set_fraction(float(seen) / total) - self.progressbar.set_text(str(int(pct)) + "%") + self._ui.progressbar.set_fraction(float(seen) / total) + size_total = round(total / (1024 * 1024), 1) + size_progress = round(seen / (1024 * 1024), 1) + self._ui.progress_label.set_text( + _('%(progress)s of %(total)s MiB sent') % \ + {'progress': str(size_progress), 'total': str(size_total)})
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/366b3df235cdb1cdd54dc909ea5c2900af...