summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--poezio/core/core.py3
-rw-r--r--poezio/poezio.py4
-rw-r--r--poezio/singleton.py20
-rw-r--r--poezio/tabs/basetabs.py1
4 files changed, 2 insertions, 26 deletions
diff --git a/poezio/core/core.py b/poezio/core/core.py
index c6d83ad5..0918be86 100644
--- a/poezio/core/core.py
+++ b/poezio/core/core.py
@@ -37,7 +37,6 @@ from poezio.fifo import Fifo
from poezio.logger import logger
from poezio.plugin_manager import PluginManager
from poezio.roster import roster
-from poezio.singleton import Singleton
from poezio.size_manager import SizeManager
from poezio.text_buffer import TextBuffer
from poezio.theming import get_theme
@@ -69,7 +68,7 @@ class Core(object):
self.status = Status(show=status,
message=config.get('status_message'))
self.running = True
- self.xmpp = Singleton(connection.Connection)
+ self.xmpp = connection.Connection()
self.xmpp.core = self
self.keyboard = keyboard.Keyboard()
roster.set_node(self.xmpp.client_roster)
diff --git a/poezio/poezio.py b/poezio/poezio.py
index f136785e..55c1afea 100644
--- a/poezio/poezio.py
+++ b/poezio/poezio.py
@@ -17,8 +17,6 @@ import logging
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
-from poezio.singleton import Singleton
-
def test_curses():
"""
Check if the system ncurses linked with python has unicode capabilities.
@@ -77,7 +75,7 @@ def main():
log = logging.getLogger('')
signal.signal(signal.SIGINT, signal.SIG_IGN) # ignore ctrl-c
- cocore = Singleton(core.Core)
+ cocore = core.Core()
signal.signal(signal.SIGUSR1, cocore.sigusr_handler) # reload the config
signal.signal(signal.SIGHUP, cocore.exit_from_signal)
signal.signal(signal.SIGTERM, cocore.exit_from_signal)
diff --git a/poezio/singleton.py b/poezio/singleton.py
deleted file mode 100644
index 7f12796b..00000000
--- a/poezio/singleton.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright 2010-2011 Florent Le Coz <louiz@louiz.org>
-#
-# This file is part of Poezio.
-#
-# Poezio is free software: you can redistribute it and/or modify
-# it under the terms of the zlib license. See the COPYING file.
-
-"""
-Defines a Singleton function that initialize an object
-of the given class if it was never instantiated yet. Else, returns
-the previously instantiated object.
-This method is the only one that I can come up with that do not call
-__init__() each time.
-"""
-
-_instances = {}
-def Singleton(cls, *args, **kwargs):
- if not cls in _instances:
- _instances[cls] = cls(*args, **kwargs)
- return _instances[cls]
diff --git a/poezio/tabs/basetabs.py b/poezio/tabs/basetabs.py
index ad467c9a..b54cd542 100644
--- a/poezio/tabs/basetabs.py
+++ b/poezio/tabs/basetabs.py
@@ -30,7 +30,6 @@ from poezio.common import safeJID
from poezio.config import config
from poezio.decorators import refresh_wrapper
from poezio.logger import logger
-from poezio.singleton import Singleton
from poezio.text_buffer import TextBuffer
from poezio.theming import get_theme, dump_tuple
from poezio.decorators import command_args_parser