Example #1
0
neighborhoods = soup.find_all("span", "result-hood")

area, desc, dates = [], [], []

with open("output.html", "w+") as o:
	for z in times:
		x = z.getText()
		dates.append(x)
	
	for d in descriptions:
		t = d.getText()
		l = d["href"]
		dl = t + " " + l + " " + "\n"
		desc.append(dl)
	
	for n in neighborhoods:
		n = n.getText()
		area.append(n)
	
	for a, b, c in zip(dates, desc, area):
		output = a + "\n" + b + "\n" + c + "<br><br>"
		o.write(output)

file = os.path.abspath("output.html")

w = ui.WebView()

w.load_url(file)

w.present()
            slide_percent = self.detail.x / self.master.width
            self.master.alpha = slide_percent

    def touch_ended(self, touch):
        def slide_left():
            self.detail.x = 0
            self.master.alpha = 0

        def slide_right():
            self.detail.x = self.master.width
            self.master.alpha = 1

        if self.x_movement == 'right':
            ui.animate(slide_right, duration=0.4)
        elif self.x_movement == 'left':
            ui.animate(slide_left, duration=0.4)


master = ui.WebView()
master.load_html('master')
master.flex = 'WH'
master.scales_page_to_fit = False
detail = ui.WebView()
detail.load_url('http://www.google.com/')
detail.flex = 'WH'
detail.scales_page_to_fit = False

a = SideMenuSlideView(master, detail)

# --------------------
Example #3
0
def main():
	global button_pressed,file_txt,file_html
	
	console.clear()
	
	if appex.is_running_extension():
		url = appex.get_url()
	else:
		url = clipboard.get()
		
	if url == None:
		console.alert('Nothing in the ClipBoard','','Ok',hide_cancel_button=True)
		return
		
	if url[:7] <> 'http://' and url[:8] <> 'https://':
		console.alert('ClipBoard does not contain a valid URL','','Ok',hide_cancel_button=True)
		return
		
	# Webview to display conversion site
	x = 0
	y = 0
	w = back.width
	h = back.height - 32 - 2*10
	
	web = ui.WebView(name='web',frame=(x,y,w,h))
	web.border_color = 'blue'
	web.border_width = 1
	back.add_subview(web)
	
		# Label to display progress
	titlbl = ui.Label(name='titlbl')
	titlbl.width = back.width - 80*2 - 10*4
	titlbl.height = 32
	titlbl.x = 80 + 10*2
	titlbl.y = web.y + web.height + 10
	titlbl.text = ''
	titlbl.alignment = ui.ALIGN_CENTER
	titlbl.font= ('Courier-Bold',20)
	titlbl.text_color = 'black'
	back.add_subview(titlbl)
	
	# Button: yes
	oui_button = ui.Button()
	oui_button.border_color = 'black'
	oui_button.border_width = 1
	oui_button.width = 80
	oui_button.height = 32
	oui_button.x = web.x + web.width - 80 - 10
	oui_button.y = titlbl.y
	oui_button.title = 'yes'
	oui_button.alignment = ui.ALIGN_CENTER
	oui_button.font = ('Courier',20)
	oui_button.text_color = 'black'
	oui_button.hidden = False
	oui_button.action = oui_action
	back.add_subview(oui_button)
	
	# Button: non
	non_button = ui.Button()
	non_button.border_color = 'black'
	non_button.border_width = 1
	non_button.width = 80
	non_button.height = 32
	non_button.x = 10
	non_button.y = titlbl.y
	non_button.title = 'Non'
	non_button.alignment = ui.ALIGN_CENTER
	non_button.font = ('Courier',20)
	non_button.text_color = 'black'
	non_button.hidden = False
	non_button.action = non_action
	back.add_subview(non_button)
	
	
	# Read page contents
	r = requests.get(url)
	source = r.text
	ct = r.headers['Content-Type']
	extension = '.html' if ct.startswith('text/html') else '.txt'
	# Where to save the source
	filename='View-OpenPageSource'
	file_txt = os.path.abspath(filename+'.txt')
	file_html = os.path.abspath(filename+'.html')
	# Save the source
	with open(file_txt,'w') as f:
		f.write(source)
	# Display the source
	web.load_url(path2url(file_txt))
	
	# Ask if source file to be kept
	titlbl.text = 'Keep the souce file?'
	# loop button not pressed
	button_pressed = False
	while not button_pressed:
		time.sleep(0.5)
		
	back.close()
Example #4
0
 def __init__(self):
     '''Children must call RootView.__init__(self), in order to set up hidden webview!'''
     self.__w = ui.WebView(frame=(1, 1, 1, 1))
     self.add_subview(self.__w)
Example #5
0
                                 border_width=2,
                                 border_color='#e3e3e3',
                                 corner_radius=7,
                                 alpha=0)
customFactorInput.delegate = customFactorDelegate()
seekSlider = ui.Slider(continuous=True, value=0)
seekSlider.action = seekSlide
trimSlider = ui.Slider(continuous=True, value=1)
trimSlider.action = trimSlide
pointSizeSlider = ui.Slider(continuous=True, value=0.333)
pointSizeSlider.action = pointSizeSlide
colorSelector = ui.SegmentedControl(corner_radius=5)
colorSelector.segments = ('True Colors', 'White', 'Depth Map')
colorSelector.selected_index = 0
colorSelector.action = colorSelect
cameraControl = ui.WebView(corner_radius=10)
cameraControl.delegate = debugDelegate()
rotateLeftButton = ui.Button(title='\u293e',
                             font=('<system>', 30),
                             background_color='black',
                             tint_color='white',
                             corner_radius=10)
rotateLeftButton.action = rotateLeftAction
resetCameraButton = ui.Button(title='Reset Camera',
                              background_color='black',
                              tint_color='white',
                              corner_radius=5)
resetCameraButton.action = resetCameraAction
rotateRightButton = ui.Button(title='\u293f',
                              font=('<system>', 30),
                              background_color='black',
Example #6
0
            slide_percent = self.detail.x / self.master.width
            self.master.alpha = slide_percent

    def touch_ended(self, touch):
        def slide_left():
            self.detail.x = 0
            self.master.alpha = 0

        def slide_right():
            self.detail.x = self.master.width
            self.master.alpha = 1

        if self.x_movement == 'right':
            ui.animate(slide_right, duration=0.4)
        elif self.x_movement == 'left':
            ui.animate(slide_left, duration=0.4)


master = ui.TableView()
L = ui.ListDataSource(['A', 'B'])
master.flex = 'WH'
master.data_source = L
master.delegate = L

detail = ui.WebView()
detail.load_url('http://www.google.com/')
detail.flex = 'WH'
detail.scales_page_to_fit = False

a = SideMenuSlideView(master, detail)
Example #7
0
def get_view(url):
	wv = ui.WebView()
	wv.load_url(url)
	return wv
Example #8
0
 def init_size(self):
     # initialize with correct size when landscape
     orientation = ui.WebView(frame=(0, 0, 100,
                                     200)).eval_js('window.orientation')
     if orientation in (-90, 90):
         self.frame = (0, 0, self.height, self.width)
Example #9
0
 def __init__(self, l_mpc, ui_file_path):
     self._mpc = l_mpc
     self._wv = ui.WebView()
     self._filepath = ui_file_path
Example #10
0
import ui 

wv = ui.WebView()
def get_view(url):
	wv = ui.WebView()
	wv.load_url(url)
	return wv
Example #11
0
def basic_login_webview(url, username, password):
    webview = ui.WebView(name=url)
    webview.load_html(requests.get(url, auth=(username, password)).text)
    return webview
# https://forum.omz-software.com/topic/3910/autoplay-mp4-video-in-webview/7

import ui
import os, time

# [~/Documents]$ wget http://techslides.com/demos/sample-videos/small.mp4
absfilepath = os.path.abspath('small.mp4')

TEMPLATE = '''
<video id="myvideo" autoplay preload="auto">
    <source src="file://{{FPATH}}" type="video/mp4">
</video>
'''
v = ui.View()
webview = ui.WebView()
v.add_subview(webview)

html = TEMPLATE.replace('{{FPATH}}', absfilepath)
webview.load_html(html)

#button = ui.Button(title="Start Game")
#button.action = button_tapped
#v.add_subview(button)

v.frame = (0, 0, 500, 500)
webview.frame = (0, 0, 500, 500)
v.present()

#after view is presented, check that html is loaded, then play
# might be better to check document.readyState, but sometimes this can be complete before you start
id = webview.eval_js('document.getElementById("myvideo").id')
Example #13
0
 def __make_wvB(self):
     self.__wvB = ui.WebView()
     self.add_subview(self.__wvB)
Example #14
0
def openLink(url):
    wv = ui.WebView()
    wv.load_url(url)
    tableview.navigation_view.push_view(wv)
    webview.load_url(link1)
    webview.present()


main()

#==============================

# coding: utf-8

import ui
import urllib2
import re

v = ui.load_view()
webview = ui.WebView()
webview.flex = 'WH'
v.add_subview(webview)
v.present('full_screen')


def main():
    fx = open('sites.txt', 'r')
    lines = fx.readlines()
    fx.close()
    link1 = lines[0].strip()
    #link1 = re.split('/\n', lines[0])
    #link1.pop()
    #link2 = re.split('/\n', lines[1])
    #link2.pop()
    #link3 = re.split('/\n', lines[2])