def __init__(self, block_editor, block): Gtk.ScrolledWindow.__init__(self) self.block_editor = block_editor self.block = block for widget in self.get_children(): self.remove(widget) hbox = Gtk.HBox() vbox2 = Gtk.VBox() self.add(hbox) self.tree_view = TreeView(_("Properties"), self.__on_props_row_activated) self.__populate_property() vbox2.pack_start(self.tree_view, True, True, 1) # Button bar button_bar = ButtonBar() button_bar.add_button({"icone":Gtk.STOCK_NEW, "action": self.__new, "data":None}) button_bar.add_button({"icone":Gtk.STOCK_DELETE, "action": self.__delete, "data":None}) button_bar.add_button({"icone":Gtk.STOCK_GO_UP, "action": self.__up, "data":None}) button_bar.add_button({"icone":Gtk.STOCK_GO_DOWN, "action": self.__down, "data":None}) vbox2.pack_start(button_bar, False, False, 1) hbox.pack_start(vbox2, True, True, 2) vbox = Gtk.VBox() hbox.pack_start(vbox, True, True, 2) self.side_panel = Gtk.VBox() vbox.pack_start(self.side_panel, True, True, 1) self.set_shadow_type(Gtk.ShadowType.IN) self.show_all()
class TestButtonBar(TestBase): def setUp(self): self.buttonbar = ButtonBar() def test_add_button(self): self.buttonbar.add_button({ "icone": Gtk.STOCK_NEW, "action": self.test_add_button, "data": None })
def __init__(self, block): Gtk.ScrolledWindow.__init__(self) self.block = block vbox = Gtk.VBox() self.add(vbox) # Code Parts content_pane = Gtk.HBox() vbox.pack_start(content_pane, True, True, 1) self.tree_view = TreeView(_("Code Parts"), self.__on_row_activated) content_pane.pack_start(self.tree_view, True, True, 1) button_bar = ButtonBar() button_bar.add_button({ "icone": Gtk.STOCK_NEW, "action": self.__new, "data": None }) button_bar.add_button({ "icone": Gtk.STOCK_DELETE, "action": self.__delete, "data": None }) vbox.pack_start(button_bar, False, False, 1) self.codes = self.block.codes self.__populate_list() self.side_panel = Gtk.VBox() content_pane.pack_start(self.side_panel, True, True, 1) self.show_all()
def __init__(self, main_window): Gtk.Dialog.__init__(self, _("Code Template Manager"), main_window, 0, ()) self.main_window = main_window self.set_default_size(400, 300) box = self.get_content_area() vbox = Gtk.VBox() box.pack_start(vbox, True, True, 0) # CodeTemplate List sw = Gtk.ScrolledWindow() self.tree_store = Gtk.TreeStore(str) self.tree_view = Gtk.TreeView(self.tree_store) col = Gtk.TreeViewColumn(_("Available Code Templates")) self.tree_view.append_column(col) self.tree_view.connect("row-activated", self.__on_row_activated) cellrenderertext = Gtk.CellRendererText() col.pack_end(cellrenderertext, True) col.add_attribute(cellrenderertext, "text", 0) sw.add(self.tree_view) vbox.pack_start(sw, True, True, 0) # Button bar button_bar = ButtonBar() button_bar.add_button({ "icone": Gtk.STOCK_NEW, "action": self.__new, "data": None }) button_bar.add_button({ "icone": Gtk.STOCK_EDIT, "action": self.__edit, "data": None }) button_bar.add_button({ "icone": Gtk.STOCK_DELETE, "action": self.__delete, "data": None }) vbox.pack_start(button_bar, False, False, 0) self.__update() self.show_all() self.show()
def __init__(self, main_window, title): Gtk.Dialog.__init__( self, title=_(title), transient_for=main_window) self.main_window = main_window self.set_default_size(400, 300) box = self.get_content_area() vbox = Gtk.VBox() box.pack_start(vbox, True, True, 0) # Port List sw = Gtk.ScrolledWindow() self.tree_store = Gtk.TreeStore(str) self.tree_view = Gtk.TreeView.new_with_model(self.tree_store) col = Gtk.TreeViewColumn(_("Available items")) self.tree_view.append_column(col) self.tree_view.connect("row-activated", self.__on_row_activated) cellrenderertext = Gtk.CellRendererText() col.pack_end(cellrenderertext, True) col.add_attribute(cellrenderertext, "text", 0) sw.add(self.tree_view) vbox.pack_start(sw, True, True, 0) # Button bar button_bar = ButtonBar() button_bar.add_button({ "icone":Gtk.STOCK_NEW, "action": self.__new, "data":None }) button_bar.add_button({ "icone":Gtk.STOCK_EDIT, "action": self.__edit, "data":None }) button_bar.add_button({ "icone":Gtk.STOCK_DELETE, "action": self.__delete, "data":None }) vbox.pack_start(button_bar, False, False, 0) self.element = None self.get_items = None
def __init__(self, main_window): Gtk.Dialog.__init__(self, title=_("Block Manager"), transient_for=main_window) self.main_window = main_window self.main_control = self self.set_default_size(400, 300) box = self.get_content_area() vbox = Gtk.VBox() box.pack_start(vbox, True, True, 0) # Block List self.block_notebook = BlockNotebook(self) self.update() vbox.pack_start(self.block_notebook, True, True, 0) # Button bar button_bar = ButtonBar() button_bar.add_button({ "icone": Gtk.STOCK_NEW, "action": self.__new, "data": None }) button_bar.add_button({ "icone": Gtk.STOCK_EDIT, "action": self.__edit, "data": None }) button_bar.add_button({ "icone": Gtk.STOCK_DELETE, "action": self.__delete, "data": None }) vbox.pack_start(button_bar, False, False, 0) self.show_all() self.show()
def setUp(self): self.buttonbar = ButtonBar()