def _serialize_frames(filename,
                      function,
                      pre_context,
                      post_context,
                      context_line,
                      variables,
                      lineno,
                      pre_context_lineno,
                      is_opened=False,
                      **opts):

    if filename:
        description = wl.Row([
            wl.Button(
                wl.Style(filename,
                         wl.RGBColor(0.25, 0.48, 1),
                         wl.Small,
                         FontFamily="Courier"),
                wl.If(wl.FileExistsQ(filename), wl.SystemOpen(filename)),
                Appearance="Frameless",
            ),
            " in ",
            function,
        ])
    else:
        description = function

    yield wl.OpenerView(
        [
            description,
            wl.Column(
                iterate(
                    (wl.Column(
                        iterate(
                            (_paginate(pre_context_lineno + i, l)
                             for i, l in enumerate(pre_context)),
                            [
                                wl.Item(
                                    _paginate(lineno, context_line),
                                    Background=wl.LightYellow,
                                )
                            ],
                            (_paginate(lineno + i + 1, l)
                             for i, l in enumerate(post_context)),
                        ),
                        Background=[[wl.GrayLevel(0.95),
                                     wl.GrayLevel(1)]],
                        Frame=wl.LightGray,
                    ), ),
                    _serialize_variables(variables),
                )),
        ],
        is_opened,
    )
示例#2
0
 def _(blk, _condition=serv.valueOrGetArgName == self.GET_CODE):
     if self.allow_get:
         return wl.If(blk.key == self.ALL_KEY, mwl.to_json(blk.data),
                      mwl.to_json(blk.data[blk.key]))
     else:
         return "GET: NO ACCESS"
示例#3
0
文件: wolf_lang.py 项目: mgroth0/mlib
def If(*args):
    return wl.If(*args)