[banner_tweaks] Remove plugin
Most features have become obsolete in Gajim 1.2
This commit is contained in:
@@ -1 +0,0 @@
|
||||
from .plugin import BannerTweaksPlugin
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 16 KiB |
@@ -1,75 +0,0 @@
|
||||
<?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="banner_tweaks_config_vbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="border_width">9</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">4</property>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="show_banner_image_checkbutton">
|
||||
<property name="label" translatable="yes">Display status icon</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="tooltip_text" translatable="yes">If checked, status icon will be displayed in chat window banner.</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="on_show_banner_image_checkbutton_toggled"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="show_banner_online_msg_checkbutton">
|
||||
<property name="label" translatable="yes">Display status message of contact</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="tooltip_text" translatable="yes">If checked, status message of contact will be displayed in chat window banner.</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="on_show_banner_online_msg_checkbutton_toggled"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="show_banner_resource_checkbutton">
|
||||
<property name="label" translatable="yes">Display resource name of contact</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="tooltip_text" translatable="yes">If checked, resource name of contact will be displayed in chat window banner.</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="on_show_banner_resource_checkbutton_toggled"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="banner_small_fonts_checkbutton">
|
||||
<property name="label" translatable="yes">Use small fonts for contact name and resource name</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="tooltip_text" translatable="yes">If checked, smaller font will be used to display resource name and contact name in chat window banner.</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="on_banner_small_fonts_checkbutton_toggled"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
@@ -1,9 +0,0 @@
|
||||
[info]
|
||||
name: Banner Tweaks
|
||||
short_name: banner_tweaks
|
||||
version: 1.3.0
|
||||
description: Allows to tweak chat window banner appearance (e.g. make it compact).
|
||||
authors: Mateusz Biliński <mateusz@bilinski.it>
|
||||
homepage: https://dev.gajim.org/gajim/gajim-plugins/wikis/BannerTweaksPlugin
|
||||
min_gajim_version: 1.2.91
|
||||
max_gajim_version: 1.3.90
|
||||
@@ -1,209 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
## This file is part of Gajim.
|
||||
##
|
||||
## Gajim is free software; you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation; version 3 only.
|
||||
##
|
||||
## Gajim is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
||||
##
|
||||
|
||||
'''
|
||||
Adjustable chat window banner.
|
||||
|
||||
Includes tweaks to make it compact.
|
||||
|
||||
Based on patch by pb in issue #4133:
|
||||
https://dev.gajim.org/uploads/-/system/note/attachment/162938/gajim-chatbanneroptions-svn10008.patch
|
||||
|
||||
:author: Mateusz Biliński <mateusz@bilinski.it>
|
||||
:since: 30 July 2008
|
||||
:copyright: Copyright (2008) Mateusz Biliński <mateusz@bilinski.it>
|
||||
:license: GPL
|
||||
'''
|
||||
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import GObject
|
||||
from gajim import message_control
|
||||
from gajim.common import app
|
||||
from gajim.common import helpers
|
||||
|
||||
from gajim.plugins import GajimPlugin
|
||||
from gajim.plugins.helpers import log_calls
|
||||
from gajim.plugins.gui import GajimPluginConfigDialog
|
||||
from gajim.plugins.plugins_i18n import _
|
||||
|
||||
|
||||
class BannerTweaksPlugin(GajimPlugin):
|
||||
|
||||
@log_calls('BannerTweaksPlugin')
|
||||
def init(self):
|
||||
self.description = _('Allows user to tweak chat window banner '
|
||||
'appearance (eg. make it compact).\n'
|
||||
'Based on patch by pb in issue #4133:\n'
|
||||
'https://dev.gajim.org/gajim/gajim/issues/4133.')
|
||||
self.config_dialog = BannerTweaksPluginConfigDialog(self)
|
||||
|
||||
self.gui_extension_points = {
|
||||
'chat_control_base_draw_banner': (
|
||||
self.chat_control_base_draw_banner_called,
|
||||
self.chat_control_base_draw_banner_deactivation)
|
||||
}
|
||||
|
||||
self.config_default_values = {
|
||||
'show_banner_image': (True, 'If True, Gajim will display a status icon in the banner of chat windows.'),
|
||||
'show_banner_online_msg': (True, 'If True, Gajim will display the status message of the contact in the banner of chat windows.'),
|
||||
'show_banner_resource': (False, 'If True, Gajim will display the resource name of the contact in the banner of chat windows.'),
|
||||
'banner_small_fonts': (False, 'If True, Gajim will use small fonts for contact name and resource name in the banner of chat windows.'),
|
||||
'old_chat_avatar_height': (52, 'chat_avatar_height value before plugin was activated'),
|
||||
}
|
||||
|
||||
@log_calls('BannerTweaksPlugin')
|
||||
def activate(self):
|
||||
self.config['old_chat_avatar_height'] = app.config.get(
|
||||
'chat_avatar_height')
|
||||
#gajim.config.set('chat_avatar_height', 28)
|
||||
|
||||
@log_calls('BannerTweaksPlugin')
|
||||
def deactivate(self):
|
||||
app.config.set('chat_avatar_height', self.config[
|
||||
'old_chat_avatar_height'])
|
||||
|
||||
@log_calls('BannerTweaksPlugin')
|
||||
def chat_control_base_draw_banner_called(self, chat_control):
|
||||
if not self.config['show_banner_online_msg']:
|
||||
chat_control.banner_status_label.hide()
|
||||
chat_control.banner_status_label.set_no_show_all(True)
|
||||
status_text = ''
|
||||
chat_control.banner_status_label.set_markup(status_text)
|
||||
|
||||
if not self.config['show_banner_image']:
|
||||
if chat_control.TYPE_ID == message_control.TYPE_GC:
|
||||
banner_status_img = chat_control.xml.get_object(
|
||||
'gc_banner_status_image')
|
||||
else:
|
||||
banner_status_img = chat_control.xml.get_object(
|
||||
'banner_status_image')
|
||||
banner_status_img.clear()
|
||||
|
||||
# TODO: part below repeats a lot of code from
|
||||
# ChatControl.draw_banner_text()
|
||||
# This could be rewritten using re module: getting markup text from
|
||||
# banner_name_label and replacing some elements based on plugin config.
|
||||
# Would it be faster?
|
||||
if self.config['show_banner_resource'] or self.config[
|
||||
'banner_small_fonts']:
|
||||
banner_name_label = chat_control.xml.get_object('banner_name_label')
|
||||
label_text = banner_name_label.get_label()
|
||||
|
||||
contact = chat_control.contact
|
||||
jid = contact.jid
|
||||
|
||||
name = contact.get_shown_name()
|
||||
if chat_control.resource:
|
||||
name += '/' + chat_control.resource
|
||||
elif contact.resource and self.config['show_banner_resource']:
|
||||
name += '/' + contact.resource
|
||||
|
||||
if chat_control.TYPE_ID == message_control.TYPE_PM:
|
||||
name = _('%(nickname)s from group chat %(room_name)s') % \
|
||||
{'nickname': name, 'room_name': chat_control.room_name}
|
||||
name = GObject.markup_escape_text(name)
|
||||
|
||||
# We know our contacts nick, but if another contact has the same
|
||||
# nick in another account we need to also display the account.
|
||||
# except if we are talking to two different resources of the same
|
||||
# contact
|
||||
acct_info = ''
|
||||
for account in app.contacts.get_accounts():
|
||||
if account == chat_control.account:
|
||||
continue
|
||||
if acct_info: # We already found a contact with same nick
|
||||
break
|
||||
for jid in app.contacts.get_jid_list(account):
|
||||
other_contact_ = \
|
||||
app.contacts.get_first_contact_from_jid(account, jid)
|
||||
if other_contact_.get_shown_name() == \
|
||||
chat_control.contact.get_shown_name():
|
||||
acct_info = ' (%s)' % \
|
||||
GObject.markup_escape_text(chat_control.account)
|
||||
break
|
||||
|
||||
font_attrs, font_attrs_small = chat_control.get_font_attrs()
|
||||
if self.config['banner_small_fonts']:
|
||||
font_attrs = font_attrs_small
|
||||
|
||||
st = app.config.get('displayed_chat_state_notifications')
|
||||
cs = contact.chatstate
|
||||
if cs and st in ('composing_only', 'all'):
|
||||
if contact.show == 'offline':
|
||||
chatstate = ''
|
||||
elif st == 'all' or cs == 'composing':
|
||||
chatstate = helpers.get_uf_chatstate(cs)
|
||||
else:
|
||||
chatstate = ''
|
||||
|
||||
label_text = '<span %s>%s</span><span %s>%s %s</span>' % \
|
||||
(font_attrs, name, font_attrs_small, acct_info, chatstate)
|
||||
else:
|
||||
# weight="heavy" size="x-large"
|
||||
label_text = '<span %s>%s</span><span %s>%s</span>' % \
|
||||
(font_attrs, name, font_attrs_small, acct_info)
|
||||
|
||||
banner_name_label.set_markup(label_text)
|
||||
|
||||
@log_calls('BannerTweaksPlugin')
|
||||
def chat_control_base_draw_banner_deactivation(self, chat_control):
|
||||
pass
|
||||
#chat_control.draw_banner()
|
||||
|
||||
class BannerTweaksPluginConfigDialog(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_plugins')
|
||||
self.xml.add_objects_from_file(self.GTK_BUILDER_FILE_PATH,
|
||||
['banner_tweaks_config_vbox'])
|
||||
self.config_vbox = self.xml.get_object('banner_tweaks_config_vbox')
|
||||
self.get_child().pack_start(self.config_vbox, True, True, 0)
|
||||
|
||||
self.show_banner_image_checkbutton = self.xml.get_object(
|
||||
'show_banner_image_checkbutton')
|
||||
self.show_banner_online_msg_checkbutton = self.xml.get_object(
|
||||
'show_banner_online_msg_checkbutton')
|
||||
self.show_banner_resource_checkbutton = self.xml.get_object(
|
||||
'show_banner_resource_checkbutton')
|
||||
self.banner_small_fonts_checkbutton = self.xml.get_object(
|
||||
'banner_small_fonts_checkbutton')
|
||||
|
||||
self.xml.connect_signals(self)
|
||||
|
||||
def on_run(self):
|
||||
self.show_banner_image_checkbutton.set_active(self.plugin.config[
|
||||
'show_banner_image'])
|
||||
self.show_banner_online_msg_checkbutton.set_active(self.plugin.config[
|
||||
'show_banner_online_msg'])
|
||||
self.show_banner_resource_checkbutton.set_active(self.plugin.config[
|
||||
'show_banner_resource'])
|
||||
self.banner_small_fonts_checkbutton.set_active(self.plugin.config[
|
||||
'banner_small_fonts'])
|
||||
|
||||
def on_show_banner_image_checkbutton_toggled(self, button):
|
||||
self.plugin.config['show_banner_image'] = button.get_active()
|
||||
|
||||
def on_show_banner_online_msg_checkbutton_toggled(self, button):
|
||||
self.plugin.config['show_banner_online_msg'] = button.get_active()
|
||||
|
||||
def on_show_banner_resource_checkbutton_toggled(self, button):
|
||||
self.plugin.config['show_banner_resource'] = button.get_active()
|
||||
|
||||
def on_banner_small_fonts_checkbutton_toggled(self, button):
|
||||
self.plugin.config['banner_small_fonts'] = button.get_active()
|
||||
Reference in New Issue
Block a user