示例#1
0
def start():
    email = refresh.Email("*****@*****.**", "password")
    email.login()
    email.get_new_emails()
    email.say()
    x = a.listen()
    while True:
        if x == "help":
            a.say(
                "read, to read out your unread emails, new, to compose a new email, refresh, to refresh your inbox, close, to close the app"
            )
        elif x == "read":
            reademails.read(email.body, email.subject, email.sender,
                            email.user, email.passw)
        elif x == "new":
            compose.compos(f=email.user, p=email.passw)
        elif x == "@#":
            a.say("i didnt catch that, could you repeat it")
        elif x == "close":
            webview.destroy_window()
            email.close()
            exit()
        elif x == "refresh" or "reference":
            email.get_new_emails()
            email.say()
        else:
            a.say("say a valid command")
        x = ''
        x = a.listen()
示例#2
0
def destroy():
    # show the window for a few seconds before destroying it:
    time.sleep(5)

    print("Destroying window..")
    webview.destroy_window()
    print("Destroyed!")
示例#3
0
def load_html():
    child_window = webview.create_window('Window #2')
    assert child_window != 'MainWindow'
    webview.load_html(
        '<body style="background: red;"><h1>Master Window</h1></body>',
        uid=child_window)
    webview.destroy_window(child_window)
示例#4
0
def evaluate_js():
    child_window = webview.create_window('Window #2', 'https://google.com')
    assert child_window != 'MainWindow'
    result1 = webview.evaluate_js("""
        document.body.style.backgroundColor = '#212121';
        // comment
        function test() {
            return 2 + 5;
        }
        test();
    """)

    assert result1 == 7

    result2 = webview.evaluate_js("""
        document.body.style.backgroundColor = '#212121';
        // comment
        function test() {
            return 2 + 2;
        }
        test();
    """,
                                  uid=child_window)
    assert result2 == 4
    webview.destroy_window(child_window)
示例#5
0
def destroy():
    # show the window for a few seconds before destroying it:
    time.sleep(5)

    print("Destroying window..")
    webview.destroy_window()
    print("Destroyed!")
示例#6
0
    def stop():
        event.wait()
        time.sleep(delay)
        webview.destroy_window()

        if sys.platform == 'darwin':
            from .util_cocoa import mouseMoveRelative

            mouseMoveRelative(1, 1)
示例#7
0
    def _js_bridge(webview):
        webview.load_html('<html><body><h1>Master window</h1></body></html>')

        api2 = Api2()
        child_window = webview.create_window('Window #2', js_api=api2)
        webview.load_html('<html><body><h1>Secondary window</h1></body></html>', uid=child_window)

        assert_js(webview, 'test1', 1)
        assert_js(webview, 'test2', 2, uid=child_window)

        webview.destroy_window(child_window)
        destroy_event.set()
示例#8
0
def js_bridge():
    class Api2:
        def test2(self, params):
            return 2

    webview.load_html('<html><body><h1>Master window</h1></body></html>')

    api2 = Api2()
    child_window = webview.create_window('Window #2', js_api=api2)
    assert child_window != 'MainWindow'
    webview.load_html('<html><body><h1>Secondary window</h1></body></html>', uid=child_window)
    assert_js(webview, 'test1', 1)
    assert_js(webview, 'test2', 2, uid=child_window)

    webview.destroy_window(child_window)
示例#9
0
def show_carrousel():
    time.sleep(5)
    while True:
        script = [line.rstrip('\n') for line in open('carrousel1.txt')]  
        for line in script: 
            if (line == "quit"):
               webview.destroy_window()
               sys.exit(0)
            try:
                page,timeout=line.split(',')
                print page
                webview.load_url(page)
                time.sleep(int(timeout))
            except:
                print "ERROR:",line
示例#10
0
def js_bridge():
    class Api2:
        def test2(self, params):
            return 2

    webview.load_html('<html><body><h1>Master window</h1></body></html>')

    api2 = Api2()
    child_window = webview.create_window('Window #2', js_api=api2)
    assert child_window != 'MainWindow'
    webview.load_html('<html><body><h1>Secondary window</h1></body></html>', uid=child_window)

    assert_js(webview, 'test1', 1)
    assert_js(webview, 'test2', 2, uid=child_window)

    webview.destroy_window(child_window)
示例#11
0
def run_view(url, stop_event):
    """
    this should be in it's own thread
    :param url:string
    :param stop_event: threading.Event, triggered when shutdown time happens
    :return: None
    """
    logger.info("waiting for webserver to start...")
    block_until_server_started(url)

    logger.info("starting view...")

    webview.create_window(title="Simple Mod Installer", url=url)

    # the window has been closed, lets shut down
    logger.info("View closed, shutting down...")
    webview.destroy_window()

    stop_event.set()
示例#12
0
    def get_cookies():
        timeout = 120

        def is_logged_in():
            return webview.evaluate_js(
                "document.querySelector('#logout-btn') !== null")

        while not webview.webview_ready() or not is_logged_in():
            time.sleep(1)
            timeout -= 1
            if timeout == 0:
                raise AuthenticationFailed("Can't login, timeout exceeded.")
            if not webview.window_exists():
                raise AuthenticationFailed(
                    "Webview window closed prematurely.")

        cookies = webview.evaluate_js("document.cookie")
        webview.destroy_window()
        return cookies
示例#13
0
def evaluate_js():
    child_window = webview.create_window('Window #2', 'https://google.com')
    assert child_window != 'MainWindow'
    result1 = webview.evaluate_js("""
        document.body.style.backgroundColor = '#212121';
        // comment
        function test() {
            return 2 + 5;
        }
        test();
    """)

    assert result1 == 7

    result2 = webview.evaluate_js("""
        document.body.style.backgroundColor = '#212121';
        // comment
        function test() {
            return 2 + 2;
        }
        test();
    """, uid=child_window)
    assert result2 == 4
    webview.destroy_window(child_window)
示例#14
0
def on_stackoverflow(data):
    if data["devHand"] == True:
        try:
            webview.destroy_window()
        except Exception:
            pass

        print("Received StackOverflow question:", data["query"])
        #webbrowser.open(data["link"])

        with open("style.css") as css_file:
            css = css_file.read()

            html = f"""<!DOCTYPE html>
            <html>
                <head>
                    <title>{data['query']}</title>
                    <style>
                        {css}
                    </style>
                </head>
                <body>
                    <div id="answer">
                        <h3 style="answer-heading">BEST ANSWER ({data['score']})</h3>
                        {data['html']}
                    </div>
                </body>
            </html>
            """

        def load_html():
            webview.load_html(html)

        t = threading.Thread(target=load_html)
        t.start()
        webview.create_window(data["query"], width=500, height=700)
示例#15
0
def destroy():
    import time
    time.sleep(5)
    print("Destroying window..")
    webview.destroy_window()
示例#16
0
 def quit(self, arg):
     # until i find a better way
     webview.destroy_window()
示例#17
0
 def displayTab(self):
     self.close()
     webview.destroy_window()
     views = DisplayB()
     views.show()
     views.exec_()
示例#18
0
 def _bg_color(webview):
     child_window = webview.create_window('Window #2', background_color='#0000FF')
     webview.webview_ready()
     webview.destroy_window(child_window)
     destroy_event.set()
示例#19
0
 def _load_url(webview):
     child_window = webview.create_window('Window #2')
     webview.load_url('https://google.com', uid=child_window)
     webview.destroy_window(child_window)
     destroy_event.set()
示例#20
0
def signal_handler(signal, frame):
    log.info('You pressed Ctrl+C!')
    webview.destroy_window()
    sys.exit(0)
示例#21
0
 def close_message_listener(receiver):
     close = receiver.recv()
     if close:
         webview.destroy_window()
         print('窗口  close')
示例#22
0
 def navtomov(self):
     self.close()
     webview.destroy_window()
     newvar = mplayer()
     newvar.exec_()
示例#23
0
def load_url():
    child_window = webview.create_window('Window #2')
    assert child_window != 'MainWindow'
    webview.load_url('https://google.com', uid=child_window)
    webview.destroy_window(child_window)
示例#24
0
def load_html():
    child_window = webview.create_window('Window #2')
    assert child_window != 'MainWindow'
    webview.load_html('<body style="background: red;"><h1>Master Window</h1></body>', uid=child_window)
    webview.destroy_window(child_window)
示例#25
0
def quit():
    """docstring for quit"""
    webview.destroy_window()
    return jsonify({})
示例#26
0
def close_down():
    response = {'message': 'closing'}
    webview.destroy_window()
    os._exit(0)

    return jsonify(response)
示例#27
0
 def stop(self):
     webview.destroy_window()
示例#28
0
def destroy():
    import time
    time.sleep(5)
    print("Destroying window..")
    webview.destroy_window()
    print("Destroyed!")
示例#29
0
 def close(self):
     webview.destroy_window()
示例#30
0
def bg_color():
    child_window = webview.create_window('Window #2', background_color='#0000FF')
    assert child_window != 'MainWindow'
    webview.webview_ready()
    webview.destroy_window(child_window)
示例#31
0
 def on_execute(self, *args):
     global commands
     commands += args
     socketio_client.disconnect()
     socketio.stop()
     webview.destroy_window()
示例#32
0
def load_url():
    child_window = webview.create_window('Window #2')
    assert child_window != 'MainWindow'
    webview.load_url('https://google.com', uid=child_window)
    webview.destroy_window(child_window)
示例#33
0
def bg_color():
    child_window = webview.create_window('Window #2', background_color='#0000FF')
    assert child_window != 'MainWindow'
    webview.webview_ready()
    webview.destroy_window(child_window)
示例#34
0
 def _load_html(webview):
     child_window = webview.create_window('Window #2')
     webview.load_html('<body style="background: red;"><h1>Master Window</h1></body>', uid=child_window)
     webview.destroy_window(child_window)
     destroy_event.set()
示例#35
0
文件: webview.py 项目: AstraLuma/smol
 def close(self):
     """
     Destroy a web view window
     """
     webview.destroy_window()