예제 #1
0
파일: details.py 프로젝트: waddon1/solus-sc
 def render_plain(self, input_string):
     """ Render a plain version of the description, no markdown """
     plain = As.markup_convert_simple(input_string)
     plain = plain.replace(""",
                           "\"").replace("'",
                                         "'").replace("&", "&")
     return plain
예제 #2
0
파일: details.py 프로젝트: vdemir/solus-sc
    def update_description(self):
        # I have become GTK - Destroyer Of Children
        for child in self.description_box.get_children():
            child.destroy()

        id = self.item.get_id()
        fallback = self.item.get_description()
        desc = self.context.appsystem.get_description(id, fallback)

        plain = As.markup_convert(desc, As.MarkupConvertFormat.MARKDOWN)
        lines = []
        try:
            self.parser.consume(plain)
            lines = self.parser.emit()
        except Exception as e:
            print("Parsing error: {}".format(e))
            plain = As.markup_convert_simple(desc)
            lines = plain.split("\n")

        for line in lines:
            lab = Gtk.Label(line)
            lab.set_use_markup(True)
            lab.set_halign(Gtk.Align.START)
            lab.set_line_wrap(True)
            lab.set_property("xalign", 0.0)
            lab.set_property("margin", 2)
            lab.set_margin_bottom(4)
            self.description_box.pack_start(lab, False, False, 0)
            lab.show_all()
예제 #3
0
    def update_description(self):
        # I have become GTK - Destroyer Of Children
        for child in self.description_box.get_children():
            child.destroy()

        id = self.item.get_id()
        fallback = self.item.get_description()
        store = self.item.get_store()
        desc = self.context.appsystem.get_description(id, fallback, store)

        plain = As.markup_convert(desc, As.MarkupConvertFormat.MARKDOWN)
        lines = []
        try:
            self.parser.consume(plain)
            lines = self.parser.emit()
        except Exception as e:
            print("Parsing error: {}".format(e))
            plain = As.markup_convert_simple(desc)
            lines = plain.split("\n")

        for line in lines:
            lab = Gtk.Label(line)
            lab.set_use_markup(True)
            lab.set_halign(Gtk.Align.START)
            lab.set_line_wrap(True)
            lab.set_property("xalign", 0.0)
            lab.set_property("margin", 2)
            lab.set_margin_bottom(4)
            self.description_box.pack_start(lab, False, False, 0)
            lab.show_all()
예제 #4
0
def test_markup(desc):
    m = AS.markup_convert_simple(desc)
    return m
예제 #5
0
def render_plain(input_string):
    """ Render a plain version of the description, no markdown """
    plain = As.markup_convert_simple(input_string)
    plain = plain.replace(""", "\"").replace("'", "'").replace("&", "&")
    return plain