def startup(self): # first read debug flags - before any logging core.debugFlags(self.pluginPrefs) # startup call core.logger(traceLog = u"startup called") interface.init() corethread.init() core.logger(traceLog = u"end of startup")
def start(agent, subscriber): mib2_system.init(agent, subscriber) mib2_interfaces.init(agent, subscriber) mib2_ifMIB.init(agent, subscriber) management.init(agent, subscriber) interface.init(agent, subscriber) stats.init(agent, subscriber) device.init(agent, subscriber) operate.init(agent, subscriber) system.init(agent, subscriber)
def startup(self): # first read debug flags - before any logging core.debugFlags(self.pluginPrefs) # startup call core.logger(traceLog = u'startup called') self.timerPlugin = indigo.server.getPlugin(u'com.perceptiveautomation.indigoplugin.timersandpesters') self.timerPluginEnabled = self.timerPlugin.isEnabled() interface.init() core.logger(traceLog = u'end of startup')
def start(agent, subscriber): mib2_system.init(agent, subscriber) mib2_interfaces.init(agent, subscriber) mib2_ifMIB.init(agent, subscriber) operate.init(agent, subscriber) interface.init(agent, subscriber) linkagg.init(agent, subscriber) management.init(agent, subscriber) tapflow.init(agent, subscriber) tapgroup.init(agent, subscriber) stats.init(agent, subscriber) system.init(agent, subscriber)
def bank(): """Handles initialization, and the main menu""" ci.init() ci.startup() opdc = { 0: new_account, 1: login, 2: simulate_time, 3: handle_currencies, 4: finish } while True: op = ci.list_handler('', ['Open a new bank9000™ Account', 'Login with your existing bank9000™ Account', 'Simulate Passage of Time', 'Currency Conversions', 'Exit']) opdc[op]()
def main(): global devices_id if (len(sys.argv) != 1): dev_id = checkArgv() devices_id.append(dev_id) else: devices_id = loadDeviceID(file_deviceid) initStatDict() stat_dict_old = copy.deepcopy(stat_dict) socket_broadcast = getBroadcastSocket(host, portS) socket_udp = getUDPSocket(host, portC) cnt_reboot = 0 dev_error = [] cnt_test = 0 interface.init(len(devices_id)) interface.printTitle(len(devices_id), len(dev_error), cnt_test, cnt_reboot) interface.printInfo_plus(devices_id, -1, test_items, stat_dict, stat_dict_old) outputInfo("*** Start Test") # exit(0) while True: for i in range(num_test_pre_reboot): cnt_test += 1 for index, dev_id in enumerate(devices_id): stat_dict_old[dev_id] = copy.deepcopy(stat_dict[dev_id]) ret = testOneDevice(socket_broadcast, socket_udp, i, dev_id) if not ret and dev_id not in dev_error: dev_error.append(dev_id) interface.printTitle(len(devices_id), len(dev_error), cnt_test, cnt_reboot) interface.printInfo_plus(devices_id, index, test_items, stat_dict, stat_dict_old) # stat_dict_old[dev_id] = copy.deepcopy(stat_dict[dev_id]) time.sleep(time_interval) # stat_dict_old = copy.deepcopy(stat_dict) # mytelnet.reboot(dev_info) time.sleep(20) cnt_reboot += 1
def create_app(config_file="server.ini"): #Check ini file for quick configuration if not os.path.exists(config_file): print "error: can't find ini file %s" % config_file usage(2) # Load settings from ini file log_file, db_path, random_id, trace_path, option_path = load_inifile(config_file) log.init_log(log_file) interface.init(db_path, random_id, trace_path, option_path) # Stop Werkzeug logging wz_log = logging.getLogger('werkzeug') wz_log.disabled = True application = Flask(__name__) application.register_blueprint(aa_bp) application.register_blueprint(interface.if_blueprint) return application
def __init__(self, photo_storage_path, video_storage_path): try: self.pi_camera_pres = True import pi_camera except: print("WARN : no pi camera library detected !") self.pi_camera_pres = False try: self.gphoto_lib_pres = True import gphoto except: print("WARN : no gphoto library detected !") self.gphoto_lib_pres = False # Display warning for deprecated Picamera functions (since v1.8) warnings.filterwarnings('default', category=DeprecationWarning) # Init pygame pygame.init() # GPIO self.gpio = gpio.init(self.gpio_callback_func) # Storage init self.photo_storage = storage.init(photo_storage_path) self.video_storage = storage.init(video_storage_path) # Intialize gphoto library if self.gphoto_lib_pres: self.gp = gphoto.gphoto(); # Picamera object / objet Picamera if self.pi_camera_pres: self.pi_camera = pi_camera.camera() # Start camera preview / Demarre affichage en direct if self.pi_camera_pres: self.pi_camera.start() # Create interface self.ihm = interface.init(pygame, self.pi_camera, "../images/fond.png", "../sounds/snapshot.wav") self.capture = capture.init(self.photo_storage, self.video_storage, self.pi_camera) # Initialize dubsmash self.dubsmash = dubsmash.init(pygame, self.ihm, self.pi_camera, self.capture) # Internal flag self.led_garland_process_started = False self.protect_gpio_double_press = False
from gameclass import *
import physics_engine import objects import maps import interface pygame.init() width = 1800 height = 700 display = pygame.display.set_mode((width, height)) clock = pygame.time.Clock() physics_engine.init(display) objects.init(display) maps.init(display) interface.init(display) background = (51, 51, 51) def close(): pygame.quit() sys.exit() def start_game(map): map.draw_map() def GAME(): map = maps.Maps() welcome = interface.Label(700, 100, 400, 200, None, background) welcome.add_text("ANGRY BIRDS", 80, "Fonts/arfmoochikncheez.ttf", (236, 240, 241))
def main(): global options try: longopts = ["help", "verbose", "load=", "save=", "density", "density-range:" "density-step=", "which=", "epsilon=", "moments=", "prombsTest", "savefig=", "threads=", "stacksize=", "algorithm=", "mgs-samples=", "no-model-posterior", "hmm", "rho="] opts, tail = getopt.getopt(sys.argv[1:], "mr:s:k:bhvt", longopts) except getopt.GetoptError: usage() return 2 output = None for o, a in opts: if o in ("-v", "--verbose"): sys.stderr.write("Verbose mode turned on.\n") options["verbose"] = True if o in ("-t", "--prombsTest"): sys.stderr.write("Testing prombs.\n") options["prombsTest"] = True if o in ("-m", "--density"): options["density"] = True if o in ("-r", "--density-range"): options['density_range'] = tuple(map(float, a[1:-1].split(','))) if o in ("-s", "--density-step"): options["density_step"] = float(a) if o in ("-k", "--moments"): if int(a) >= 2: options["n_moments"] = int(a) else: usage() return 0 if o in ("-h", "--help"): usage() return 0 if o == "-b": options["bprob"] = True if o == "--load": options["load"] = a if o == "--save": options["save"] = a if o == "--savefig": options["savefig"] = a if o == "--which": options["which"] = int(a) if o == "--epsilon": options["epsilon"] = float(a) if o == "--threads": if int(a) >= 1: options["threads"] = int(a) else: usage() return 0 if o == "--stacksize": if int(a) >= 1: options["stacksize"] = int(a) else: usage() return 0 if o == "--algorithm": options["algorithm"] = a if o == "--mgs-samples": options["mgs_samples"] = tuple(map(int, a.split(":"))) if o == "--no-model-posterior": options["model_posterior"] = False if o == "--hmm": options["hmm"] = True if o == "--rho": options["rho"] = float(a) if len(tail) != 1: usage() return 1 interface.init(options['epsilon']) parseConfig(tail[0]) interface.free() return 0
def setUp(self): interface.init(None)
def init(screen): global width, height, display display = screen (width, height) = display.get_rect().size height -= ground interface.init(display)
def main(video_path): # Detector configs per_frame = 10 series_frame = 1 detector_confidence_threshold = 0.5 # Load detectable classes with open("./yolo/yolov3.txt", 'r') as f: classes = [line.strip() for line in f.readlines()] classes = ['person', 'car'] detect_time = False # Tracker configs frame_id = 0 round_frame = 0 # Synchronizer configs fail_synchronize_threshold = series_frame * 3 interface.init(classes) cap = cv2.VideoCapture(video_path) r, frame = cap.read() # Create collision areas areas = interface.create_areas(frame) while True: # Exit if Q pressed or end of file k = cv2.waitKey(1) & 0xFF if k == ord('q') or r is False: break # Detect series if round_frame > 0: round_frame -= 1 detect_time = True if frame_id % per_frame == 0: round_frame = series_frame detect_time = True # Get tracked objects tracked_objects = tracker.get_tracked(frame) # Detect objects and match them with tracked one if detect_time is True: detected_objects = detector.detect(frame, detector_confidence_threshold, classes, frame_id, video_path) # TODO: remove frame synchronized_objects = synchronize\ .synchronize_objects(detected_objects, tracked_objects, fail_synchronize_threshold, frame) tracker.set_tracked(frame, synchronized_objects) tracked_objects = synchronized_objects detect_time = False collisions_objects, info, triggers = collision.detect_collisions( tracked_objects, areas, frame_id) interface.draw_obj(frame, tracked_objects) interface.draw_collisions(frame, collisions_objects) interface.draw_collisions_info(frame, info) interface.draw_triggers(frame, triggers) interface.show(frame) r, frame = cap.read() frame_id += 1 interface.close()
delta = 0.01 #Variable égale au temps entre deux images, servant à adapter la vitesse #du jeu pour qu'elle soit toujours identique quel que soit le framerate deltaMultiplieur = 1 #Permettant de modifier le delta (pour ralentir ou accélérer le temps par exemple) tempsDerniereImage = 0 #Contient le temps écoulé durant le dernier rendu, permet de calculer le delta images.init() #On charge toutes les textures du jeu joueur.init() #On initialise le joueur... monstres.init()#...les monstres... boulesdefeu.init()#... et les boules de feu. bonus.init() niveaux = ["tutoriel", "niveau1", "niveau2", "niveau3", "fin du jeu"]#Liste des niveaux niveauActuel = 0 #Niveau dans lequel le joueur se trouve actuellement interface.init() #Initialisation de l'interface (compteurs de bonus) carte.init(niveaux[niveauActuel],True) #On charge le terrain du jeu depuis un fichier cache.init(largeur,hauteur,niveaux[niveauActuel]) #On initialise la camera, la centrant sur le joueur et lui mettant les dimensions de la fenêtre: camera.init(joueur.x,joueur.y,largeur,hauteur,carte.w*32,carte.h*32) #On initialise l' "afficheur", qui permettra le rendu des textures à l'écran afficheur.init(0,0) afficheur.mettreWindow(window) afficheur.update(camera.x, camera.y) musiquelancee = False end = False
def reinitialiserNiveau():#Permet de réinitialiser tout sauf l'état de la carte joueur.init() monstres.init() boulesdefeu.init() bonus.init() interface.init()
import twisted import time from twisted.internet import reactor # from game import game import graphics import interface import messaging #------------------------------------------------------------------------------- #Initialization graphics.show_splash_screen() clock=game.clock=pygame.time.Clock() graphics.init() interface.init() time.sleep(2) #More loading goes in this area! graphics.finalize() #------------------------------------------------------------------------------- while game.running: game.frame_time=game.clock.tick(60) #Handle user input interface.handle_events() #Deal with any timed events (MAYBE THIS SHOULD BE DEALT WITH IN THE REACTOR.ITERATE BIT?) messaging.pump_messaging() #Handle internet events (and eventually game logic)
import streamlit as st import interface import defaults as DFT from tasks import (load, preprocess, prepare, cluster, customize, save, visual) st.set_page_config(page_title='Mosaic', layout='wide') interface.init() interface.subheader('GUI for Mosaic built using Streamlit') interface.status('v0.1.2') sample, should_save, save_name = load.run() current_assay, available_assays = preprocess.run(sample) prepare.run(current_assay, available_assays) cluster.run(current_assay, available_assays) customize.run(current_assay) save.run(sample, save_name, should_save) visual.run(sample, current_assay) for a in available_assays: a.add_metadata(DFT.INITIALIZE, False)
def main(): global options try: longopts = ["help", "verbose", "load=", "save=", "density", "density-range=", "density-step=", "which=", "epsilon=", "moments", "look-ahead=", "savefig=", "lapsing=", "port=", "threads=", "stacksize=", "strategy=", "kl-psi", "kl-multibin", "algorithm=", "samples=", "mgs-samples", "no-model-posterior", "video=", "hmm", "rho=", "path-iteration", "distances" ] opts, tail = getopt.getopt(sys.argv[1:], "mr:s:k:n:bhvt", longopts) except getopt.GetoptError: usage() return 2 output = None for o, a in opts: if o in ("-v", "--verbose"): sys.stderr.write("Verbose mode turned on.\n") options["verbose"] = True if o in ("-t", "--prombsTest"): sys.stderr.write("Testing prombs.\n") options["prombsTest"] = True if o == "--look-ahead": options["look_ahead"] = int(a) if o in ("-n", "--samples"): options["samples"] = int(a) if o in ("-m", "--density"): options["density"] = True if o in ("-r", "--density-range"): options['density_range'] = tuple(map(float, a[1:-1].split(','))) if o in ("-s", "--density-step"): options["density_step"] = float(a) if o in ("-k", "--moments"): if int(a) >= 2: options["n_moments"] = int(a) else: usage() return 0 if o in ("-h", "--help"): usage() return 0 if o == "--distances": options["distances"] = True if o == "-b": options["bprob"] = True if o == "--lapsing": options["lapsing"] = float(a) if o == "--strategy": options["strategy"] = a if o == "--kl-psi": options["kl_psi"] = True if o == "--kl-multibin": options["kl_multibin"] = True if o == "--load": options["load"] = a if o == "--port": options["port"] = int(a) if o == "--save": options["save"] = a if o == "--savefig": options["savefig"] = a if o == "--which": options["which"] = int(a) if o == "--epsilon": options["epsilon"] = float(a) if o == "--threads": if int(a) >= 1: options["threads"] = int(a) else: usage() return 0 if o == "--stacksize": if int(a) >= 1: options["stacksize"] = int(a) else: usage() return 0 if o == "--algorithm": options["algorithm"] = a if o == "--mgs-samples": options["mgs_samples"] = tuple(map(int, a.split(":"))) if o == "--no-model-posterior": options["model_posterior"] = False if o == "--video": options["video"] = a if o == "--hmm": options["hmm"] = True if o == "--rho": options["rho"] = float(a) if o == "--path-iteration": options["path_iteration"] = True if (options["strategy"] == "kl-divergence" and options["kl_psi"] == False and options["kl_multibin"] == False): # set default kl divergence options["kl_psi"] = True if options["strategy"] == "effective-counts": options["effective_counts"] = True if options["strategy"] == "effective-posterior-counts": options["effective_posterior_counts"] = True if len(tail) != 1: usage() return 1 interface.init(options['epsilon']) parseConfig(tail[0]) interface.free() return 0