def __init__(self, parent, width=400): super(LayersWindow, self).__init__(parent, 'Layers') self.setLayout(GridLayout(orientation=Orientation.Vertical)) self.layers_scroll = VScrollPanel(self) self.layers_scroll.setFixedSize((width, 600)) self.layers = LayersList(self.layers_scroll) self.redraw_spec_cb = None right_align = Widget(self) right_align.setLayout(GridLayout()) TOOLS_WIDTH = 130 TOOLS_HEIGHT = 15 spacer = Widget(right_align) spacer.setSize((width - TOOLS_WIDTH, TOOLS_HEIGHT)) tools = Widget(right_align) tools.setLayout(BoxLayout(Orientation.Horizontal, spacing=6)) tools.setFixedSize((TOOLS_WIDTH, TOOLS_HEIGHT)) # ToolButton(tools, entypo.ICON_CONTROLLER_FAST_FORWARD) ToolButton(tools, entypo.ICON_COMPASS) tb = ToolButton(tools, entypo.ICON_ADD_TO_LIST) def cb(): valid = [('mp3', ''), ('wav', '')] file_path = nanogui.file_dialog(valid, False) song = open_song_from_file(file_path) layer = self.layers.add_layer('New Layer') if self.redraw_spec_cb: self.redraw_spec_cb() tb.setCallback(cb) ToolButton(tools, entypo.ICON_TRASH) self.setPosition((960, TOOLS_HEIGHT)) self.setSize((width, 800)) self.setLayout(GridLayout(Orientation.Vertical, resolution=2))