Philipp Hörist pushed to branch master at gajim / gajim
Commits:
6926bdae by Philipp Hörist at 2017-12-08T20:20:07+01:00
Port some error messages to new interface
- - - - -
7 changed files:
- gajim/accounts_window.py
- gajim/adhoc_commands.py
- gajim/app_actions.py
- gajim/chat_control_base.py
- gajim/dataforms_widget.py
- gajim/dialog_messages.py
- gajim/dialogs.py
Changes:
=====================================
gajim/accounts_window.py
=====================================
--- a/gajim/accounts_window.py
+++ b/gajim/accounts_window.py
@@ -177,10 +177,7 @@ class AccountsWindow(Gtk.ApplicationWindow):
def on_remove_account(self, button, account):
if app.events.get_events(account):
- dialogs.ErrorDialog(
- _('Unread events'),
- _('Read all pending events before removing this account.'),
- transient_for=self)
+ app.interface.raise_dialog('unread-events-on-remove')
return
if app.config.get_per('accounts', account, 'is_zeroconf'):
@@ -361,10 +358,7 @@ class Account(Gtk.Box):
if (account in app.connections and
app.connections[account].connected > 0):
# connecting or connected
- dialogs.ErrorDialog(
- _('You are currently connected to the server'),
- _('To disable the account, you must be disconnected.'),
- transient_for=self.parent)
+ app.interface.raise_dialog('connected-on-disable-account')
switch.set_active(not state)
return
if state:
=====================================
gajim/adhoc_commands.py
=====================================
--- a/gajim/adhoc_commands.py
+++ b/gajim/adhoc_commands.py
@@ -364,10 +364,8 @@ class CommandWindow:
if self.data_form_widget.get_data_form():
df = self.data_form_widget.get_data_form()
if not df.is_valid():
- dialogs.ErrorDialog(
- _('Invalid Form'),
- _('The form is not filled correctly.'),
- transient_for=self.window)
+ app.interface.raise_dialog(
+ 'invalid-form', transient_for=self.window)
self.data_form_widget.set_sensitive(True)
return
self.data_form_widget.data_form.type_ = 'submit'
=====================================
gajim/app_actions.py
=====================================
--- a/gajim/app_actions.py
+++ b/gajim/app_actions.py
@@ -124,8 +124,7 @@ class AppActions():
account = param.get_string()
invisible_show = app.SHOW_LIST.index('invisible')
if app.connections[account].connected == invisible_show:
- dialogs.ErrorDialog(_(
- 'You cannot join a group chat while you are invisible'))
+ app.interface.raise_dialog('join-while-invisible')
return
if 'join_gc' in interface.instances[account]:
interface.instances[account]['join_gc'].present()
=====================================
gajim/chat_control_base.py
=====================================
--- a/gajim/chat_control_base.py
+++ b/gajim/chat_control_base.py
@@ -694,8 +694,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
if send_message and app.connections[self.account].connected < 2:
# we are not connected
- dialogs.ErrorDialog(_('A connection is not available'),
- _('Your message can not be sent until you are connected.'))
+ app.interface.raise_dialog('not-connected-while-sending')
elif send_message:
self.send_message(message, xhtml=xhtml)
else:
=====================================
gajim/dataforms_widget.py
=====================================
--- a/gajim/dataforms_widget.py
+++ b/gajim/dataforms_widget.py
@@ -37,6 +37,7 @@ from gajim import dialogs
from gajim.common import dataforms
from gajim.common import helpers
+from gajim.common import app
import itertools
@@ -641,12 +642,10 @@ class SingleForm(Gtk.Table, object):
try:
newtext = helpers.parse_jid(newtext)
except helpers.InvalidFormat as s:
- dialogs.ErrorDialog(_('Invalid JID'), str(s))
+ app.interface.raise_dialog('invalid-jid-with-error', str(s))
return
if newtext in field.values:
- dialogs.ErrorDialog(
- _('JID already in list'),
- _('The JID you entered is already in the list. Choose another one.'))
+ app.interface.raise_dialog('jid-in-list')
GLib.idle_add(treeview.set_cursor, path)
return
model[path][0]=newtext
=====================================
gajim/dialog_messages.py
=====================================
--- a/gajim/dialog_messages.py
+++ b/gajim/dialog_messages.py
@@ -22,10 +22,52 @@ from collections import namedtuple
from gi.repository import GLib
from gajim.common.app import app
+from gajim.dialogs import ErrorDialog
Message = namedtuple('Message', ['title', 'text', 'dialog'])
-messages = {}
+messages = {
+ 'start-chat-not-connected': Message(
+ _('You are not connected to the server'),
+ _('You can not start a new conversation unless you are connected.'),
+ ErrorDialog),
+
+ 'invalid-jid-with-error': Message(
+ _('Invalid JID'),
+ '%s',
+ ErrorDialog),
+
+ 'unread-events-on-remove-account': Message(
+ _('Unread events'),
+ _('Read all pending events before removing this account.'),
+ ErrorDialog),
+
+ 'connected-on-disable-account': Message(
+ _('You are currently connected to the server'),
+ _('To disable the account, you must be disconnected.'),
+ ErrorDialog),
+
+ 'invalid-form': Message(
+ _('Invalid Form'),
+ _('The form is not filled correctly.'),
+ ErrorDialog),
+
+ 'join-while-invisible': Message(
+ _('Invisible'),
+ _('You cannot join a group chat while you are invisible'),
+ ErrorDialog),
+
+ 'not-connected-while-sending': Message(
+ _('A connection is not available'),
+ _('Your message can not be sent until you are connected.'),
+ ErrorDialog),
+
+ 'jid-in-list': Message(
+ _('JID already in list'),
+ _('The JID you entered is already in the list. Choose another one.'),
+ ErrorDialog),
+
+ }
def get_dialog(name, *args, **kwargs):
@@ -42,8 +84,10 @@ def get_dialog(name, *args, **kwargs):
if args:
message_text = message.text % args
- else:
+ elif kwargs:
message_text = message.text % kwargs
+ else:
+ message_text = message.text
dialog = message.dialog(message.title,
GLib.markup_escape_text(message_text),
transient_for=transient_for)
=====================================
gajim/dialogs.py
=====================================
--- a/gajim/dialogs.py
+++ b/gajim/dialogs.py
@@ -2879,16 +2879,12 @@ class StartChatDialog(Gtk.ApplicationWindow):
def _start_new_chat(self, row):
if row.new:
if not app.account_is_connected(row.account):
- ErrorDialog(
- _('You are not connected to the server'),
- _('You can not start a new conversation'
- ' unless you are connected.'),
- transient_for=self)
+ app.interface.raise_dialog('start-chat-not-connected')
return
try:
helpers.parse_jid(row.jid)
except helpers.InvalidFormat as e:
- ErrorDialog(_('Invalid JID'), str(e), transient_for=self)
+ app.interface.raise_dialog('invalid-jid-with-error', str(e))
return
if row.groupchat:
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/6926bdaee0234191b3d9610ba4d74434fa…
---
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/6926bdaee0234191b3d9610ba4d74434fa…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
61ad7836 by Philipp Hörist at 2017-12-08T19:50:48+01:00
Add new interface to raise dialogs
- - - - -
2 changed files:
- + gajim/dialog_messages.py
- gajim/gui_interface.py
Changes:
=====================================
gajim/dialog_messages.py
=====================================
--- /dev/null
+++ b/gajim/dialog_messages.py
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2017 Philipp Hörist <philipp AT hoerist.com>
+#
+# This file is part of Gajim.
+#
+# Gajim is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Gajim is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Gajim. If not, see <http://www.gnu.org/licenses/>.
+
+from collections import namedtuple
+
+from gi.repository import GLib
+
+from gajim.common.app import app
+
+Message = namedtuple('Message', ['title', 'text', 'dialog'])
+
+messages = {}
+
+
+def get_dialog(name, *args, **kwargs):
+ message = messages.get(name, None)
+ if message is None:
+ raise ValueError('Dialog %s does not exist' % name)
+
+ # Set transient window
+ transient_for = kwargs.get('transient_for', None)
+ if transient_for is None:
+ transient_for = app.get_active_window()
+ else:
+ del kwargs['transient_for']
+
+ if args:
+ message_text = message.text % args
+ else:
+ message_text = message.text % kwargs
+ dialog = message.dialog(message.title,
+ GLib.markup_escape_text(message_text),
+ transient_for=transient_for)
+ return dialog
=====================================
gajim/gui_interface.py
=====================================
--- a/gajim/gui_interface.py
+++ b/gajim/gui_interface.py
@@ -67,6 +67,7 @@ from gajim import gui_menu_builder
from gajim import dialogs
from gajim import notify
from gajim import message_control
+from gajim.dialog_messages import get_dialog
from gajim.chat_control_base import ChatControlBase
from gajim.chat_control import ChatControl
@@ -143,6 +144,10 @@ class Interface:
cls(obj.pri_txt, GLib.markup_escape_text(obj.sec_txt))
+ @staticmethod
+ def raise_dialog(name, *args, **kwargs):
+ get_dialog(name, *args, **kwargs)
+
def handle_ask_new_nick(self, account, room_jid, parent_win):
title = _('Unable to join group chat')
prompt = _('Your desired nickname in group chat\n'
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/61ad783658266a6036dec0287136e34ee0…
---
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/61ad783658266a6036dec0287136e34ee0…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
dc52f560 by Philipp Hörist at 2017-12-08T16:43:11+01:00
Update README.md
- - - - -
1 changed file:
- README.md
Changes:
=====================================
README.md
=====================================
--- a/README.md
+++ b/README.md
@@ -14,7 +14,7 @@
### Optional Runtime Requirements
-- python-pillow for support of webp avatars
+- python3-pil (pillow) for support of webp avatars
- python3-crypto to enable End to end encryption
- python3-gnupg to enable GPG encryption
- For zeroconf (bonjour) you need dbus-glib, python-avahi
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/dc52f560ed5775d001b67e13a26d5f1b4d…
---
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/dc52f560ed5775d001b67e13a26d5f1b4d…
You're receiving this email because of your account on dev.gajim.org.
Yann Leboulanger pushed to branch gajim_0.16 at gajim / gajim
Commits:
12914d5c by Yann Leboulanger at 2017-12-03T20:09:06+01:00
correctly compute file hash when file is received
- - - - -
1 changed file:
- src/gui_interface.py
Changes:
=====================================
src/gui_interface.py
=====================================
--- a/src/gui_interface.py
+++ b/src/gui_interface.py
@@ -1006,7 +1006,8 @@ class Interface:
file_props=file_props))
else:
ft.set_status(file_props, 'stop')
- if file_props.stalled or file_props.paused:
+ if not file_props.completed and (file_props.stalled or \
+ file_props.paused):
return
if file_props.type_ == 'r': # we receive a file
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/12914d5c0b344fe6dfcbe8ac4870d17256…
---
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/12914d5c0b344fe6dfcbe8ac4870d17256…
You're receiving this email because of your account on dev.gajim.org.