Beispiel #1
0
 def _on_map_lyrics(self, widget):
     """
         Load on map
         @param widget as Gtk.Viewport
     """
     self._on_child_unmap(widget)
     Lp().settings.set_value('infoswitch',
                             GLib.Variant('s', 'lyrics'))
     self.__jump_button.hide()
     if self.__current_track.id is None:
         self.__current_track = Lp().player.current_track
     # First try to get lyrics from tags
     from lollypop.tagreader import TagReader
     reader = TagReader()
     try:
         info = reader.get_info(self.__current_track.uri)
     except:
         info = None
     lyrics = ""
     if info is not None:
         tags = info.get_tags()
         lyrics = reader.get_lyrics(tags)
     if lyrics or InfoPopover.WebView is None\
             or not get_network_available():
         label = Gtk.Label()
         label.set_vexpand(True)
         label.set_hexpand(True)
         label.set_margin_top(10)
         label.set_margin_end(10)
         label.show()
         widget.add(label)
         if lyrics:
             label.set_label(lyrics)
         elif not get_network_available():
             string = GLib.markup_escape_text(_("Network access disabled"))
             label.get_style_context().add_class('dim-label')
             label.set_markup(
                    "<span font_weight='bold' size='xx-large'>" +
                    string +
                    "</span>")
         else:
             string = GLib.markup_escape_text(
                    _("No lyrics found, please install gir1.2-webkit2-4.0"))
             label.get_style_context().add_class('dim-label')
             label.set_markup(
                    "<span font_weight='bold' size='xx-large'>" +
                    string +
                    "</span>")
     elif get_network_available():
         artists = ", ".join(Lp().player.current_track.artists)
         title = self.__current_track.name
         search = GLib.uri_escape_string(artists + " " + title, None, True)
         url = "http://genius.com/search?q=%s" % search
         # Delayed load due to WebKit memory loading and Gtk animation
         web = self.WebView(True, True)
         web.add_word('search')
         web.add_word('lyrics')
         web.show()
         widget.add(web)
         GLib.timeout_add(250, web.load, url, OpenLink.OPEN)
Beispiel #2
0
    def setup_palette(self):
        activity_name = self._home_activity.get_activity_name()
        if activity_name:
            self.props.primary_text = GLib.markup_escape_text(activity_name)

        title = self._home_activity.get_title()
        if title and title != activity_name:
            self.props.secondary_text = GLib.markup_escape_text(title)

        self.menu_box = PaletteMenuBox()

        menu_item = PaletteMenuItem(_('Resume'), 'activity-start')
        menu_item.connect('activate', self.__resume_activate_cb)
        self.menu_box.append_item(menu_item)

        # TODO: share-with, keep

        menu_item = PaletteMenuItem(_('View Source'), 'view-source')
        menu_item.connect('activate', self.__view_source__cb)
        self.menu_box.append_item(menu_item)

        separator = PaletteMenuItemSeparator()
        self.menu_box.append_item(separator)
        separator.show()

        menu_item = PaletteMenuItem(_('Stop'), 'activity-stop')
        menu_item.connect('activate', self.__stop_activate_cb)
        self.menu_box.append_item(menu_item)

        self.set_content(self.menu_box)
        self.menu_box.show_all()
        def message_data_func (column, cell, model, tree_iter, user_data):

            msg = model.get_value (tree_iter, id_)

            if not highlighters:
                cell.props.text = msg
                return

            if len (highlighters) > 1:
                raise NotImplementedError ("FIXME: Support more than one...")

            highlighter = highlighters.values ()[0]
            row = model[tree_iter]
            ranges = highlighter (row)
            if not ranges:
                cell.props.text = msg
            else:
                tags = []
                prev_end = 0
                end = None
                for start, end in ranges:
                    if prev_end < start:
                        tags.append (GLib.markup_escape_text (msg[prev_end:start]))
                    msg_escape = GLib.markup_escape_text (msg[start:end])
                    tags.append ("<span foreground=\'#FFFFFF\'"
                                 " background=\'#0000FF\'>%s</span>" % (msg_escape,))
                    prev_end = end
                if end is not None:
                    tags.append (GLib.markup_escape_text (msg[end:]))
                cell.props.markup = "".join (tags)
Beispiel #4
0
    def update(self, artist, album, item, header_bar, selection_toolbar):
        self.selection_toolbar = selection_toolbar
        self.header_bar = header_bar
        self.album = album
        real_artist = item.get_artist() or _("Unknown Artist")
        self.ui.get_object('cover').set_from_pixbuf(self.loadingIcon)
        ALBUM_ART_CACHE.lookup(item, 256, 256, self._on_look_up, None, real_artist, album)

        self.duration = 0
        self._create_model()
        GLib.idle_add(grilo.populate_album_songs, item, self.add_item)
        header_bar._select_button.connect(
            'toggled', self._on_header_select_button_toggled)
        header_bar._cancel_button.connect(
            'clicked', self._on_header_cancel_button_clicked)
        self.view.connect('view-selection-changed',
                          self._on_view_selection_changed)
        self.view.set_model(self.model)
        escaped_artist = GLib.markup_escape_text(artist)
        escaped_album = GLib.markup_escape_text(album)
        self.ui.get_object('artist_label').set_markup(escaped_artist)
        self.ui.get_object('title_label').set_markup(escaped_album)
        if (item.get_creation_date()):
            self.ui.get_object('released_label_info').set_text(
                str(item.get_creation_date().get_year()))
        else:
            self.ui.get_object('released_label_info').set_text('----')
        self.player.connect('playlist-item-changed', self.update_model)
Beispiel #5
0
    def create_palette(self):
        primary_text = GLib.markup_escape_text(self._model.bundle.get_name())
        secondary_text = GLib.markup_escape_text(self._model.get_name())
        palette_icon = Icon(file=self._model.bundle.get_icon(),
                            xo_color=self._model.get_color())
        palette_icon.props.icon_size = Gtk.IconSize.LARGE_TOOLBAR
        palette = Palette(None,
                          primary_text=primary_text,
                          secondary_text=secondary_text,
                          icon=palette_icon)

        private = self._model.props.private
        joined = get_owner_instance() in self._model.props.buddies

        menu_box = PaletteMenuBox()

        if joined:
            item = PaletteMenuItem(_('Resume'))
            icon = Icon(icon_size=Gtk.IconSize.MENU, icon_name='activity-start')
            item.set_image(icon)
            item.connect('activate', self.__palette_item_clicked_cb)
            menu_box.append_item(item)
        elif not private:
            item = PaletteMenuItem(_('Join'))
            icon = Icon(icon_size=Gtk.IconSize.MENU, icon_name='activity-start')
            item.set_image(icon)
            item.connect('activate', self.__palette_item_clicked_cb)
            menu_box.append_item(item)

        palette.set_content(menu_box)
        menu_box.show_all()

        self.connect_to_palette_pop_events(palette)
        return palette
Beispiel #6
0
    def __init__(self):
        label = GLib.markup_escape_text(_('Wired Network'))
        Palette.__init__(self, primary_text=label)

        self._speed_label = Gtk.Label()
        self._speed_label.props.xalign = 0.0
        self._speed_label.show()

        self._ip_address_label = Gtk.Label()

        self._info = Gtk.VBox()

        def _padded(child, xalign=0, yalign=0.5):
            padder = Gtk.Alignment.new(xalign=xalign, yalign=yalign,
                                       xscale=1, yscale=0.33)
            padder.set_padding(style.DEFAULT_SPACING,
                               style.DEFAULT_SPACING,
                               style.DEFAULT_SPACING,
                               style.DEFAULT_SPACING)
            padder.add(child)
            return padder

        self._info.pack_start(_padded(self._speed_label), True, True, 0)
        self._info.pack_start(_padded(self._ip_address_label), True, True, 0)
        self._info.show_all()

        self.set_content(self._info)
        self.props.secondary_text = GLib.markup_escape_text(_('Connected'))
def _format_label_text(song):
    if song:
        return '<small><b>Next: </b>{artist} - {title}</small>'.format(
                artist=GLib.markup_escape_text(song.artist),
                title=GLib.markup_escape_text(song.title)
        )
    else:
        return '<small><b>Next: </b><small>(( none ))</small></small>'
Beispiel #8
0
    def update(self):
        name_markup = GLib.markup_escape_text(self.app.name)
        comment_markup = GLib.markup_escape_text(self.app.comment)
        delay_time_markup = GLib.markup_escape_text(self.app.delay)

        self.name_label.set_markup("<b>{}</b>".format(name_markup))
        self.comment_label.set_markup("<small>{}</small>".format(comment_markup))
        self.delay_time_label.set_markup(delay_time_markup)
Beispiel #9
0
def markup(text, isheading):
	"""
	Gives markup for name - for liststore.
	"""
	if isheading:
		return "<u><i>%s</i></u>" % (glib.markup_escape_text(text.encode('UTF-8')))
	else:
		return glib.markup_escape_text(text.encode('UTF-8'))
Beispiel #10
0
 def _update(self):
     name = self._cb_object.get_name()
     self.props.primary_text = GLib.markup_escape_text(name)
     preview = self._cb_object.get_preview()
     if preview:
         self.props.secondary_text = GLib.markup_escape_text(preview)
     self._update_items_visibility()
     self._update_open_submenu()
Beispiel #11
0
def get_name_string(stock):
    configParser = config.AvernusConfig()
    option = configParser.get_option('smallPosition', 'General')
    if option == "True":
        format_string = '%s\n<small>%s | %s</small>'
    else:
        format_string = '<b>%s</b>\n<small>%s\n%s</small>'
    return format_string % (GLib.markup_escape_text(stock.name), GLib.markup_escape_text(stock.isin), GLib.markup_escape_text(stock.exchange.encode('utf8')))
Beispiel #12
0
 def asMarkupText(self):
     assert not self._retracted
     untranslated_mood = self._pep_specific_data['mood']
     mood = self._translate_mood(untranslated_mood)
     markuptext = '<b>%s</b>' % GLib.markup_escape_text(mood)
     if 'text' in self._pep_specific_data:
         text = self._pep_specific_data['text']
         markuptext += ' (%s)' % GLib.markup_escape_text(text)
     return markuptext
Beispiel #13
0
 def create_palette(self):
     device_label = GLib.markup_escape_text(_('My Audio'))
     output_label = GLib.markup_escape_text(self._output_label)
     input_label = GLib.markup_escape_text(self._input_label)
     palette = AudioPalette(device_label, output_label, input_label,
                            output_model=self._audio_output_model,
                            input_model=self._audio_input_model)
     palette.set_group_id('frame')
     return palette
Beispiel #14
0
    def update(self, artist, album, item, header_bar, selection_toolbar):
        released_date = item.get_publication_date()
        if released_date is not None:
            self.ui.get_object("released_label_info").set_text(
                released_date.get_year().toString())
        duration = 0
        self.album = album
        self.ui.get_object("cover").set_from_pixbuf(self._symbolicIcon)
        albumArtCache.lookup(256, artist,
                             item.get_string(Grl.METADATA_KEY_ALBUM),
                             self._onLookUp(pixbuf))

        # if the active queue has been set by self album,
        # use it as model, otherwise build the liststore
        cachedPlaylist = self.player.runningPlaylist("Album", album)
        if cachedPlaylist is not None:
            self.model = cachedPlaylist
            self.updateModel(self.player, cachedPlaylist,
                             self.player.currentTrack)
        else:
            self.model = Gtk.ListStore([
                GObject.TYPE_STRING,  # title
                GObject.TYPE_STRING,
                GObject.TYPE_STRING,
                GObject.TYPE_STRING,
                GdkPixbuf.Pixbuf,    # icon
                GObject.TYPE_OBJECT,  # song object
                GObject.TYPE_BOOLEAN,  # icon shown
                GObject.TYPE_STRING,
                GObject.TYPE_BOOLEAN,
                GObject.TYPE_BOOLEAN,
            ])
            tracks = []
            grilo.getAlbumSongs(item.get_id(), self._onGetAlbumSongs(source,
                                                                     prefs,
                                                                     track))
        header_bar._selectButton.connect(
            'toggled',
            self._onHeaderSelectButtonToggled(button))
        header_bar._cancelButton.connect(
            'clicked',
            self._onHeaderCancelButtonClicked(button))
        self.view.connect('view-selection-changed',
                          self._onViewSelectionChanged())
        self.view.set_model(self.model)
        escapedArtist = GLib.markup_escape_text(artist, -1)
        escapedAlbum = GLib.markup_escape_text(album, -1)
        self.ui.get_object("artist_label").set_markup(escapedArtist)
        self.ui.get_object("title_label").set_markup(escapedAlbum)
        if (item.get_creation_date()):
            self.ui.get_object("released_label_info").set_text(
                item.get_creation_date().get_year().toString())
        else:
            self.ui.get_object("released_label_info").set_text("----")
        self.player.connect('playlist-item-changed', self.updateModel())
        self.emit('loaded')
Beispiel #15
0
 def get_description(self, package):
     """ Return a usable description for a package """
     app = self.store.get_app_by_pkgname(package.name)
     if not app:
         return self.sanitize(
             GLib.markup_escape_text(str(package.description)))
     c = app.get_description("C")
     if not c:
         return self.sanitize(
             GLib.markup_escape_text(str(package.description)))
     return c
Beispiel #16
0
 def file_saved_cb(self, saver, result, *args):
     gfile = saver.get_location()
     try:
         saver.save_finish(result)
     except GLib.Error as err:
         filename = GLib.markup_escape_text(gfile.get_parse_name())
         error_dialog(
             primary=_("Could not save file %s.") % filename,
             secondary=_("Couldn’t save file due to:\n%s") % (
                 GLib.markup_escape_text(str(err))),
         )
Beispiel #17
0
    def play_queue_data_func(cls, cell_layout, cell, model, it, data):
        entry = model.get_value(it, 0)

        title = entry.get_string(RB.RhythmDBPropType.TITLE)
        genre = entry.get_string(RB.RhythmDBPropType.GENRE)

        markup = '{title}\n<span size="smaller">{genre}</span>'.format(
            title = GLib.markup_escape_text(title),
            genre = GLib.markup_escape_text(genre))

        cell.props.markup = markup
Beispiel #18
0
 def get_status_info(self, resource, priority, show, status):
     str_status = resource + ' (' + str(priority) + ')'
     if status:
         status = status.strip()
         if status != '':
             # reduce to 100 chars, 1 line
             status = helpers.reduce_chars_newlines(status, 100, 1)
             str_status = GLib.markup_escape_text(str_status)
             status = GLib.markup_escape_text(status)
             str_status += ' - <i>' + status + '</i>'
     return str_status
Beispiel #19
0
    def setup_palette(self):
        activity_name = self._home_activity.get_activity_name()
        if activity_name:
            self.props.primary_text = GLib.markup_escape_text(activity_name)

        title = self._home_activity.get_title()
        if title and title != activity_name:
            self.props.secondary_text = GLib.markup_escape_text(title)

        self.menu_box = PaletteMenuBox()

        menu_item = PaletteMenuItem(_("Resume"), "activity-start")
        menu_item.connect("activate", self.__resume_activate_cb)
        self.menu_box.append_item(menu_item)
        menu_item.show()

        # TODO: share-with, keep

        menu_item = PaletteMenuItem(_("View Source"), "view-source")
        menu_item.connect("activate", self.__view_source__cb)
        menu_item.set_accelerator("Shift+Alt+V")
        self.menu_box.append_item(menu_item)
        menu_item.show()

        help_url_and_title = get_help_url_and_title(self._home_activity)
        if help_url_and_title:
            menu_item = PaletteMenuItem(_("View Help"), "toolbar-help")
            menu_item.connect("activate", self.__view_help__cb)
            menu_item.set_accelerator("Shift+Alt+H")
            self.menu_box.append_item(menu_item)
            menu_item.show()

        # avoid circular importing reference
        from jarabe.frame.notification import NotificationBox

        menu_item = NotificationBox(self._home_activity.get_activity_id())
        self.menu_box.append_item(menu_item, 0, 0)

        separator = PaletteMenuItemSeparator()
        menu_item.add(separator)
        menu_item.reorder_child(separator, 0)
        separator.show()

        separator = PaletteMenuItemSeparator()
        self.menu_box.append_item(separator)
        separator.show()

        menu_item = PaletteMenuItem(_("Stop"), "activity-stop")
        menu_item.connect("activate", self.__stop_activate_cb)
        self.menu_box.append_item(menu_item)
        menu_item.show()

        self.set_content(self.menu_box)
        self.menu_box.show()
Beispiel #20
0
 def populate_tree_view(self, content_pages):
     """Populate the tree view with tasks from `content_pages`."""
     self._tree_view.get_model().clear()
     store = self._tree_view.get_model()
     pages = gaupol.conf.text_assistant.pages
     for page in content_pages:
         title = GLib.markup_escape_text(page.title)
         description = GLib.markup_escape_text(page.description)
         markup = "<b>{}</b>\n{}".format(title, description)
         page.set_visible(page.handle in pages)
         store.append((page, page.handle in pages, markup))
     self._tree_view.get_selection().unselect_all()
Beispiel #21
0
    def __init__(self, title, message, button_callback):
        Gtk.EventBox.__init__(self)

        self.modify_bg(Gtk.StateType.NORMAL, style.COLOR_WHITE.get_gdk_color())

        alignment = Gtk.Alignment.new(0.5, 0.5, 0.1, 0.1)
        self.add(alignment)
        alignment.show()

        box = Gtk.VBox()
        alignment.add(box)
        box.show()

        # Get the icon of this activity through the bundle path.
        bundle_path = activity.get_bundle_path()
        activity_bundle = ActivityBundle(bundle_path)
        icon = Icon(
            pixel_size=style.LARGE_ICON_SIZE,
            file=activity_bundle.get_icon(),
            stroke_color=style.COLOR_BUTTON_GREY.get_svg(),
            fill_color=style.COLOR_TRANSPARENT.get_svg(),
        )

        box.pack_start(icon, expand=True, fill=False, padding=0)
        icon.show()

        color = style.COLOR_BUTTON_GREY.get_html()

        label = Gtk.Label()
        label.set_markup('<span weight="bold" color="%s">%s</span>' % (color, GLib.markup_escape_text(title)))
        box.pack_start(label, expand=True, fill=False, padding=0)
        label.show()

        label = Gtk.Label()
        label.set_markup('<span color="%s">%s</span>' % (color, GLib.markup_escape_text(message)))
        box.pack_start(label, expand=True, fill=False, padding=0)
        label.show()

        button_box = Gtk.HButtonBox()
        button_box.set_layout(Gtk.ButtonBoxStyle.CENTER)
        box.pack_start(button_box, False, True, 0)
        button_box.show()

        button = Gtk.Button(label=_("Try again"))
        button.connect("clicked", button_callback)
        button.props.image = Icon(
            icon_name="entry-refresh",
            pixel_size=style.SMALL_ICON_SIZE,
            stroke_color=style.COLOR_WHITE.get_svg(),
            fill_color=style.COLOR_TRANSPARENT.get_svg(),
        )
        button_box.pack_start(button, expand=True, fill=False, padding=0)
        button.show()
    def __init__(self, artist_ids, genre_ids):
        """
            Init ArtistView
            @param artist id as int (Current if None)
            @param genre id as int
        """
        ArtistAlbumsView.__init__(self, artist_ids, genre_ids)
        self.__art_signal_id = None
        self.connect('realize', self.__on_realize)
        self.connect('unrealize', self.__on_unrealize)

        builder = Gtk.Builder()
        builder.add_from_resource('/org/gnome/Lollypop/ArtistView.ui')
        builder.connect_signals(self)
        self.__artwork = builder.get_object('artwork')
        self.__artwork_box = builder.get_object('artwork-box')
        self.__label = builder.get_object('artist')
        self.__jump_button = builder.get_object('jump-button')
        self.__jump_button.set_tooltip_text(_("Go to current track"))
        self.__add_button = builder.get_object('add-button')
        self.__play_button = builder.get_object('play-button')
        self.__grid = builder.get_object('header')
        if Lp().lastfm is None:
            builder.get_object('lastfm-button').hide()
        elif not get_network_available():
            builder.get_object('lastfm-button').set_sensitive(False)
            builder.get_object('lastfm-button').set_tooltip_text(
                                                  _("Network access disabled"))
        self._overlay.add_overlay(self.__grid)
        self.__empty = Gtk.Grid()
        self.__empty.show()
        self._albumbox.add(self.__empty)
        self._albumbox.set_row_spacing(20)

        self.__scale_factor = self.__artwork.get_scale_factor()
        self.__set_artwork()
        self.__set_add_icon()
        self.__on_lock_changed(Lp().player)

        artists = []
        for artist_id in artist_ids:
            artists.append(Lp().artists.get_name(artist_id))
        if Lp().settings.get_value('artist-artwork'):
            self.__label.set_markup(
                                "<span size='x-large' weight='bold'>" +
                                GLib.markup_escape_text(", ".join(artists)) +
                                "</span>")
        else:
            self.__label.set_markup(
                                "<span size='large' weight='bold'>" +
                                GLib.markup_escape_text(", ".join(artists)) +
                                "</span>")
Beispiel #23
0
 def __update_jump_button(self):
     """
         Update jump button status
     """
     if Lp().player.current_track.id in self.__tracks:
         self.__jump_button.set_sensitive(True)
         artists = ", ".join(Lp().player.current_track.artists)
         self.__jump_button.set_tooltip_markup(
          "<b>%s</b>\n%s" % (GLib.markup_escape_text(artists),
                             GLib.markup_escape_text(
                                           Lp().player.current_track.name)))
     else:
         self.__jump_button.set_sensitive(False)
         self.__jump_button.set_tooltip_text('')
Beispiel #24
0
 def _text_to_markup(self, text, show_lengths, length_unit):
     """Return `text` renderer as markup for display."""
     # We don't actually use the length_unit argument,
     # but do need it accounted for in memoized values.
     if not text: return ""
     if not show_lengths:
         return GLib.markup_escape_text(text)
     lengths = gaupol.ruler.get_lengths(text)
     text = GLib.markup_escape_text(text)
     lines = text.split("\n")
     return "\n".join(("{} <small>[{:d}]</small>"
                       .format(lines[i], lengths[i])
                       if lines[i] else lines[i]
                       for i in range(len(lines))))
    def _combined_progress_label(self, entry):
        """
           utility function to calculate the label to be used when a progress bar has the label above it
           :param RBEntry
        """

        if ( entry is None ):
            self.song_button_label.set_label("")
            return False

        stream_title = self.shell.props.db.entry_request_extra_metadata(entry, RB.RHYTHMDB_PROP_STREAM_SONG_TITLE)
        stream_artist = self.shell.props.db.entry_request_extra_metadata(entry, RB.RHYTHMDB_PROP_STREAM_SONG_ARTIST)

        if stream_title:
            if stream_artist:
                markup = "<small><b>{title}</b> {artist}</small>".format(
                    title=GLib.markup_escape_text(stream_title),
                    artist=GLib.markup_escape_text(stream_artist))
            else:
                markup = "<small><b>{title}</b></small>".format(
                    title=GLib.markup_escape_text(stream_title))
            self.song_button_label.set_markup(markup)
            return True

        album = entry.get_string(RB.RhythmDBPropType.ALBUM)
        if not album or album == "":
            self.song_button_label.set_markup("<small><b>{title}</b></small>".format(
                title=GLib.markup_escape_text(entry.get_string(RB.RhythmDBPropType.TITLE))))
            return True

        if self.plugin.playing_label:
            year = entry.get_ulong(RB.RhythmDBPropType.DATE)
            if year == 0:
                year = date.today().year
            else:
                year = datetime.fromordinal(year).year

            self.song_button_label.set_markup(
                "<small>{album} - {genre} - {year}</small>".format(
                    album=GLib.markup_escape_text(entry.get_string(RB.RhythmDBPropType.ALBUM)),
                    genre=GLib.markup_escape_text(entry.get_string(RB.RhythmDBPropType.GENRE)),
                    year=GLib.markup_escape_text(str(year))))
        else:
            self.song_button_label.set_markup(
                "<small><b>{title}</b> {album} - {artist}</small>".format(
                    title=GLib.markup_escape_text(entry.get_string(RB.RhythmDBPropType.TITLE)),
                    album=GLib.markup_escape_text(entry.get_string(RB.RhythmDBPropType.ALBUM)),
                    artist=GLib.markup_escape_text(entry.get_string(RB.RhythmDBPropType.ARTIST))))

        return True
Beispiel #26
0
    def get_markup(self, doc):
        app = self.db.get_application(doc)

        # the logic is that "apps" are displayed normally
        # but "packages" are displayed with their summary as name
        if app.appname:
            appname = self.get_appname(doc)
            summary = capitalize_first_word(self.db.get_summary(doc))
        else:
            appname = capitalize_first_word(self.db.get_summary(doc))
            summary = self.get_pkgname(doc)

        return "%s\n<small>%s</small>" % (
            GLib.markup_escape_text(appname),
            GLib.markup_escape_text(summary))
Beispiel #27
0
    def show_error (self, message1, message2):

        bar = Gtk.InfoBar ()
        bar.props.message_type = Gtk.MessageType.ERROR
        box = bar.get_content_area ()

        markup = "<b>%s</b> %s" % (GLib.markup_escape_text (message1),
                                   GLib.markup_escape_text (message2),)
        label = Gtk.Label ()
        label.props.use_markup = True
        label.props.label = markup
        label.props.selectable = True
        box.pack_start (label, False, False, 0)

        self.show_info (bar)
Beispiel #28
0
 def update_headers(self):
     """Update the attributes of all column header labels."""
     fcol = self.get_focus()[1]
     acol = getattr(self.columns, self._active_col_name, None)
     if fcol == acol: return
     self._active_col_name = ""
     if acol is not None:
         label = self.get_column(acol).get_widget()
         text = GLib.markup_escape_text(label.get_text())
         label.set_markup("{}".format(text))
     if fcol is not None:
         label = self.get_column(fcol).get_widget()
         text = GLib.markup_escape_text(label.get_text())
         label.set_markup("<i>{}</i>".format(text))
         self._active_col_name = self.columns[fcol].name
Beispiel #29
0
    def _update_entry(self, needs_update=False):
        if not model.is_editable(self._metadata):
            return

        old_title = self._metadata.get('title', None)
        new_title = self._title.get_text()
        if old_title != new_title:
            label = GLib.markup_escape_text(new_title)
            self._icon.palette.props.primary_text = label
            self._metadata['title'] = new_title
            self._metadata['title_set_by_user'] = '******'
            needs_update = True

        bounds = self._tags.get_buffer().get_bounds()
        old_tags = self._metadata.get('tags', None)
        new_tags = self._tags.get_buffer().get_text(bounds[0], bounds[1],
                                                    include_hidden_chars=False)

        if old_tags != new_tags:
            self._metadata['tags'] = new_tags
            needs_update = True

        bounds = self._description.get_buffer().get_bounds()
        old_description = self._metadata.get('description', None)
        new_description = self._description.get_buffer().get_text(
            bounds[0], bounds[1], include_hidden_chars=False)
        if old_description != new_description:
            self._metadata['description'] = new_description
            needs_update = True

        if needs_update:
            self._write_entry()

        self._update_title_sid = None
 def add_data(self, item):
     """Add a new row to the model if it doesn't exists"""
     super(self.__class__, self).add_data(item)
     if item.filename not in self.rows:
         icon = None
         if item.icon_name:
             icon = get_pixbuf_from_icon_name(item.icon_name, 48)
         # If the icon was not found or it was missing use a fallback icon
         if not icon:
             icon = get_pixbuf_from_icon_name(MISSING_ICON_NAME, 48)
         new_row = self.model.append((
             item.filename,
             item.name,
             item.description,
             '<b>{name}</b>\n'
             '<small>{description}</small>\n'
             '<small>{filename}</small>'.format(**{
                 'name': item.name,
                 'description': item.description,
                 'filename': GLib.markup_escape_text(item.filename)}),
             icon,
             item.valid,
             item.valid))
         self.rows[item.filename] = new_row
         self.items[item.filename] = item
         return new_row
Beispiel #31
0
 def __init__(self, track, album_artist_ids, view_type):
     """
         Init row widgets
         @param track as Track
         @param album_artist_ids as [int]
         @param view_type as ViewType
     """
     # We do not use Gtk.Builder for speed reasons
     Gtk.ListBoxRow.__init__(self)
     self._view_type = view_type
     self._artists_label = None
     self._track = track
     self.__filtered = False
     self.__next_row = None
     self.__previous_row = None
     self._indicator = IndicatorWidget(self, view_type)
     self._row_widget = Gtk.EventBox()
     self._row_widget.connect("destroy", self._on_destroy)
     self.__gesture = Gtk.GestureLongPress.new(self._row_widget)
     self.__gesture.connect("pressed", self.__on_gesture_pressed)
     self.__gesture.connect("end", self.__on_gesture_end)
     # We want to get release event after gesture
     self.__gesture.set_propagation_phase(Gtk.PropagationPhase.CAPTURE)
     self.__gesture.set_button(0)
     self._grid = Gtk.Grid()
     self._grid.set_property("valign", Gtk.Align.CENTER)
     self._grid.set_column_spacing(5)
     self._row_widget.add(self._grid)
     self._title_label = Gtk.Label.new(
         GLib.markup_escape_text(self._track.name))
     self._title_label.set_use_markup(True)
     self._title_label.set_property("has-tooltip", True)
     self._title_label.connect("query-tooltip", on_query_tooltip)
     self._title_label.set_property("hexpand", True)
     self._title_label.set_property("halign", Gtk.Align.START)
     self._title_label.set_property("xalign", 0)
     self._title_label.set_ellipsize(Pango.EllipsizeMode.END)
     featuring_artist_ids = track.get_featuring_artist_ids(album_artist_ids)
     if featuring_artist_ids:
         artists = []
         for artist_id in featuring_artist_ids:
             artists.append(App().artists.get_name(artist_id))
         self._artists_label = Gtk.Label.new(
             GLib.markup_escape_text(", ".join(artists)))
         self._artists_label.set_use_markup(True)
         self._artists_label.set_property("has-tooltip", True)
         self._artists_label.connect("query-tooltip", on_query_tooltip)
         self._artists_label.set_property("hexpand", True)
         self._artists_label.set_property("halign", Gtk.Align.END)
         self._artists_label.set_ellipsize(Pango.EllipsizeMode.END)
         self._artists_label.set_opacity(0.3)
         self._artists_label.set_margin_end(5)
         self._artists_label.show()
     duration = seconds_to_string(self._track.duration)
     self._duration_label = Gtk.Label.new(duration)
     self._duration_label.get_style_context().add_class("dim-label")
     self._num_label = Gtk.Label.new()
     self._num_label.set_ellipsize(Pango.EllipsizeMode.END)
     self._num_label.set_width_chars(4)
     self._num_label.get_style_context().add_class("dim-label")
     self.update_number_label()
     self._grid.add(self._num_label)
     self._grid.add(self._title_label)
     if self._artists_label is not None:
         self._grid.add(self._artists_label)
     self._grid.add(self._duration_label)
     if self._view_type & ViewType.DND and\
             self._view_type & ViewType.POPOVER:
         self.__action_button = Gtk.Button.new_from_icon_name(
             "list-remove-symbolic", Gtk.IconSize.MENU)
         self.__action_button.set_tooltip_text(_("Remove from playback"))
     elif not self._view_type & (ViewType.POPOVER | ViewType.SEARCH):
         self.__action_button = Gtk.Button.new_from_icon_name(
             "view-more-symbolic", Gtk.IconSize.MENU)
     else:
         self.__action_button = None
     if self.__action_button is not None:
         self.__action_button.set_margin_end(MARGIN_SMALL)
         self.__action_button.connect("button-release-event",
                                      self.__on_action_button_release_event)
         self.__action_button.set_relief(Gtk.ReliefStyle.NONE)
         context = self.__action_button.get_style_context()
         context.add_class("menu-button")
         context.add_class("track-menu-button")
         self._grid.add(self.__action_button)
     else:
         self._duration_label.set_margin_end(MARGIN_SMALL)
     self.add(self._row_widget)
     self.set_indicator(self._get_indicator_type())
     self.update_duration()
Beispiel #32
0
    def init_view(self):
        # Install? Modifiable? Display label | Size | Image | Sensitive | iSize
        # | UpdateObject
        model = Gtk.TreeStore(bool, bool, str, str, GdkPixbuf.Pixbuf, bool,
                              int, ScUpdateObject)
        self.selected_object = None

        # Mandatory updates
        m_label = "<big><b>Required Updates</b></big>\n" \
                  "These updates are mandatory and will be selected " \
                  "automatically."
        row_m = model.append(None, [
            True, False, m_label, None, self.appsystem.mandatory_pixbuf, True,
            0, None
        ])
        # Security row
        s_label = "<big><b>Security Updates</b></big>\n" \
                  "These updates are strongly recommended to support safe " \
                  "usage of your device."
        row_s = model.append(None, [
            False, True, s_label, None, self.appsystem.security_pixbuf, True,
            0, None
        ])
        # All other updates
        u_label = "<big><b>Other Updates</b></big>\n" \
                  "These updates may introduce new software versions and " \
                  "bug-fixes."
        row_u = model.append(None, [
            False, True, u_label, None, self.appsystem.other_pixbuf, True, 0,
            None
        ])

        # Need a shared context for these guys
        self.installdb = self.basket.installdb
        self.packagedb = self.basket.packagedb

        # Expand with a plan operation to be up front about new deps
        upgrades = pisi.api.list_upgradable()
        n_updates = len(upgrades)

        obsol = pisi.api.list_obsoleted()
        replc = pisi.api.list_replaces()
        for item in sorted(upgrades):

            old_item = item
            if item in obsol:
                if item not in replc:
                    # No valid replacement, skip it
                    continue
                # Chose the replacement
                item = replc[item][0]

            new_pkg = self.packagedb.get_package(item)
            new_version = "%s-%s" % (str(new_pkg.version), str(
                new_pkg.release))
            pkg_name = str(new_pkg.name)
            old_pkg = None
            systemBase = False

            icon = PACKAGE_ICON_NORMAL
            if new_pkg.partOf == "system.base":
                systemBase = True
                parent_row = row_m
            else:
                parent_row = row_u

            if self.installdb.has_package(item):
                old_pkg = self.installdb.get_package(item)

            sc_obj = ScUpdateObject(old_pkg, new_pkg)

            if sc_obj.is_security_update() and parent_row != row_m:
                parent_row = row_s
                icon = PACKAGE_ICON_SECURITY

            summary = str(new_pkg.summary)
            if len(summary) > 76:
                summary = "%s…" % summary[0:76]

            # Finally, actual size, and readable size
            pkgSize = sc_obj.get_update_size()
            dlSize = sc_format_size_local(pkgSize)

            icon = self.appsystem.get_pixbuf_only(new_pkg)

            pkg_name = self.appsystem.get_name(new_pkg)
            summary = GLib.markup_escape_text(summary)

            if old_item != item:
                pref = "%s (replaces %s)" % (pkg_name, old_item)
            else:
                pref = "%s" % (pkg_name)

            p_print = "%s - <small>%s</small>\n%s" % (pref, new_version,
                                                      summary)

            model.append(parent_row, [
                systemBase, not systemBase, p_print, dlSize, icon, True,
                pkgSize, sc_obj
            ])

        # Disable empty rows
        for item in [row_s, row_m, row_u]:
            if model.iter_n_children(item) == 0:
                model.set(item, 0, False)
                model.set(item, 1, False)
                model.set(item, 5, False)

        Gdk.threads_enter()
        self.tview.set_model(model)
        # Hook up events so we know what's going on (4 non blondes.)
        self.update_from_selection()
        model.connect_after('row-changed', self.on_model_row_changed)
        if n_updates < 1:
            self.stack.set_visible_child_name("check")
        else:
            self.stack.set_visible_child_name("updates")
        Gdk.threads_leave()
        return False
Beispiel #33
0
def popup(event_type,
          jid,
          account,
          msg_type='',
          path_to_image=None,
          title=None,
          text=None,
          timeout=-1):
    """
    Notify a user of an event. It first tries to a valid implementation of
    the Desktop Notification Specification. If that fails, then we fall back to
    the older style PopupNotificationWindow method
    """
    # default image
    if not path_to_image:
        path_to_image = gtkgui_helpers.get_icon_path('gajim-chat_msg_recv', 48)

    if timeout < 0:
        timeout = gajim.config.get('notification_timeout')

    # Try to show our popup via D-Bus and notification daemon
    if gajim.config.get('use_notif_daemon') and dbus_support.supported:
        try:
            DesktopNotification(event_type, jid, account, msg_type,
                                path_to_image, title,
                                GLib.markup_escape_text(text), timeout)
            return  # sucessfully did D-Bus Notification procedure!
        except dbus.DBusException as e:
            # Connection to D-Bus failed
            gajim.log.debug(str(e))
        except TypeError as e:
            # This means that we sent the message incorrectly
            gajim.log.debug(str(e))

    # Ok, that failed. Let's try pynotify, which also uses notification daemon
    if gajim.config.get('use_notif_daemon') and USER_HAS_PYNOTIFY:
        if not text and event_type == 'new_message':
            # empty text for new_message means do_preview = False
            # -> default value for text
            _text = GLib.markup_escape_text(
                gajim.get_name_from_jid(account, jid))
        else:
            _text = GLib.markup_escape_text(text)

        if not title:
            _title = ''
        else:
            _title = title

        notification = Notify.Notification.new(_title, _text)
        notification.set_timeout(timeout * 1000)

        notification.set_category(event_type)
        notification._data = {}
        notification._data["event_type"] = event_type
        notification._data["jid"] = jid
        notification._data["account"] = account
        notification._data["msg_type"] = msg_type
        notification.set_property('icon-name', path_to_image)
        if 'actions' in Notify.get_server_caps():
            notification.add_action('default', 'Default Action',
                                    on_pynotify_notification_clicked)

        try:
            notification.show()
            return
        except GObject.GError as e:
            # Connection to notification-daemon failed, see #2893
            gajim.log.debug(str(e))

    # Either nothing succeeded or the user wants old-style notifications
    instance = PopupNotificationWindow(event_type, jid, account, msg_type,
                                       path_to_image, title, text, timeout)
    gajim.interface.roster.popup_notification_windows.append(instance)
Beispiel #34
0
    def __init__(self, extension_type, metadata, size_groups):
        super(ManageSpicesRow, self).__init__()
        self.extension_type = extension_type
        self.metadata = metadata

        self.status_ids = {}

        self.writable = metadata['writable']

        self.uuid = self.metadata['uuid']
        self.name = translate(self.metadata['uuid'], self.metadata['name'])
        self.description = translate(self.metadata['uuid'],
                                     self.metadata['description'])

        self.author = ""
        if 'author' in metadata:
            if metadata['author'].lower(
            ) != "none" and metadata['author'].lower() != "unknown":
                self.author = metadata['author']

        icon_path = os.path.join(self.metadata['path'], 'icon.png')

        try:
            self.max_instances = int(self.metadata['max-instances'])
            if self.max_instances < -1:
                self.max_instances = 1
        except (KeyError, ValueError):
            self.max_instances = 1

        try:
            self.role = self.metadata['role']
        except (KeyError, ValueError):
            self.role = None

        try:
            last_edited = self.metadata['last-edited']
        except (KeyError, ValueError):
            last_edited = -1

        # Check for the right version subdir (if the spice is multi-versioned, it won't necessarily be in its root directory)
        self.metadata['path'] = find_extension_subdir(self.metadata['path'])

        # "hide-configuration": true in metadata trumps all
        # otherwise we check for "external-configuration-app" in metadata and settings-schema.json in settings
        self.has_config = False
        self.ext_config_app = None
        if not 'hide-configuration' in self.metadata or self.metadata[
                'hide-configuration'] != True:
            if 'external-configuration-app' in self.metadata:
                self.ext_config_app = os.path.join(
                    self.metadata['path'],
                    self.metadata['external-configuration-app'])

            if self.ext_config_app is not None:
                if os.path.exists(self.ext_config_app):
                    self.has_config = True
                else:
                    self.ext_config_app = None

            if self.ext_config_app is None and os.path.exists(
                    '%s/settings-schema.json' % self.metadata['path']):
                self.has_config = True

        widget = SettingsWidget()
        self.add(widget)

        grid = Gtk.Grid()
        grid.set_column_spacing(15)
        widget.pack_start(grid, True, True, 0)

        enabled_box = Gtk.Box()
        enabled_box.set_spacing(4)
        size_groups[0].add_widget(enabled_box)
        self.enabled_image = Gtk.Image.new_from_icon_name(
            'object-select-symbolic', 2)
        if self.extension_type == "applet":
            self.enabled_image.set_tooltip_text(
                _("This applet is currently enabled"))
        elif self.extension_type == "desklet":
            self.enabled_image.set_tooltip_text(
                _("This desklet is currently enabled"))
        elif self.extension_type == "extension":
            self.enabled_image.set_tooltip_text(
                _("This extension is currently enabled"))
        self.enabled_image.set_no_show_all(True)
        enabled_box.pack_end(self.enabled_image, False, False, 0)
        enabled_box.show()
        grid.attach(enabled_box, 0, 0, 1, 1)

        icon = None
        if 'icon' in self.metadata:
            icon_name = self.metadata['icon']
            if Gtk.IconTheme.get_default().has_icon(icon_name):
                icon = Gtk.Image.new_from_icon_name(icon_name, 3)

        if os.path.exists(icon_path):
            try:
                pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(
                    icon_path, 24, 24, True)
                icon = Gtk.Image.new_from_pixbuf(pixbuf)
            except:
                icon = None

        if icon is None:
            icon = Gtk.Image.new_from_icon_name('cs-%ss' % (extension_type), 3)

        grid.attach_next_to(icon, enabled_box, Gtk.PositionType.RIGHT, 1, 1)

        desc_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        desc_box.props.hexpand = True
        desc_box.props.halign = Gtk.Align.START
        desc_box.set_spacing(1)

        name_label = Gtk.Label()
        name_markup = GLib.markup_escape_text(self.name)
        if self.author == "":
            name_label.set_markup('<b>{}</b>'.format(name_markup))
        else:
            by_author = _("by %s") % self.author
            name_label.set_markup('<b>{}</b><small> {}</small>'.format(
                name_markup, by_author))
        name_label.props.xalign = 0.0
        desc_box.add(name_label)

        uuid_label = Gtk.Label()
        uuid_markup = GLib.markup_escape_text(self.uuid)
        uuid_label.set_markup('<small><i>{}</i></small>'.format(uuid_markup))
        uuid_label.props.xalign = 0.0
        desc_box.add(uuid_label)

        description_label = SettingsLabel()
        description_markup = GLib.markup_escape_text(
            sanitize_html(self.description))
        description_label.set_markup(
            '<small>{}</small>'.format(description_markup))
        description_label.set_margin_top(2)
        desc_box.add(description_label)

        grid.attach_next_to(desc_box, icon, Gtk.PositionType.RIGHT, 1, 1)

        self.status_box = Gtk.Box()
        self.status_box.set_spacing(4)
        grid.attach_next_to(self.status_box, desc_box, Gtk.PositionType.RIGHT,
                            1, 1)
        size_groups[1].add_widget(self.status_box)

        self.button_box = Gtk.Box()
        self.button_box.set_valign(Gtk.Align.CENTER)
        grid.attach_next_to(self.button_box, self.status_box,
                            Gtk.PositionType.RIGHT, 1, 1)
        size_groups[2].add_widget(self.button_box)

        if self.has_config:
            config_icon = Gtk.Image.new_from_icon_name('system-run-symbolic',
                                                       2)
            self.config_button = Gtk.Button(image=config_icon)
            self.config_button.set_tooltip_text(_('Configure'))
            self.button_box.pack_start(self.config_button, False, False, 0)
            self.config_button.connect('clicked', self.configure)
            self.set_can_config()

        if not self.writable:
            if self.extension_type == "applet":
                self.add_status(
                    'locked', 'changes-prevent-symbolic',
                    _("This is a system applet. It cannot be removed."))
            elif self.extension_type == "desklet":
                self.add_status(
                    'locked', 'changes-prevent-symbolic',
                    _("This is a system desklet. It cannot be removed."))
            elif self.extension_type == "extension":
                self.add_status(
                    'locked', 'changes-prevent-symbolic',
                    _("This is a system extension. It cannot be removed."))

        try:
            schema_filename = self.metadata['schema-file']
        except (KeyError, ValueError):
            schema_filename = ''

        if self.writable:
            self.scan_extension_for_danger(self.metadata['path'])

        self.version_supported = self.is_compatible_with_cinnamon_version()
Beispiel #35
0
 def get_name(self, id, fallback):
     app = self.store.get_app_by_pkgname(id)
     if not app:
         return GLib.markup_escape_text(str(fallback))
     return GLib.markup_escape_text(self.sanitize(app.get_name("C")))
Beispiel #36
0
    def __init__(self, uuid, data, spices, size_groups):
        super().__init__()

        self.uuid = uuid
        self.data = data
        self.spices = spices
        self.name = data['name']
        self.description = data['description']
        self.score = data['score']
        self.timestamp = data['last_edited']

        self.author = ""
        if 'author_user' in data:
            if data['author_user'].lower(
            ) != "none" and data['author_user'].lower() != "unknown":
                self.author = data['author_user']

        if 'translations' in data.keys():
            key = 'name_%s' % LANGUAGE_CODE
            if key in data['translations'].keys():
                self.name = data['translations'][key]
            key = 'description_%s' % LANGUAGE_CODE
            if key in data['translations'].keys():
                self.description = data['translations'][key]

        self.has_update = False

        self.status_ids = {}

        self.installed = self.spices.get_is_installed(uuid)

        widget = SettingsWidget()
        widget.set_spacing(15)
        self.add(widget)

        installed_box = Gtk.Box()
        installed_box.set_spacing(4)
        widget.pack_start(installed_box, False, False, 0)
        size_groups[0].add_widget(installed_box)
        installed_image = Gtk.Image.new_from_icon_name(
            'object-select-symbolic', 2)
        installed_box.pack_end(installed_image, False, False, 0)
        installed_image.set_tooltip_text(_("Installed"))
        installed_image.set_no_show_all(True)
        if self.installed:
            installed_image.show()
        else:
            installed_image.hide()

        icon = spices.get_icon(uuid)
        widget.pack_start(icon, False, False, 0)

        desc_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        desc_box.set_hexpand(True)
        desc_box.set_halign(Gtk.Align.FILL)
        desc_box.set_spacing(1)

        name_label = Gtk.Label()
        name_markup = GLib.markup_escape_text(self.name)
        if self.author == "":
            name_label.set_markup('<b>{}</b>'.format(name_markup))
        else:
            by_author = _("by %s") % self.author
            name_label.set_markup('<b>{}</b><small> {}</small>'.format(
                name_markup, by_author))
        name_label.set_hexpand(True)
        name_label.set_halign(Gtk.Align.START)
        desc_box.pack_start(name_label, False, False, 0)

        uuid_label = Gtk.Label()
        uuid_markup = GLib.markup_escape_text(self.uuid)
        uuid_label.set_markup('<small><i>{}</i></small>'.format(uuid_markup))
        uuid_label.props.xalign = 0.0
        desc_box.add(uuid_label)

        description_label = SettingsLabel()
        description_markup = GLib.markup_escape_text(
            sanitize_html(self.description))
        description_label.set_markup(
            '<small>{}</small>'.format(description_markup))
        description_label.set_margin_top(2)
        desc_box.pack_start(description_label, False, False, 0)

        widget.pack_start(desc_box, True, True, 0)

        score_box = Gtk.Box()
        score_image = Gtk.Image.new_from_icon_name('starred-symbolic', 2)
        score_box.pack_start(score_image, False, False, 0)
        score_label = Gtk.Label(self.score)
        score_box.pack_start(score_label, False, False, 5)
        widget.pack_start(score_box, False, False, 0)
        size_groups[1].add_widget(score_box)

        self.status_box = Gtk.Box()
        self.status_box.set_spacing(4)
        widget.pack_start(self.status_box, False, False, 0)
        size_groups[2].add_widget(self.status_box)

        self.button_box = Gtk.Box()
        self.button_box.set_valign(Gtk.Align.CENTER)
        self.button_box.set_baseline_position(Gtk.BaselinePosition.CENTER)
        widget.pack_start(self.button_box, False, False, 0)
        size_groups[3].add_widget(self.button_box)

        if not self.installed:
            download_button = Gtk.Button.new_from_icon_name(
                'go-down-symbolic', 2)
            self.button_box.pack_start(download_button, False, False, 0)
            download_button.connect('clicked', self.download)
            download_button.set_tooltip_text(_("Install"))
        elif self.spices.get_has_update(uuid):
            self.has_update = True
            download_button = Gtk.Button.new_from_icon_name(
                'view-refresh-symbolic', 2)
            self.button_box.pack_start(download_button, False, False, 0)
            download_button.connect('clicked', self.download)
            download_button.set_tooltip_text(_("Update"))
Beispiel #37
0
 def _show_error(self, error):
     dialog = HigDialog(self, Gtk.MessageType.INFO, Gtk.ButtonsType.OK,
                        _('Error!'), GLib.markup_escape_text(str(error)))
     dialog.popup()
Beispiel #38
0
def escape(tooltip):
    '''Escape special characters in tooltip text'''
    return GLib.markup_escape_text(tooltip)
Beispiel #39
0
 def set_message(self, s):
     escaped = GLib.markup_escape_text(s)
     self.message.set_markup(f'<small>{escaped}</small>')
Beispiel #40
0
 def set_text(self, text):
     self._text.set_markup('<b>%s</b>' % GLib.markup_escape_text(str(text)))