Exemplo n.º 1
0
def gui_handler(driver):
    '''launch wxwidgets gui'''
    if driver.device is not None:
        import gui
        gui.run(driver.device)
    else:
        logger.warn("can't launch gui without arrived device")
Exemplo n.º 2
0
def gui_handler(driver):
    '''launch wxwidgets gui'''
    if driver.device is not None:
        import gui
        gui.run(driver.device)
    else:
        logger.warn("can't launch gui without arrived device")
Exemplo n.º 3
0
 def run_gui_context(self):
     app_hold = gui.config.app
     try:
         gui.config.app = gui.config.Config('test moviedb', 'test version')
         gui.run()
         yield gui.config.app
     finally:
         gui.config.app = app_hold
Exemplo n.º 4
0
 def run(self, until=None, gui=False, *args, **kwargs):
     if until is not None:
         self.actor(lambda: self.elapse(until))
     if gui:
         self.gui_running = True
         from gui import run
         run(self)
     else:
         while not self.env.finished:
             self.step(*args, **kwargs)
Exemplo n.º 5
0
def run(host, port, listen, username):
    if listen:
        server = ServerThread(host, port)
        server.start()

    client = ClientThread(host, port, username)
    client.start()
    client.messages.put('server: Connected to %s:%s' % (host, port))
    gui.run(client)
    client.send_disconnection_message()
Exemplo n.º 6
0
def main():
    

    ###  Create Global Variables ###
    settings.init()

    ###  Command Line Menu  ###
    #menu.run()

    ###  GUI Run  ###
    gui.run()
Exemplo n.º 7
0
def main():
    update_internal_memory("paths")

    # If no command-line arguments provided, run in GUI mode
    if not cli.args.headless:
        recall_last_folders()
        gui.run()
        return

    # Else, run in headless mode
    cli.run()
    return
Exemplo n.º 8
0
def do_gui(cmd, mcname, opts, args, opterr):
	if len(args) != 0:
		opterr("Incorrect number of arguments.")

	try:
		import gui
	except ImportError:
		write_error(None, "GUI not available")
		return 1

	gui.run(mcname)
	return 0
Exemplo n.º 9
0
def main():
	parser = argparse.ArgumentParser()
	parser.add_argument("-o", "--opaque",    dest="opaque",    action="store_true", help="start in opaque mode")
	parser.add_argument("-z", "--minimized", dest="minimized", action="store_true", help="start minimized")
	args = parser.parse_args()

	if args.opaque:
		state.toggle_opaque()
	if args.minimized:
		state.toggle_minimized()

	gui.run()
Exemplo n.º 10
0
 def run(self, until=None, gui=None, *args, **kwargs):
     if until is not None:
         self.actor(lambda: self.elapse(until))
     if gui not in (False, None):
         if not isinstance(gui, dict):
             gui = {}
         self.gui_running = True
         from gui import run
         run(self, gui, *args, **kwargs)
     else:
         while not self.env.finished:
             self.step(*args, **kwargs)
Exemplo n.º 11
0
def main():
    opts = docopt(usage, version=__version__)
   
    if opts['-i']:
        log.info('Starting the graphical interface...')
        try:
            import gui
            gui.run()
            return
        except Exception, e:
            log.critical(e)
            return
Exemplo n.º 12
0
 def run(self, until=None, gui=None, *args, **kwargs):
     if until is not None:
         self.actor(lambda: self.elapse(until))
     if gui not in (False, None):
         if not isinstance(gui, dict):
             gui = {}
         self.gui_running = True
         from gui import run
         run(self, gui, *args, **kwargs)
     else:
         while not self.env.finished:
             self.step(*args, **kwargs)
Exemplo n.º 13
0
def do_gui(cmd, mcname, opts, args, opterr):
    if len(args) != 0:
        opterr("Incorrect number of arguments.")

    try:
        import gui
    except ImportError:
        write_error(None, "GUI not available")
        return 1

    gui.run(mcname)
    return 0
Exemplo n.º 14
0
def main():
    """ docstring """
    headlightFlash_o = HeadlightControl()
    config_o = Config()

    def pit_limiter():
        return config_o.get('miscellaneous', 'pit_limiter') == '1'

    def pit_lane():
        return config_o.get('miscellaneous', 'pit_lane') == '1'

    def flash_duration():
        return int(config_o.get('miscellaneous', 'flash_duration'))

    def pit_flash_duration():
        return int(config_o.get('miscellaneous', 'pit_flash_duration'))

    def default_to_on():
        return config_o.get('miscellaneous', 'default_to_on') == '1'

    def on_automatically():
        return int(config_o.get('miscellaneous', 'on_automatically'))

    _root, tabConfigureFlash = gui_main()
    _player_is_driving = False
    _o_run = run(_root, tabConfigureFlash)
    _o_run.controller_o.start_pit_check_timer()  # Start the 1 second timer
    while True:
        _cmd = _o_run.running()
        if headlightFlash_o.player_is_driving():
            if not _player_is_driving:
                # First time player takes control
                _player_is_driving = True
                if default_to_on():
                    status_poker_fn('default_to_on')
                    headlightFlash_o.on()

            if _cmd == 'Headlights off':
                headlightFlash_o.on()
            if _cmd == 'Headlights on':
                headlightFlash_o.off()
            if _cmd == 'Flash headlights':
                headlightFlash_o.four_flashes(flash_duration())
            if _cmd == 'Toggle headlights':
                headlightFlash_o.toggle()
            if _cmd == TIMER_EVENT:
                if pit_limiter():
                    headlightFlash_o.check_pit_limiter(pit_flash_duration())
                if pit_lane():
                    headlightFlash_o.check_pit_lane(pit_flash_duration())
                headlightFlash_o.automatic_headlights(on_automatically())
        else:
            _player_is_driving = False
        if _cmd == 'QUIT':
            break
Exemplo n.º 15
0
    signal = np.fromstring(signal, 'Int16')

    #If Stereo
    if spf.getnchannels() == 2:
        print 'Just mono files'
        sys.exit(0)

    fig = plt.figure(1)
    plt.title('Signal Wave...')
    plt.plot(signal)
    play_wav(wavFileName)
    
    plt.grid()
    plt.show()


#main
if __name__ =='__main__':
    #read bag file
    bagFile = parse_arguments()
    audioData = audio_bag_file(bagFile) 
    # get audio data 
    mp3FileName = write_mp3_file(audioData, bagFile)
    wavFileName = mp3_to_wav(mp3FileName)
    gui.run(wavFileName, bagFile)


    


Exemplo n.º 16
0
 def run(self):
     try:
         gui.run()
     except KeyboardInterrupt, e:
         self.mainwin.cb_Close()
Exemplo n.º 17
0
            self.num_piece += 1
            if self.turn == "white":
                self.turn = "black"
            else:
                self.turn = "white"
        else:
            self.show_message("ERROR: Space {},{} already occupied".format(letter, y))

    def on_point_click(self, x, y):
        self.remove_point(x, y)

    def on_open_click(self, path):
        print(path)

    def on_save_click(self, path):
        print(path)

    def on_pass_click(self):
        self.remove_line((6, 2), (5, 1))
        print("pass")

    def on_count_click(self):
        print("count")

    def on_resign_click(self):
        print("resign")


if __name__ == '__main__':
    run(MyWindow())
no = input("Output: ")
nh = list(map(int, nh.split(" ")))

if 2 * M != int(ni):
    print("2*M doesn't match number of inputs")
    exit()

Xd, yd = read(path)
cache = initializeWeights(int(ni), nh, int(no))

epochs = int(input("Epochs: ") or 10000)
lrn_rt = float(input("Learning rate: ") or 0.01)
btch_sz = int(input("Batch size: ") or 1)
train(Xd, yd, cache, epochs, lrn_rt, btch_sz)

#run forward pass for training data
print(yd)
print(forward_pass(Xd.T, cache).T)

print("=======NOW PLAY WITH IT========")

points = gui.run()
Xtest, ytest = processing.dataProcessing(points, M)
y = forward_pass(Xtest.T, cache).T

for i in range(0, len(ytest)):
    print("Y-label: ", ytest[i])
    print("Y predicted: ", y[i])
    print("Loss: ", loss(y[i], ytest[i]))
    print()
Exemplo n.º 19
0
 def gui_handler(self):
     '''launch wxwidgets gui'''
     import gui
     gui.run(self.dev)
Exemplo n.º 20
0
 def gui(self, arg):
     import gui
     return gui.run(self.dev)
Exemplo n.º 21
0
from PyQt5 import QtGui, QtCore, QtWidgets

from telescope import Telescope
from allsky import AllSky
import gui


# parse configuration file
config = ConfigObj("config.ini")
location = config["LOCATION"]
objects = config["OBJECTS"]

# set new Observer object from config file
obsLocation = EarthLocation(location["LONGITUDE"], location["LATITUDE"],
                            float(location["ELEVATION"]))
add_site(location["SITE_NAME"], obsLocation)

# add objects to a dictionary of `astroplan.FixedTarget`s
fixed_targets = {}
for key in objects:
    coordinates = SkyCoord(objects[key]["RA"], objects[key]["DEC"])
    fixed_targets[key] = FixedTarget(name=key, coord=coordinates)


skymap = AllSky(objects=fixed_targets)
telescope = Telescope(Observer.at_site(location["SITE_NAME"]))
gui.run(telescope, skymap)

#fig = skymap.draw(telescope.Observer)
#fig.savefig("test.png")
Exemplo n.º 22
0
import math

gui.init()
human = Human(Human.COWARD, Human.NO_WEAPON, cord_x=100, cord_y=100)
human.add_decoration("gui/assets/bullet.png")
zombie = Zombie()
human.angle = 0
ticks = 0


def tick():
    human.cord_x += 1
    human.cord_y += 1
    human.angle += 1


zombies = []
for i in range(20):
    zombie = Zombie(cord_x=random.randint(0, 800),
                    cord_y=random.randint(0, 800))
    gui.add_entity(zombie)
    zombies.append(zombie)

gui.add_entity(human)
gui.add_entity(zombie)
gui.add_entity(GunShopLong(100, 200))
gui.add_entity(GunShopShort(300, 300))
gui.add_entity(Building(300, 200))
gui.add_entity(Bullet(50, 50))
gui.run(tick, 50)
Exemplo n.º 23
0
        """Callback luego de presionar el botón `Desconectarse` en ventana
        principal.
        """
        pass

    def on_main_window_item_double_click(self, row):
        """Callback luego de hacer click en alguna fila de la tabla de la
        ventana principal.

        Argumentos:
            int row -- el índice de la fila dónde se hizo click.
        """
        pass

    def on_compose_widget_send_button_click(self, recipients, subject, msg):
        """Callback luego de presionar el botón `Enviar` en la ventana de
        redacción de correos.

        Argumentos:
            str recipients -- destinatarios de correo.
            str subject    -- asunto del correo.
            str msg        -- cuerpo del correo.
        Retorna:
            bool           -- si el envío es exitoso, retorna verdadero. En
            otro caso, retorna falso.
        """
        return True

if __name__ == "__main__":
    run(MiGUI)
Exemplo n.º 24
0
    else:
        base = loc('convert_success_gmk')
    return base % conversion_output_filename

# prompt and load language
if os.path.exists('lang'):
    with open('lang', 'r') as f:
        language = list(f)[0]
    localize.load(language)
else:
    language = gui.ask_language()
    with open('lang', 'w') as f:
        f.write(language)
    localize.load(language)
    gui.show_instructions()

# check for update
try:
    r = requests.get('http://cwpat.me/map2gm-version')
    if r.status_code == 200:
        my_version = '2.2'
        newest_version = r.json()['map2gm-version']
        if my_version != newest_version:
            gui.show_update(newest_version)
except Exception as e:
    print('Error when checking for new version.')
    print(e)

# kick off the gui
gui.run(submit_func=submitted)
Exemplo n.º 25
0
from gui import GUI, run
from PyQt4.QtCore import QObject, SIGNAL


class BoBlo(QObject):
    '''
        Clase principal
    '''
    def __init__(self):
        super().__init__()


class BoBloGui(GUI):
    def __init__(self):
        super().__init__()


if __name__ == "__main__":
    run(BoBloGui)
Exemplo n.º 26
0
def main():
    prog = sys.argv[0].decode(sys.getdefaultencoding(), "replace")
    usage = "usage: %prog [-ih] memcard.ps2 command [...]"
    description = ("Manipulate PS2 memory card images.\n\n"
                   "Supported commands: ")
    for cmd in sorted(cmd_table.keys()):
        description += "\n   " + cmd + ": " + cmd_table[cmd][3]

    version = ("mymc " + verbuild.MYMC_VERSION_MAJOR + "." +
               verbuild.MYMC_VERSION_BUILD + "   (" + _SCCS_ID + ")")

    optparser = optparse.OptionParser(prog=prog,
                                      usage=usage,
                                      description=description,
                                      version=version,
                                      formatter=my_help_formatter())
    optparser.add_option("-D",
                         dest="debug",
                         action="store_true",
                         default=False,
                         help=optparse.SUPPRESS_HELP)
    optparser.add_option("-i",
                         "--ignore-ecc",
                         action="store_true",
                         help="Ignore ECC errors while reading.")

    optparser.disable_interspersed_args()
    (opts, args) = optparser.parse_args()

    if len(args) == 0:
        try:
            import gui
        except ImportError:
            gui = None
        if gui != None:
            gui.run()
            sys.exit(0)

    if len(args) < 2:
        optparser.error("Incorrect number of arguments.")

    if opts.debug:
        cmd_table.update(debug_cmd_table)
    cmd = args[1]
    if cmd not in cmd_table:
        optparser.error('Command "%s" not recognized.' % cmd)
    (fn, mode, usage_args, description, optlist) = cmd_table[cmd]

    usage = "%prog"
    if len(optlist) > 0:
        usage += " [options]"
    if usage_args != None:
        usage += " " + usage_args
    subprog = prog + " memcard.ps2 " + cmd
    subopt_parser = suboption_parser(prog=subprog,
                                     usage=usage,
                                     description=description,
                                     option_list=optlist)
    subopt_parser.disable_interspersed_args()

    f = None
    mc = None
    ret = 0
    mcname = args[0]

    try:
        (subopts, subargs) = subopt_parser.parse_args(args[2:])
        try:
            if mode == None:
                ret = fn(cmd, mcname, subopts, subargs, subopt_parser.error)
            else:
                f = file(mcname, mode)
                mc = ps2mc.ps2mc(f, opts.ignore_ecc)
                ret = fn(cmd, mc, subopts, subargs, subopt_parser.error)
        finally:
            if mc != None:
                mc.close()
            if f != None:
                # print "f.close()"
                f.close()

    except EnvironmentError, value:
        if getattr(value, "filename", None) != None:
            write_error(value.filename, value.strerror)
            ret = 1
        elif getattr(value, "strerror", None) != None:
            write_error(mcname, value.strerror)
            ret = 1
        else:
            # something weird
            raise
        if opts.debug:
            raise
Exemplo n.º 27
0
 def gui(self):
     """Start the gui from the board state"""
     import gui
     gui.run(self)
Exemplo n.º 28
0
#!/bin/python3

import logging
import argparse

import gui

if __name__ == '__main__':
    log_level = logging.DEBUG
    logging.basicConfig(level=log_level)

    parser = argparse.ArgumentParser(
        description='ctfi2 - Remotely manage your CTFd server instance',
        epilog="GUI (-G) is default behavior")

    parser.add_argument('-G', action='store_true', help='Start the GUI')
    parser.add_argument('-C', action='store_true', help='Start the CLI')

    args = parser.parse_args()

    if args.C:
        pass

    elif args.G:
        gui.run(log_level)

    else:
        parser.print_help()
Exemplo n.º 29
0
def main():
    gui.run()
Exemplo n.º 30
0
        sys.stdout = _donowt()
        sys.stderr = _donowt()

    for _k, _v in _options:
        if _k == '-d':
            _kwargs['config_filename'] = os.path.join(_v, '.bitpim')
        elif _k == '-c':
            _kwargs['config_filename'] = _v
        elif _k == '-p':
            _kwargs['comm_port'] = _v
        elif _k == '-f':
            _kwargs['phone_model'] = _v
    if _args and _clicmd:
        # CLI detected
        _cli = bp_cli.CLI(_args[0], sys.stdin, sys.stdout, sys.stderr,
                          **_kwargs)
        if _cli.OK:
            _cli.run()
    elif _args and 'bitfling' in _args:
        import bitfling.bitfling
        #if True:
        #    profile("bitfling.prof", "bitfling.bitfling.run(sys.argv)")
        #else:
        bitfling.bitfling.run(sys.argv)
    else:
        import gui
        #if True:
        #    profile("bitpim.prof", "gui.run(sys.argv)")
        #else:
        gui.run(sys.argv, _kwargs)
Exemplo n.º 31
0
def asyncrun(s, d):
    run()
Exemplo n.º 32
0
    import encodings.iso8859_1
    import getopt
    import os.path
    if sys.platform=="darwin" and len(sys.argv)>1 and sys.argv[1].startswith("-psn_"):
	sys.argv=sys.argv[:1]+sys.argv[2:]
    _options, _args=getopt.getopt(sys.argv[1:], 'c:d:')
    _kwargs={}
    _debug=__debug__ or bool(_args and 'debug' in _args)
    if not _debug:
        import warnings
        def ignorer(*args, **kwargs): pass
        warnings.showwarning=ignorer
        class _donowt:
            def __getattr__(self, _):
                return self
            def __call__(self, *args, **kwargs):
                pass
        sys.stdout=_donowt()
        sys.stderr=_donowt()
    for _k,_v in _options:
        if _k=='-d':
            _kwargs['config_filename']=os.path.join(_v, '.bitpim')
        elif _k=='-c':
            _kwargs['config_filename']=_v
    if _args and 'bitfling' in _args:
        import bitfling.bitfling
        bitfling.bitfling.run(sys.argv)
    else:
        import gui
        gui.run(sys.argv, _kwargs)
Exemplo n.º 33
0
    # listo
    def guardar_juego(self):
        if self.hint == "":
            pass
        else:
            gui.pop_piece(int(self.hint[0]), int(self.hint[1]))
            self.hint = ""
        self.numeros += 1
        DATOS.guardados.agregar_nodo(DATOS.puestas.len)
        gui.add_number(self.numeros, self.color)

        print("Presionaron guardar")


if __name__ == 'demo':

    def hook(type, value, traceback):
        print(type)
        print(value)
        print(traceback)

    sys.__excepthook__ = hook

    gui.set_scale(False)  # Any float different from 0
    gui.init()
    gui.set_quality("ultra")  # low, medium, high ultra
    gui.set_animations(False)
    gui.init_grid()
    gui.set_game_interface(MyInterface())  # GUI Listener
    gui.run()
Exemplo n.º 34
0
def main():
    g.run()
Exemplo n.º 35
0
def main():
	prog = sys.argv[0].decode(sys.getdefaultencoding(), "replace")
	usage = "usage: %prog [-ih] memcard.ps2 command [...]"
	description = ("Manipulate PS2 memory card images.\n\n"
		       "Supported commands: ")
	for cmd in sorted(cmd_table.keys()):
		description += "\n   " + cmd + ": " + cmd_table[cmd][3]
		
	version = ("mymc "
		   + verbuild.MYMC_VERSION_MAJOR
		   + "." + verbuild.MYMC_VERSION_BUILD
		   + "   (" + _SCCS_ID + ")")

	optparser = optparse.OptionParser(prog = prog, usage = usage,
					  description = description,
			 		  version = version,
					  formatter = my_help_formatter())
	optparser.add_option("-D", dest = "debug", action = "store_true",
			     default = False, help = optparse.SUPPRESS_HELP)
	optparser.add_option("-i", "--ignore-ecc", action = "store_true",
			     help = "Ignore ECC errors while reading.")
			     
	optparser.disable_interspersed_args()
	(opts, args) = optparser.parse_args()

	if len(args) == 0:
		try:
			import gui
		except ImportError:
			gui = None
		if gui != None:
			gui.run()
			sys.exit(0)

	if len(args) < 2:
		optparser.error("Incorrect number of arguments.")

	if opts.debug:
		cmd_table.update(debug_cmd_table)
	cmd = args[1]
	if cmd not in cmd_table:
		optparser.error('Command "%s" not recognized.' % cmd)
	(fn, mode, usage_args, description, optlist) = cmd_table[cmd]

	usage = "%prog"
	if len(optlist) > 0:
		usage += " [options]"
	if usage_args != None:
		usage += " " + usage_args
	subprog = prog + " memcard.ps2 " + cmd
	subopt_parser = suboption_parser(prog = subprog, usage = usage,
					 description = description,
					 option_list = optlist)
	subopt_parser.disable_interspersed_args()
	
	f = None
	mc = None
	ret = 0
	mcname = args[0]

	try:
		(subopts, subargs) = subopt_parser.parse_args(args[2:])
		try:
			if mode == None:
				ret = fn(cmd, mcname, subopts, subargs,
					 subopt_parser.error)
			else:
				f = file(mcname, mode)
				mc = ps2mc.ps2mc(f, opts.ignore_ecc)
				ret = fn(cmd, mc, subopts, subargs,
					 subopt_parser.error)
		finally:
			if mc != None:
				mc.close()
			if f != None:
				# print "f.close()"
				f.close()

	except EnvironmentError, value:
		if getattr(value, "filename", None) != None:
			write_error(value.filename, value.strerror)
			ret = 1
		elif getattr(value, "strerror", None) != None:
			write_error(mcname, value.strerror)
			ret = 1
		else:		
			# something weird
			raise
		if opts.debug:
			raise
Exemplo n.º 36
0
    :param functioname: Entweder 'sin(x)' oder 'exp(x)'. Bei unbekannter Funktion wird ein ValueError geworfen.
    :return: None
    '''
    # print("Aufruf mit", x0, N, functioname)
    if functioname == 'sin(x)':
        fkt = SineFunction()
    elif functioname == 'exp(x)':
        fkt = ExpFunction()
    else:
        raise ValueError()

    taylor = TaylorApproximation(fkt, N, x0)
    x = np.linspace(-10, 10, 400)
    y = fkt.evaluate(x)
    ytaylor = taylor.evaluate(x)

    ax.plot(x, ytaylor, label=taylor.getLatex())
    ax.plot(x, y, label=fkt.getLatex())
    ax.plot(x0, fkt.evaluate(x0), marker='o', label='$x_0$', mfc='r', mec='g')

    ax.legend(loc='upper right', prop={'size': 6})

    margin = (y.max() - y.min()) * .4
    ax.set_ylim([y.min() - margin, y.min() + margin])


if __name__ == '__main__':
    import gui

    gui.run(plotFunction)
Exemplo n.º 37
0
import math


gui.init()
human = Human(Human.COWARD, Human.NO_WEAPON, cord_x=100, cord_y=100)
human.add_decoration("gui/assets/bullet.png")
zombie = Zombie()
human.angle = 0
ticks = 0


def tick():
    human.cord_x += 1
    human.cord_y += 1
    human.angle += 1

zombies = []
for i in range(20):
    zombie = Zombie(cord_x=random.randint(0, 800), cord_y=random.randint(0, 800))
    gui.add_entity(zombie)
    zombies.append(zombie)


gui.add_entity(human)
gui.add_entity(zombie)
gui.add_entity(GunShopLong(100, 200))
gui.add_entity(GunShopShort(300, 300))
gui.add_entity(Building(300, 200))
gui.add_entity(Bullet(50, 50))
gui.run(tick, 50)
Exemplo n.º 38
0
from gui.entities import Entity, Human
import gui
import os

_PATH = os.path.dirname(os.path.abspath(__file__))

gui.init()

client = Human("ludopata")
client.add_decoration("gui/assets/decoracion/bullet.png")

client.angle = 0
client.y = 0
client.x = 0
ticks = 0


def tick():
    client.x += 1
    client.y += 1
    client.angle = 1


gui.set_size(773, 485)
gui.add_entity(client)
gui.run(tick, 30)
import gui
import processing
import save

M = int(input('M: ') or 10)

allPoints = gui.run()
Xob, yob = processing.dataProcessing(allPoints, M)

path = input('Path to save data: ')
save.writeToFile(Xob, yob, path)
Exemplo n.º 40
0
        ax = self.ax1

        ax.plot(t * 1e3, y)
        ax.set_title('Zeitbereichsdarstellung')
        ax.set_xlabel('t [ms]')
        ax.set_ylabel('Amplitude')
        ax.grid()

    def plotAmplitudeSpectrum(self, f, c):
        ax = self.ax2

        ax.plot(f, abs(c), marker='.', color='k')
        ax.set_title('Fourier Koeffizienten')
        ax.set_xlabel('f [Hz]')
        ax.set_ylabel('Amplitude')
        ax.grid()

        from matplotlib.ticker import ScalarFormatter
        for axis in [ax.xaxis]:
            axis.set_major_formatter(ScalarFormatter())

    def do(self):
        t, y = self.readData()
        f, c = self.calcFourierCoefficients(t, y)
        self.plotTimeSignal(t, y)
        self.plotAmplitudeSpectrum(f, c)

if __name__ == '__main__':
    import gui
    gui.run(Creator(), Analyzer())
Exemplo n.º 41
0
 def gui_handler(self):
     '''launch wxwidgets gui'''
     import gui
     gui.run(self.dev)
Exemplo n.º 42
0
class MyInterface(gui.GameInterface):

    def piece_clicked(self, row, column, section, piece):
        piece.selected = not piece.selected
        print("{}, {} Section: {}".format(row, column, section))

    def reverse_clicked(self, clockwise):
        print(clockwise)
        gui.set_points(100)

    def piece_section_entered(self, section, piece):
        print("Section entered {}".format(section))

    def hint_asked(self):
        print("Para k kieres saber eso jaja saludos")

    def save_game(self):
        print("Save game")

gui.init()
gui.set_quality("ultra")  # low, medium, high ultra
gui.set_animations(False)
gui.set_scale(1)  # Any float different from 0
gui.set_game_interface(MyInterface())  # GUI Listener
gui.add_piece(0, 0, random.choice(variables.HEXAGON_TYPES))


gui.run()

Exemplo n.º 43
0
    if gewinner(Spielfeld):
        return

    ix, iy = mapMouseToField(x, y, width, height)
    ok = setField(ix, iy, tokens[current], Spielfeld)

    if ok:
        current = (current + 1) % 2
        window.setStatus("Das {} ist dran...".format(tokens[current]))
    else:
        window.setStatus("Bitte auf ein freies Feld drücken.")

    who = gewinner(Spielfeld)
    if who is not None:
        window.setStatus("{} hat gewonnen!".format(who))
    elif unentschieden(Spielfeld):
        window.setStatus("unentschieden")
        return


if __name__ == '__main__':
    import sys, os

    sys.path.insert(0, os.path.dirname(__file__))
    import gui

    gui.run(callback_repaint=repaint,
            callback_init=init,
            callback_mouseclick=mouseclick)
Exemplo n.º 44
0
# -*- coding: utf-8 -*-

import math

def berechnung(radius):
    return 0  # Diese Zeile bitte entfernen
#
#
#               HIER KOMMT IHRE LÖSUNG
#
#


#######################################
#        AB HIER NICHTS MEHR ÄNDERN
#######################################

if __name__ == '__main__':
    import gui
    gui.run(berechnung)
Exemplo n.º 45
0
        self.add_point(10, 2, 11, "white")
        self.add_line((6, 2), (5, 1), "black")

    def on_piece_click(self, letter, y):
        # self.remove_piece(letter, y)
        self.add_piece(letter, y, '1', "white")
        self.show_message("Added {},{}".format(letter, y))

    def on_point_click(self, x, y):
        self.remove_point(x, y)

    def on_open_click(self, path):
        print(path)

    def on_save_click(self, path):
        print(path)

    def on_pass_click(self):
        self.remove_line((6, 2), (5, 1))
        print("pass")

    def on_count_click(self):
        print("count")

    def on_resign_click(self):
        print("resign")


if __name__ == '__main__':
    run(MyWindow())
Exemplo n.º 46
0
#!/usr/bin/env python3

from gui import run
import multiprocessing

run()
Exemplo n.º 47
0
def main():
    args = parser.parse_args()
    logger.setLevel(args.loglevel)
    handler.setFormatter(formatter)
    handler.setLevel(args.loglevel)
    logger.addHandler(handler)

    # If gui was specified we will launch te GUI otherwise the program will run from the command line
    if args.gui:
        import gui
        gui.run()
    else:
        # A scan of the network has been requested
        if args.scan:
            logger.info("Scanning for interfaces")
            interfaces = scan.get_interfaces()
            logger.info("The following interfaces are present: \n")
            for i in interfaces:
                logger.info(i)
        elif args.arp == 'silent' or args.arp == 's':
            args = check_arp(args)
            logging.info("Starting silent ARP Poison")
            for i in range(len(args.victim)):
                poison_thread = threading.Thread(
                    target=scan.arp_poison_stealthy,
                    args=(args.victim[i], args.victimmac[i], args.gateway,
                          args.attackermac))
                poison_thread.start()
            if args.dns is not None:
                dns_spoof(args)

            threads_started(len(args.victim))
            sys.exit(0)
        elif args.arp == 'normal' or args.arp == 'n':
            args = check_arp(args)
            logging.info("Starting ARP Poison")
            for i in range(len(args.victim)):
                poison_thread = threading.Thread(
                    target=scan.arp_poison,
                    args=(args.victim[i], args.victimmac[i], args.gateway,
                          args.gatewaymac, args.attackermac, args.packets))
                poison_thread.start()
            if args.dns is not None:
                dns_spoof(args)

            threads_started(len(args.victim))
            sys.exit(0)
        elif args.dns:
            dns_spoof(args)
            sys.exit(0)
        elif args.arp == 'restore' or args.arp == 'r':
            args = check_arp(args)
            logging.info("Starting ARP Restore")
            for i in range(len(args.victim)):
                restore_thread = threading.Thread(
                    target=scan.arp_restore,
                    args=(args.victim[i], args.victimmac[i], args.gateway,
                          args.gatewaymac))
                restore_thread.start()
        elif args.scaniface:
            # Grab the IP's and MAC addresses
            logger.info("Matching the interface")
            interfaces = scan.get_interfaces()
            interfaces = [s for s in interfaces if re.match(args.scaniface, s)]
            if len(interfaces) == 1:
                logger.info("Scanning for devices")
                s = interfaces[0].split(", ")
                scan.scan(net=s[0], interface=s[1])
            else:
                logger.warn(
                    "Cannot find one interface that matches, you can use the -s or --scan "
                    "flag to list interfaces")
                sys.exit(0)
Exemplo n.º 48
0
#create waveform of wav file
def createWaveform(wavFileName):
    spf = wave.open(wavFileName, 'r')
    #Extract Raw Audio from Wav File
    signal = spf.readframes(-1)
    signal = np.fromstring(signal, 'Int16')

    #If Stereo
    if spf.getnchannels() == 2:
        print 'Just mono files'
        sys.exit(0)

    fig = plt.figure(1)
    plt.title('Signal Wave...')
    plt.plot(signal)
    play_wav(wavFileName)

    plt.grid()
    plt.show()


#main
if __name__ == '__main__':
    #read bag file
    bagFile = parse_arguments()
    audioData = audio_bag_file(bagFile)
    # get audio data
    mp3FileName = write_mp3_file(audioData, bagFile)
    wavFileName = mp3_to_wav(mp3FileName)
    gui.run(wavFileName, bagFile)
Exemplo n.º 49
0
def run_gui():
    import gui

    gui.run(tasks, sys.argv)