Example #1
0
    def parameters(cls, mode):
        def bookmark_config_to_vs(v):
            if v:
                return (v["title"], v["url"], v["icon"], v["topic"])
            return v

        def bookmark_vs_to_config(v):
            return {
                "title": v[0],
                "url": v[1],
                "icon": v[2],
                "topic": v[3],
            }

        parameters = super(BookmarkList, cls).parameters(mode)

        parameters += [(
            _("Bookmarks"),
            [
                # sort-index, key, valuespec
                (2.5, "default_topic",
                 TextUnicode(
                     title=_("Default Topic") + "<sup>*</sup>",
                     size=50,
                     allow_empty=False,
                 )),
                (
                    3.0,
                    "bookmarks",
                    ListOf(
                        # For the editor we want a compact dialog. The tuple horizontal editin mechanism
                        # is exactly the thing we want. But we want to store the data as dict. This is a
                        # nasty hack to use the transform by default. Better would be to make Dict render
                        # the same way the tuple is rendered.
                        Transform(
                            Tuple(
                                elements=[
                                    (TextUnicode(
                                        title=_("Title") + "<sup>*</sup>",
                                        size=30,
                                        allow_empty=False,
                                    )),
                                    (TextUnicode(
                                        title=_("URL"),
                                        size=50,
                                        allow_empty=False,
                                        validate=cls.validate_url,
                                    )),
                                    (IconSelector(title=_("Icon"), )),
                                    (cls._vs_topic()),
                                ],
                                orientation="horizontal",
                                title=_("Bookmarks"),
                            ),
                            forth=bookmark_config_to_vs,
                            back=bookmark_vs_to_config,
                        )))
            ])]

        return parameters
Example #2
0
 def _load_custom_icons(self):
     s = IconSelector()
     return s.available_icons(only_local=True)
Example #3
0
 def _load_custom_icons(self):
     s = IconSelector(show_builtin_icons=False, with_emblem=False)
     return s.available_icons(only_local=True)