Skip to content
Snippets Groups Projects
Commit 2c68be72 authored by Dicson's avatar Dicson
Browse files

juick.fix typo

Chat State Notifications plugin. init
parent 4b52359b
No related branches found
No related tags found
No related merge requests found
from chatstate import ChatstatePlugin
# -*- coding: utf-8 -*-
##
import gtk
import gobject
import pango
from plugins.gui import GajimPluginConfigDialog
from plugins import GajimPlugin
from plugins.helpers import log_calls, log
from common import ged
from common import gajim
from common import helpers
import gtkgui_helpers
class ChatstatePlugin(GajimPlugin):
@log_calls('ChatstatePlugin')
def init(self):
self.config_dialog = ChatstatePluginConfigDialog(self)
self.events_handlers = {'raw-message-received' :
(ged.POSTCORE, self.raw_pres_received),}
self.config_default_values = {
'active': ('darkblue',''),
'composing': ('darkred', ''),
'inactive': ('#675B5B',''),
'paused': ('darkgreen', ''),}
self.compose = ('active', 'composing', 'gone', 'inactive', 'paused')
def raw_pres_received(self, event_object):
jid = str(event_object.xmpp_msg.getFrom())
account = event_object.account
contact = gajim.contacts.get_contact_from_full_jid(account, jid)
if not contact:
return
for compose in self.compose:
state = event_object.xmpp_msg.getTag(compose)
if state:
break
if not state:
return
self.model = gajim.interface.roster.model
child_iters = gajim.interface.roster._get_contact_iter(
jid.split('/')[0], account, contact, self.model)
for child_iter in child_iters:
name = gobject.markup_escape_text(contact.get_shown_name())
if compose != 'gone':
name = '<span foreground="%s">%s</span>' % (
self.config[compose], name)
if contact.status and gajim.config.get('show_status_msgs_in_roster'):
status = contact.status.strip()
if status != '':
status = helpers.reduce_chars_newlines(status,
max_lines = 1)
color = gtkgui_helpers.get_fade_color(
gajim.interface.roster.tree, False, False)
colorstring = '#%04x%04x%04x' % (color.red, color.green,
color.blue)
name += '\n<span size="small" style="italic" ' \
'foreground="%s">%s</span>' % (colorstring,
gobject.markup_escape_text(status))
self.model[child_iter][1] = name
@log_calls('ChatstatePlugin')
def activate(self):
pass
@log_calls('ChatstatePlugin')
def deactivate(self):
pass
class ChatstatePluginConfigDialog(GajimPluginConfigDialog):
def init(self):
self.GTK_BUILDER_FILE_PATH = self.plugin.local_file_path(
'config_dialog.ui')
self.xml = gtk.Builder()
self.xml.set_translation_domain('gajim')
self.xml.add_objects_from_file(self.GTK_BUILDER_FILE_PATH,
['vbox1'])
vbox1 = self.xml.get_object('vbox1')
self.child.pack_start(vbox1)
self.xml.connect_signals(self)
self.connect('hide', self.on_hide)
def on_run(self):
for name in self.plugin.config_default_values:
widget = self.xml.get_object(name)
widget.set_color(gtk.gdk.color_parse(self.plugin.config[name]))
def changed(self, entry):
name = gtk.Buildable.get_name(entry)
self.plugin.config[name] = entry.get_text()
def on_hide(self, widget):
for name in self.plugin.config_default_values:
widget = self.xml.get_object(name)
self.plugin.config[name] = widget.get_color().to_string()
<?xml version="1.0"?>
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy toplevel-contextual -->
<object class="GtkWindow" id="window1">
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
<object class="GtkHBox" id="hbox3">
<property name="visible">True</property>
<property name="border_width">3</property>
<child>
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">is doing something else</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="inactive">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="color">#000000000000</property>
</object>
<packing>
<property name="expand">False</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox2">
<property name="visible">True</property>
<property name="border_width">3</property>
<child>
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">is composing a message...</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="composing">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="color">#000000000000</property>
</object>
<packing>
<property name="expand">False</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox4">
<property name="visible">True</property>
<property name="border_width">3</property>
<child>
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">paused composing a message</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="paused">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="focus_on_click">False</property>
<property name="xalign">0</property>
<property name="color">#000000000000</property>
</object>
<packing>
<property name="expand">False</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="border_width">3</property>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">is paying attention to the conversation</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="active">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="color">#000000000000</property>
</object>
<packing>
<property name="expand">False</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">3</property>
</packing>
</child>
</object>
</child>
</object>
</interface>
[info]
name: Chatstate in roster
short_name: chatstate
version: 0.1
description: Chat State Notifications in roster.
Font color of the contact varies depending on the chat state.
The plugin does not work if you use custom font color for contacts in roster.
http://trac.gajim.org/ticket/3628.
http://xmpp.org/extensions/xep-0085.html
authors = Denis Fomin <fominde@gmail.com>
homepage = http://trac-plugins.gajim.org/wiki
......@@ -4,6 +4,6 @@ short_name: Juick
version: 0.2
description: Clickable juick links , juick nics, preview juick picturs.
The key combination alt + up in the textbox allow insert the number of last message (comment or topic).
authors: Denis Fomin <fominde@gmail.com>>, evgen <drujebober@gmail.com>
authors: Denis Fomin <fominde@gmail.com>, evgen <drujebober@gmail.com>
homepage: http://trac-plugins.gajim.org/wiki/JuickPlugin
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment