예제 #1
0
    def _createWidgets(self):
        """
        Creates the widget this class is responsible for.
        """
        store = gtk.TreeStore(str)

        for row in self.ROWS:
            self._addRow(store, *row)

        renderer = gtk.CellRendererText()

        column = gtk.TreeViewColumn()
        column.pack_start(renderer, expand=True)
        column.add_attribute(renderer, 'text', 0)

        self._treeView = gtk.TreeView(store)
        self._treeView.append_column(column)
        self._treeView.set_headers_visible(False)
        self._treeView.set_size_request(*listBoxSize)
        self._treeView.expand_all()

        self._treeView.get_selection().select_path((0,))
        self._treeView.get_selection().connect('changed',
            util.WeakMethod(self._selectionChanged))

        self._widget = widgets.createScrolledWindow(self._treeView)
        self._widget.set_shadow_type(gtk.SHADOW_ETCHED_IN)
예제 #2
0
    def _createPanes(self):
        """
        Creates the instance of :class:`gtk.HPaned` that holds the list box and
        the switchable child widgets this dialog can show and the scrolled
        window and associated viewport that contain these widgets, and adds
        their (inital) children.
        """
        # Determine the widget that should intially be shown on the right side.
        # ListBoxHandler starts out with the first row selected.
        # TODO: Check which row is actually selected.
        path, widgetName, labelText = self._listBoxHandler.ROWS[0]
        initialWidget = self._widgetFromName[widgetName]

        self._viewport = gtk.Viewport()
        self._viewport.add(initialWidget)

        self._paned = gtk.HPaned()
        self._paned.pack1(self._listBoxHandler._widget)
        self._paned.pack2(widgets.createScrolledWindow(self._viewport))

        self._mainBox.pack_start(self._paned, expand=True)