Commit efec098a authored by André's avatar André

Use absolute imports

parent 10f8fe2b
......@@ -29,12 +29,12 @@ from gi.repository import GLib
from gi.repository import Gtk
import nbxmpp
from common import gajim
from common import dataforms
from gajim.common import gajim
from gajim.common import dataforms
import gtkgui_helpers
import dialogs
import dataforms_widget
from gajim import gtkgui_helpers
from gajim import dialogs
from gajim import dataforms_widget
class CommandWindow:
"""
......
......@@ -26,11 +26,11 @@
from enum import IntEnum, unique
from gi.repository import Gtk
import gtkgui_helpers
from gajim import gtkgui_helpers
from gi.repository import GLib
from gi.repository import Pango
from common import gajim
from gajim.common import gajim
@unique
class Column(IntEnum):
......
This diff is collapsed.
......@@ -25,9 +25,9 @@
from gi.repository import Gdk
from gi.repository import GLib
import gtkgui_helpers
from common import helpers
from common import i18n
from gajim import gtkgui_helpers
from gajim.common import helpers
from gajim.common import i18n
class AtomWindow:
window = None
......
......@@ -34,29 +34,29 @@ from gi.repository import Gdk
from gi.repository import GdkPixbuf
from gi.repository import Pango
from gi.repository import GLib
import gtkgui_helpers
import gui_menu_builder
import message_control
import dialogs
from common import logger
from common import gajim
from common import helpers
from common import exceptions
from common import ged
from common import i18n
from common.stanza_session import EncryptedStanzaSession, ArchivingStanzaSession
from common.contacts import GC_Contact
from common.logger import KindConstant
from gajim import gtkgui_helpers
from gajim import gui_menu_builder
from gajim import message_control
from gajim import dialogs
from gajim.common import logger
from gajim.common import gajim
from gajim.common import helpers
from gajim.common import exceptions
from gajim.common import ged
from gajim.common import i18n
from gajim.common.stanza_session import EncryptedStanzaSession, ArchivingStanzaSession
from gajim.common.contacts import GC_Contact
from gajim.common.logger import KindConstant
from nbxmpp.protocol import NS_XHTML, NS_XHTML_IM, NS_FILE, NS_MUC
from nbxmpp.protocol import NS_ESESSION
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 nbxmpp.protocol import NS_CHATSTATES
from common.connection_handlers_events import MessageOutgoingEvent
from common.exceptions import GajimGeneralException
from gajim.common.connection_handlers_events import MessageOutgoingEvent
from gajim.common.exceptions import GajimGeneralException
from command_system.implementation.hosts import ChatCommands
from gajim.command_system.implementation.hosts import ChatCommands
try:
import gtkspell
......@@ -64,7 +64,7 @@ try:
except (ImportError, ValueError):
HAS_GTK_SPELL = False
from chat_control_base import ChatControlBase
from gajim.chat_control_base import ChatControlBase
################################################################################
class ChatControl(ChatControlBase):
......@@ -1033,7 +1033,7 @@ class ChatControl(ChatControlBase):
name = self.get_our_nick()
if not xhtml and not encrypted and \
gajim.config.get('rst_formatting_outgoing_messages'):
from common.rst_xhtml_generator import create_xhtml
from gajim.common.rst_xhtml_generator import create_xhtml
xhtml = create_xhtml(text)
if xhtml:
xhtml = '<body xmlns="%s">%s</body>' % (NS_XHTML, xhtml)
......
......@@ -35,35 +35,35 @@ from gi.repository import Pango
from gi.repository import GObject
from gi.repository import GLib
from gi.repository import Gio
import gtkgui_helpers
from gtkgui_helpers import Color
import message_control
import dialogs
import history_window
import notify
from gajim import gtkgui_helpers
from gajim.gtkgui_helpers import Color
from gajim import message_control
from gajim import dialogs
from gajim import history_window
from gajim import notify
import re
import emoticons
from scrolled_window import ScrolledWindow
from common import events
from common import gajim
from common import helpers
from common import ged
from message_control import MessageControl
from conversation_textview import ConversationTextview
from message_textview import MessageTextView
from common.contacts import GC_Contact
from common.connection_handlers_events import MessageOutgoingEvent
from command_system.implementation.middleware import ChatCommandProcessor
from command_system.implementation.middleware import CommandTools
from gajim import emoticons
from gajim.scrolled_window import ScrolledWindow
from gajim.common import events
from gajim.common import gajim
from gajim.common import helpers
from gajim.common import ged
from gajim.message_control import MessageControl
from gajim.conversation_textview import ConversationTextview
from gajim.message_textview import MessageTextView
from gajim.common.contacts import GC_Contact
from gajim.common.connection_handlers_events import MessageOutgoingEvent
from gajim.command_system.implementation.middleware import ChatCommandProcessor
from gajim.command_system.implementation.middleware import CommandTools
# The members of these modules are not referenced directly anywhere in this
# module, but still they need to be kept around. Importing them automatically
# registers the contained CommandContainers with the command system, thereby
# populating the list of available commands.
import command_system.implementation.standard
import command_system.implementation.execute
from gajim.command_system.implementation import standard
from gajim.command_system.implementation import execute
try:
import gtkspell
......
......@@ -31,7 +31,7 @@ to automatic discovery and dispatching, also features manual control
over the process.
"""
from .tools import remove
from gajim.command_system.tools import remove
COMMANDS = {}
CONTAINERS = {}
......@@ -66,7 +66,7 @@ def traverse_commands(container):
yield attribute
def is_command(attribute):
from .framework import Command
from gajim.command_system.framework import Command
return isinstance(attribute, Command)
def is_root(namespace):
......@@ -115,4 +115,4 @@ class Container(Dispatchable):
def disable(self):
remove_commands(self)
remove_container(self)
\ No newline at end of file
remove_container(self)
......@@ -22,10 +22,10 @@ declarative way.
from types import FunctionType
from inspect import getargspec, getdoc
from .dispatcher import Host, Container
from .dispatcher import get_command, list_commands
from .mapping import parse_arguments, adapt_arguments
from .errors import DefinitionError, CommandError, NoCommandError
from gajim.command_system.dispatcher import Host, Container
from gajim.command_system.dispatcher import get_command, list_commands
from gajim.command_system.mapping import parse_arguments, adapt_arguments
from gajim.command_system.errors import DefinitionError, CommandError, NoCommandError
class CommandHost(metaclass=Host):
"""
......
......@@ -34,8 +34,8 @@ code in here will not be executed and commands defined here will not be
detected.
"""
from ..framework import CommandContainer, command, doc
from .hosts import ChatCommands, PrivateChatCommands, GroupChatCommands
from gajim.command_system.framework import CommandContainer, command, doc
from gajim.command_system.implementation.hosts import ChatCommands, PrivateChatCommands, GroupChatCommands
class CustomCommonCommands(CommandContainer):
"""
......
......@@ -37,8 +37,8 @@ from os.path import expanduser
from gi.repository import GLib
from ..framework import CommandContainer, command, doc
from .hosts import ChatCommands, PrivateChatCommands, GroupChatCommands
from gajim.command_system.framework import CommandContainer, command, doc
from gajim.command_system.implementation.hosts import ChatCommands, PrivateChatCommands, GroupChatCommands
class Execute(CommandContainer):
AUTOMATIC = True
......
......@@ -18,7 +18,7 @@ The module defines a set of command hosts, which are bound to a
different command processors, which are the source of commands.
"""
from ..framework import CommandHost
from gajim.command_system.framework import CommandHost
class ChatCommands(CommandHost):
"""
......
......@@ -34,10 +34,10 @@ don't need to dig up the code itself to write basic commands.
from traceback import print_exc
from gi.repository import Pango
from common import gajim
from gajim.common import gajim
from ..framework import CommandProcessor
from ..errors import CommandError, NoCommandError
from gajim.command_system.framework import CommandProcessor
from gajim.command_system.errors import CommandError, NoCommandError
class ChatCommandProcessor(CommandProcessor):
"""
......
......@@ -20,17 +20,17 @@ Provides an actual implementation for the standard commands.
from time import localtime, strftime
from datetime import date
import dialogs
from common import gajim
from common import helpers
from common.exceptions import GajimGeneralException
from common.logger import KindConstant
from gajim import dialogs
from gajim.common import gajim
from gajim.common import helpers
from gajim.common.exceptions import GajimGeneralException
from gajim.common.logger import KindConstant
from ..errors import CommandError
from ..framework import CommandContainer, command, doc
from ..mapping import generate_usage
from gajim.command_system.errors import CommandError
from gajim.command_system.framework import CommandContainer, command, doc
from gajim.command_system.mapping import generate_usage
from .hosts import ChatCommands, PrivateChatCommands, GroupChatCommands
from gajim.command_system.implementation.hosts import ChatCommands, PrivateChatCommands, GroupChatCommands
class StandardCommonCommands(CommandContainer):
"""
......
......@@ -25,7 +25,7 @@ according to the command properties.
import re
from operator import itemgetter
from .errors import DefinitionError, CommandError
from gajim.command_system.errors import DefinitionError, CommandError
# Quite complex piece of regular expression logic to parse options and
# arguments. Might need some tweaking along the way.
......
......@@ -9,7 +9,7 @@ try:
raise ImportError
from pyasn1.type import univ, constraint, char, namedtype, tag
from pyasn1.codec.der.decoder import decode
from common.helpers import prep, InvalidFormat
from gajim.common.helpers import prep, InvalidFormat
MAX = 64
oid_xmppaddr = '1.3.6.1.5.5.7.8.5'
......
......@@ -27,8 +27,8 @@ import os
import shutil
import sys
from common import gajim
from common import logger
from gajim.common import gajim
from gajim.common import logger
# DO NOT MOVE ABOVE OF import gajim
import sqlite3 as sqlite
......@@ -179,7 +179,7 @@ def check_and_possibly_move_config():
vars['MY_ICONSETS_PATH'] = gajim.MY_ICONSETS_PATH
vars['MY_MOOD_ICONSETS_PATH'] = gajim.MY_MOOD_ICONSETS_PATH
vars['MY_ACTIVITY_ICONSETS_PATH'] = gajim.MY_ACTIVITY_ICONSETS_PATH
from common import configpaths
from gajim.common import configpaths
MY_DATA = configpaths.gajimpaths['MY_DATA']
MY_CONFIG = configpaths.gajimpaths['MY_CONFIG']
MY_CACHE = configpaths.gajimpaths['MY_CACHE']
......@@ -264,7 +264,7 @@ def check_and_possibly_create_paths():
VCARD_PATH = gajim.VCARD_PATH
AVATAR_PATH = gajim.AVATAR_PATH
from common import configpaths
from gajim.common import configpaths
MY_DATA = configpaths.gajimpaths['MY_DATA']
MY_CONFIG = configpaths.gajimpaths['MY_CONFIG']
MY_CACHE = configpaths.gajimpaths['MY_CACHE']
......
......@@ -23,10 +23,10 @@
##
import nbxmpp
from common import helpers
from common import dataforms
from common import gajim
from common.connection_handlers_events import MessageOutgoingEvent
from gajim.common import helpers
from gajim.common import dataforms
from gajim.common import gajim
from gajim.common.connection_handlers_events import MessageOutgoingEvent
import logging
log = logging.getLogger('gajim.c.commands')
......
......@@ -33,7 +33,7 @@
import re
from common import defs
from gajim.common import defs
from gi.repository import GLib
from enum import IntEnum, unique
......@@ -795,7 +795,7 @@ class Config:
self.__options[1][opt] = self.__options[0][opt][Option.VAL]
def _really_save(self):
from common import gajim
from gajim.common import gajim
if gajim.interface:
gajim.interface.save_config()
self.save_timeout_id = None
......
......@@ -25,7 +25,7 @@
import os
import sys
import tempfile
from common import defs
from gajim.common import defs
from enum import Enum, unique
@unique
......
......@@ -54,15 +54,16 @@ if os.name != 'nt':
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
import nbxmpp
from common import helpers
from common import gajim
from common import gpg
from common import passwords
from common import exceptions
from common import check_X509
from common.connection_handlers import *
from gajim import common
from gajim.common import helpers
from gajim.common import gajim
from gajim.common import gpg
from gajim.common import passwords
from gajim.common import exceptions
from gajim.common import check_X509
from gajim.common.connection_handlers import *
from gtkgui_helpers import get_action
from gajim.gtkgui_helpers import get_action
if gajim.HAVE_PYOPENSSL:
import OpenSSL.crypto
......@@ -289,7 +290,7 @@ class CommonConnection:
if obj.message and not obj.xhtml and gajim.config.get(
'rst_formatting_outgoing_messages'):
from common.rst_xhtml_generator import create_xhtml
from gajim.common.rst_xhtml_generator import create_xhtml
obj.xhtml = create_xhtml(obj.message)
if not obj.message and obj.chatstate is None and obj.form_node is None:
return
......@@ -2613,7 +2614,7 @@ class Connection(CommonConnection, ConnectionHandlers):
return
if not obj.xhtml and gajim.config.get('rst_formatting_outgoing_messages'):
from common.rst_xhtml_generator import create_xhtml
from gajim.common.rst_xhtml_generator import create_xhtml
obj.xhtml = create_xhtml(obj.message)
msg_iq = nbxmpp.Message(obj.jid, obj.message, typ='groupchat',
......
......@@ -39,27 +39,27 @@ from time import (altzone, daylight, gmtime, localtime, strftime,
from gi.repository import GLib
import nbxmpp
from common import caps_cache as capscache
from common.pep import LOCATION_DATA
from common import helpers
from common import gajim
from common import exceptions
from common import dataforms
from common import jingle_xtls
from common.commands import ConnectionCommands
from common.pubsub import ConnectionPubSub
from common.protocol.caps import ConnectionCaps
from common.protocol.bytestream import ConnectionSocks5Bytestream
from common.protocol.bytestream import ConnectionIBBytestream
from common.message_archiving import ConnectionArchive313
from common.connection_handlers_events import *
from common import ged
from common import nec
from common.nec import NetworkEvent
from common.jingle import ConnectionJingle
from gajim.common import caps_cache as capscache
from gajim.common.pep import LOCATION_DATA
from gajim.common import helpers
from gajim.common import gajim
from gajim.common import exceptions
from gajim.common import dataforms
from gajim.common import jingle_xtls
from gajim.common.commands import ConnectionCommands
from gajim.common.pubsub import ConnectionPubSub
from gajim.common.protocol.caps import ConnectionCaps
from gajim.common.protocol.bytestream import ConnectionSocks5Bytestream
from gajim.common.protocol.bytestream import ConnectionIBBytestream
from gajim.common.message_archiving import ConnectionArchive313
from gajim.common.connection_handlers_events import *
from gajim.common import ged
from gajim.common import nec
from gajim.common.nec import NetworkEvent
from gajim.common.jingle import ConnectionJingle
import logging
log = logging.getLogger('gajim.c.connection_handlers')
......@@ -77,7 +77,7 @@ PEP_CONFIG = 'pep_config'
HAS_IDLE = True
try:
# import idle
import common.sleepy
from gajim.common import sleepy
except Exception:
log.debug(_('Unable to load idle module'))
HAS_IDLE = False
......
......@@ -32,19 +32,19 @@ from time import time as time_time
import nbxmpp
from nbxmpp.protocol import NS_CHATSTATES
from common import atom
from common import nec
from common import helpers
from common import gajim
from common import i18n
from common import dataforms
from common import exceptions
from common.zeroconf.zeroconf import Constant
from common.logger import LOG_DB_PATH, KindConstant
from common.pep import SUPPORTED_PERSONAL_USER_EVENTS
from common.jingle_transport import JingleTransportSocks5
from common.file_props import FilesProp
from common.nec import NetworkEvent
from gajim.common import atom
from gajim.common import nec
from gajim.common import helpers
from gajim.common import gajim
from gajim.common import i18n
from gajim.common import dataforms
from gajim.common import exceptions
from gajim.common.zeroconf.zeroconf import Constant
from gajim.common.logger import LOG_DB_PATH, KindConstant
from gajim.common.pep import SUPPORTED_PERSONAL_USER_EVENTS
from gajim.common.jingle_transport import JingleTransportSocks5
from gajim.common.file_props import FilesProp
from gajim.common.nec import NetworkEvent
if gajim.HAVE_PYOPENSSL:
import OpenSSL.crypto
......@@ -1831,7 +1831,7 @@ class NewAccountConnectedEvent(nec.NetworkIncomingEvent):
self.errnum = 0 # we don't have an errnum
self.ssl_msg = ''
if self.errnum > 0:
from common.connection import ssl_error
from gajim.common.connection import ssl_error
self.ssl_msg = ssl_error.get(self.errnum,
_('Unknown SSL error: %d') % self.errnum)
self.ssl_cert = ''
......
......@@ -31,9 +31,9 @@
from functools import cmp_to_key
try:
from common import caps_cache
from common.account import Account
import common.gajim
from gajim.common import caps_cache
from gajim.common.account import Account
from gajim import common
except ImportError as e:
if __name__ != "__main__":
raise ImportError(str(e))
......
......@@ -27,7 +27,7 @@ information how to use them, read documentation
"""
import nbxmpp
from common import helpers
from gajim.common import helpers
# exceptions used in this module
# base class
......
......@@ -26,8 +26,8 @@
import os
from common import gajim
from common import exceptions
from gajim.common import gajim
from gajim.common import exceptions
_GAJIM_ERROR_IFACE = 'org.gajim.dbus.Error'
......
......@@ -28,7 +28,7 @@ import sys
import os.path
docdir = '../'
basedir = '../'
basedir = './'
localedir = '../po'
version = '0.16.10.5'
......
......@@ -34,9 +34,9 @@ import gi
import uuid
from distutils.version import LooseVersion as V
from common import config
from gajim.common import config
import nbxmpp
from common import ged as ged_module
from gajim.common import ged as ged_module
interface = None # The actual interface (the gtk one for the moment)
thread_interface = None # Interface to run a thread and then a callback
......@@ -54,7 +54,7 @@ log = logging.getLogger('gajim')
logger = None
from common import configpaths
from gajim.common import configpaths
gajimpaths = configpaths.gajimpaths
VCARD_PATH = gajimpaths['VCARD']
......@@ -86,8 +86,8 @@ else:
os_info = None # used to cache os information
from common.contacts import LegacyContactsAPI
from common.events import Events
from gajim.common.contacts import LegacyContactsAPI
from gajim.common.events import Events
gmail_domains = ['gmail.com', 'googlemail.com']
......
......@@ -24,8 +24,8 @@
import os
import logging
from common import gajim
from common.gajim import HAVE_GPG, GPG_BINARY
from gajim.common import gajim
from gajim.common.gajim import HAVE_GPG, GPG_BINARY
if HAVE_GPG:
import gnupg
......
......@@ -40,7 +40,7 @@ import select
import base64
import hashlib
import shlex
from common import caps_cache
from gajim.common import caps_cache
import socket
import time
from datetime import datetime, timedelta, timezone, tzinfo
......@@ -50,8 +50,8 @@ from string import Template
import nbxmpp
from common.i18n import Q_
from common.i18n import ngettext
from gajim.common.i18n import Q_
from gajim.common.i18n import ngettext
try:
import precis_i18n.codec
......@@ -750,7 +750,7 @@ def parse_datetime(timestring, check_utc=False, convert='utc', epoch=False):
return date_time
return None
from common import gajim
from gajim.common import gajim
if gajim.HAVE_PYCURL:
import pycurl
from io import StringIO
......
......@@ -24,7 +24,7 @@
import locale
import gettext
import os
from common import defs
from gajim.common import defs
import unicodedata
# May be changed after GTK is imported
......
......@@ -31,14 +31,14 @@ Handles the jingle signalling protocol
import logging
import nbxmpp
from common import helpers
from common import gajim
from gajim.common import helpers
from gajim.common import gajim
from common.jingle_session import JingleSession, JingleStates
from common.jingle_ft import JingleFileTransfer
from common.jingle_transport import JingleTransportSocks5, JingleTransportIBB
from gajim.common.jingle_session import JingleSession, JingleStates
from gajim.common.jingle_ft import JingleFileTransfer
from gajim.common.jingle_transport import JingleTransportSocks5, JingleTransportIBB
if gajim.HAVE_FARSTREAM:
from common.jingle_rtp import JingleAudio, JingleVideo
from gajim.common.jingle_rtp import JingleAudio, JingleVideo
logger = logging.getLogger('gajim.c.jingle')
......
......@@ -18,10 +18,10 @@ Handles Jingle contents (XEP 0166)
"""
import os
from common import gajim
from gajim.common import gajim
import nbxmpp
from .jingle_xtls import SELF_SIGNED_CERTIFICATE
from .jingle_xtls import load_cert_file
from gajim.common.jingle_xtls import SELF_SIGNED_CERTIFICATE
from gajim.common.jingle_xtls import load_cert_file
contents = {}
......
......@@ -25,14 +25,14 @@ import os
import threading
from enum import IntEnum, unique
import nbxmpp
from common import gajim