Import _() instead of using builtin namespace

- Prepare for removing the global installed _() method in builtins
- Sort some imports along the way
This commit is contained in:
Philipp Hörist 2018-10-04 23:55:35 +02:00
parent 8ace1f2b2b
commit f197358e2f
61 changed files with 159 additions and 57 deletions

View File

@ -25,6 +25,7 @@ from gi.repository import Gtk
import nbxmpp
from gajim.common import app
from gajim.common.i18n import _
from gajim.common.modules import dataforms
from gajim.common import ged

View File

@ -46,6 +46,7 @@ from gajim.common import logging_helpers
from gajim.common import exceptions
from gajim.common import caps_cache
from gajim.common import logger
from gajim.common.i18n import _
class GajimApplication(Gtk.Application):

View File

@ -23,9 +23,11 @@ from typing import Any # pylint: disable=unused-import
from gi.repository import Gdk
from gi.repository import GLib
from gajim import gtkgui_helpers
from gajim.common import helpers
from gajim.common import i18n
from gajim.common.i18n import _
from gajim import gtkgui_helpers
class AtomWindow:
window = None

View File

@ -37,22 +37,24 @@ from nbxmpp.protocol import NS_XHTML, NS_XHTML_IM, NS_FILE, NS_MUC
from nbxmpp.protocol import NS_JINGLE_RTP_AUDIO, NS_JINGLE_RTP_VIDEO
from nbxmpp.protocol import NS_JINGLE_ICE_UDP, NS_JINGLE_FILE_TRANSFER_5
from gajim import gtkgui_helpers
from gajim import gui_menu_builder
from gajim import message_control
from gajim import dialogs
from gajim.gtk.dialogs import ConfirmationDialog
from gajim.gtk.add_contact import AddNewContactWindow
from gajim.common import app
from gajim.common import helpers
from gajim.common import ged
from gajim.common import i18n
from gajim.common.i18n import _
from gajim.common.contacts import GC_Contact
from gajim.common.const import AvatarSize
from gajim.common.const import KindConstant
from gajim.common.const import Chatstate
from gajim import gtkgui_helpers
from gajim import gui_menu_builder
from gajim import message_control
from gajim import dialogs
from gajim.gtk.dialogs import ConfirmationDialog
from gajim.gtk.add_contact import AddNewContactWindow
from gajim.command_system.implementation.hosts import ChatCommands
from gajim.command_system.framework import CommandHost # pylint: disable=unused-import
from gajim.chat_control_base import ChatControlBase

View File

@ -32,25 +32,29 @@ from gi.repository import Gdk
from gi.repository import GLib
from gi.repository import Gio
from gajim import gtkgui_helpers
from gajim import message_control
from gajim.gtk.dialogs import NonModalConfirmationDialog
from gajim.gtk.util import convert_rgb_to_hex
from gajim import notify
from gajim.gtk.emoji_chooser import emoji_chooser
from gajim.common import events
from gajim.common import app
from gajim.common import helpers
from gajim.common import ged
from gajim.common import i18n
from gajim.message_control import MessageControl
from gajim.conversation_textview import ConversationTextview
from gajim.message_textview import MessageTextView
from gajim.common.i18n import _
from gajim.common.contacts import GC_Contact
from gajim.common.connection_handlers_events import MessageOutgoingEvent
from gajim.common.const import StyleAttr
from gajim.common.const import Chatstate
from gajim import notify
from gajim import gtkgui_helpers
from gajim import message_control
from gajim.message_control import MessageControl
from gajim.conversation_textview import ConversationTextview
from gajim.message_textview import MessageTextView
from gajim.gtk.dialogs import NonModalConfirmationDialog
from gajim.gtk.util import convert_rgb_to_hex
from gajim.gtk.emoji_chooser import emoji_chooser
from gajim.command_system.implementation.middleware import ChatCommandProcessor
from gajim.command_system.implementation.middleware import CommandTools

View File

@ -56,6 +56,7 @@ from gajim.common import app
from gajim.common import gpg
from gajim.common import passwords
from gajim.common import idle
from gajim.common.i18n import _
from gajim.common.connection_handlers import *
from gajim.common.contacts import GC_Contact
from gajim.common import modules

View File

@ -28,6 +28,7 @@ from gajim.common import nec
from gajim.common import helpers
from gajim.common import app
from gajim.common import i18n
from gajim.common.i18n import _
from gajim.common.modules import dataforms
from gajim.common.const import KindConstant, SSLError
from gajim.common.pep import SUPPORTED_PERSONAL_USER_EVENTS

View File

@ -17,6 +17,8 @@
# You should have received a copy of the GNU General Public License
# along with Gajim. If not, see <http://www.gnu.org/licenses/>.
from gajim.common.i18n import _
class PysqliteOperationalError(Exception):
"""

View File

@ -27,7 +27,7 @@ from gi.repository import Gst
from gi.repository import GLib
from gajim.common import app
from gajim.common.i18n import _
from gajim.common.jingle_transport import JingleTransportICEUDP
from gajim.common.jingle_content import contents, JingleContent, JingleContentSetupException
from gajim.common.connection_handlers_events import InformationEvent

View File

@ -41,6 +41,7 @@ from gi.repository import GLib
from gajim.common import exceptions
from gajim.common import app
from gajim.common import configpaths
from gajim.common.i18n import _
from gajim.common.const import (
JIDConstant, KindConstant, ShowConstant, TypeConstant,
SubscriptionConstant)

View File

@ -18,6 +18,8 @@ import logging
import os
import sys
from gajim.common.i18n import _
def parseLogLevel(arg):
"""
Eiter numeric value or level name from logging module

View File

@ -32,6 +32,7 @@ from gi.repository import GLib
from gajim.common import app
from gajim.common import ged
from gajim.common.i18n import _
from gajim.common.nec import NetworkIncomingEvent
from gajim.common.connection_handlers_events import InformationEvent
from gajim.common.connection_handlers_events import MessageOutgoingEvent

View File

@ -21,6 +21,7 @@ import nbxmpp
from gajim.common import app
from gajim.common import helpers
from gajim.common.i18n import _
from gajim.common.nec import NetworkIncomingEvent, NetworkEvent
from gajim.common.modules.security_labels import parse_securitylabel
from gajim.common.modules.user_nickname import parse_nickname

View File

@ -19,6 +19,7 @@ import logging
import nbxmpp
from gajim.common import app
from gajim.common.i18n import _
from gajim.common.nec import NetworkEvent
from gajim.common.modules.user_nickname import parse_nickname

View File

@ -20,6 +20,7 @@ import nbxmpp
from gajim.common import app
from gajim.common import helpers
from gajim.common.i18n import _
from gajim.common.nec import NetworkIncomingEvent
log = logging.getLogger('gajim.c.m.roster_item_exchange')

View File

@ -19,6 +19,8 @@ import logging
gi.require_version('Gst', '1.0')
from gi.repository import Gst
from gajim.common.i18n import _
log = logging.getLogger('gajim.c.multimedia_helpers')

View File

@ -30,6 +30,7 @@ import logging
from gajim.common import app
from gajim.common import caps_cache
from gajim.common.i18n import _
log = logging.getLogger('gajim.c.optparser')

View File

@ -29,6 +29,7 @@ from gajim.common import app
from gajim.common.protocol.bytestream import ConnectionSocks5BytestreamZeroconf
from gajim.common.zeroconf.zeroconf import Constant
from gajim.common import connection_handlers
from gajim.common.i18n import _
from gajim.common.nec import NetworkIncomingEvent, NetworkEvent
from gajim.common.modules.user_nickname import parse_nickname
from gajim.common.modules.misc import parse_eme

View File

@ -44,6 +44,7 @@ from gajim.common.connection import CommonConnection
from gajim.common import app
from gajim.common import ged
from gajim.common import modules
from gajim.common.i18n import _
from gajim.common.zeroconf import client_zeroconf
from gajim.common.zeroconf import zeroconf
from gajim.common.zeroconf.connection_handlers_zeroconf import *

View File

@ -22,6 +22,7 @@ try:
except ImportError:
pass
from gajim.common.i18n import _
from gajim.common.zeroconf.zeroconf import Constant, ConstantRI
from gajim.common.zeroconf.zeroconf_avahi_const import *

View File

@ -19,6 +19,8 @@ import logging
import select
import socket
import re
from gajim.common.i18n import _
from gajim.common.zeroconf.zeroconf import Constant

View File

@ -33,12 +33,14 @@ from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GObject
from gajim.common import helpers
from gajim.common import app
from gajim.common.i18n import _
from gajim import gtkgui_helpers
from gajim import dialogs
from gajim import dataforms_widget
from gajim import gui_menu_builder
from gajim.common import helpers
from gajim.common import app
from gajim.gtk.dialogs import ConfirmationDialog
from gajim.gtk.dialogs import ConfirmationDialogDoubleRadio

View File

@ -35,20 +35,21 @@ from gi.repository import Pango
from gi.repository import GObject
from gi.repository import GLib
from gajim.common import app
from gajim.common import helpers
from gajim.common import i18n
from gajim.common.i18n import _
from gajim.common.fuzzyclock import FuzzyClock
from gajim.common.const import StyleAttr
from gajim.htmltextview import HtmlTextView
from gajim.gtk import util
from gajim.gtk.util import load_icon
from gajim.gtk.util import get_cursor
from gajim.gtk.emoji_data import emoji_pixbufs
from gajim.gtk.emoji_data import is_emoji
from gajim.gtk.emoji_data import get_emoji_pixbuf
from gajim.common import app
from gajim.common import helpers
from gajim.common import i18n
from gajim.common.fuzzyclock import FuzzyClock
from gajim.common.const import StyleAttr
from gajim.htmltextview import HtmlTextView
NOT_SHOWN = 0
ALREADY_RECEIVED = 1

View File

@ -34,6 +34,7 @@ from gajim import gtkgui_helpers
from gajim.common.modules import dataforms
from gajim.common import helpers
from gajim.common import app
from gajim.common.i18n import _
class DataFormWidget(Gtk.Alignment):

View File

@ -37,6 +37,7 @@ from gajim import tooltips
from gajim.common import app
from gajim.common import helpers
from gajim.common.i18n import _
from gajim.common.file_props import FilesProp
from gajim.common.protocol.bytestream import (is_transfer_active, is_transfer_paused,
is_transfer_stopped)

View File

@ -57,6 +57,7 @@ from gajim.common import helpers
from gajim.common.modules import dataforms
from gajim.common import ged
from gajim.common import i18n
from gajim.common.i18n import _
from gajim.common import contacts
from gajim.common.const import StyleAttr
from gajim.common.const import Chatstate

View File

@ -18,6 +18,7 @@ from gi.repository import Gtk
from gi.repository import GObject
from gajim.common import app
from gajim.common.i18n import _
from gajim.common.const import DEVS_CURRENT
from gajim.common.const import DEVS_PAST
from gajim.common.const import ARTISTS

View File

@ -23,15 +23,20 @@ from gajim.common import ged
from gajim.common import configpaths
from gajim.common import helpers
from gajim.common import connection
from gajim.common.i18n import _
from gajim.common.modules import dataforms
from gajim.config import ManageProxiesWindow
from gajim.config import FakeDataForm
from gajim.gtk.util import get_builder
from gajim.gtk.dialogs import ErrorDialog
from gajim import gtkgui_helpers
from gajim import dataforms_widget
from gajim import gui_menu_builder
from gajim.config import ManageProxiesWindow
from gajim.config import FakeDataForm
from gajim.gtk.util import get_builder
from gajim.gtk.dialogs import ErrorDialog
class AccountCreationWizard:
def __init__(self):

View File

@ -18,18 +18,23 @@ from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GLib
from gajim import gtkgui_helpers
from gajim import gui_menu_builder
from gajim import config
from gajim.options_dialog import OptionsDialog, OptionsBox
from gajim.common import app
from gajim.common import passwords
from gajim.common import helpers
from gajim.common import ged
from gajim.common.i18n import _
from gajim.common.connection import Connection
from gajim.common.zeroconf.connection_zeroconf import ConnectionZeroconf
from gajim.common.const import Option, OptionKind, OptionType
from gajim.common.const import Option
from gajim.common.const import OptionKind
from gajim.common.const import OptionType
from gajim import gtkgui_helpers
from gajim import gui_menu_builder
from gajim import config
from gajim.options_dialog import OptionsDialog
from gajim.options_dialog import OptionsBox
from gajim.gtk.dialogs import ConfirmationDialog
from gajim.gtk.dialogs import YesNoDialog

View File

@ -19,6 +19,7 @@ from gajim.common import app
from gajim.common import ged
from gajim.common import helpers
from gajim.common.i18n import _
from gajim.gtk.dialogs import ErrorDialog
from gajim.gtk.util import get_builder

View File

@ -26,6 +26,7 @@ from gi.repository import GLib
from gi.repository import Pango
from gajim.common import app
from gajim.common.i18n import _
from gajim.gtk.util import get_builder

View File

@ -15,10 +15,13 @@
from gi.repository import Gtk
from gi.repository import Gdk
from gajim import gui_menu_builder
from gajim.common import app
from gajim.common import helpers
from gajim.common.i18n import Q_
from gajim.common.i18n import _
from gajim import gui_menu_builder
from gajim.gtk.dialogs import ErrorDialog
from gajim.gtk.util import get_builder

View File

@ -16,6 +16,8 @@ from gi.repository import Gtk
from gajim.common import app
from gajim.common import helpers
from gajim.common.i18n import _
from gajim.gtk.util import get_builder
from gajim.gtk.util import load_icon

View File

@ -26,6 +26,8 @@ from gi.repository import Gtk, Gdk
from gajim.common import app
from gajim.common.i18n import Q_
from gajim.common.i18n import _
from gajim.gtk.util import get_builder

View File

@ -25,6 +25,7 @@ from gi.repository import GObject
from gajim.common import app
from gajim.common.i18n import _
from gajim.gtk.const import Filter
from gajim.gtk.types import FilterList # pylint: disable=unused-import

View File

@ -29,15 +29,17 @@ from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GLib
from gajim import conversation_textview
from gajim.gtk.dialogs import ErrorDialog
from gajim.gtk import util
from gajim.gtk.util import python_month, gtk_month
from gajim.common import app
from gajim.common import helpers
from gajim.common import exceptions
from gajim.common.i18n import _
from gajim.common.const import ShowConstant, KindConstant
from gajim import conversation_textview
from gajim.gtk import util
from gajim.gtk.util import python_month, gtk_month
from gajim.gtk.dialogs import ErrorDialog
@unique
class InfoColumn(IntEnum):

View File

@ -16,11 +16,14 @@ import logging
from enum import IntEnum
from datetime import datetime, timedelta
from gi.repository import Gtk, GLib
from gi.repository import Gtk
from gi.repository import GLib
from gajim.common import app
from gajim.common import ged
from gajim.common.i18n import _
from gajim.common.const import ArchiveState
from gajim.gtk.util import load_icon
log = logging.getLogger('gajim.gtk.history_sync')

View File

@ -18,8 +18,10 @@ from gi.repository import Gdk
from gajim.common import app
from gajim.common import helpers
from gajim.common.i18n import _
from gajim.common.caps_cache import muc_caps_cache
from gajim.common.exceptions import GajimGeneralException
from gajim.gtk.dialogs import ErrorDialog
from gajim.gtk.util import get_builder

View File

@ -19,6 +19,7 @@ from gi.repository import Gdk
from gajim.common import app
from gajim.common import ged
from gajim.common.i18n import _
from gajim.gtk.util import get_builder
from gajim.gtk.dialogs import HigDialog

View File

@ -16,6 +16,8 @@ from gi.repository import Gtk
from gajim.common import app
from gajim.common import ged
from gajim.common.i18n import _
from gajim.gtk.dialogs import ErrorDialog
from gajim.gtk.dialogs import WarningDialog
from gajim.gtk.util import get_builder

View File

@ -24,13 +24,17 @@ from gajim.common import helpers
from gajim.common import configpaths
from gajim.common import config as c_config
from gajim.common import idle
from gajim.common.i18n import _
from gajim.chat_control_base import ChatControlBase
from gajim.config import ManageProxiesWindow, ManageSoundsWindow
from gajim import message_control
from gajim import cell_renderer_image
from gajim import gtkgui_helpers
from gajim.chat_control_base import ChatControlBase
from gajim.config import ManageProxiesWindow
from gajim.config import ManageSoundsWindow
from gajim.gtk.util import get_builder
from gajim.gtk.dialogs import AspellDictError
from gajim.gtk.themes import Themes

View File

@ -19,6 +19,8 @@ from gi.repository import GObject
from gajim.common import app
from gajim.common import ged
from gajim.common.i18n import _
from gajim.gtk.dialogs import ErrorDialog
from gajim.gtk.util import get_builder

View File

@ -25,14 +25,18 @@ from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GLib
from gajim.common import app
from gajim.common import ged
from gajim.common.i18n import _
from gajim.common.const import AvatarSize
from gajim import gtkgui_helpers
from gajim.gtk.dialogs import ErrorDialog
from gajim.gtk.dialogs import InformationDialog
from gajim.gtk.util import get_builder
from gajim.gtk.filechoosers import AvatarChooserDialog
from gajim.common.const import AvatarSize
from gajim.common import app
from gajim.common import ged
log = logging.getLogger('gajim.profile')

View File

@ -21,6 +21,7 @@ from gi.repository import Gtk
from gajim.common import app
from gajim.common import ged
from gajim.common.i18n import _
log = logging.getLogger('gajim.gtk.serverinfo')

View File

@ -20,6 +20,7 @@ from gi.repository import Gtk
from gajim.common import app
from gajim.common.modules import dataforms
from gajim.common.i18n import _
from gajim.gtk.dataform import DataFormWidget
log = logging.getLogger('gajim.gtk.registration')

View File

@ -18,9 +18,14 @@ from gi.repository import Gdk
from gi.repository import GLib
from gajim.common import app
from gajim.common.modules import dataforms
from gajim.common import helpers
from gajim.common.i18n import _
from gajim.common.modules import dataforms
from gajim.common.connection_handlers_events import MessageOutgoingEvent
from gajim.dataforms_widget import DataFormWidget
from gajim.conversation_textview import ConversationTextview
from gajim.gtk.dialogs import ErrorDialog
from gajim.gtk.dialogs import AspellDictError
from gajim.gtk.util import get_builder
@ -28,9 +33,6 @@ from gajim.gtk.util import get_iconset_name_for
from gajim.gtk.util import get_completion_liststore
from gajim.gtk.util import move_window
from gajim.gtk.util import resize_window
from gajim.dataforms_widget import DataFormWidget
from gajim.conversation_textview import ConversationTextview
if app.is_installed('GSPELL'):
from gi.repository import Gspell

View File

@ -21,6 +21,7 @@ from gi.repository import Pango
from gajim.common import app
from gajim.common import helpers
from gajim.common.i18n import _
from gajim.common.const import AvatarSize
from gajim.gtk.util import get_iconset_name_for

View File

@ -22,8 +22,11 @@ from gi.repository import Gdk
from gajim.common import app
from gajim.common.i18n import _
from gajim.common.const import StyleAttr, DialogButton, ButtonAction
from gajim.common.const import StyleAttr
from gajim.common.const import DialogButton
from gajim.common.const import ButtonAction
from gajim.common.connection_handlers_events import StyleChanged
from gajim.gtk.dialogs import ErrorDialog
from gajim.gtk.dialogs import NewConfirmationDialog
from gajim.gtk.util import get_builder

View File

@ -21,11 +21,17 @@ from gi.repository import GLib
from gajim.common import app
from gajim.common import ged
from gajim.common.const import Option, OptionKind, OptionType, StyleAttr
from gajim.gtk.dialogs import ErrorDialog
from gajim.common.i18n import _
from gajim.common.const import Option
from gajim.common.const import OptionKind
from gajim.common.const import OptionType
from gajim.common.const import StyleAttr
from gajim.gtk import util
from gajim.gtk.util import get_builder
from gajim.gtk.util import get_image_button
from gajim.gtk.dialogs import ErrorDialog
from gajim.options_dialog import OptionsDialog

View File

@ -45,6 +45,7 @@ except Exception:
pass
from gajim.common import i18n
from gajim.common.i18n import _
from gajim.common import app
from gajim.common import configpaths
from gajim.common.const import PEPEventType, ACTIVITIES, MOODS

View File

@ -89,6 +89,7 @@ from gajim.common import socks5
from gajim.common import helpers
from gajim.common import passwords
from gajim.common import logging_helpers
from gajim.common.i18n import _
from gajim.common.connection_handlers_events import (
OurShowEvent, FileRequestErrorEvent, FileTransferCompletedEvent,
UpdateRosterAvatarEvent, UpdateGCAvatarEvent, UpdateRoomAvatarEvent)

View File

@ -24,6 +24,7 @@ from gajim.gtkgui_helpers import get_action
from gajim.common import app
from gajim.common import helpers
from gajim.common.i18n import ngettext
from gajim.common.i18n import _
def build_resources_submenu(contacts, account, action, room_jid=None,

View File

@ -33,6 +33,7 @@ from gi.repository import GLib
from gajim import common
from gajim.common import app
from gajim.common.i18n import Q_
from gajim.common.i18n import _
from gajim import gtkgui_helpers
from gajim import message_control

View File

@ -36,6 +36,7 @@ from gajim import gtkgui_helpers
from gajim.common import app
from gajim.common import helpers
from gajim.common import ged
from gajim.common.i18n import _
log = logging.getLogger('gajim.notify')

View File

@ -1,6 +1,7 @@
from gi.repository import Gtk, GLib, Gdk, GObject
from gajim.common import app
from gajim.common import passwords
from gajim.common.i18n import _
from gajim import gtkgui_helpers
from gajim.common.const import OptionKind, OptionType
from gajim.common.exceptions import GajimGeneralException

View File

@ -36,6 +36,7 @@ from gajim.common import app
from gajim.common import nec
from gajim.common import configpaths
from gajim.common import modules
from gajim.common.i18n import _
from gajim.common.exceptions import PluginsystemError
from gajim.plugins.helpers import log, log_calls, Singleton

View File

@ -59,6 +59,7 @@ from gajim.common import helpers
from gajim.common import idle
from gajim.common.exceptions import GajimGeneralException
from gajim.common import i18n
from gajim.common.i18n import _
from gajim.common.const import PEPEventType, AvatarSize, StyleAttr
if app.is_installed('GEOCLUE'):
from gajim.common import location_listener

View File

@ -20,8 +20,9 @@ from gi.repository import Gtk
from gi.repository import Gdk
from gajim.common import app
from gajim.common.modules import dataforms
from gajim.common import ged
from gajim.common.modules import dataforms
from gajim.common.i18n import _
from gajim import gtkgui_helpers
from gajim import vcard

View File

@ -29,6 +29,7 @@ from gajim import tooltips
from gajim import gtkgui_helpers
from gajim.common import app
from gajim.common import helpers
from gajim.common.i18n import _
from gajim.gtk.single_message import SingleMessageWindow

View File

@ -39,6 +39,7 @@ from gajim.common.const import AvatarSize
from gajim.common import app
from gajim.common import helpers
from gajim.common.i18n import Q_
from gajim.common.i18n import _
log = logging.getLogger('gajim.tooltips')

View File

@ -39,6 +39,7 @@ from gajim.common import app
from gajim.common import ged
from gajim.common import configpaths
from gajim.common.i18n import Q_
from gajim.common.i18n import _
from gajim.common.const import AvatarSize
# log = logging.getLogger('gajim.vcard')