diff --git a/sugar/chat/ChatToolbar.py b/sugar/chat/ChatToolbar.py index 4fcc54ad..3e33c0c1 100644 --- a/sugar/chat/ChatToolbar.py +++ b/sugar/chat/ChatToolbar.py @@ -8,22 +8,23 @@ import richtext class ChatToolbar(gtk.HBox): def __init__(self, editor): - gtk.HBox.__init__(self) - + gtk.HBox.__init__(self, False, 24) + self._editor = editor self._emt_popup = None -# spring = gtk.Label('') -# self.pack_start(spring, True) -# spring.show() + spring = gtk.Label('') + self.pack_start(spring, True) + spring.show() - toolbar = richtext.RichTextToolbar(editor.get_buffer()) - toolbar.set_show_arrow(False) - - item = gtk.ToolButton() + toolbox = richtext.RichTextToolbox(editor.get_buffer()) + self.pack_start(toolbox, False) + toolbox.show() + + item = gtk.Button() e_hbox = gtk.HBox(False, 6) - + e_image = gtk.Image() e_image.set_from_icon_name('stock_smiley-1', gtk.ICON_SIZE_SMALL_TOOLBAR) e_hbox.pack_start(e_image) @@ -33,10 +34,9 @@ class ChatToolbar(gtk.HBox): e_hbox.pack_start(arrow) arrow.show() - item.set_icon_widget(e_hbox) - item.set_homogeneous(False) + item.set_image(e_hbox) item.connect("clicked", self.__emoticons_button_clicked_cb) - toolbar.insert(item, -1) + toolbox.pack_start(item, False) item.show() # separator = gtk.SeparatorToolItem() @@ -49,17 +49,14 @@ class ChatToolbar(gtk.HBox): # toolbar.insert(item, -1) # item.show() - self.pack_start(toolbar) - toolbar.show() - toolbox = Toolbox() toolbox.connect('color-selected', self._color_selected) self.pack_start(toolbox, False) toolbox.show() -# spring = gtk.Label('') -# self.pack_start(spring, True) -# spring.show() + spring = gtk.Label('') + self.pack_start(spring, True) + spring.show() def _color_selected(self, toolbox, color): self._editor.set_color(color) diff --git a/sugar/chat/richtext.py b/sugar/chat/richtext.py index 5aa44f7c..688b41a3 100644 --- a/sugar/chat/richtext.py +++ b/sugar/chat/richtext.py @@ -149,38 +149,58 @@ class RichTextBuffer(gtk.TextBuffer): pos_end.backward_chars(length) self.apply_tag_by_name(tag, pos, pos_end) -class RichTextToolbar(gtk.Toolbar): +class RichTextToolbox(gtk.HBox): def __init__(self, buf): - gtk.Toolbar.__init__(self) + gtk.HBox.__init__(self, False, 6) self.buf = buf - self.set_style(gtk.TOOLBAR_ICONS) - self._font_size = "normal" self._font_scales = [ "xx-small", "x-small", "small", \ "normal", \ "large", "x-large", "xx-large" ] - item = gtk.ToggleToolButton(gtk.STOCK_BOLD) + image = gtk.Image() + image.set_from_stock(gtk.STOCK_BOLD, gtk.ICON_SIZE_SMALL_TOOLBAR) + + item = gtk.ToggleButton() + item.set_image(image) item.connect("toggled", self.__toggle_style_cb, "bold") - self.insert(item, -1) + self.pack_start(item, False) item.show() - item = gtk.ToggleToolButton(gtk.STOCK_ITALIC) + image.show() + + image = gtk.Image() + image.set_from_stock(gtk.STOCK_ITALIC, gtk.ICON_SIZE_SMALL_TOOLBAR) + + item = gtk.ToggleButton() + item.set_image(image) item.connect("toggled", self.__toggle_style_cb, "italic") - self.insert(item, -1) + self.pack_start(item, False) item.show() - self._font_size_up = gtk.ToolButton(gtk.STOCK_GO_UP) - self._font_size_up.connect("clicked", self.__font_size_up_cb) - self.insert(self._font_size_up, -1) - self._font_size_up.show() + image = gtk.Image() + image.set_from_stock(gtk.STOCK_GO_UP, gtk.ICON_SIZE_SMALL_TOOLBAR) - self._font_size_down = gtk.ToolButton(gtk.STOCK_GO_DOWN) + self._font_size_up = gtk.Button() + self._font_size_up.set_image(image) + self._font_size_up.connect("clicked", self.__font_size_up_cb) + self.pack_start(self._font_size_up, False) + self._font_size_up.show() + + image.show() + + image = gtk.Image() + image.set_from_stock(gtk.STOCK_GO_DOWN, gtk.ICON_SIZE_SMALL_TOOLBAR) + + self._font_size_down = gtk.Button() + self._font_size_down.set_image(image) self._font_size_down.connect("clicked", self.__font_size_down_cb) - self.insert(self._font_size_down, -1) + self.pack_start(self._font_size_down, False) self._font_size_down.show() + + image.show() def _get_font_size_index(self): return self._font_scales.index(self._font_size); diff --git a/sugar/chat/sketchpad/Toolbox.py b/sugar/chat/sketchpad/Toolbox.py index 77ea19c2..9428e421 100644 --- a/sugar/chat/sketchpad/Toolbox.py +++ b/sugar/chat/sketchpad/Toolbox.py @@ -13,7 +13,7 @@ class ColorButton(gtk.RadioButton): self.set_relief(gtk.RELIEF_NONE) drawing_area = gtk.DrawingArea() - drawing_area.set_size_request(16, 16) + drawing_area.set_size_request(24, 24) drawing_area.connect('expose_event', self.expose) self.add(drawing_area) drawing_area.show()