Rename ToolbarBox.bar to ToolbarBox.toolbar

This commit is contained in:
Aleksey Lim 2009-07-30 16:25:04 +00:00
parent 7ca9574ca1
commit 3dd0ac8432
2 changed files with 19 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.bar.insert(tollbarbutton_1, -1)
toolbar.toolbar.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.bar.insert(tollbarbutton_2, -1)
toolbar.toolbar.insert(tollbarbutton_2, -1)
toolbar.bar.insert(gtk.SeparatorToolItem(), -1)
toolbar.toolbar.insert(gtk.SeparatorToolItem(), -1)
def del_cb(widget):
toolbar.bar.remove(tollbarbutton_3)
toolbar.toolbar.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.bar.insert(tollbarbutton_3, -1)
toolbar.toolbar.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.bar.insert(tollbarbutton_4, -1)
toolbar.toolbar.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.__bar = gtk.Toolbar()
self.__bar.owner = self
self.__toolbar = gtk.Toolbar()
self.__toolbar.owner = self
top_widget = _align(gtk.EventBox, self.__bar)
top_widget = _align(gtk.EventBox, self.__toolbar)
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.__bar.connect('remove', self.__remove_cb)
self.__toolbar.connect('remove', self.__remove_cb)
bar = property(lambda self: self.__bar)
toolbar = property(lambda self: self.__toolbar)
def get_padding(self):
return self.bar.parent.props.left_padding
return self.toolbar.parent.props.left_padding
def set_padding(self, pad):
self.bar.parent.set_padding(0, 0, pad, pad)
self.toolbar.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.bar.get_n_items()):
page = self.bar.get_nth_item(i)
for i in range(self.toolbar.get_n_items()):
page = self.toolbar.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.bar.parent.parent.modify_bg(state, color)
self.bar.modify_bg(state, color)
self.toolbar.parent.parent.modify_bg(state, color)
self.toolbar.modify_bg(state, color)
def __remove_cb(self, sender, widget):
if not isinstance(widget, ToolbarButton):
@ -304,7 +304,8 @@ class _Palette(gtk.Window):
self.add(page)
x, y = toolbar.window.get_origin()
self.move(x + toolbar.allocation.x, y + toolbar.bar.allocation.height)
self.move(x + toolbar.allocation.x,
y + toolbar.toolbar.allocation.height)
self.set_transient_for(self._invoker.get_toplevel())
if not immediate: