def __init__(self, icons, icon_size):
        Gtk.TreeView.__init__(self)

        tr = CellRendererConfigUpdateView(icons, ConfigUpdatesListStore.ICON_SIZE, self.create_pango_layout(""))
        tr.set_pixbuf_width(icon_size)
        tr.set_button_spacing(em(0.3))

        # create buttons and set initial strings
        edit_source = CellButtonRenderer(self, name=ConfigUpdateCellButtonIDs.EDIT)
        edit_source.set_markup_variants({self.VARIANT_EDIT: _("Edit")})
        tr.button_pack_start(edit_source)

        edit_dest = CellButtonRenderer(self, name=ConfigUpdateCellButtonIDs.DIFF)
        edit_dest.set_markup_variants({self.VARIANT_DIFF: _("Difference")})
        tr.button_pack_start(edit_dest)

        merge = CellButtonRenderer(self, name=ConfigUpdateCellButtonIDs.MERGE)
        merge.set_markup_variants({self.VARIANT_MERGE: _("Accept")})
        tr.button_pack_end(merge)

        discard = CellButtonRenderer(self, name=ConfigUpdateCellButtonIDs.DISCARD)
        discard.set_markup_variants({self.VARIANT_DISCARD: _("Discard")})
        tr.button_pack_end(discard)

        GenericTreeView.__init__(self, self._row_activated_callback, self._button_activated_callback, tr)

        column = Gtk.TreeViewColumn("ConfigUpdates", tr, confupdate=self.COL_ROW_DATA)

        column.set_cell_data_func(tr, self._cell_data_func_cb)
        column.set_fixed_width(350)
        column.set_sizing(Gtk.TreeViewColumnSizing.FIXED)
        self.append_column(column)
Exemple #2
0
    def _calc_row_heights(self, tr):
        ypad = StockEms.SMALL
        tr.set_property('xpad', StockEms.MEDIUM)
        tr.set_property('ypad', ypad)

        btn = None
        for btn in tr.get_buttons():
            # recalc button geometry and cache
            btn.configure_geometry(self.create_pango_layout(""))

        if btn is None:
            btn_h = 0
        else:
            btn_h = btn.height

        normal_height = max(32 + 4 * ypad, em(2.5) + 4 * ypad)
        tr.normal_height = normal_height
        medium = StockEms.MEDIUM
        tr.selected_height = tr.normal_height + btn_h + medium
Exemple #3
0
    def _calc_row_heights(self, tr):
        ypad = StockEms.SMALL
        tr.set_property('xpad', StockEms.MEDIUM)
        tr.set_property('ypad', ypad)

        btn = None
        for btn in tr.get_buttons():
            # recalc button geometry and cache
            btn.configure_geometry(self.create_pango_layout(""))

        if btn is None:
            btn_h = 0
        else:
            btn_h = btn.height

        normal_height = max(32 + 4*ypad, em(2.5) + 4*ypad)
        tr.normal_height = normal_height
        medium = StockEms.MEDIUM
        tr.selected_height = tr.normal_height + btn_h + medium
    def __init__(self, icons, icon_size):
        Gtk.TreeView.__init__(self)

        tr = CellRendererConfigUpdateView(icons,
                                          ConfigUpdatesListStore.ICON_SIZE,
                                          self.create_pango_layout(""))
        tr.set_pixbuf_width(icon_size)
        tr.set_button_spacing(em(0.3))

        # create buttons and set initial strings
        edit_source = CellButtonRenderer(self,
                                         name=ConfigUpdateCellButtonIDs.EDIT)
        edit_source.set_markup_variants({self.VARIANT_EDIT: _("Edit")})
        tr.button_pack_start(edit_source)

        edit_dest = CellButtonRenderer(self,
                                       name=ConfigUpdateCellButtonIDs.DIFF)
        edit_dest.set_markup_variants({self.VARIANT_DIFF: _("Difference")})
        tr.button_pack_start(edit_dest)

        merge = CellButtonRenderer(self, name=ConfigUpdateCellButtonIDs.MERGE)
        merge.set_markup_variants({self.VARIANT_MERGE: _("Accept")})
        tr.button_pack_end(merge)

        discard = CellButtonRenderer(self,
                                     name=ConfigUpdateCellButtonIDs.DISCARD)
        discard.set_markup_variants({self.VARIANT_DISCARD: _("Discard")})
        tr.button_pack_end(discard)

        GenericTreeView.__init__(self, self._row_activated_callback,
                                 self._button_activated_callback, tr)

        column = Gtk.TreeViewColumn("ConfigUpdates",
                                    tr,
                                    confupdate=self.COL_ROW_DATA)

        column.set_cell_data_func(tr, self._cell_data_func_cb)
        column.set_fixed_width(350)
        column.set_sizing(Gtk.TreeViewColumnSizing.FIXED)
        self.append_column(column)