Exemplo n.º 1
0
    def __icon_cell_data_cb(self, celllayout, renderer, model, iter, data):
        model = self.get_model()
        engine = model.get_value(iter, 0)

        if isinstance(engine, str) or isinstance (engine, unicode):
            renderer.set_property("visible", False)
            renderer.set_property("sensitive", False)
        elif isinstance(engine, int):
            if engine == 0:
                renderer.set_property("visible", False)
                renderer.set_property("sensitive", False)
                renderer.set_property("pixbuf", None)
            elif engine < 0:
                if not self.__show_sub_lang:
                    pixbuf = load_icon("go-bottom", Gtk.IconSize.LARGE_TOOLBAR)
                else:
                    pixbuf = load_icon("go-up", Gtk.IconSize.LARGE_TOOLBAR)
                if pixbuf == None:
                    pixbuf = load_icon(Gtk.STOCK_MISSING_IMAGE,
                                       Gtk.IconSize.LARGE_TOOLBAR)
                if pixbuf == None:
                    renderer.set_property("visible", False)
                    renderer.set_property("sensitive", False)
                    return
                renderer.set_property("visible", True)
                renderer.set_property("sensitive", True)
                renderer.set_property("pixbuf", pixbuf)
        else:
            renderer.set_property("visible", True)
            renderer.set_property("sensitive", True)
            pixbuf = load_icon(engine.get_icon(), Gtk.IconSize.LARGE_TOOLBAR)
            renderer.set_property("pixbuf", pixbuf)
Exemplo n.º 2
0
    def __icon_cell_data_cb(self, celllayout, renderer, model, iter, data):
        model = self.get_model()
        engine = model.get_value(iter, 0)

        if isinstance(engine, str):
            renderer.set_property("visible", False)
            renderer.set_property("sensitive", False)
        elif sys.version < '3' and isinstance(engine, unicode):
            renderer.set_property("visible", False)
            renderer.set_property("sensitive", False)
        elif isinstance(engine, int):
            if engine == 0:
                renderer.set_property("visible", False)
                renderer.set_property("sensitive", False)
                renderer.set_property("pixbuf", None)
            elif engine < 0:
                if not self.__show_sub_lang:
                    pixbuf = load_icon("go-bottom", Gtk.IconSize.LARGE_TOOLBAR)
                else:
                    pixbuf = load_icon("go-up", Gtk.IconSize.LARGE_TOOLBAR)
                if pixbuf == None:
                    pixbuf = load_icon("image-missing",
                                       Gtk.IconSize.LARGE_TOOLBAR)
                if pixbuf == None:
                    renderer.set_property("visible", False)
                    renderer.set_property("sensitive", False)
                    return
                renderer.set_property("visible", True)
                renderer.set_property("sensitive", True)
                renderer.set_property("pixbuf", pixbuf)
        else:
            renderer.set_property("visible", True)
            renderer.set_property("sensitive", True)
            pixbuf = load_icon(engine.get_icon(), Gtk.IconSize.LARGE_TOOLBAR)
            renderer.set_property("pixbuf", pixbuf)
Exemplo n.º 3
0
    def __icon_cell_data_cb(self, celllayout, renderer, model, iter):
        engine = self.__model.get_value(iter, 0)

        icon_size = gtk.icon_size_lookup(gtk.ICON_SIZE_LARGE_TOOLBAR)[0]
        pixbuf = load_icon(engine.icon, gtk.ICON_SIZE_LARGE_TOOLBAR)

        if pixbuf == None:
            pixbuf = load_icon("engine-default", gtk.ICON_SIZE_LARGE_TOOLBAR)
        if pixbuf == None:
            pixbuf = load_icon("gtk-missing-image", gtk.ICON_SIZE_LARGE_TOOLBAR)

        renderer.set_property("pixbuf", pixbuf)
Exemplo n.º 4
0
    def __icon_cell_data_cb(self, celllayout, renderer, model, iter):
        engine = self.__model.get_value(iter, 0)

        icon_size = gtk.icon_size_lookup(gtk.ICON_SIZE_LARGE_TOOLBAR)[0]
        pixbuf = load_icon(engine.icon, gtk.ICON_SIZE_LARGE_TOOLBAR)

        if pixbuf == None:
            pixbuf = load_icon("ibus-engine", gtk.ICON_SIZE_LARGE_TOOLBAR)
        if pixbuf == None:
            pixbuf = load_icon("gtk-missing-image", gtk.ICON_SIZE_LARGE_TOOLBAR)

        renderer.set_property("pixbuf", pixbuf)
Exemplo n.º 5
0
    def __icon_cell_data_cb(self, celllayout, renderer, model, it, data):
        engine = self.__model.get_value(it, 0)

        icon_size = Gtk.icon_size_lookup(Gtk.IconSize.LARGE_TOOLBAR)[0]
        pixbuf = load_icon(engine.get_icon(), Gtk.IconSize.LARGE_TOOLBAR)

        if pixbuf == None:
            pixbuf = load_icon("ibus-engine", Gtk.IconSize.LARGE_TOOLBAR)
        if pixbuf == None:
            pixbuf = load_icon(Gtk.STOCK_MISSING_IMAGE,
                               Gtk.IconSize.LARGE_TOOLBAR)

        renderer.set_property("pixbuf", pixbuf)
Exemplo n.º 6
0
    def __icon_cell_data_cb(self, celllayout, renderer, model, it, data):
        engine = self.__model.get_value(it, 0)

        icon_size = Gtk.icon_size_lookup(Gtk.IconSize.LARGE_TOOLBAR)[0]
        pixbuf = load_icon(engine.get_icon(), Gtk.IconSize.LARGE_TOOLBAR)

        if pixbuf == None:
            pixbuf = load_icon("ibus-engine", Gtk.IconSize.LARGE_TOOLBAR)
        if pixbuf == None:
            pixbuf = load_icon(Gtk.STOCK_MISSING_IMAGE,
                               Gtk.IconSize.LARGE_TOOLBAR)

        renderer.set_property("pixbuf", pixbuf)
Exemplo n.º 7
0
    def __padded_label_new(self, text, icon, alignment, direction):
        hbox = Gtk.Box(orientation = Gtk.Orientation.HORIZONTAL)

        if direction == ROW_TRAVEL_DIRECTION_BACKWARD:
            rtl = (Gtk.Widget.get_default_direction() == \
                   Gtk.TextDirection.RTL)
            if rtl:
                arrow = Gtk.Image.new_from_icon_name(
                    'go-previous-rtl-symbolic', Gtk.IconSize.MENU)
            else:
                arrow = Gtk.Image.new_from_icon_name(
                    'go-previous-symbolic', Gtk.IconSize.MENU)
            hbox.pack_start(arrow, False, True, 0)

        if icon != None:
            pixbuf = load_icon(icon, Gtk.IconSize.LARGE_TOOLBAR)
            image = Gtk.Image(pixbuf = pixbuf)
            hbox.pack_start(image, False, True, 0)

        label = Gtk.Label(label = text)
        label.set_halign(alignment)
        label.set_valign(Gtk.Align.CENTER)
        label.set_margin_left(20)
        label.set_margin_right(20)
        label.set_margin_top(6)
        label.set_margin_bottom(6)
        hbox.pack_start(label, True, True, 0)
        return hbox
Exemplo n.º 8
0
    def __padded_label_new(self, text, icon, alignment, direction):
        hbox = Gtk.Box(orientation = Gtk.Orientation.HORIZONTAL)

        if direction == ROW_TRAVEL_DIRECTION_BACKWARD:
            rtl = (Gtk.Widget.get_default_direction() == \
                   Gtk.TextDirection.RTL)
            if rtl:
                arrow = Gtk.Image.new_from_icon_name(
                    'go-previous-rtl-symbolic', Gtk.IconSize.MENU)
            else:
                arrow = Gtk.Image.new_from_icon_name(
                    'go-previous-symbolic', Gtk.IconSize.MENU)
            hbox.pack_start(arrow, False, True, 0)

        if icon != None:
            pixbuf = load_icon(icon, Gtk.IconSize.LARGE_TOOLBAR)
            image = Gtk.Image(pixbuf = pixbuf)
            hbox.pack_start(image, False, True, 0)

        label = Gtk.Label(label = text)
        label.set_halign(alignment)
        label.set_valign(Gtk.Align.CENTER)
        label.set_margin_start(20)
        label.set_margin_end(20)
        label.set_margin_top(6)
        label.set_margin_bottom(6)
        hbox.pack_start(label, True, True, 0)
        return hbox
Exemplo n.º 9
0
    def __icon_cell_data_cb(self, celllayout, renderer, model, iter):
        engine = self.__model.get_value(iter, 0)

        if isinstance(engine, str) or isinstance (engine, unicode):
            renderer.set_property("visible", False)
            renderer.set_property("sensitive", False)
        elif isinstance(engine, int):
            renderer.set_property("visible", False)
            renderer.set_property("sensitive", False)
        else:
            renderer.set_property("visible", True)
            renderer.set_property("sensitive", True)
            pixbuf = load_icon(engine.icon, gtk.ICON_SIZE_LARGE_TOOLBAR)
            if pixbuf == None:
                pixbuf = load_icon("ibus-engine", gtk.ICON_SIZE_LARGE_TOOLBAR)
            if pixbuf == None:
                pixbuf = load_icon("gtk-missing-image", gtk.ICON_SIZE_LARGE_TOOLBAR)
            renderer.set_property("pixbuf", pixbuf)
Exemplo n.º 10
0
    def __icon_cell_data_cb(self, celllayout, renderer, model, iter, data):
        engine = self.__model.get_value(iter, 0)

        if isinstance(engine, str) or isinstance(engine, unicode):
            renderer.set_property("visible", False)
            renderer.set_property("sensitive", False)
        elif isinstance(engine, int):
            renderer.set_property("visible", False)
            renderer.set_property("sensitive", False)
        else:
            renderer.set_property("visible", True)
            renderer.set_property("sensitive", True)
            pixbuf = load_icon(engine.get_icon(), Gtk.IconSize.LARGE_TOOLBAR)
            if pixbuf == None:
                pixbuf = load_icon("ibus-engine", Gtk.IconSize.LARGE_TOOLBAR)
            if pixbuf == None:
                pixbuf = load_icon(Gtk.STOCK_MISSING_IMAGE,
                                   Gtk.IconSize.LARGE_TOOLBAR)
            renderer.set_property("pixbuf", pixbuf)
Exemplo n.º 11
0
    def __icon_cell_data_cb(self, celllayout, renderer, model, iter):
        engine = self.__model.get_value(iter, 0)

        if isinstance(engine, str) or isinstance(engine, unicode):
            renderer.set_property("visible", False)
            renderer.set_property("sensitive", False)
        elif isinstance(engine, int):
            renderer.set_property("visible", False)
            renderer.set_property("sensitive", False)
        else:
            renderer.set_property("visible", True)
            renderer.set_property("sensitive", True)
            pixbuf = load_icon(engine.icon, gtk.ICON_SIZE_LARGE_TOOLBAR)
            if pixbuf == None:
                pixbuf = load_icon("ibus-engine", gtk.ICON_SIZE_LARGE_TOOLBAR)
            if pixbuf == None:
                pixbuf = load_icon("gtk-missing-image",
                                   gtk.ICON_SIZE_LARGE_TOOLBAR)
            renderer.set_property("pixbuf", pixbuf)
Exemplo n.º 12
0
    def __icon_cell_data_cb(self, celllayout, renderer, model, iter, data):
        engine = self.__model.get_value(iter, 0)

        if isinstance(engine, str) or isinstance (engine, unicode):
            renderer.set_property("visible", False)
            renderer.set_property("sensitive", False)
        elif isinstance(engine, int):
            renderer.set_property("visible", False)
            renderer.set_property("sensitive", False)
        else:
            renderer.set_property("visible", True)
            renderer.set_property("sensitive", True)
            pixbuf = load_icon(engine.get_icon(), Gtk.IconSize.LARGE_TOOLBAR)
            if pixbuf == None:
                pixbuf = load_icon("ibus-engine", Gtk.IconSize.LARGE_TOOLBAR)
            if pixbuf == None:
                pixbuf = load_icon(Gtk.STOCK_MISSING_IMAGE,
                        Gtk.IconSize.LARGE_TOOLBAR)
            renderer.set_property("pixbuf", pixbuf)
Exemplo n.º 13
0
    def __icon_cell_data_cb(self, celllayout, renderer, model, it, data):
        engine = self.__model.get_value(it, 0)

        # When append_engine() is called, self.__model.append(None)
        # is called internally and engine == None could happen in
        # a slow system.
        if engine == None:
            return

        icon_size = Gtk.icon_size_lookup(Gtk.IconSize.LARGE_TOOLBAR)[0]
        pixbuf = load_icon(engine.get_icon(), Gtk.IconSize.LARGE_TOOLBAR)
        renderer.set_property("pixbuf", pixbuf)
Exemplo n.º 14
0
    def __icon_cell_data_cb(self, celllayout, renderer, model, it, data):
        engine = self.__model.get_value(it, 0)

        # When append_engine() is called, self.__model.append(None)
        # is called internally and engine == None could happen in
        # a slow system.
        if engine == None:
            return

        icon_size = Gtk.icon_size_lookup(Gtk.IconSize.LARGE_TOOLBAR)[0]
        pixbuf = load_icon(engine.get_icon(), Gtk.IconSize.LARGE_TOOLBAR)
        renderer.set_property("pixbuf", pixbuf)
Exemplo n.º 15
0
    def __icon_cell_data_cb(self, celllayout, renderer, model, iter, data):
        engine = self.__model.get_value(iter, 0)

        if isinstance(engine, str):
            renderer.set_property("visible", False)
            renderer.set_property("sensitive", False)
        elif sys.version < '3' and isinstance(engine, unicode):
            renderer.set_property("visible", False)
            renderer.set_property("sensitive", False)
        elif isinstance(engine, int):
            renderer.set_property("visible", False)
            renderer.set_property("sensitive", False)
        else:
            renderer.set_property("visible", True)
            renderer.set_property("sensitive", True)
            pixbuf = load_icon(engine.get_icon(), Gtk.IconSize.LARGE_TOOLBAR)
            renderer.set_property("pixbuf", pixbuf)
Exemplo n.º 16
0
    def __icon_cell_data_cb(self, celllayout, renderer, model, iter, data):
        engine = self.__model.get_value(iter, 0)

        if isinstance(engine, str):
            renderer.set_property("visible", False)
            renderer.set_property("sensitive", False)
        elif sys.version < '3' and isinstance (engine, unicode):
            renderer.set_property("visible", False)
            renderer.set_property("sensitive", False)
        elif isinstance(engine, int):
            renderer.set_property("visible", False)
            renderer.set_property("sensitive", False)
        else:
            renderer.set_property("visible", True)
            renderer.set_property("sensitive", True)
            pixbuf = load_icon(engine.get_icon(), Gtk.IconSize.LARGE_TOOLBAR)
            renderer.set_property("pixbuf", pixbuf)
Exemplo n.º 17
0
    def __icon_cell_data_cb(self, celllayout, renderer, model, it, data):
        engine = self.__model.get_value(it, 0)

        icon_size = Gtk.icon_size_lookup(Gtk.IconSize.LARGE_TOOLBAR)[0]
        pixbuf = load_icon(engine.get_icon(), Gtk.IconSize.LARGE_TOOLBAR)
        renderer.set_property("pixbuf", pixbuf)
Exemplo n.º 18
0
    def __icon_cell_data_cb(self, celllayout, renderer, model, it, data):
        engine = self.__model.get_value(it, 0)

        icon_size = Gtk.icon_size_lookup(Gtk.IconSize.LARGE_TOOLBAR)[0]
        pixbuf = load_icon(engine.get_icon(), Gtk.IconSize.LARGE_TOOLBAR)
        renderer.set_property("pixbuf", pixbuf)