diff options
author | mathieui <mathieui@mathieui.net> | 2011-11-06 21:10:09 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2011-11-06 21:10:09 +0100 |
commit | c3c67b5e0afec8b322b8f08aa76b8e35c24bc23b (patch) | |
tree | fdc82387aafafb2220411ebd631ef10844499b0a | |
parent | 0315b05f5122f1f4697699fc09de1b0860203177 (diff) | |
download | poezio-c3c67b5e0afec8b322b8f08aa76b8e35c24bc23b.tar.gz poezio-c3c67b5e0afec8b322b8f08aa76b8e35c24bc23b.tar.bz2 poezio-c3c67b5e0afec8b322b8f08aa76b8e35c24bc23b.tar.xz poezio-c3c67b5e0afec8b322b8f08aa76b8e35c24bc23b.zip |
Code cleanup (unused import, variables, undefined names, etc…)
-rw-r--r-- | src/common.py | 1 | ||||
-rw-r--r-- | src/connection.py | 1 | ||||
-rw-r--r-- | src/core.py | 6 | ||||
-rw-r--r-- | src/keyboard.py | 2 | ||||
-rw-r--r-- | src/logger.py | 1 | ||||
-rw-r--r-- | src/multiuserchat.py | 2 | ||||
-rw-r--r-- | src/roster.py | 2 | ||||
-rw-r--r-- | src/tabs.py | 9 | ||||
-rw-r--r-- | src/user.py | 5 | ||||
-rw-r--r-- | src/windows.py | 11 |
10 files changed, 10 insertions, 30 deletions
diff --git a/src/common.py b/src/common.py index 11a09b93..7e1c0642 100644 --- a/src/common.py +++ b/src/common.py @@ -15,7 +15,6 @@ import os import mimetypes import hashlib import subprocess -import curses import time import shlex diff --git a/src/connection.py b/src/connection.py index 7246ae1e..f407dfe9 100644 --- a/src/connection.py +++ b/src/connection.py @@ -15,7 +15,6 @@ log = logging.getLogger(__name__) from gettext import (bindtextdomain, textdomain, bind_textdomain_codeset, gettext as _) -import sys import getpass import sleekxmpp diff --git a/src/core.py b/src/core.py index dd320022..30935330 100644 --- a/src/core.py +++ b/src/core.py @@ -8,7 +8,6 @@ from gettext import gettext as _ import os -import re import sys import time import curses @@ -39,8 +38,7 @@ import timed_events from data_forms import DataFormsTab from config import config, options from logger import logger -from user import User -from roster import Roster, RosterGroup, roster +from roster import roster from contact import Contact, Resource from text_buffer import TextBuffer from keyboard import read_char @@ -1237,7 +1235,6 @@ class Core(object): the_input.auto_completion(items, '') else: # we are writing the server: complete the server - serv = jid.server serv_list = [] for tab in self.tabs: if isinstance(tab, tabs.MucTab): @@ -1246,7 +1243,6 @@ class Core(object): return True def completion_list(self, the_input): - txt = the_input.get_text() muc_serv_list = [] for tab in self.tabs: # TODO, also from an history if isinstance(tab, tabs.MucTab) and\ diff --git a/src/keyboard.py b/src/keyboard.py index 99173f40..c8f4b60c 100644 --- a/src/keyboard.py +++ b/src/keyboard.py @@ -12,8 +12,6 @@ of the time ONE char, but may be longer if it's a keyboard shortcut, like ^A, M-a or KEY_RESIZE) """ -import time - def get_next_byte(s): """ Read the next byte of the utf-8 char diff --git a/src/logger.py b/src/logger.py index e8a29a3f..bd24eb3b 100644 --- a/src/logger.py +++ b/src/logger.py @@ -5,7 +5,6 @@ # Poezio is free software: you can redistribute it and/or modify # it under the terms of the zlib license. See the COPYING file. -import sys from os import environ, makedirs import os from datetime import datetime diff --git a/src/multiuserchat.py b/src/multiuserchat.py index ac910837..0527c1ed 100644 --- a/src/multiuserchat.py +++ b/src/multiuserchat.py @@ -11,8 +11,6 @@ Add some facilities that are not available on the XEP_0045 sleek plugin """ -import sleekxmpp - from xml.etree import cElementTree as ET import logging diff --git a/src/roster.py b/src/roster.py index 4ef2da1b..df84d4d8 100644 --- a/src/roster.py +++ b/src/roster.py @@ -14,7 +14,7 @@ log = logging.getLogger(__name__) from config import config from os import path as p -from contact import Contact, Resource +from contact import Contact from sleekxmpp.xmlstream.stanzabase import JID class Roster(object): diff --git a/src/tabs.py b/src/tabs.py index afc93a9d..71063007 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -24,7 +24,6 @@ from gettext import gettext as _ import windows import curses import difflib -import text_buffer import string import common import core @@ -40,7 +39,7 @@ from theming import get_theme from sleekxmpp.xmlstream.stanzabase import JID from config import config from roster import RosterGroup, roster -from contact import Contact, Resource +from contact import Contact from text_buffer import TextBuffer from user import User from os import getenv, path @@ -565,9 +564,9 @@ class MucTab(ChatTab): """ args = arg.split() if len(args): - msg = ' '.join(args) + arg = ' '.join(args) else: - msg = None + arg = None if self.joined: muc.leave_groupchat(self.core.xmpp, self.name, self.own_nick, arg) self.add_message(_("\x195}You left the chatroom\x193}")) @@ -932,7 +931,7 @@ class MucTab(ChatTab): self.add_message('\x194}%(spec)s \x19%(color)d}%(nick)s\x195} joined the room' % {'nick':from_nick, 'color':color, 'spec':get_theme().CHAR_JOIN}) else: self.add_message('\x194}%(spec)s \x19%(color)d}%(nick)s \x195}(\x194}%(jid)s\x195}) joined the room' % {'spec':get_theme().CHAR_JOIN, 'nick':from_nick, 'color':color, 'jid':jid.full}) - self.core.on_user_rejoined_private_conversation(room.name, from_nick) + self.core.on_user_rejoined_private_conversation(self.name, from_nick) def on_user_nick_change(self, presence, user, from_nick, from_room): new_nick = presence.find('{%s}x/{%s}item' % (NS_MUC_USER, NS_MUC_USER)).attrib['nick'] diff --git a/src/user.py b/src/user.py index 5867e1f3..0d29569f 100644 --- a/src/user.py +++ b/src/user.py @@ -10,10 +10,7 @@ Define the user class. An user is a MUC participant, not a roster contact (see contact.py) """ -import curses - -from random import randrange, choice -from config import config +from random import choice from datetime import timedelta, datetime from theming import get_theme diff --git a/src/windows.py b/src/windows.py index 790dd858..612f78ec 100644 --- a/src/windows.py +++ b/src/windows.py @@ -14,26 +14,23 @@ A Tab (see tab.py) is composed of multiple Windows from gettext import (bindtextdomain, textdomain, bind_textdomain_codeset, gettext as _) -from os.path import isfile import logging log = logging.getLogger(__name__) -import shlex import curses import string from config import config from threading import RLock -from contact import Contact, Resource -from roster import RosterGroup, roster +from contact import Contact +from roster import RosterGroup from poopt import cut_text from sleekxmpp.xmlstream.stanzabase import JID import core -import common import wcwidth import singleton import collections @@ -1471,11 +1468,9 @@ class RosterWin(Win): if not resource: # There's no online resource presence = 'unavailable' - folder = ' ' nb = '' else: presence = resource.get_presence() - folder = '[+]' if contact._folded else '[-]' nb = ' (%s)' % (contact.get_nb_resources(),) color = RosterWin.color_show[presence] if contact.get_name(): @@ -1519,11 +1514,11 @@ class ContactInfoWin(Win): """ draw the contact information """ + resource = contact.get_highest_priority_resource() if contact: jid = contact.get_bare_jid() else: jid = jid or resource.get_jid().full - resource = contact.get_highest_priority_resource() if resource: presence = resource.get_presence() else: |