def build_extension(self, icon_name, service_path, cp_path, service_title):
        size = Gdk.Screen.width() / 10

        xo_color = get_user_color()
        label = Gtk.Label(service_title)
        icono = Icon(icon_name=icon_name, pixel_size=size, xo_color=xo_color)

        font = Pango.FontDescription("%d" % (size / 4))
        label.modify_font(font)

        remove = CanvasIcon(icon_name='remove-extension', xo_color=xo_color)

        hbox = Gtk.HBox()
        hbox.pack_start(icono, False, False, 5)
        hbox.pack_start(label, False, False, 5)
        hbox.pack_end(remove, False, False, 5)
        hbox.set_size_request(size * 10, -1)

        vbox = Gtk.VBox()
        vbox.pack_start(hbox, False, False, 0)
        vbox.pack_end(Gtk.HSeparator(), False, False, 3)

        remove.connect('button-press-event', self.remove_extension,
            service_path, cp_path, vbox, service_title)

        return vbox
    def __init__(self, data, extension, group, activity):
        Gtk.VBox.__init__(self)
        self.activity = activity
        self.md5sum = data[extension][1]
        self.progressbar = Gtk.ProgressBar()

        size = Gdk.Screen.width() / 10

        tmp_dir = os.path.join(self.activity.get_activity_root(), 'tmp')
        fd, self.file_path = tempfile.mkstemp(dir=tmp_dir)
        os.close(fd)

        xo_color = get_user_color()
        icon = CanvasIcon(icon_name=extension, xo_color=xo_color,
            pixel_size=size)
        icon.connect('button-press-event', self.download,
            data[extension][0])
        title = Gtk.Label(extension)
        font = Pango.FontDescription("%d" % (size / 4))
        title.modify_font(font)

        hbox = Gtk.HBox()
        hbox.pack_start(icon, False, False, 5)
        hbox.pack_start(title, False, False, 15)
        hbox.pack_end(self.progressbar, False, False, 5)
        hbox.set_size_request(Gdk.Screen.width(), -1)
        group.add_widget(self.progressbar)

        self.pack_start(hbox, True, True, 0)
        self.pack_end(Gtk.HSeparator(), False, False, 5)
        self.show_all()
Example #3
0
    def __init__(self, model, alerts):
        SectionView.__init__(self)

        self._model = model
        self.restart_alerts = alerts

        services = get_webaccount_services()
        if len(services) == 0:
            label = Gtk.Label()
            label.set_markup(
                '<span size="x-large" weight="bold">' +
                glib.markup_escape_text(
                    _('No web services are installed.\n'
                      'Please visit %s for more details.' %
                      'http://wiki.sugarlabs.org/go/WebServices')) +
                '</span>')
            label.show()
            self.add(label)
            return

        vbox = Gtk.VBox()
        hbox = Gtk.HBox(style.DEFAULT_SPACING)

        self._service_config_box = Gtk.VBox()

        for service in services:
            icon = CanvasIcon(icon_name=service.get_icon_name())
            icon.connect('button_press_event',
                         service.config_service_cb,
                         self._service_config_box)
            icon.show()
            hbox.pack_start(icon, False, False, 0)

        hbox.show()
        vbox.pack_start(hbox, False, False, 0)

        scrolled = Gtk.ScrolledWindow()
        vbox.pack_start(scrolled, True, True, 0)

        self.add(vbox)
        scrolled.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        scrolled.show()

        workspace = Gtk.VBox()
        scrolled.add_with_viewport(workspace)
        workspace.show()

        workspace.add(self._service_config_box)
        workspace.show_all()
        vbox.show()
Example #4
0
    def __init__(self, model, alerts):
        SectionView.__init__(self)

        self._model = model
        self.restart_alerts = alerts

        services = get_webaccount_services()
        if len(services) == 0:
            label = Gtk.Label()
            label.set_markup(
                '<span size="x-large" weight="bold">' +
                GLib.markup_escape_text(
                    _('No web services are installed.\n'
                      'Please visit %s for more details.' %
                      'http://wiki.sugarlabs.org/go/WebServices')) + '</span>')
            label.show()
            self.add(label)
            return

        vbox = Gtk.VBox()
        hbox = Gtk.HBox(style.DEFAULT_SPACING)

        self._service_config_box = Gtk.VBox()

        for service in services:
            icon = CanvasIcon(icon_name=service.get_icon_name())
            icon.connect('button_press_event', service.config_service_cb,
                         self._service_config_box)
            icon.show()
            hbox.pack_start(icon, False, False, 0)

        hbox.show()
        vbox.pack_start(hbox, False, False, 0)

        scrolled = Gtk.ScrolledWindow()
        vbox.pack_start(scrolled, True, True, 0)

        self.add(vbox)
        scrolled.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        scrolled.show()

        workspace = Gtk.VBox()
        scrolled.add_with_viewport(workspace)
        workspace.show()

        workspace.add(self._service_config_box)
        workspace.show_all()
        vbox.show()
    def build_zone(self, icon_name, text, zones=2):
        xo_color = get_user_color()
        width = Gdk.Screen.width() / zones
        icon = CanvasIcon(icon_name=icon_name, xo_color=xo_color,
            pixel_size=width)

        label = Gtk.Label()
        label.set_markup("%s" % text)
        label.modify_font(Pango.FontDescription('15'))
        label.set_justify(2)

        label.modify_fg(Gtk.StateType.NORMAL,
            Gdk.color_parse(get_fill_color()))

        vbox = Gtk.VBox()
        vbox.pack_start(icon, True, True, 0)
        vbox.pack_end(label, False, False, 5)

        box = Gtk.EventBox()
        box.add(vbox)
        #box.modify_bg(Gtk.StateType.NORMAL, Gdk.color_parse('white'))
        icon.connect('button-press-event',
            lambda x, y: self.emit('action', icon_name))
        return box