Example #1
0
def main():

    # make the application quit when the last window is closed
    elm.policy_set(elm.ELM_POLICY_QUIT, elm.ELM_POLICY_QUIT_LAST_WINDOW_CLOSED)

    # Create the main app window
    win = elm.StandardWindow("main",
                             "My first window",
                             autodel=True,
                             size=(300, 200))

    # Create a simple label
    label = elm.Label(win,
                      text="Hello World Python !",
                      size_hint_expand=EXPAND_BOTH,
                      size_hint_fill=FILL_BOTH)
    win.resize_object_add(label)
    label.show()

    # Show the window and start the efl main loop
    win.show()
    elm.run()
Example #2
0
    handler = logging.StreamHandler()
    formatter = logging.Formatter(
        "%(name)s [%(levelname)s] %(module)s:%(lineno)d   %(message)s")
    handler.setFormatter(formatter)

    efl_log = logging.getLogger("efl")
    efl_log.addHandler(handler)

    log.addHandler(handler)
    log.setLevel(logging.DEBUG)

    evas.init()
    elm.init()

    elm.policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED)

    doc_specs = {}

    cfg_base_path = BaseDirectory.save_config_path("lekha")
    cfg_file_path = os.path.join(cfg_base_path, "document_positions")

    if not os.path.exists(cfg_file_path):
        try:
            open(cfg_file_path, "w").close()
        except Exception as e:
            log.debug(e)

    with open(cfg_file_path, "r") as fp:
        try:
            doc_specs = json.load(fp)
    def do_change_uri(en):
        web.uri = en.entry

    def did_change_uri(web, uri, en):
        en.entry = uri

    en.callback_activated_add(do_change_uri)
    web.callback_uri_changed_add(did_change_uri, en)

    # Sync title
    def did_change_title(web, title, win):
        win.title_set("Web - %s" % title)
    web.callback_title_changed_add(did_change_title, win)

    win.show()


if __name__ == "__main__":
    elementary.init()
    if not elementary.need_web():
        elementary.shutdown()
        raise SystemExit("EFL-webkit not available!")

    elementary.policy_set(elementary.ELM_POLICY_QUIT,
                          elementary.ELM_POLICY_QUIT_LAST_WINDOW_CLOSED)

    web_clicked(None)

    elementary.run()
    elementary.shutdown()
Example #4
0
    handler = logging.StreamHandler()
    formatter = logging.Formatter(
        "%(name)s [%(levelname)s] %(module)s:%(lineno)d   %(message)s")
    handler.setFormatter(formatter)

    efl_log = logging.getLogger("efl")
    efl_log.addHandler(handler)

    log.addHandler(handler)
    log.setLevel(logging.DEBUG)

    evas.init()
    elm.init()

    elm.policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED)

    doc_specs = {}

    cfg_base_path = BaseDirectory.save_config_path("lekha")
    cfg_file_path = os.path.join(cfg_base_path, "document_positions")

    if not os.path.exists(cfg_file_path):
        try:
            open(cfg_file_path, "w").close()
        except Exception as e:
            log.debug(e)

    with open(cfg_file_path, "r") as fp:
        try:
            doc_specs = json.load(fp)