Rename ToolbarBox.top to ToolbarBox.bar

This commit is contained in:
Aleksey Lim 2009-07-30 16:20:10 +00:00
parent b69d875201
commit 7ca9574ca1
2 changed files with 18 additions and 18 deletions

View File

@ -15,24 +15,24 @@ box.pack_start(toolbar, False)
tollbarbutton_1 = ToolbarButton(
page=gtk.Button('sub-widget #1'),
icon_name='computer-xo')
toolbar.top.insert(tollbarbutton_1, -1)
toolbar.bar.insert(tollbarbutton_1, -1)
tollbarbutton_2 = ToolbarButton(
page=gtk.Button('sub-widget #2'),
icon_name='button_cancel',
tooltip='with custom palette instead of sub-widget')
toolbar.top.insert(tollbarbutton_2, -1)
toolbar.bar.insert(tollbarbutton_2, -1)
toolbar.top.insert(gtk.SeparatorToolItem(), -1)
toolbar.bar.insert(gtk.SeparatorToolItem(), -1)
def del_cb(widget):
toolbar.top.remove(tollbarbutton_3)
toolbar.bar.remove(tollbarbutton_3)
del_b = gtk.Button('delete sub-widget #3')
del_b.connect('clicked', del_cb)
tollbarbutton_3 = ToolbarButton(
page=del_b,
icon_name='activity-journal')
toolbar.top.insert(tollbarbutton_3, -1)
toolbar.bar.insert(tollbarbutton_3, -1)
subbar = gtk.Toolbar()
subbutton = ToolButton(
@ -44,7 +44,7 @@ subbar.show_all()
tollbarbutton_4 = ToolbarButton(
page=subbar,
icon_name='document-save')
toolbar.top.insert(tollbarbutton_4, -1)
toolbar.bar.insert(tollbarbutton_4, -1)
print [i.props.page for i in toolbar.subs]

View File

@ -113,10 +113,10 @@ class ToolbarBox(gtk.VBox):
def __init__(self, padding=style.TOOLBOX_HORIZONTAL_PADDING):
gtk.VBox.__init__(self)
self.__top = gtk.Toolbar()
self.__top.owner = self
self.__bar = gtk.Toolbar()
self.__bar.owner = self
top_widget = _align(gtk.EventBox, self.__top)
top_widget = _align(gtk.EventBox, self.__bar)
self.pack_start(top_widget)
self.props.padding = padding
@ -128,23 +128,23 @@ class ToolbarBox(gtk.VBox):
self.__notebook.set_show_tabs(False)
self.__notebook.show()
self.__top.connect('remove', self.__remove_cb)
self.__bar.connect('remove', self.__remove_cb)
top = property(lambda self: self.__top)
bar = property(lambda self: self.__bar)
def get_padding(self):
return self.__top.parent.props.left_padding
return self.bar.parent.props.left_padding
def set_padding(self, pad):
self.__top.parent.set_padding(0, 0, pad, pad)
self.bar.parent.set_padding(0, 0, pad, pad)
padding = gobject.property(type=object,
getter=get_padding, setter=set_padding)
def get_subs(self):
out = []
for i in range(self.top.get_n_items()):
page = self.top.get_nth_item(i)
for i in range(self.bar.get_n_items()):
page = self.bar.get_nth_item(i)
if isinstance(page, ToolbarButton):
out.append(page)
return out
@ -154,8 +154,8 @@ class ToolbarBox(gtk.VBox):
def modify_bg(self, state, color):
if state == gtk.STATE_NORMAL:
self._bg = color
self.__top.parent.parent.modify_bg(state, color)
self.__top.modify_bg(state, color)
self.bar.parent.parent.modify_bg(state, color)
self.bar.modify_bg(state, color)
def __remove_cb(self, sender, widget):
if not isinstance(widget, ToolbarButton):
@ -304,7 +304,7 @@ class _Palette(gtk.Window):
self.add(page)
x, y = toolbar.window.get_origin()
self.move(x + toolbar.allocation.x, y + toolbar.top.allocation.height)
self.move(x + toolbar.allocation.x, y + toolbar.bar.allocation.height)
self.set_transient_for(self._invoker.get_toplevel())
if not immediate: