示例#1
0
def register_client(message):
    print(message)

    starttime = time.time()
    interval = 0.25

    eel.spawn(run_exo_vis)
def verify(link: str, title: str, file_format: str) -> None:
    if file_format == 'mp4':
        eel.spawn(vd_downloader(link, title))

    elif file_format == 'mp3':
        path = os.path.join(os.environ['USERPROFILE'], 'Desktop')
        eel.spawn(audio_downloader(link, title, path))
示例#3
0
    def start_final_game():
        game.setup_finalround(players=True)
        game.choose_question(game.random_question())
        resend_gamestate()

        game.final_player_thread = True

        eel.spawn(final_player_thread)
示例#4
0
    def start_final_chaser():
        game.final_chaser_thread = True

        game.state = GameState.FINAL_CHASER
        game.choose_question(game.random_question())
        resend_gamestate()

        game.current_round.finalTime.append({'start': datetime.datetime.now()})

        eel.spawn(final_chaser_thread)
示例#5
0
    def start_round():
        game.new_round()

        game.choose_question(
            game.random_question(
                level=game.current_player.level))

        game.fast_thread = True
        eel.spawn(fastround_timer)
        resend_gamestate()
示例#6
0
def start_eel():
    """Start Eel with either production or development configuration."""
    directory = 'web'
    app = 'chrome-app'
    page = parser.get('settings', 'main')

    eel.init(directory, ['.tsx', '.ts', '.jsx', '.js', '.html'])
    eel.spawn(loop)

    global data_list, cube_list
    try:
        eel.resize_capture()
        eel.load_data_list(data_list)
        eel.load_cube_list(cube_list)
        eel.start(page, size=(960, 1024))
    except EnvironmentError:
        raise
示例#7
0
文件: gui.py 项目: swz-gh/RLBotGUI
def start_match(bot_list, match_settings):
    launcher_preference_map = load_launcher_settings()
    launcher_prefs = launcher_preferences_from_map(launcher_preference_map)

    # Show popup in GUI if rocket league is not started with -rlbot flag
    try:
        testSetupManager = SetupManager()
        temp, port = gateway_util.find_existing_process()
        del temp
        testSetupManager.is_rocket_league_running(port)
    except Exception:
        eel.noRLBotFlagPopup()
        print(
            "Error starting match. This is probably due to Rocket League not being started under the -rlbot flag."
        )
    else:
        eel.spawn(start_match_helper, bot_list, match_settings, launcher_prefs)
示例#8
0
def start_match(bot_list, match_settings):
    launcher_preference_map = load_launcher_settings()
    launcher_prefs = launcher_preferences_from_map(launcher_preference_map)

    # Show popup in GUI if rocket league is not started with -rlbot flag
    try:
        testSetupManager = SetupManager()
        temp, port = gateway_util.find_existing_process()
        if port is None:
            # RLBot.exe is not running, but Rocket League might be. That's a situation we can recover from, RLBot.exe
            # will be booted up using the ideal port later, so assume that port.
            port = gateway_util.IDEAL_RLBOT_PORT
        del temp
        # It's fine if rocket league is not running, this would just return false and we'd proceed. What we're checking
        # for is an exception thrown when rocket league IS running but without the necessary flags or a mismatched port.
        testSetupManager.is_rocket_league_running(port)
    except Exception as e:
        eel.noRLBotFlagPopup()
        print(
            f"Error starting match. This is probably due to Rocket League not being started under the -rlbot flag. {e}"
        )
    else:
        eel.spawn(start_match_helper, bot_list, match_settings, launcher_prefs)
示例#9
0
def toggleKeylogger(flag):
    print("Toggle Keylogger ", flag)
    global KEYLOGGER_ON
    if flag:
        try:
            subprocess.run(["sudo", "insmod", "./driver/intrpt.ko"])
            KEYLOGGER_ON = flag
            print("Turning on Keylogger")
        except:
            print("Error with insmod")

        try:
            eel.spawn(keyloggerThread)
        except:
            print("Error spawning keylogger thread")
    else:
        try:
            subprocess.run(["sudo", "rmmod", "intrpt"])
            KEYLOGGER_ON = flag

            print("Turning off Keylogger")
        except:
            print("Error with rmmod")
示例#10
0
def init(seconds):
    update()
    eel.init(web_dir)
    eel.start(
        'index.html',
        port=0,
        all_interfaces=True,
        block=False,
        close_callback=fake_close,
        # size=window_size,
        cmdline_args=['--start-fullscreen'],
    )
    eel.spawn(keep_calling, seconds / 5)
    eel.spawn(keep_loading, seconds)
    while not last_call:
        eel.sleep(1)
    eel.spawn(check_alive, 2 * seconds)
    wait()
示例#11
0
    print("loading eval")
    evaluation_annotations = load_annotations(evaluation_labels_path,
                                              evaluation_images_path,
                                              load_all=False)

    print("loading train")
    unlabeled_items = load_annotations(training_labels_path,
                                       training_images_path,
                                       load_all=True)
    print("all data loaded")

    load_most_recent_model()


def continually_retrain():
    while True:
        train_model()
        eel.sleep(20)  # Use eel.sleep(), not time.sleep()


# It takes a while to load the data, especially first time, so we parallelize it
eel.spawn(load_data)

# Separate thread to gradually download and extract COCO and ImageNet representations
eel.spawn(add_pending_annotations)

# Continually retrain the model and get predictions over unlabeled items
eel.spawn(continually_retrain)

eel.start('bicycle_detection.html', size=(1350, 900))
示例#12
0
def start_match(bot_list, match_settings):
    eel.spawn(start_match_helper, bot_list, match_settings)
示例#13
0
    draw_closeness(tcc)
    print('tcc', tcc)
    tbc = betweenness_centrality(paths)
    draw_betweenness(tbc)
    print('tbc', tbc)


@eel.expose
def clear_data():
    print('clear data')
    files = glob.glob('./browser/data/*.png')
    for f in files:
        os.remove(f)


"""
def my_other_thread():
    while True:
        print("I'm a thread")
        eel.sleep(1.0)                  # Use eel.sleep(), not time.sleep()

eel.spawn(my_other_thread)
"""

#~~~~~~~[ 2021-03-05 ]~~~~~~~#
import shutil
from .generator.geometric.sst import sstLauncher
from .serializer import dat
from .models.network import *

示例#14
0
def start_training(playlist, bot):
    eel.spawn(start_training_helper, playlist, bot)
示例#15
0
def start_eel():
    logging.info('\n\n\n')
    logging.info('#######################################################')
    logging.info('################ Starting APP               ###########')
    logging.info('#######################################################\n\n\n')

    if FROZEN:
        # Set Exception hook
        sys.excepthook = AppExceptionHook.exception_hook

    AppSettings.load()
    AppSettings.copy_default_presets()
    AppSettings.delete_current_settings_presets()

    # This will ask for and re-run with admin rights
    # if setting needs_admin set.
    if AppSettings.needs_admin and not run_as_admin():
        return

    """
        THIS WILL DISABLE ctypes support! But it will make sure "Launch rFactor2" 
        or basically any executable that is loading DLLs will work.
    """
    if sys.platform == "win32":
        import ctypes
        ctypes.windll.kernel32.SetDllDirectoryA(None)
    """
        //
    """
    page = 'index.html'
    host = 'localhost'
    port = 8123
    eel.init('web')

    # TODO: fetch OSError port in use
    try:
        eel.start(page, host=host, port=port, block=False)
    except EnvironmentError:
        # If Chrome isn't found, fallback to Microsoft Edge on Win10 or greater
        if sys.platform in ['win32', 'win64'] and int(platform.release()) >= 10:
            eel.start(page, mode='edge', host=host, port=port, block=False)
        # Fallback to opening a regular browser window
        else:
            eel.start(page, mode=None, app_mode=False, host=host, port=port, block=False)
            # Open system default web browser
            webbrowser.open_new(f'http://{host}:{port}')

    # -- Game Controller Greenlet
    cg = eel.spawn(controller_greenlet)

    # -- Headlights Greenlet
    hg = eel.spawn(headlights_greenlet)

    # -- rFactor Greenlet
    rg = eel.spawn(rfactor_greenlet)

    # -- Run until window/tab closed
    while not CLOSE_EVENT.is_set():
        # Game controller event loop
        controller_event_loop()
        # rFactor 2 event loop
        rfactor_event_loop()
        # Capture exception events
        AppExceptionHook.exception_event_loop()
        test_exception()

    # -- Shutdown Greenlets
    logging.debug('Shutting down Greenlets.')
    gevent.joinall((cg, hg, rg), timeout=15.0)

    # -- Shutdown logging
    logging.info('\n\n\n')
    logging.info('#######################################################')
    logging.info('################ APP SHUTDOWN               ###########')
    logging.info('#######################################################\n\n\n')
    logging.shutdown()
示例#16
0
import eel
from bot.mm_bot import MMBot

# Give folder containing web files
eel.init('web')

# Set up bot, and runs as subprocess
bot = MMBot()
eel.spawn(bot.run)

# Start
eel.start('main.html', size=(300, 600))
示例#17
0
                #print(bar_percentage,"%")
                current_segment = current_segment + 1
                #print(current_segment)
                if (current_segment < numb_segments):
                    current_segment_time = current_audio_features_segments_array[
                        current_segment]["start"]

            else:
                print("song data end")
                break

        prev_track_uri = current_track_uri
        prev_track_progress = current_track_progress


def blynk_main():
    #print("blynk_main")
    jjjj = 1


eel.spawn(spotify_auth)
eel.start('start.html', block=False)

while True:
    #print("I'm a main loop")
    if (confirmation == True):
        eel.spawn(blynk_main)
        eel.spawn(spotify_main)

    eel.sleep(0.01)
示例#18
0
import eel

# Set web files folder and optionally specify which file types to check for eel.expose()
#   *Default allowed_extensions are: ['.js', '.html', '.txt', '.htm', '.xhtml']
eel.init('web', allowed_extensions=['.js', '.html'])

#eel.say_hello_js("hi")

ser = serial.Serial("COM3",9600)
print("hi")

def my_other_thread():
    while True:
        eel.sleep(.001)

        cc = str(ser.readline())
        heart_val = cc[2:][:-5]
        print(heart_val)
        try:
            eel.clean_heart_val(heart_val)
        except:
            print("it would have crashed here")

eel.spawn(my_other_thread)


eel.start('psychophys.html',block=False)


while True:
    eel.sleep(1.0)
示例#19
0
def start_sending_frames(fps, camera_id=0):
    """Initiate sending frames to the frontend continuously."""
    open_capture(camera_id)
    eel.spawn(stream_frames(fps))
示例#20
0
        
        ct = time.time()       
        if currently_training or annotation_count == 0 or ct - last_annotation < 20:
            eel.sleep(10)   
            continue
        
        
        annotation_count = 0 # reset counter for annotations
        
        retrain('data/'+label+'/')
        
        # print(ct)
       
        eel.sleep(10)                  # Use eel.sleep(), not time.sleep()

eel.spawn(check_to_train)



# LOAD ALL THE DATA TO GET STARTED ! 

unlabeled_file = gzip.open(unlabeled_data_path, mode='rt')
csvobj = csv.reader(unlabeled_file,delimiter = ',',quotechar='"')
for row in csvobj:
    unlabeled_data.append(row)
random.shuffle(unlabeled_data)

eel.start('headlines.html', size=(800, 600))


示例#21
0
def start_game():
    global cw
    logging.debug('Starting game')
    eel.spawn(start)
示例#22
0
文件: Eel.py 项目: axl3blaz3/Eel-help
def start_record():
    ctypes.windll.user32.MessageBoxW(0, "ok", "Message", 1)
    eel.spawn(get_audio())
示例#23
0
def set_spawns():
    eel.spawn(update_app_manager)
    #check to ensure the browser is configured
    eel.spawn(server_thread)
示例#24
0
def keyloggerThread():
    """
    *********************************************************
    Keylogger 
    *********************************************************
    """
    try:
        global KEYLOGGER_ON
        while (KEYLOGGER_ON):
            try:
                logFile = readFile("/proc/keylogger")
                date = logFile[0:10]
                time = logFile[11:19]
                content = logFile[20:]
                if (content):
                    print(content)

                eel.setLoggerData([date, time, content])
            except:
                print("Error in keylogger fetching")
            eel.sleep(1)
    except KeyboardInterrupt:
        print("Closing keylogger")


eel.spawn(updateDataThread)

print("On browser navigate to : localhost:8000/main.html")
eel.start('main.html', mode="False")
示例#25
0
    ret, jpeg = cv2.imencode('.jpg', frame)
    jpeg_b64 = base64.b64encode(jpeg.tobytes())
    jpeg_str = jpeg_b64.decode()
    eel.js_imshow(jpeg_str)


def loop():
    while True:
        ret, frame = cap.read()
        if mouse_on_down == True & streaming == True:
            frame = cv2.rectangle(frame, (x1, y1), (x2, y2), (0, 0, 255), 2)
        if streaming == True:
            imshow(frame)
        eel.sleep(0.03)


eel.spawn(loop)
if mode == 0:
    print("Server is running on desktop")
    cap = cv2.VideoCapture(0)
    setup_cam(640, 480)
    eel.start(html, size=(680, 600))

elif mode == 1 or mode == 2:
    if mode == 1:
        webbrowser.open(url)
    cap = cv2.VideoCapture(0)
    setup_cam(240, 320)
    print("Server is running on {}".format(url))
    eel.start(html, mode=None, port=port, host=host)
示例#26
0
	       return False

    return True

def polarToCords(num):

    x = num * math.cos(num)
    y = num * math.sin(num)

    return (x,y)

def update():

    plotted = 0

    for number in range(1,50000):

        coords = polarToCords(number)
        randomObj = {'x' : coords[0],'y' : coords[1]}

        if isPrimeNumber(number):
            eel.updateDataSet(randomObj,True)
        eel.sleep(0.001)

    eel.sleep(5)
    eel.reset()
    update()


eel.spawn(update)
def converter_params(path: str, media_file: str,
                     save_file_to_path: str) -> None:
    eel.spawn(converter(path, media_file, save_file_to_path))
示例#28
0
import eel
import datetime as dt
import json
import subprocess
eel.init('web')


@eel.expose
def getTime():
    now = str(dt.datetime.now())
    #return json.dumps({'now':now})
    return now


#eel.js_random()(print)


def testThread():
    #below should be replaced by an electron app call if necessary.
    #maybe have a json file and regular checks from the javascript side to update values.
    subprocess.call(['touch', 'other.html'])


eel.spawn(testThread)
eel.start('main.html')
random_number_from_javascript = eel.js_random()()
print(random_number_from_javascript)
eel.say_hello_js('javascript')
示例#29
0
# This is run after waiting 5 seconds for the calendar information to be updated and then every 5 seconds after.
def roomAvailabilityThread():
    while True:
        eel.sleep(5.0)
        exchange.roomAvailability()


# Set up a scheduled event that runs nextDayPython daily at 5am.
def nextDayThread():
    scheduler = BackgroundScheduler()
    scheduler.add_job(nextDayPython, 'cron', hour=5, minute=0)
    scheduler.start()


# Starts the function to get updated calendar information in its own thread.
eel.spawn(getExchangeEventsThread)

# Starts the function to check room availability in its own thread.
eel.spawn(roomAvailabilityThread)

# Starts the function to navigate to today in the calendar view in its own thread.
eel.spawn(nextDayThread)

# Settings to run Chrome in kiosk mode if eel.start is run with the web_app_options.
web_app_options = {'mode': 'chrome-app', 'chromeFlags': ['--kiosk']}

# Because of Raspberry Pi's modest hardware, a 2 second delay is added
# to make sure the needed information is collected from Exchange before running.
eel.sleep(2)

# eel.start('main.html', size=(800, 480)) # Uncomment this for the application to run in a broswer window.
示例#30
0
    return data


@eel.expose
def list_downloads():
    items = db.list_queue()
    return items


def download_loop():
    while True:
        items = db.list_unstarted_queue()
        try:
            item = items[0]
            download(item['key'])
            eel.sleep(10)
        except IndexError:
            pass
        eel.sleep(3)


def start_app():
    web_config = {'mode': 'chrome-app', 'host': 'localhost', 'port': 3060}
    eel.init('web')
    eel.start('index.html', options=web_config)


if __name__ == '__main__':
    eel.spawn(download_loop)
    start_app()