def on_get_token(self, *args): token = args[0]['token'] sid = args[0]['sid'] login_url = "http://{}:{}/login?token={}&sid={}".format( HOST, PORT, token, sid) print(login_url) webview.load_url(login_url)
def start(): global task_process # pylint: disable=global-statement # show loading screen webview.load_html(get_loading_screen()) double_instance = server_started() if not double_instance: # start web server logger.debug("Starting server") t = Thread(target=repomaker.runserver) t.daemon = True t.start() # wait for server to start while not server_started(): if not t.is_alive(): logging.error('Repomaker webserver could not be started.') return time.sleep(0.1) # load repomaker into webview webview.load_url(URL) if not double_instance: # wait and then start the background tasks for i in range(0, WAIT_BEFORE_TASKS): if terminate: return time.sleep(1) if not terminate: # this needs to run as its own process task_process = subprocess.Popen(['repomaker-tasks'])
def on_message(ws, message): """ The screen react to MOVE and SHOW messages only""" try: pkg = json.loads(message) except Exception: return ws.send( msg.create_error_pkg(u'Format error')) if pkg['TYPE'] == msg.MOVE: # MOVE THE screen pass if pkg['TYPE'] == msg.SHOW: time.sleep(pkg['delay_s']) webview.load_url(pkg['url']) webview.evaluate_js( """ if (window.hasOwnProperty('Reveal')) { Reveal.addEventListener( 'slidechanged', function( event ) { if(Reveal.isLastSlide()){ pywebview.api.shown() } } ) }; """ ) # else: # print( # msg.create_error_pkg(u'Unknown TYPE')) print(message)
def _change_url(webview): try: webview.load_url('https://www.google.org') q.put(0) except Exception as e: q.put(1) pytest.fail('Exception occured:\n{0}'.format( traceback.format_exc()))
def load_url(self, url): """ WARNING: May segfault with PyWebview v1.2.2 Load a new URL into a previously created WebView window. This function must be invoked after WebView windows is created with create_window(). Otherwise an exception is thrown. :param url: url to load """ webview.load_url(url)
def inicialize(self, parent): Lb1 = Label(parent, text="First Name") Lb1.grid(row=0, column=0) t = threading.Thread(target=load_html) t.start() webview.create_window('Load HTML Example') webview.create_window("Meu navegador", "./Nota_Fiscal.html", width=800, height=600, resizable=True, fullscreen=False) webview.load_url("./Nota_Fiscal.html")
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
def logic_thread(): # get path to local files fpath = os.path.abspath(__file__) fpath = os.path.join(os.path.split(fpath)[0], "gui.html") # wait until window ready while True: print 'checking if window ready...' if webview.window_exists(): break time.sleep(.1) # load gui html file print "get_current_url() returns: ", webview.get_current_url() webview.load_url(fpath) print "get_current_url() returns: ", webview.get_current_url()
def run(self): for idx, url in self.urls.iteritems(): print "Starting " + self.name + " on " + url webview.load_url(url) print 'Getting input...' for lbl in self.lbls: while True: #ask for input while the user makes mistakes try: rep = input(lbl + '?') if rep not in [0, 1]: raise self.data_lbl.loc[idx, lbl] = rep except: print "Please enter 0 or 1" else: break self.past_df.update(self.data_lbl, overwrite=False) self.past_df.to_csv('dom_lbl.csv', index=False)
def changeWebView(self, params): # Add key 'url' with a URL to change global CURRENT_URL if self._is_debug: print(params) p = self.parse_react_json(params) if p == '': response = {'message': ''} return json.dumps(response) if u'url' in p: CURRENT_URL = p[u'url'] self.run_lights(18, 5) webview.load_url(CURRENT_URL) response = {'message': 'ok'} else: response = {'message': ''} return json.dumps(response)
def connect_to_wifi(): global captive_portal_url global user_continue_url captive_portal_url = request.form["captive_portal_url"] base_grant_url = request.host_url + "splash/grant" user_continue_url = request.form["user_continue_url"] node_mac = generate_fake_mac() client_ip = request.remote_addr client_mac = generate_fake_mac() splashclick_time = datetime.datetime.now() full_url = captive_portal_url + \ "?base_grant_url=" + base_grant_url + \ "&user_continue_url=" + user_continue_url + \ "&node_mac=" + node_mac + \ "&client_ip=" + client_ip + \ "&client_mac=" + client_mac webview.load_url(full_url, uid='master') return render_template("connected.html", full_url=full_url)
def on_release(key): global CURRENT_URL, HACKPACK_URL, _is_debug, _max_lights if _is_debug: print('{0} released'.format(key)) circular_keys.append(key) if keyboard.Key.esc == \ circular_keys[0] == circular_keys[1] == circular_keys[2]: circular_keys.append(0) circular_keys.append(0) circular_keys.append(0) if CURRENT_URL is not HACKPACK_URL: if _is_debug: print("RESETTING!") CURRENT_URL = HACKPACK_URL webview.load_url(HACKPACK_URL) os.system(' '.join([ 'python', '/home/pi/firmware/drivers/leds/light_client/lightclient.py', '-d', '24', '-r', '5', '-i', str(_max_lights) ]))
def file_monitor(): global _fileMonitorActive global _current_url while _fileMonitorActive: time.sleep(5) print 'Checking file..' file_path = '/home/pi/config.txt' file_exists = os.path.isfile(file_path) # print('Current url: ' + _current_url) if file_exists: f = open('/home/pi/config.txt', 'r') if f.mode == 'r': requested_url = f.read() if requested_url != _current_url: _current_url = requested_url webview.load_url(_current_url)
@app.route('/') def index(): return render_template('index.html') @app.route('/play') def play(): return render_template('play.html') def start_server(debug=False): app.run(debug=debug) if __name__ == '__main__': if developmentMode: #start server start_server(debug=True) else: # start the server and create a window for the video t = threading.Thread(target=start_server) t.daemon = True t.start() time.sleep(0.5) webview.create_window("Apple Aerial", "http://127.0.0.1:5000", debug=True) webview.load_url("http://127.0.0.1:5000") sys.exit()
def compos(t='', r='', f='', p='', body=''): done = False subj = '' gui.showUnread(t, f, r, body) while not done: if t == '': a.say("Who do you want to send this email to") to = a.listen() while to == "@#": a.say("i didnt catch that, could you repeat") to = a.listen() else: to = t to = to.replace(' ', '') gui.showUnread(to, f, subj, body) if r == '': a.say("What is the subject") subj = a.listen() while subj == "@#": a.say("i didnt catch that, could you repeat") subj = a.listen() else: subj = r gui.showUnread(to, f, subj, str(body)) a.say("What is the body") bdone = False body = "" while not bdone: x = a.listen() if x == '@#': a.say("i didn't catch that, could you repeat") continue body = body + ' ' + x gui.showUnread(to, f, subj, body) a.say("are you done with the body") s = a.listen() if s == "yes": bdone = True break elif s == 'no': print("ok") else: a.say("yes or no") if to.lower() == "proto": to = to + "@protonmail.com" elif to.index("@") != -1: print(to) else: to = to + "@gmail.com" gui.showUnread(to, f, subj, body) a.say("To: " + to) a.say("subject: " + subj) a.say("body: " + body) a.say("are you done, and ready to send") v = a.listen() while v not in ["yes, no"]: if v == "yes": send(f, p, to, subj, body) print("sent") a.say("sent") done = True webview.load_url("file://" + os.getcwd() + "/GUI/index.html") print("file://" + os.getcwd() + "/GUI/index.html") a.say( "read, to read out your unread emails, new, to compose a new email, refresh, to refresh your inbox, close, to close this app" ) break elif v == "no": break else: a.say("i couldnt catch that, please repeat") v = a.listen()
def change_url(): sleep(3) webview.load_url("https://cygo.network")
def goto(self, endpoint): webview.load_url(join(self.url, endpoint))
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)
def open_url(url, client): webview.load_url(url) client.publish('%s/opened' % mqtt_client_name, url)
def reload(): webview.load_url('http://localhost:5000') return jsonify({})
def url_load(): webview.load_url('https://www.google.org')
def change_url(): # wait a few seconds before changing url: time.sleep(10) # change url: webview.load_url("https://pywebview.flowrl.com/hello")
def change_url(): import time time.sleep(3) webview.load_url("http://www.hao123.com/") webview.gui.set_title("nihao","master") print(webview.get_current_url())
def newurl(self, args): webview.load_url(str(self.addUrl.text()))
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()
def reload(): blink.refresh() webview.load_url("http://127.0.0.1:5000/blinker")
def webload(self, url_load): webview.load_url(url_load)
def load_html(): webview.load_url("http://www.baidu.com") print(123123) time.sleep(2) webview.evaluate_js('alert("w00t")') print(2222)
def change_url(): import time time.sleep(10) webview.load_url("http://www.html5zombo.com/")
def change_url(): # wait a few seconds before changing url: time.sleep(10) # change url: webview.load_url("http://www.html5zombo.com/")