コード例 #1
0
ファイル: fontawesome.py プロジェクト: PhanterJR/phanterpwa
 def _sampled(self, value):
     html = DIV(
         DIV(DIV(
             widgets.MenuBox(
                 value.replace(" ", "_"),
                 DIV(I(_class=value), _class="icon_button wave_on_click"),
                 custom_menu=DIV(DIV(
                     DIV(LABEL("Python"),
                         INPUT(_value="I(_class=\"{0}\")".format(value)),
                         _class="label_and_input"),
                     DIV(
                         I(_class="fas fa-clipboard"), **{
                             "_data-src": "I(_class=\"{0}\")".format(value),
                             "_class": "copy_buttom"
                         }),
                     _class="icon_awesome_panel"),
                                 DIV(DIV(LABEL("Html"),
                                         INPUT(_value=str(I(_class=value))),
                                         _class="label_and_input"),
                                     DIV(
                                         I(_class="fas fa-clipboard"), **{
                                             "_data-src":
                                             str(I(_class=value)),
                                             "_class": "copy_buttom"
                                         }),
                                     _class="icon_awesome_panel"),
                                 DIV(DIV(LABEL("Class"),
                                         INPUT(_value=value),
                                         _class="label_and_input"),
                                     DIV(
                                         I(_class="fas fa-clipboard"), **{
                                             "_data-src": value,
                                             "_class": "copy_buttom"
                                         }),
                                     _class="icon_awesome_panel"),
                                 _class="icon_awesome_panel_wrapper"),
                 onOpen=self._on_icon_open), **{
                     "_data-icon": value,
                     "_class": "icon_awesome-button"
                 }),
             DIV(TABLE(TR(TD(" ".join(
                 value.split(" ")[1].split("-")[1:])))),
                 _class="icon_awesome-label"),
             _class="icon_awesome-wrapper"),
         _class="p-col w1p50 w3p25 w4p14",
     )
     return html
コード例 #2
0
ファイル: project.py プロジェクト: PhanterJR/phanterpwa
    def _xml_projects_list(self, json):
        table = XTABLE(
            "applications-table",
            XTRH(
                "applications-table-head",
                *["Application Name", "Build Folder"],
                DIV(
                    I(_class="fas fa-plus"), **{
                        "_phanterpwa-way": "application/new",
                        "_class": "icon_button wave_on_click"
                    })))
        apps_dict = dict(json.config.APPS)
        for x in apps_dict.keys():
            table.append(
                XTRD(
                    "applications-table-data-{0}".format(x), x,
                    apps_dict[x]["build_folder"],
                    widgets.MenuBox(
                        "drop_2_{0}".format(x),
                        DIV(I(_class="fas fa-ellipsis-v"),
                            _class="icon_button wave_on_click"),
                        custom_menu=UL(
                            LI(
                                "Compile", **{
                                    "_id":
                                    "btn_compile_app_project_{0}".format(x),
                                    "_class": "btn_compile_app_project",
                                    "_data-path":
                                    json.config['PROJECT']['path'],
                                    "_data-app": x
                                }),
                            LI(
                                "View", **{
                                    "_class":
                                    "botao_editar_role",
                                    "_phanterpwa-way":
                                    "application/{0}/view".format(x)
                                }),
                            LI(
                                "Delete", **{
                                    "_class":
                                    "botao_editar_role",
                                    "_phanterpwa-way":
                                    "application/{0}/delete".format(x)
                                }),
                            **{
                                "data-menubox": "drop_2_{0}".format(x),
                                "_class": 'dropdown-content'
                            },
                        ),
                        onOpen=lambda: window.PhanterPWA.flash("foi clicado!"
                                                               ))))

        url = json.config.BACKEND.api.http_address

        ShowApi = left_bar.LeftBarButton(
            "view_api", "Open Api", I(_class="fas fa-globe"), **{
                "position":
                "top",
                "ways": [
                    lambda: True if json.running is True and window.PhanterPWA.
                    get_current_way().startswith("project/{0}".format(
                        self.request.get_arg(0))) else False
                ],
                "onStart":
                lambda: self._bind_open_api(self.request.get_arg(0), url)
            })
        window.PhanterPWA.Components['left_bar'].add_button(ShowApi)

        html = DIV(
            XSECTION(
                LABEL("Summary"),
                DIV(DIV(DIV(DIV(STRONG("PROJECT PATH"),
                                SPAN(json.config['PROJECT']['path']),
                                _class="e-tagger-wrapper"),
                            _class="p-col w1p100"),
                        _class="p-row"),
                    DIV(DIV(DIV(STRONG("IDENTIFIER NAME"),
                                SPAN(json.config['PROJECT']['name']),
                                _class="e-tagger-wrapper"),
                            _class="p-col w1p100"),
                        _class="p-row"),
                    DIV(DIV(DIV(STRONG("TITLE"),
                                SPAN(json.config['PROJECT']['title']),
                                _class="e-tagger-wrapper"),
                            _class="p-col w1p100"),
                        _class="p-row"),
                    DIV(DIV(DIV(STRONG("AUTHOR"),
                                SPAN(json.config['PROJECT']['author']),
                                _class="e-tagger-wrapper"),
                            _class="p-col w1p100"),
                        _class="p-row"),
                    DIV(DIV(DIV(STRONG("VERSION"),
                                SPAN(json.config['PROJECT']['version']),
                                _class="e-tagger-wrapper"),
                            _class="p-col w1p100 w3p50"),
                        DIV(DIV(STRONG("COMPILATION"),
                                SPAN(json.config['PROJECT']['compilation']),
                                _class="e-tagger-wrapper"),
                            _class="p-col w1p100 w3p50"),
                        _class="p-row"),
                    DIV(DIV(DIV(STRONG("DEBUG"),
                                SPAN(json.config['PROJECT']['debug']),
                                _class="e-tagger-wrapper"),
                            _class="p-col w1p100 w3p50"),
                        DIV(DIV(STRONG("STATUS"),
                                SPAN("Running" if json.running else "Stopped",
                                     _style="color: {0};".format(
                                         "green" if json.running else "red")),
                                _class="e-tagger-wrapper"),
                            _class="p-col w1p100 w3p50"),
                        _class="p-row"),
                    _class="e-padding_20")), table)
        html.html_to("#applications_container")
        self.widgets_initialize()
コード例 #3
0
ファイル: menus.py プロジェクト: PhanterJR/phanterpwa
 def __init__(self, gatehandler):
     self.gatehandler = gatehandler
     html = CONCATENATE(
         DIV(DIV(DIV(DIV("COMPONENTES", _class="phanterpwa-breadcrumb"),
                     DIV("MENUS", _class="phanterpwa-breadcrumb"),
                     _class="phanterpwa-breadcrumb-wrapper"),
                 _class="p-container"),
             _class='title_page_container card'),
         DIV(DIV(DIV(
             H2(I18N("MenuBox")),
             HR(),
             XSECTION(
                 LABEL(I18N("Example"), ' 01'),
                 DIV(STRONG(I18N("Code"), ":"),
                     codemirror.CodeMirrorHelper(
                         "codemirrorfirstmenu", **{
                             "value": codemirrorfirstmenu,
                             "mode": "python",
                             "lineNumbers": True
                         }),
                     STRONG(I18N("Results"), ":"),
                     DIV(widgets.MenuBox(
                         "firstmenu", I(_class="fas fa-ellipsis-v"),
                         DIV("Option1", _class="my_button_one"),
                         DIV("Option2", _class="my_button_two")),
                         _class="widget_input_example"),
                     _class="e-padding_10"),
             ),
             XSECTION(
                 LABEL(I18N("Example"), ' 02'),
                 DIV(STRONG(I18N("Code"), ":"),
                     codemirror.CodeMirrorHelper(
                         "codemirrormenu2", **{
                             "value": codemirrormenu2,
                             "mode":
                             "python",
                             "lineNumbers": True
                         }),
                     STRONG(I18N("Results"), ":"),
                     DIV(widgets.MenuBox(
                         "firstmenu2", "My menu",
                         DIV("Option1", _class="my_button_one"),
                         DIV("Option2", _class="my_button_two"), **{
                             "width":
                             200,
                             "onOpen":
                             lambda el: jQuery(el).find(
                                 ".phanterpwa-widget-menubox-option")
                             .off("click.phanterpwa-awesome-icon", ).on(
                                 "click.phanterpwa-awesome-icon", lambda:
                                 window.PhanterPWA.flash("I'm clicked!"))
                         }),
                         _class="widget_input_example"),
                     _class="e-padding_10"),
             ),
             XSECTION(
                 LABEL(I18N("Example"), ' 01 (wear="android")'),
                 DIV(STRONG(I18N("Code"), ":"),
                     codemirror.CodeMirrorHelper(
                         "codemirrorsidebyside", **{
                             "value": codemirrorsidebyside,
                             "mode": "python",
                             "lineNumbers": True
                         }),
                     STRONG(I18N("Results"), ":"),
                     DIV(DIV(DIV(widgets.MenuBox(
                         "sideleft", I(_class="fas fa-ellipsis-v"),
                         DIV("Option1", _class="my_button_one"),
                         DIV("Option2", _class="my_button_two")),
                                 _class="p-col w1p10"),
                             DIV(" ", _class="p-col w1p80"),
                             DIV(widgets.MenuBox(
                                 "sideright", I(_class="fas fa-ellipsis-v"),
                                 DIV("Option1", _class="my_button_one"),
                                 DIV("Option2", _class="my_button_two")),
                                 _class="p-col w1p10"),
                             _class="p-row"),
                         _class="widget_input_example"),
                     _class="e-padding_10"),
             ),
             _class="card e-padding_20"),
                 _class="new-container"),
             _class="phanterpwa-container p-container"))
     # jQuery("#main-container").html(html.jquery())
     html.html_to("#main-container")
コード例 #4
0
    def _xml_projects_list(self, json):
        table = XTABLE(
            "projects-table",
            XTRH(
                "projects-table-head",
                *["Project Name", "Diretory", "Status", "Port"],
                DIV(
                    I(_class="fas fa-plus"), **{
                        "_phanterpwa-way": "project/novo",
                        "_class": "icon_button wave_on_click"
                    })))
        for x in json.projects_list:
            btn_lbl = "run"
            if x[2] == "running":
                btn_lbl = "stop"
            table.append(
                XTRD(
                    "projects-table-data-{0}".format(x[0]), x[0], x[1],
                    SPAN(
                        x[2].capitalize(), **{
                            "_class":
                            "project_status_content {0}".format(x[2]),
                            "_id": "project_status_{0}".format(x[0]),
                            "_data-path": x[1],
                        }), x[3],
                    widgets.MenuBox(
                        "drop_project_{0}".format(x[0]),
                        DIV(I(_class="fas fa-ellipsis-v"),
                            _class="icon_button wave_on_click"),
                        custom_menu=UL(
                            LI(
                                btn_lbl.capitalize(), **{
                                    "_id":
                                    "btn_run_stop_project_{0}".format(x[0]),
                                    "_class": "btn_run_stop_project",
                                    "_data-path": x[1]
                                }),
                            LI(
                                "View", **{
                                    "_class":
                                    "botao_editar_role",
                                    "_phanterpwa-way":
                                    "project/{0}/view".format(x[0])
                                }),
                            LI(
                                "Delete", **{
                                    "_class":
                                    "botao_editar_role",
                                    "_phanterpwa-way":
                                    "project/{0}/delete".format(x[0])
                                }),
                            **{
                                "data-menubox":
                                "drop_project_{0}".format(x[0]),
                                "_class": 'dropdown-content'
                            },
                        ),
                        onOpen=self._bind_btn_run_stop)))

        html = DIV(
            XSECTION(
                LABEL("Enviroment"),
                DIV(DIV(DIV(DIV(STRONG("PYTHON EXECUTABLE"),
                                SPAN(json.enviroment.python_executable),
                                _class="e-tagger-wrapper"),
                            _class="p-col w1p100"),
                        _class="p-row"),
                    DIV(DIV(DIV(STRONG("PYTHON PATH"),
                                SPAN(json.enviroment.python_path),
                                _class="e-tagger-wrapper"),
                            _class="p-col w1p100"),
                        _class="p-row"),
                    DIV(DIV(DIV(STRONG("PYTHON VERSION"),
                                SPAN(json.enviroment.python_version),
                                _class="e-tagger-wrapper"),
                            _class="p-col w1p100 w3p50"),
                        DIV(DIV(STRONG("PHANTERPWA VERSION"),
                                SPAN(json.enviroment.phanterpwa_version),
                                _class="e-tagger-wrapper"),
                            _class="p-col w1p100 w3p50"),
                        _class="p-row"),
                    DIV(DIV(DIV(STRONG("PROJECTS FOLDER"),
                                SPAN(json.enviroment.projects_folder),
                                _class="e-tagger-wrapper"),
                            _class="p-col w1p100"),
                        _class="p-row"),
                    _class="e-padding_20")), table)
        html.html_to("#projects_container")
        self._binds()
コード例 #5
0
ファイル: examples.py プロジェクト: PhanterJR/phanterpwa
 def __init__(self, gatehandler):
     self.gatehandler = gatehandler
     html = CONCATENATE(
         DIV(DIV(DIV(DIV("COMPONENTES", _class="phanterpwa-breadcrumb"),
                     DIV("TEXTAREA", _class="phanterpwa-breadcrumb"),
                     _class="phanterpwa-breadcrumb-wrapper"),
                 _class="p-container"),
             _class='title_page_container card'),
         DIV(DIV(DIV(
             H2(I18N("Textboxs")),
             HR(),
             XSECTION(
                 LABEL("Type: Password"),
                 DIV(widgets.Textarea(
                     "textare1",
                     label="Label Widget",
                 ),
                     _class="component_materialize"),
             ),
             XSECTION(
                 LABEL("Type: Password"),
                 DIV(widgets.Textarea("textare2",
                                      label="Label Widget",
                                      wear="shadows"),
                     _class="component_shadows"),
             ),
             XSECTION(
                 LABEL("Type: Password"),
                 DIV(widgets.Textarea("textare3",
                                      label="Label Widget",
                                      wear="elegant"),
                     _class="component_shadows"),
             ),
             H2(I18N("Dropdown")),
             HR(),
             XSECTION(
                 LABEL("Value: True"),
                 DIV(DIV(DIV(widgets.MenuBox(
                     "drop1",
                     xml_menu=UL(LI(
                         SPAN("Editar", _class="botao_editar_socio")),
                                 LI(
                                     SPAN("Visualizar",
                                          _class="botao_visualizar_socio")),
                                 _class='dropdown-content')),
                             _class="p-col w1p10"),
                         DIV(" ", _class="p-col w1p80"),
                         DIV(widgets.MenuBox(
                             "drop2",
                             xml_menu=UL(LI(
                                 SPAN("Editar",
                                      _class="botao_editar_socio")),
                                         LI(
                                             SPAN(
                                                 "Visualizar",
                                                 _class=
                                                 "botao_visualizar_socio")),
                                         _class='dropdown-content')),
                             _class="p-col w1p10"),
                         _class="p-row"),
                     _class="component_materialize"),
             ),
             H2(I18N("Checkbox")),
             HR(),
             XSECTION(
                 LABEL("Value: True"),
                 DIV(widgets.CheckBox(
                     "check1",
                     value=True,
                     label="Label Widget",
                 ),
                     _class="component_materialize"),
             ),
             XSECTION(
                 LABEL("Value: False"),
                 DIV(widgets.CheckBox(
                     "check2",
                     value=False,
                     label="Label Widget",
                 ),
                     _class="component_materialize"),
             ),
             XSECTION(
                 LABEL("Value: False"),
                 DIV(widgets.CheckBox("check3",
                                      value=False,
                                      label="Label Widget",
                                      wear="elegant"),
                     _class="component_materialize"),
             ),
             H2(I18N("Radiobox")),
             HR(),
             XSECTION(
                 LABEL("Value: True"),
                 DIV(widgets.RadioBox(
                     "radio1",
                     value=True,
                     label="Label Widget",
                 ),
                     _class="component_materialize"),
             ),
             XSECTION(
                 LABEL("Value: False"),
                 DIV(widgets.RadioBox(
                     "radio2",
                     value=False,
                     label="Label Widget",
                 ),
                     _class="component_materialize"),
             ),
             XSECTION(
                 LABEL("Value: False"),
                 DIV(widgets.RadioBox("radio4",
                                      value=False,
                                      label="Label Widget",
                                      name="my_radio"),
                     widgets.RadioBox("radio5",
                                      value=False,
                                      label="Label Widget",
                                      name="my_radio"),
                     widgets.RadioBox("radio6",
                                      value=False,
                                      label="Label Widget",
                                      name="my_radio"),
                     widgets.RadioBox("radio7",
                                      value=False,
                                      label="Label Widget",
                                      name="my_radio"),
                     _class="component_materialize"),
             ),
             H2(I18N("ListString")),
             HR(),
             XSECTION(
                 LABEL("Value: [\"Value01\", \"Value02\", \"Value03\"]"),
                 DIV(widgets.ListString(
                     "liststring1",
                     value=["Value01", "Value02", "Value03"],
                     label="Label Widget",
                 ),
                     _class="component_materialize"),
             ),
             XSECTION(
                 LABEL(
                     "data_set: [\"Value04\", \"Value05\"] and editable: False"
                 ),
                 DIV(widgets.ListString(
                     "liststring2",
                     value=["Value01", "Value02", "Value03"],
                     label="Label Widget",
                     data_set=["Value04", "Value05"],
                     editable=False),
                     _class="component_materialize"),
             ),
             _class="card e-padding_20"),
                 _class="new-container"),
             _class="phanterpwa-container p-container"))
     jQuery("#main-container").html(html.jquery())