Python gi.repository.GObject.TYPE_INT Examples

The following are 3 code examples of gi.repository.GObject.TYPE_INT(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module gi.repository.GObject , or try the search function .
Example #1
Source File: action_renderer.py    From alienfx with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, treeview, max_colour_val):
        Gtk.CellRenderer.__init__(self)
        prop = GObject.Value()
        prop.init(GObject.TYPE_INT)
        treeview.style_get_property("horizontal-separator", prop)
        self.cell_padding = old_div(prop.get_int(),2)
        treeview.style_get_property("grid-line-width", prop)
        self.cell_padding += prop.get_int()
        self.selected_action = None
        self.max_colour_val = max_colour_val 
Example #2
Source File: uistuff.py    From pychess with GNU General Public License v3.0 5 votes vote down vote up
def appendAutowrapColumn(treeview, name, **kvargs):
    cell = Gtk.CellRendererText()
    # cell.props.wrap_mode = Pango.WrapMode.WORD
    # TODO:
    # changed to ellipsize instead until "never ending grow" bug gets fixed
    # see https://github.com/pychess/pychess/issues/1054
    cell.props.ellipsize = Pango.EllipsizeMode.END
    column = Gtk.TreeViewColumn(name, cell, **kvargs)
    treeview.append_column(column)

    def callback(treeview, allocation, column, cell):
        otherColumns = [c for c in treeview.get_columns() if c != column]
        newWidth = allocation.width - sum(c.get_width() for c in otherColumns)

        hsep = GObject.Value()
        hsep.init(GObject.TYPE_INT)
        hsep.set_int(0)
        treeview.style_get_property("horizontal-separator", hsep)
        newWidth -= hsep.get_int() * (len(otherColumns) + 1) * 2
        if cell.props.wrap_width == newWidth or newWidth <= 0:
            return
        cell.props.wrap_width = newWidth
        store = treeview.get_model()
        store_iter = store.get_iter_first()
        while store_iter and store.iter_is_valid(store_iter):
            store.row_changed(store.get_path(store_iter), store_iter)
            store_iter = store.iter_next(store_iter)
        treeview.set_size_request(0, -1)
    # treeview.connect_after("size-allocate", callback, column, cell)

    scroll = treeview.get_parent()
    if isinstance(scroll, Gtk.ScrolledWindow):
        scroll.set_policy(Gtk.PolicyType.NEVER, scroll.get_policy()[1])

    return cell 
Example #3
Source File: IconWindow.py    From bcloud with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, app):
        super().__init__()
        self.parent = parent
        self.app = app

        # pixbuf, name, path, tooltip, size, humansize,
        # isdir, mtime, human mtime, type, pcs_file
        self.liststore = Gtk.ListStore(GdkPixbuf.Pixbuf, str, str, str,
                                       GObject.TYPE_INT64, str,
                                       GObject.TYPE_INT, GObject.TYPE_INT64,
                                       str, str, str)
        self.init_ui()