From a14d62716fdd1e9475dff0f6df6d62978e16e384 Mon Sep 17 00:00:00 2001 From: Aleksey Lim Date: Wed, 29 Apr 2009 01:39:19 +0000 Subject: Move port/toolcombobox.py's functionality to port/combobox.py --- diff --git a/Speak.activity/activity.py b/Speak.activity/activity.py index f35dc4e..5abd9a0 100644 --- a/Speak.activity/activity.py +++ b/Speak.activity/activity.py @@ -32,7 +32,7 @@ import cjson from gettext import gettext as _ from sugar.graphics.toolbutton import ToolButton -from port.toolcombobox import ToolComboBox +from port.combobox import ToolComboBox from port.combobox import ComboBox from port.activity import SharedActivity diff --git a/Speak.activity/bot/aiml/Kernel.py b/Speak.activity/bot/aiml/Kernel.py index ead8c08..413f26d 100644 --- a/Speak.activity/bot/aiml/Kernel.py +++ b/Speak.activity/bot/aiml/Kernel.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# -*- coding: latin-1 -*- """This file contains the public interface to the aiml module.""" import AimlParser import DefaultSubs diff --git a/Speak.activity/brain.py b/Speak.activity/brain.py index cc969cd..4be6f98 100644 --- a/Speak.activity/brain.py +++ b/Speak.activity/brain.py @@ -24,7 +24,7 @@ from gettext import gettext as _ import logging logger = logging.getLogger('speak') -from port.toolcombobox import ToolComboBox +from port.combobox import ToolComboBox import bot.aiml import voice diff --git a/Speak.activity/port/combobox.py b/Speak.activity/port/combobox.py index bb1a65a..c68efc0 100644 --- a/Speak.activity/port/combobox.py +++ b/Speak.activity/port/combobox.py @@ -22,6 +22,8 @@ STABLE. import gobject import gtk +from sugar.graphics import style + class ComboBox(gtk.ComboBox): def __init__(self): gtk.ComboBox.__init__(self) @@ -177,3 +179,40 @@ class ComboBox(gtk.ComboBox): if silent_cb: self.connect('changed', silent_cb) break + +class ToolComboBox(gtk.ToolItem): + __gproperties__ = { + 'label-text' : (str, None, None, None, + gobject.PARAM_WRITABLE), + } + + def __init__(self, combo=None, **kwargs): + self.label = None + self._label_text = '' + + gobject.GObject.__init__(self, **kwargs) + + self.set_border_width(style.DEFAULT_PADDING) + + hbox = gtk.HBox(False, style.DEFAULT_SPACING) + + self.label = gtk.Label(self._label_text) + hbox.pack_start(self.label, False) + self.label.show() + + if combo: + self.combo = combo + else: + self.combo = ComboBox() + + hbox.pack_start(self.combo) + self.combo.show() + + self.add(hbox) + hbox.show() + + def do_set_property(self, pspec, value): + if pspec.name == 'label-text': + self._label_text = value + if self.label: + self.label.set_text(self._label_text) diff --git a/Speak.activity/port/toolcombobox.py b/Speak.activity/port/toolcombobox.py deleted file mode 100644 index b198ecc..0000000 --- a/Speak.activity/port/toolcombobox.py +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright (C) 2007, Red Hat, Inc. -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the -# Free Software Foundation, Inc., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. - -""" -STABLE. -""" - -import gtk -import gobject - -from sugar.graphics import style -from port.combobox import ComboBox - -class ToolComboBox(gtk.ToolItem): - __gproperties__ = { - 'label-text' : (str, None, None, None, - gobject.PARAM_WRITABLE), - } - - def __init__(self, combo=None, **kwargs): - self.label = None - self._label_text = '' - - gobject.GObject.__init__(self, **kwargs) - - self.set_border_width(style.DEFAULT_PADDING) - - hbox = gtk.HBox(False, style.DEFAULT_SPACING) - - self.label = gtk.Label(self._label_text) - hbox.pack_start(self.label, False) - self.label.show() - - if combo: - self.combo = combo - else: - self.combo = ComboBox() - - hbox.pack_start(self.combo) - self.combo.show() - - self.add(hbox) - hbox.show() - - def do_set_property(self, pspec, value): - if pspec.name == 'label-text': - self._label_text = value - if self.label: - self.label.set_text(self._label_text) -- cgit v0.9.1