Rename ToolbarBox.top to ToolbarBox.bar
This commit is contained in:
parent
b69d875201
commit
7ca9574ca1
@ -15,24 +15,24 @@ box.pack_start(toolbar, False)
|
|||||||
tollbarbutton_1 = ToolbarButton(
|
tollbarbutton_1 = ToolbarButton(
|
||||||
page=gtk.Button('sub-widget #1'),
|
page=gtk.Button('sub-widget #1'),
|
||||||
icon_name='computer-xo')
|
icon_name='computer-xo')
|
||||||
toolbar.top.insert(tollbarbutton_1, -1)
|
toolbar.bar.insert(tollbarbutton_1, -1)
|
||||||
|
|
||||||
tollbarbutton_2 = ToolbarButton(
|
tollbarbutton_2 = ToolbarButton(
|
||||||
page=gtk.Button('sub-widget #2'),
|
page=gtk.Button('sub-widget #2'),
|
||||||
icon_name='button_cancel',
|
icon_name='button_cancel',
|
||||||
tooltip='with custom palette instead of sub-widget')
|
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):
|
def del_cb(widget):
|
||||||
toolbar.top.remove(tollbarbutton_3)
|
toolbar.bar.remove(tollbarbutton_3)
|
||||||
del_b = gtk.Button('delete sub-widget #3')
|
del_b = gtk.Button('delete sub-widget #3')
|
||||||
del_b.connect('clicked', del_cb)
|
del_b.connect('clicked', del_cb)
|
||||||
tollbarbutton_3 = ToolbarButton(
|
tollbarbutton_3 = ToolbarButton(
|
||||||
page=del_b,
|
page=del_b,
|
||||||
icon_name='activity-journal')
|
icon_name='activity-journal')
|
||||||
toolbar.top.insert(tollbarbutton_3, -1)
|
toolbar.bar.insert(tollbarbutton_3, -1)
|
||||||
|
|
||||||
subbar = gtk.Toolbar()
|
subbar = gtk.Toolbar()
|
||||||
subbutton = ToolButton(
|
subbutton = ToolButton(
|
||||||
@ -44,7 +44,7 @@ subbar.show_all()
|
|||||||
tollbarbutton_4 = ToolbarButton(
|
tollbarbutton_4 = ToolbarButton(
|
||||||
page=subbar,
|
page=subbar,
|
||||||
icon_name='document-save')
|
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]
|
print [i.props.page for i in toolbar.subs]
|
||||||
|
|
||||||
|
@ -113,10 +113,10 @@ class ToolbarBox(gtk.VBox):
|
|||||||
def __init__(self, padding=style.TOOLBOX_HORIZONTAL_PADDING):
|
def __init__(self, padding=style.TOOLBOX_HORIZONTAL_PADDING):
|
||||||
gtk.VBox.__init__(self)
|
gtk.VBox.__init__(self)
|
||||||
|
|
||||||
self.__top = gtk.Toolbar()
|
self.__bar = gtk.Toolbar()
|
||||||
self.__top.owner = self
|
self.__bar.owner = self
|
||||||
|
|
||||||
top_widget = _align(gtk.EventBox, self.__top)
|
top_widget = _align(gtk.EventBox, self.__bar)
|
||||||
self.pack_start(top_widget)
|
self.pack_start(top_widget)
|
||||||
|
|
||||||
self.props.padding = padding
|
self.props.padding = padding
|
||||||
@ -128,23 +128,23 @@ class ToolbarBox(gtk.VBox):
|
|||||||
self.__notebook.set_show_tabs(False)
|
self.__notebook.set_show_tabs(False)
|
||||||
self.__notebook.show()
|
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):
|
def get_padding(self):
|
||||||
return self.__top.parent.props.left_padding
|
return self.bar.parent.props.left_padding
|
||||||
|
|
||||||
def set_padding(self, pad):
|
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,
|
padding = gobject.property(type=object,
|
||||||
getter=get_padding, setter=set_padding)
|
getter=get_padding, setter=set_padding)
|
||||||
|
|
||||||
def get_subs(self):
|
def get_subs(self):
|
||||||
out = []
|
out = []
|
||||||
for i in range(self.top.get_n_items()):
|
for i in range(self.bar.get_n_items()):
|
||||||
page = self.top.get_nth_item(i)
|
page = self.bar.get_nth_item(i)
|
||||||
if isinstance(page, ToolbarButton):
|
if isinstance(page, ToolbarButton):
|
||||||
out.append(page)
|
out.append(page)
|
||||||
return out
|
return out
|
||||||
@ -154,8 +154,8 @@ class ToolbarBox(gtk.VBox):
|
|||||||
def modify_bg(self, state, color):
|
def modify_bg(self, state, color):
|
||||||
if state == gtk.STATE_NORMAL:
|
if state == gtk.STATE_NORMAL:
|
||||||
self._bg = color
|
self._bg = color
|
||||||
self.__top.parent.parent.modify_bg(state, color)
|
self.bar.parent.parent.modify_bg(state, color)
|
||||||
self.__top.modify_bg(state, color)
|
self.bar.modify_bg(state, color)
|
||||||
|
|
||||||
def __remove_cb(self, sender, widget):
|
def __remove_cb(self, sender, widget):
|
||||||
if not isinstance(widget, ToolbarButton):
|
if not isinstance(widget, ToolbarButton):
|
||||||
@ -304,7 +304,7 @@ class _Palette(gtk.Window):
|
|||||||
self.add(page)
|
self.add(page)
|
||||||
|
|
||||||
x, y = toolbar.window.get_origin()
|
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())
|
self.set_transient_for(self._invoker.get_toplevel())
|
||||||
|
|
||||||
if not immediate:
|
if not immediate:
|
||||||
|
Loading…
Reference in New Issue
Block a user