update message_box_size plugin to py3

This commit is contained in:
Yann Leboulanger
2013-01-29 17:17:21 +01:00
parent a6ac97838c
commit d6715ad6c8
3 changed files with 11 additions and 11 deletions

View File

@@ -1 +1 @@
from msg_box_size import MsgBoxSizePlugin from .msg_box_size import MsgBoxSizePlugin

View File

@@ -1,8 +1,8 @@
[info] [info]
name: Message Box Size name: Message Box Size
short_name: message_box_size short_name: message_box_size
version: 0.2.2 version: 0.3
description: Allows you to adjust the height of the new message input field. description: Allows you to adjust the height of the new message input field.
authors: Denis Fomin <fominde@gmail.com> authors: Denis Fomin <fominde@gmail.com>
homepage: http://trac-plugins.gajim.org/wiki/MessageBoxSizePlugin homepage: http://trac-plugins.gajim.org/wiki/MessageBoxSizePlugin
max_gajim_version: 0.15.9 min_gajim_version: 0.15.10

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import gtk from gi.repository import Gtk
from common import gajim from common import gajim
from plugins import GajimPlugin from plugins import GajimPlugin
@@ -15,8 +15,8 @@ class MsgBoxSizePlugin(GajimPlugin):
' of the new message input field.') ' of the new message input field.')
self.config_dialog = MsgBoxSizePluginConfigDialog(self) self.config_dialog = MsgBoxSizePluginConfigDialog(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 = {'Do_not_resize': (False, ''), self.config_default_values = {'Do_not_resize': (False, ''),
'Minimum_lines': (2, ''),} 'Minimum_lines': (2, ''),}
self.chat_control = None self.chat_control = None
@@ -44,7 +44,7 @@ class Base(object):
chat_control.msg_textview.set_property('height-request', min_size) chat_control.msg_textview.set_property('height-request', min_size)
# plugin.config['Minimum_lines']) # plugin.config['Minimum_lines'])
self.id_ = chat_control.msg_textview.connect('size-request', self.id_ = chat_control.msg_textview.connect('size-allocate',
self.size_request) self.size_request)
chat_control.handlers[self.id_] = chat_control.msg_textview chat_control.handlers[self.id_] = chat_control.msg_textview
self.chat_control = chat_control self.chat_control = chat_control
@@ -57,7 +57,7 @@ class Base(object):
if self.plugin.config['Do_not_resize']: if self.plugin.config['Do_not_resize']:
self.chat_control.msg_scrolledwindow.set_property( self.chat_control.msg_scrolledwindow.set_property(
'vscrollbar-policy', gtk.POLICY_AUTOMATIC) 'vscrollbar-policy', Gtk.PolicyType.AUTOMATIC)
elif requisition.height > min_size: elif requisition.height > min_size:
msg_textview.set_property('height-request', requisition.height) msg_textview.set_property('height-request', requisition.height)
else: else:
@@ -77,14 +77,14 @@ class MsgBoxSizePluginConfigDialog(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(
'config_dialog.ui') 'config_dialog.ui')
self.xml = gtk.Builder() self.xml = Gtk.Builder()
self.xml.set_translation_domain('gajim_plugins') self.xml.set_translation_domain('gajim_plugins')
self.xml.add_objects_from_file(self.GTK_BUILDER_FILE_PATH, ['vbox1']) self.xml.add_objects_from_file(self.GTK_BUILDER_FILE_PATH, ['vbox1'])
self.checkbutton = self.xml.get_object('checkbutton') self.checkbutton = self.xml.get_object('checkbutton')
self.spinbutton = self.xml.get_object('minimum_lines') self.spinbutton = self.xml.get_object('minimum_lines')
self.spinbutton.get_adjustment().set_all(20, 1, 10, 1, 10, 0) self.spinbutton.get_adjustment().configure(20, 1, 10, 1, 10, 0)
vbox = self.xml.get_object('vbox1') vbox = self.xml.get_object('vbox1')
self.child.pack_start(vbox) self.get_child().pack_start(vbox, False, False, 0)
self.xml.connect_signals(self) self.xml.connect_signals(self)