Exemple #1
0
# coding: utf-8

# https://forum.omz-software.com/topic/2792/webview-bug

import ui
from objc_util import ObjCInstance, on_main_thread

web_view = ui.WebView(frame=(0, 0, 500, 500))
web_view.present('sheet')
web_view.load_url('https://www.google.com')

js = 'alert(document.title)'
wv = ObjCInstance(web_view).subviews()[0]
on_main_thread(wv.stringByEvaluatingJavaScriptFromString_)(js)
Exemple #2
0
def fix_set_idle_timer_disabled(flag=True):
    return
    objc_util.on_main_thread(console.set_idle_timer_disabled)(flag)
Exemple #3
0
import struct
import threading
from socketserver import ThreadingMixIn, TCPServer, StreamRequestHandler

# IP over which the proxy will be available (probably WiFi IP)
PROXY_HOST = "172.20.10.1"
# IP over which the proxy will attempt to connect to the Internet
CONNECT_HOST = None
# Time out connections after being idle for this long (in seconds)
IDLE_TIMEOUT = 1800

# Try to keep the screen from turning off (iOS)
try:
    import console
    from objc_util import on_main_thread
    on_main_thread(console.set_idle_timer_disabled)(True)
except ImportError:
    pass

try:
    # We want the WiFi address so that clients know what IP to use.
    # We want the non-WiFi (cellular?) address so that we can force network
    #  traffic to go over that network. This allows the proxy to correctly
    #  forward traffic to the cell network even when the WiFi network is
    #  internet-enabled but limited (e.g. firewalled)

    import ifaddrs
    from collections import defaultdict
    interfaces = ifaddrs.get_interfaces()
    iftypes = defaultdict(list)
    for iface in interfaces:
Exemple #4
0
# coding: utf-8

# https://forum.omz-software.com/topic/2792/webview-bug

import ui
from objc_util import ObjCInstance, on_main_thread

web_view = ui.WebView(frame=(0,0,500,500))
web_view.present('sheet')
web_view.load_url('https://www.google.com')

js = 'alert(document.title)'
wv = ObjCInstance(web_view).subviews()[0]
on_main_thread(wv.stringByEvaluatingJavaScriptFromString_)(js)
Exemple #5
0
    def __init__(self):
        #def __init__(self, app: AppSingleLaunch):
        #self.app = app
        self.name = "MetreAce Home"
        self.flex = 'WH'
        #self.tint_color = '#494949'
        self.background_color = 'black'

        # Setup of UI Features

        self.v = ui.load_view('mainview')
        self.v.frame = self.bounds
        self.v.flex = 'WH'

        # Console
        self.app_console = self.v['console']
        self.app_console.alpha = 0

        # Ble connection
        self.star_button = self.v['start_button']
        self.ble_icon = self.v['ble_icon']
        self.ble_status_icon = self.v['ble_status_icon']
        self.ble_status = self.v['ble_status']
        self.connect_button = self.v['connect_button']
        ble_icon_path = 'images/ble_off.png'
        self.ble_status_icon.image = ui.Image.named(ble_icon_path)

        # Set up icons
        self.instr_icon = self.v['imageview']
        dev_icon_path = 'images/MetreAceDev.png'
        self.instr_icon.image = ui.Image.named(dev_icon_path)
        self.calc_icon = self.v['button1']

        # Instr chevrons
        self.d0 = self.v['dot0']
        self.d1 = self.v['dot1']
        self.d2 = self.v['dot2']
        self.d3 = self.v['dot3']
        self.d4 = self.v['dot4']

        # Cloud chevrons
        self.d5 = self.v['dot5']
        self.d6 = self.v['dot6']
        self.d7 = self.v['dot7']
        self.d8 = self.v['dot8']
        self.d9 = self.v['dot9']

        # Version label
        self.vlabel = self.v['vlabel']
        self.vlabel.text = APP_VERSION

        # Setup
        self.cwd = os.getcwd()
        on_main_thread(console.set_idle_timer_disabled)(True)

        root_dir, metre_dir = self.cwd.split('MetreiOS')
        if DEBUG:
            print('This is self.cwd: ' + self.cwd)
            print('This is root_dir: ' + root_dir)

        # Download Single Launch Lock if it's not already installed
        check_path = root_dir + 'site-packages/single_launch.lock'
        if os.path.exists(check_path):
            if DEBUG:
                print('single_launch.lock already exists')
            else:
                print('')
        else:
            shutil.copy(self.cwd + '/resources/single_launch.lock', check_path)
            if DEBUG:
                print('moved copy of single_launch.lock')
            else:
                print('')

        # Set up UI Functions
        self.getData()
        self.results_table = self.v['results_table']
        self.restable_inst = ResultsTable(self.v, self.results_table,
                                          self.acetone, self.etime)
        self.add_subview(self.v)

        # Implementation of navigation view/mainview
        self.l = self.create_l_buttonItems('Settings', '|', 'Results', '|',
                                           'Help')
        self.left_button_items = self.l
        self.files_to_upload = os.listdir(self.cwd +
                                          '/data_files/converted_files/')
Exemple #6
0
    def fix_set_idle_timer_disabled(flag=True):
        from objc_util import on_main_thread

        on_main_thread(console.set_idle_timer_disabled)(flag)