coding style

This commit is contained in:
Denis Fomin
2010-12-06 17:37:14 +03:00
parent 1e9d3b284b
commit 4fcf603aae
8 changed files with 96 additions and 83 deletions

View File

@@ -23,7 +23,6 @@ class ChatstatePlugin(GajimPlugin):
self.chatstates = ('active', 'composing', 'gone', 'inactive', 'paused') self.chatstates = ('active', 'composing', 'gone', 'inactive', 'paused')
self.active = None self.active = None
def raw_pres_received(self, event_object): def raw_pres_received(self, event_object):
if not self.active: if not self.active:
return return
@@ -64,7 +63,8 @@ class ChatstatePlugin(GajimPlugin):
name = '<span foreground="%s">%s</span>' % ( name = '<span foreground="%s">%s</span>' % (
color, name) color, name)
if contact.status and gajim.config.get('show_status_msgs_in_roster'): if contact.status and gajim.config.get(
'show_status_msgs_in_roster'):
status = contact.status.strip() status = contact.status.strip()
if status != '': if status != '':
status = helpers.reduce_chars_newlines(status, status = helpers.reduce_chars_newlines(status,

View File

@@ -58,7 +58,9 @@ class ClickableNicknames(GajimPlugin):
def disconnect_from_chat_control(self, chat_control): def disconnect_from_chat_control(self, chat_control):
pass pass
class Base(object): class Base(object):
def __init__(self, plugin, chat_control): def __init__(self, plugin, chat_control):
self.plugin = plugin self.plugin = plugin
self.chat_control = chat_control self.chat_control = chat_control

View File

@@ -81,6 +81,7 @@ clients = {
'http://juick.com/caps': 'juick.png', 'http://juick.com/caps': 'juick.png',
} }
class ClientsIconsPlugin(GajimPlugin): class ClientsIconsPlugin(GajimPlugin):
@log_calls('ClientsIconsPlugin') @log_calls('ClientsIconsPlugin')
@@ -94,8 +95,7 @@ class ClientsIconsPlugin(GajimPlugin):
'groupchat_control': (self.connect_with_groupchat_control, 'groupchat_control': (self.connect_with_groupchat_control,
self.disconnect_from_groupchat_control), self.disconnect_from_groupchat_control),
'roster_draw_contact': (self.connect_with_roster_draw_contact, 'roster_draw_contact': (self.connect_with_roster_draw_contact,
self.disconnect_from_roster_draw_contact) self.disconnect_from_roster_draw_contact)}
}
self.config_default_values = { self.config_default_values = {
'show_in_roster': (True, ''), 'show_in_roster': (True, ''),
'show_in_groupchats': (True, ''), 'show_in_groupchats': (True, ''),
@@ -318,6 +318,7 @@ class ClientsIconsPlugin(GajimPlugin):
renderer.set_property('cell-background', None) renderer.set_property('cell-background', None)
renderer.set_property('width', 16) renderer.set_property('width', 16)
class ClientsIconsPluginConfigDialog(GajimPluginConfigDialog): class ClientsIconsPluginConfigDialog(GajimPluginConfigDialog):
def init(self): def init(self):
self.GTK_BUILDER_FILE_PATH = self.plugin.local_file_path( self.GTK_BUILDER_FILE_PATH = self.plugin.local_file_path(

View File

@@ -62,6 +62,7 @@ class FlashingKeyboard(GajimPlugin):
if self.id_0: if self.id_0:
gobject.source_remove(self.id_0) gobject.source_remove(self.id_0)
class FlashingKeyboardPluginConfigDialog(GajimPluginConfigDialog): class FlashingKeyboardPluginConfigDialog(GajimPluginConfigDialog):
def init(self): def init(self):
self.GTK_BUILDER_FILE_PATH = self.plugin.local_file_path( self.GTK_BUILDER_FILE_PATH = self.plugin.local_file_path(

View File

@@ -30,14 +30,14 @@ try:
except: except:
pass pass
class JuickPlugin(GajimPlugin): class JuickPlugin(GajimPlugin):
@log_calls('JuickPlugin') @log_calls('JuickPlugin')
def init(self): def init(self):
self.config_dialog = JuickPluginConfigDialog(self) self.config_dialog = JuickPluginConfigDialog(self)
self.gui_extension_points = { self.gui_extension_points = {
'chat_control_base': (self.connect_with_chat_control, 'chat_control_base': (self.connect_with_chat_control,
self.disconnect_from_chat_control) self.disconnect_from_chat_control)}
}
self.config_default_values = {'SHOW_AVATARS': (False, ''), self.config_default_values = {'SHOW_AVATARS': (False, ''),
'AVATAR_SIZE': (20, _('Avatar size(10-32)')), 'AVATAR_SIZE': (20, _('Avatar size(10-32)')),
'SHOW_PREVIEW': (False, ''), 'SHOW_PREVIEW': (False, ''),
@@ -47,7 +47,8 @@ class JuickPlugin(GajimPlugin):
'ONLY_AUTHOR_AVATAR': (True, ''), 'ONLY_AUTHOR_AVATAR': (True, ''),
'MENUITEM1': ('tune', ''), 'MENUITEM_TEXT1': ('*tune', ''), 'MENUITEM1': ('tune', ''), 'MENUITEM_TEXT1': ('*tune', ''),
'MENUITEM2': ('geo', ''), 'MENUITEM_TEXT2': ('*geo', ''), 'MENUITEM2': ('geo', ''), 'MENUITEM_TEXT2': ('*geo', ''),
'MENUITEM3': ('gajim',''), 'MENUITEM_TEXT3': ('*gajim',''), 'MENUITEM3': ('gajim', ''),
'MENUITEM_TEXT3': ('*gajim', ''),
'MENUITEM4': ('me', ''), 'MENUITEM_TEXT4': ('/me', ''), 'MENUITEM4': ('me', ''), 'MENUITEM_TEXT4': ('/me', ''),
'MENUITEM5': ('', ''), 'MENUITEM_TEXT5': ('', ''), 'MENUITEM5': ('', ''), 'MENUITEM_TEXT5': ('', ''),
'MENUITEM6': ('', ''), 'MENUITEM_TEXT6': ('', ''), 'MENUITEM6': ('', ''), 'MENUITEM_TEXT6': ('', ''),
@@ -171,7 +172,8 @@ class Base(object):
img.set_from_stock('juick', gtk.ICON_SIZE_BUTTON) img.set_from_stock('juick', gtk.ICON_SIZE_BUTTON)
self.button.set_image(img) self.button.set_image(img)
send_button = self.chat_control.xml.get_object('send_button') send_button = self.chat_control.xml.get_object('send_button')
send_button_pos = actions_hbox.child_get_property(send_button, 'position') send_button_pos = actions_hbox.child_get_property(send_button,
'position')
actions_hbox.add_with_properties(self.button, 'position', actions_hbox.add_with_properties(self.button, 'position',
send_button_pos - 1, 'expand', False) send_button_pos - 1, 'expand', False)
id_ = self.button.connect('clicked', self.on_juick_button_clicked) id_ = self.button.connect('clicked', self.on_juick_button_clicked)
@@ -364,7 +366,6 @@ class Base(object):
tag = ttable.lookup(tag_name) tag = ttable.lookup(tag_name)
return buffer_, buffer_.get_end_iter(), tag return buffer_, buffer_.get_end_iter(), tag
def _on_response(self, a, resp, **kwargs): def _on_response(self, a, resp, **kwargs):
# insert avatar to text mark # insert avatar to text mark
mark = kwargs['mark'] mark = kwargs['mark']
@@ -555,6 +556,7 @@ class Base(object):
self.on_insert(widget, self.last_juick_num) self.on_insert(widget, self.last_juick_num)
return True return True
class JuickPluginConfigDialog(GajimPluginConfigDialog): class JuickPluginConfigDialog(GajimPluginConfigDialog):
def init(self): def init(self):
self.GTK_BUILDER_FILE_PATH = self.plugin.local_file_path( self.GTK_BUILDER_FILE_PATH = self.plugin.local_file_path(
@@ -623,6 +625,7 @@ class JuickPluginConfigDialog(GajimPluginConfigDialog):
for control in self.plugin.controls: for control in self.plugin.controls:
control.textview.tagSharpSlash.set_property('foreground', color) control.textview.tagSharpSlash.set_property('foreground', color)
control.textview.tagJuickNick.set_property('foreground', color) control.textview.tagJuickNick.set_property('foreground', color)
def menuitem_changed(self, widget): def menuitem_changed(self, widget):
name = upper(gtk.Buildable.get_name(widget)) name = upper(gtk.Buildable.get_name(widget))
self.plugin.config[name] = widget.get_text() self.plugin.config[name] = widget.get_text()

View File

@@ -14,6 +14,7 @@ from dialogs import ChangeActivityDialog, ChangeMoodDialog
from common import pep from common import pep
import gtkgui_helpers import gtkgui_helpers
class RosterTweaksPlugin(GajimPlugin): class RosterTweaksPlugin(GajimPlugin):
@log_calls('RosterTweaksPlugin') @log_calls('RosterTweaksPlugin')
@@ -45,7 +46,8 @@ class RosterTweaksPlugin(GajimPlugin):
).get_font_description() ).get_font_description()
self.activity_button = self.xml.get_object('activity_button') self.activity_button = self.xml.get_object('activity_button')
self.activity_button.set_property('no-show-all', True) self.activity_button.set_property('no-show-all', True)
self.activity_button.set_property('visible', self.config['quick_status']) self.activity_button.set_property('visible', self.config[
'quick_status'])
self.mood_button = self.xml.get_object('mood_button') self.mood_button = self.xml.get_object('mood_button')
self.mood_button.set_property('no-show-all', True) self.mood_button.set_property('no-show-all', True)
self.mood_button.set_property('visible', self.config['quick_status']) self.mood_button.set_property('visible', self.config['quick_status'])
@@ -148,6 +150,7 @@ class RosterTweaksPlugin(GajimPlugin):
else: else:
img.set_from_stock('gtk-stop', gtk.ICON_SIZE_MENU) img.set_from_stock('gtk-stop', gtk.ICON_SIZE_MENU)
class RosterTweaksPluginConfigDialog(GajimPluginConfigDialog): class RosterTweaksPluginConfigDialog(GajimPluginConfigDialog):
def init(self): def init(self):
self.GTK_BUILDER_FILE_PATH = self.plugin.local_file_path( self.GTK_BUILDER_FILE_PATH = self.plugin.local_file_path(

View File

@@ -22,6 +22,7 @@ try:
except: except:
pass pass
class SetLocationPlugin(GajimPlugin): class SetLocationPlugin(GajimPlugin):
@log_calls('SetLocationPlugin') @log_calls('SetLocationPlugin')
def init(self): def init(self):

View File

@@ -14,7 +14,8 @@ locale_path = os.path.dirname(__file__) + '/locale'
try: try:
gett = gettext.Catalog('WrongLayout', locale_path) gett = gettext.Catalog('WrongLayout', locale_path)
_ = gett.gettext _ = gett.gettext
except: pass except:
pass
class WrongLayoutPlugin(GajimPlugin): class WrongLayoutPlugin(GajimPlugin):
@@ -23,11 +24,11 @@ class WrongLayoutPlugin(GajimPlugin):
self.config_dialog = None self.config_dialog = None
self.gui_extension_points = { self.gui_extension_points = {
'chat_control_base': (self.connect_with_chat_control, 'chat_control_base': (self.connect_with_chat_control,
self.disconnect_from_chat_control) self.disconnect_from_chat_control)}
}
self.chat_control = None self.chat_control = None
self.controls = [] self.controls = []
self.dict_eng = {'`': 'ё', 'q': 'й', 'w': 'ц', 'e': 'у', 'r': 'к', 't': 'е', self.dict_eng = {'`': 'ё', 'q': 'й', 'w': 'ц', 'e': 'у', 'r': 'к',
't': 'е',
'y': 'н', 'u': 'г', 'i': 'ш', 'o': 'щ', 'p': 'з', '[': 'х', 'y': 'н', 'u': 'г', 'i': 'ш', 'o': 'щ', 'p': 'з', '[': 'х',
']': 'ъ', 'a': 'ф', 's': 'ы', 'd': 'в', 'f': 'а', 'g': 'п', ']': 'ъ', 'a': 'ф', 's': 'ы', 'd': 'в', 'f': 'а', 'g': 'п',
'h': 'р', 'j': 'о', 'k': 'л', 'l': 'д', ';': 'ж', '\'': 'э', 'h': 'р', 'j': 'о', 'k': 'л', 'l': 'д', ';': 'ж', '\'': 'э',
@@ -64,6 +65,7 @@ class WrongLayoutPlugin(GajimPlugin):
control.disconnect_from_chat_control() control.disconnect_from_chat_control()
self.controls = [] self.controls = []
class Base(object): class Base(object):
def __init__(self, plugin, chat_control): def __init__(self, plugin, chat_control):
self.plugin = plugin self.plugin = plugin