Beispiel #1
0
 def new(self):
     """
     re inits the window. gui doesnt get imported till now to protect against import loops and other shenanigans
     """
     self._exit()
     import gui as Gui
     Gui.gui()
Beispiel #2
0
def main(args):
    if len(args) == 2 and args[1] in ["help", "-h", "--help"]:
        usage(args[0])
    elif len(args) == 3:
        maker(args[1], args[2])
    else:
        import gui
        gui.gui(args)
Beispiel #3
0
def main(args):
    if len(args) == 2 and args[1] in ["help", "-h", "--help"]:
        usage(args[0])
    elif len(args) == 3:
        maker(args[1], args[2])
    else:
        import gui
        gui.gui(args)
Beispiel #4
0
def main():
    try:
        if len(sys.argv) == 1:
            gui()
        elif len(sys.argv) == 2:
            print('Enter command and webpage address, please')
        else:
            command = sys.argv[1]
            web_page_address = sys.argv[2]

            work_with_db(web_page_address, command)
    except Exception as error:
        print("Enter correct command, please")
        print(error)
Beispiel #5
0
def main():
    global output_mode, gui_class

    # Check if there are any command line arguments of the correct format.
    if len(sys.argv) > 1 and sys.argv[1] == '-o' and len(sys.argv) > 2:
        # Set the output mode according to the argument.
        if sys.argv[2] == 'none':
            output_mode = 1
        elif sys.argv[2] == 'fancy':
            output_mode = 2
        elif sys.argv[2] == 'gui':
            output_mode = 3

            # If we are using a GUI, then set up the GUI on the main thread, and run the core loop on a separate thread.
            back_process = Thread(target=run_loop)
            gui_class = gui.gui(io, 600, 300)

            try:
                back_process.start()
                gui_class.run_gui()
            except KeyboardInterrupt:
                handle_interrupt()

            return

    # Run the core loop on the main thread, if we aren't using a GUI.
    try:
        run_loop()
    except KeyboardInterrupt:
        handle_interrupt()
Beispiel #6
0
	def __init__(self):
		self.version = gamemod.VERSION

		self.bannedservers = serverlist()
		self.registeredservers = serverlist(banned=self.bannedservers)
		self.pendingservers = serverlist(banned=self.bannedservers)

		self.masterclient = masterclient(self.pendingservers) # fetch gameservers from sauerbraten.org

		self.additionalservers = additionalservers(self.registeredservers, self.pendingservers, self.bannedservers) # fetch additional gameserver from servers.cfg and ban servers in banned.cfg
		self.additionalservers.load()

		self.gui = gui(self)
		self.gui.load()

		self.masterserver = masterserver(self.registeredservers, self.pendingservers) # let gameservers register at this (regserv) and let gameservers be registered by someone else (suggest)
		self.guiprovider = guiprovider(self.onguirequest) # provide the gamemod gui & server list
		self.statsprovider = statsprovider(self) # provide access to stats via additional commands

		# listen for connections from both clients requesting list of servers and servers trying to register and forward them to all functions in list respectively, until one of them returns a reply
		self.netserver = netserver([self.onrequest, self.masterserver.onrequest, self.guiprovider.onrequest, self.statsprovider.onrequest])

		# ping servers and kick them out if they time out / add pending servers as registered if they reply in time
		# handle replies from servers
		self.servercommunicator = servercommunicator(self.registeredservers, self.pendingservers)
Beispiel #7
0
    def __init__(self, width, height, size):
        self.width = width
        self.height = height

        self.gui = gui(self.width, self.height, "Level editor")

        self.widthRes = int(self.gui.winWidth / size)
        self.heightRes = int(self.gui.winHeight / size)
        self.size = size
        self.maze = []
        self.selectedCells = []

        makeMaze(self.maze, self.widthRes, self.heightRes, self.size)
        self.drawMaze()

        btn = Button(self.gui.master,
                     text='Done',
                     command=self.gui.master.destroy)
        btn.pack()

        self.gui.master.bind('<Button-1>', self.placeCell)
        self.gui.master.bind('<B1-Motion>', self.placeCell)
        self.gui.master.bind('<Button-3>', self.removeCell)
        self.gui.master.bind('<B3-Motion>', self.removeCell)

        self.gui.mainloop()
Beispiel #8
0
    def __init__(self, options):
        gr.top_block.__init__(self)

        self.options = options

        # create a QT application
        self.qapp = QtGui.QApplication(sys.argv)
        # give Ctrl+C back to system
        signal.signal(signal.SIGINT, signal.SIG_DFL)

        # socket addresses
        rpc_adr_server = "tcp://localhost:6666"
        rpc_adr_reply = "tcp://*:6666"
        probe_adr_gui = "tcp://localhost:5556"
        probe_adr_fg = "tcp://*:5556"
        sink_adr = "tcp://*:5555"
        source_adr = "tcp://localhost:5555"

        # create the main window
        self.ui = gui.gui("Loop", rpc_adr_server, rpc_adr_server,
                          probe_adr_gui)
        self.ui.show()

        # the strange sampling rate gives a nice movement in the plot :P
        self.samp_rate = samp_rate = 48200

        # blocks
        self.gr_sig_source = analog.sig_source_f(samp_rate, analog.GR_SIN_WAVE,
                                                 1000, 1, 0)
        self.null_source = blocks.null_source(gr.sizeof_float)
        self.throttle = blocks.throttle(gr.sizeof_float, samp_rate)
        self.zmq_source = zmqblocks.source_pushpull_feedback(
            gr.sizeof_float, source_adr)
        self.mult_a = blocks.multiply_const_ff(1)
        self.mult_b = blocks.multiply_const_ff(0.5)
        self.add = blocks.add_ff(1)
        #self.zmq_sink = zmqblocks.sink_reqrep_nopoll(gr.sizeof_float, sink_adr)
        #self.zmq_sink = zmqblocks.sink_reqrep(gr.sizeof_float, sink_adr)
        self.zmq_sink = zmqblocks.sink_pushpull(gr.sizeof_float, sink_adr)
        self.zmq_probe = zmqblocks.sink_pushpull(gr.sizeof_float, probe_adr_fg)
        #self.null_sink = blocks.null_sink(gr.sizeof_float)

        # connects
        self.connect(self.gr_sig_source, self.mult_a)
        self.connect(self.zmq_source, self.mult_b, (self.add, 1))
        #        self.connect(self.null_source, (self.add,1))
        self.connect(self.mult_a, (self.add, 0), self.throttle, self.zmq_sink)
        self.connect(self.throttle, self.zmq_probe)

        # ZeroMQ
        self.rpc_manager = zmqblocks.rpc_manager()
        self.rpc_manager.set_reply_socket(rpc_adr_reply)
        self.rpc_manager.add_interface("start_fg", self.start_fg)
        self.rpc_manager.add_interface("stop_fg", self.stop_fg)
        self.rpc_manager.add_interface("set_waveform", self.set_waveform)
        self.rpc_manager.add_interface("set_k", self.mult_a.set_k)
        self.rpc_manager.add_interface("get_sample_rate",
                                       self.throttle.sample_rate)
        self.rpc_manager.start_watcher()
def main():
    chessdatabase = "database"                  #Name of directory containing all databases
    databaselist = read_database(chessdatabase) #Creates list of I/O wrappers for all databases listed
    print("Initialization complete!")

    while True:
        print()
        print("Please select from the options:")
        print("1. Search \n2. Create game \n3. Analytics \n4. Display game\n5. Exit")
        enterinput = input()
        if enterinput in "1":             #Search option selected
            searchcriteria = search.enter_search()      #Asks user for search criteria
            showfirstgame = True
            pgnresult = []
            print("Please wait, searching through database...")
            for i in range(len(databaselist)):
                pgnresult += search.query_database(databaselist[i],searchcriteria)  #Store filtered results
                if showfirstgame:              #Show an example game found in the GUI
                    showfirstgame = False
            search.save_pgn(pgnresult,"FilteredGames.pgn")
            print("Export complete! Results are stored in database/FilteredGames.pgn")
            break
        elif enterinput in "2": #Create game
            try:
                import gui_pgn
            except:
                command_line_board(None, False)
        elif enterinput in "3":
            pgnlist = analytic.getlist(databaselist)
            analytic.graphTypes(pgnlist)
            break
        elif enterinput in "4":
            try:
                try:
                    game = chess.pgn.read_game(databaselist[0])
                    gui.gui(game)
                except:     #If GUI fails to display, use database_games to show every game in command-line
                    database_games(game, showpgn=False, cmdboard=True)
            except IndexError:
                print("Search found no games within the database!")
        elif enterinput in "5":
            print("Exiting program")
            break
        else:
            print("Invalid input")
Beispiel #10
0
 def run(self):
     if self.gs.guiOn:
         window = Tk()
         GUI = gui(window, self.gs)
         self.GUI = GUI
         GUI.window.bind("<Button-1>",
                         lambda event: self.gamePlay(event, GUI), GUI)
         window.mainloop()
     else:
         self.gamePlay()
Beispiel #11
0
    def __init__(self, options):
        gr.top_block.__init__(self)  

        self.options = options

        # create a QT application
        self.qapp = QtGui.QApplication(sys.argv)
        # give Ctrl+C back to system
        signal.signal(signal.SIGINT, signal.SIG_DFL)

        # socket addresses
        rpc_adr_server = "tcp://localhost:6666"
        rpc_adr_reply = "tcp://*:6666"
        probe_adr_gui = "tcp://localhost:5556"
        probe_adr_fg = "tcp://*:5556"
        sink_adr = "tcp://*:5555"
        source_adr = "tcp://localhost:5555"

        # create the main window
        self.ui = gui.gui("Loop",rpc_adr_server,rpc_adr_server,probe_adr_gui)
        self.ui.show()

        # the strange sampling rate gives a nice movement in the plot :P
        self.samp_rate = samp_rate = 48200

        # blocks
        self.gr_sig_source = analog.sig_source_f(samp_rate, analog.GR_SIN_WAVE , 1000, 1, 0)
        self.null_source = blocks.null_source(gr.sizeof_float)
        self.throttle = blocks.throttle(gr.sizeof_float, samp_rate)
        self.zmq_source = zmqblocks.source_pushpull_feedback(gr.sizeof_float,source_adr)
        self.mult_a = blocks.multiply_const_ff(1)
        self.mult_b = blocks.multiply_const_ff(0.5)
        self.add = blocks.add_ff(1)
        #self.zmq_sink = zmqblocks.sink_reqrep_nopoll(gr.sizeof_float, sink_adr)
        #self.zmq_sink = zmqblocks.sink_reqrep(gr.sizeof_float, sink_adr)
        self.zmq_sink = zmqblocks.sink_pushpull(gr.sizeof_float, sink_adr)
        self.zmq_probe = zmqblocks.sink_pushpull(gr.sizeof_float, probe_adr_fg)
        #self.null_sink = blocks.null_sink(gr.sizeof_float)

        # connects
        self.connect(self.gr_sig_source, self.mult_a)
        self.connect(self.zmq_source, self.mult_b, (self.add,1))
#        self.connect(self.null_source, (self.add,1))
        self.connect(self.mult_a, (self.add, 0), self.throttle, self.zmq_sink)
        self.connect(self.throttle, self.zmq_probe)

        # ZeroMQ
        self.rpc_manager = zmqblocks.rpc_manager()
        self.rpc_manager.set_reply_socket(rpc_adr_reply)
        self.rpc_manager.add_interface("start_fg",self.start_fg)
        self.rpc_manager.add_interface("stop_fg",self.stop_fg)
        self.rpc_manager.add_interface("set_waveform",self.set_waveform)
        self.rpc_manager.add_interface("set_k",self.mult_a.set_k)
        self.rpc_manager.add_interface("get_sample_rate",self.throttle.sample_rate)
        self.rpc_manager.start_watcher()
Beispiel #12
0
 def launch(self):
  if self.type == "gui":
    self.g = gui()
    self.g.launch(self.modPath)
  if self.type == "console":
    try :
     self.c.cmdloop()
    except AttributeError:
      loader().do_load(self.modPath)
      self.c = console()
      self.c.cmdloop()
Beispiel #13
0
def main():

    # User GUI input
    gui_input = gui.gui()
    directory = gui_input["datadir"]
    gantry_name = gui_input["gantry"]
    outputdir = gui_input["outputdir"]
    operator1 = gui_input["op1"]
    operator2 = gui_input["op2"]
    gantry_angles_in = gui_input["angles"]
    energies_in = gui_input["energies"]
    comment = gui_input["comment"]

    # Make energies and GA lists from input; ensure -180 < ga < 180
    energies = [int(e) for e in energies_in.split(",")]
    gas = [int(ga) for ga in gantry_angles_in.split(",")]
    gantry_angles = [ga - 360 if ga > 180 else ga for ga in gas]

    print(f"GAs: {gantry_angles}")
    print(f"Es: {energies}")

    filenames = get_filenames(directory)
    filesok = check_files(filenames, gantry_angles, energies)

    # Get acquisition date and time from from Logos output.txt file
    adate, atime = get_acquisition_date_time(join(directory, "output.txt"))

    # New directory for results
    res_dir_name = gantry_name + " " + str(adate)
    result_dir = make_results_directory(outputdir, res_dir_name)
    print("Results will be printed to {}".format(result_dir))

    if filesok:
        print("Full data set found")
        beams = get_ordered_beams(filenames)
        full_analysis(gantry_angles, energies, operator1, operator2, directory,
                      beams, gantry_name, adate, atime, comment, result_dir)
    else:
        msg = ("\nINCORRECT NUMBER OF FILES FOUND\n"
               "- Did you choose correct directory?\n"
               "- Are GANTRY and ENERGY correct in config.py?\n")
        print(msg)
        ask = True
        while ask:
            ans = input("Yes/No (Y/N): ")
            if ans.lower().strip([0]) == "n":
                print("Exiting program")
                exit(0)
            elif ans.lower().strip()[0] == "y":
                partial_analyze.analysis()
                ask = False
def main():

    parser = argparse.ArgumentParser(
        description='Python based event display core, doesn\'t draw data.')
    geom = parser.add_mutually_exclusive_group()
    geom.add_argument('-A',
                      '-a',
                      '--argoneut',
                      action='store_true',
                      help="Run with the argoneut geometry")
    geom.add_argument('-U',
                      '-u',
                      '--uboone',
                      action='store_true',
                      help="Run with the microboone geometry")
    geom.add_argument('-L',
                      '-l',
                      '--lariat',
                      action='store_true',
                      help="Run with the lariat geometry")
    parser.add_argument('file', nargs='*', help="Optional input file to use")

    args = parser.parse_args()

    app = QtGui.QApplication(sys.argv)

    if args.uboone:
        geom = evdmanager.microboone()
    elif args.lariat:
        geom = evdmanager.lariat()
    else:
        geom = evdmanager.argoneut()

    # If a file was passed, give it to the manager:

    thisgui = gui.gui(geom)
    thisgui.initManager()
    thisgui.initUI()

    # manager = larlite_manager(geom)
    # manager.setInputFiles(args.file)

    # manager.goToEvent(0)

    signal.signal(signal.SIGINT, sigintHandler)
    timer = QtCore.QTimer()
    timer.start(500)  # You may change this if you wish.
    timer.timeout.connect(lambda: None)  # Let the interpreter run each 500 ms.

    app.exec_()
Beispiel #15
0
    def __init__(self):
        #gobject.GObject.__init__(self)
        #gobject.threads_init()
        gtk.gdk.threads_init()
        # Para la simulacion, llamar al procedimiento simular cada segundo.
        #gobject.timeout_add(1000, self.simular)

        # Definiciones generales

        self.ALARMA = False
        self.DEBUG  = True
        self.modulos_activos = []
        self.pila_sql = Queue.Queue(maxsize=100)
        self.pila_tramas_leidas = Queue.Queue()

        self.logs = logging.getLogger("logtoc")
        self.logs.setLevel(logging.DEBUG)
        path_logs = os.path.join(os.path.dirname(__file__), "toc.log")
        self.logs_h = logging.FileHandler(path_logs)
        self.logs_f = logging.Formatter("%(name)s: %(levelname)s %(asctime)s %(module)s:%(funcName) %(lineno)d: %(message)s")
        self.logs_h.setFormatter(self.logs_f)
        self.logs_h.setLevel(logging.DEBUG)
        self.logs.addHandler(self.logs_h)


        self.validar = validador(self)
        self.alarmas = alarmas_email(self)
        # Obtener configuracion del archivo.

        self.configuracion = SafeConfigParser()
        self.cargar_configuracion()
        self.id_localizacion = self.configuracion.get("lugar", "id")

        self.base = conectorBD(self)

        self.ventana = gui(self)


        self.tarjeta = tarjetaTOC(self)

        if self.base.conectar():
            self.ventana.cambiar_estado_base("Conectada")
        else:
            self.ventana.cambiar_estado_base("Falló")

        # Comentar esta linea cuando ya no sea necesaria la simulacion
        #self.simular()
        self.guardar_en_pila(self.guardar_evento("Se inicio la aplicación", "0"))
        self.logs.debug("Se inicio la aplicacion")
Beispiel #16
0
Datei: ui.py Projekt: halbbob/dff
 def launch(self):
  if self.type == "gui":
    self.g = gui(self.debug)
    try:
      self.c
      self.g.launch()
    except AttributeError:
      self.g.launch(self.modPath)
  if self.type == "console":
    try :
     self.c.cmdloop()
    except AttributeError:
      loader().do_load(self.modPath)
      self.c = console(DEBUG = self.debug, VERBOSITY = self.verbosity)
      self.c.cmdloop()
Beispiel #17
0
def main():
    root = Tk()
    screen = gui.gui(root)

    root.geometry("700x600")
    commands.Commands(screen)
    voice = voiceRec(screen)
    data("goodreads_library_export.csv")
    root.resizable(width=False, height=False)
    p = Process(target=voice.main)
    p.start()
    p2 = Process(target=root.mainloop)
    p2.start()
    threading.Thread(target=voice.main()).start()
    threading.Thread(target=root.mainloop()).start()
Beispiel #18
0
def login():
    global hook
    global email_auth
    global pass_auth
    email_auth = emailEntry.get()
    pass_auth = passEntry.get()
    hook = EmailHook(email_auth, pass_auth, 'imap.gmail.com')
    try:
        g = gui(root, hook)
        login_root.destroy()
        loginPrompt.destroy()
        g.startInbox()
    except:
        emailEntry.delete(0, len(email_auth))
        passEntry.delete(0, len(pass_auth))
    def guiBase(self):
        ## Create gui
        self.gui = gui.gui()

        ## Add simulator gui items
        self.sim = simulatorGui.simulatorGui()

        ## Add controller items
        self.control = controller.controller()

        self.updateValues()
        self.gui.master.mainloop()
        try:
            self.gui.master.destroy()
        finally:
            print("App has been destroyed")
Beispiel #20
0
def main():
    print('Main rutine started')
    dir = os.path.dirname(os.path.abspath(__file__))
    print(dir)
    dir = os.path.abspath(dir + '/../')
    print(dir)
    uploadDir = (dir +'/uploadPictures/')
    uploadPrivDir = (dir + '/uploadPrivate/')
    
    cam = camera()
    g = gui(cam,uploadDir,uploadPrivDir)
    
    deamon = uploaderThread(uploadDir, uploadPrivDir, g)
    deamon.start()
    g.run()
    deamon.stop()
    deamon.join()
Beispiel #21
0
 def init(self):
     # load the config file
     self.nettester_config = config()
     # initialize the gui
     self.nettester_gui = gui(
         self.nettester_config.config["resolution"],
         self.nettester_config.config["fg_color"],
         self.nettester_config.config["bg_color"],
         self.nettester_config.config["font_size_correction"],
         self.nettester_config.config["show_mouse_cursor"],
     )
     # initialize the networking
     self.nettester_net = net()
     # create the buttons
     self.create_buttons()
     self.switch_to_wired()
     return True
Beispiel #22
0
def main():

    parser = argparse.ArgumentParser(description='Python based event display core, doesn\'t draw data.')
    geom = parser.add_mutually_exclusive_group()
    geom.add_argument('-A', '-a', '--argoneut',
                      action='store_true',
                      help="Run with the argoneut geometry")
    geom.add_argument('-U', '-u', '--uboone',
                      action='store_true',
                      help="Run with the microboone geometry")
    geom.add_argument('-L', '-l', '--lariat',
                      action='store_true',
                      help="Run with the lariat geometry")
    parser.add_argument('file', nargs='*', help="Optional input file to use")

    args = parser.parse_args()

    app = QtGui.QApplication(sys.argv)

    if args.uboone:
        geom = evdmanager.microboone()
    elif args.lariat:
        geom = evdmanager.lariat()
    else:
        geom = evdmanager.argoneut()

    # If a file was passed, give it to the manager:


    thisgui = gui.gui(geom)
    thisgui.initManager()
    thisgui.initUI()

    # manager = larlite_manager(geom)
    # manager.setInputFiles(args.file)


    # manager.goToEvent(0)

    signal.signal(signal.SIGINT, sigintHandler)
    timer = QtCore.QTimer()
    timer.start(500)  # You may change this if you wish.
    timer.timeout.connect(lambda: None)  # Let the interpreter run each 500 ms.

    app.exec_()
Beispiel #23
0
    def __init__(self, name):
        widget.__init__(self, name)

        # debug
        self.debug = config_var("debug", True)
        self.debug.hook = self.update_debug
        #enable / disable debug
        self.debug.set(True)

        #config path
        config_file_reader.config_path = "conf"

        cfr = config_file_reader()
        cfr.debug()

        self.gui = gui("gui")
        self.apps = apps("apps")
        self.log_debug("init liquidsand done")
Beispiel #24
0
    def __init__(self, filename):
        with open(filename) as data_file:
            data = json.load(data_file)

            self.domain = {}
            for var in data["variables"]:
                self.domain[var["name"]] = var["domain"]

            self.constraints = {}
            for c in data["constraints"]:
                a = c["scope"][0]
                b = c["scope"][1]
                self.constraints[(a, b)] = c["relation"]

            self.order = data["ordering"]
            self.assign = {}
            self.pruned = {}
            self.gui = gui.gui(self.domain, self.constraints, self.order)
Beispiel #25
0
def main():
	global ch, code, view, init_done
	ch = channel('BPSK')
	code = hamming_code(2, ch)
	get_input(None)
	view = gui.gui()
	view.add_radio_button([0.0, 0.0, 0.18, 0.15], ('BPSK', 'QPSK'), set_modulation)
	view.add_radio_button([0.0, 0.15, 0.18, 0.15], ('Syndrome', 'Chase'), set_ecc)
	view.add_radio_button([0.0, 0.30, 0.18, 0.15], ('(5,2,3)', '(7,4,3)'), set_code)
	view.add_button([0.0, 0.90, 0.18, 0.1], 'Decode', decode_now)
	view.add_button([0.0, 0.80, 0.18, 0.1], 'New Input', get_input)
	view.add_button([0.0, 0.70, 0.18, 0.1], 'Select Symbol', select_symbol)
	view.add_button([0.0, 0.60, 0.18, 0.1], 'Deselect Symbol', deselect_symbol)
	view.add_button([0.0, 0.50, 0.18, 0.1], 'Cust. Soft Values', custom_noise)
	view.add_slider([0.25, 0.05, 0.65, 0.08], 'Noise', (0, 3.0), set_noise)
	set_modulation('BPSK')
	init_done = True
	update()
	view.go()
	return
def Create_interaction(**kwargs):
    #fig,ax = plt.subplots()
    m = mi.build_basemap()
    plt.gca().set_title('line segments')
    lat0, lon0 = mi.pll('22 58.783S'), mi.pll('14 38.717E')
    x0, y0 = m(lon0, lat0)
    line, = m.plot([x0], [y0], 'ro-')
    text = ('Press s to stop interaction\\n'
            'Press i to restart interaction\\n')
    #plt.text(1.0,0.1,text)
    wb = ex.dict_position(**kwargs)
    lines = mi.LineBuilder(line, m=m, ex=wb)
    print 'after line builder'
    plt.show()
    print 'after show'
    plt.gcf().canvas._tkcanvas.master.geometry("900x1000")
    print 'after canvas'
    g = gui.gui(lines)
    g.make_gui()
    print 'after gui'
    return lines
def Create_interaction(**kwargs):
    #fig,ax = plt.subplots()
    m = mi.build_basemap()
    plt.gca().set_title('line segments')
    lat0,lon0 = mi.pll('22 58.783S'), mi.pll('14 38.717E')
    x0,y0 = m(lon0,lat0)
    line, = m.plot([x0],[y0],'ro-')
    text = ('Press s to stop interaction\\n'
            'Press i to restart interaction\\n')
    #plt.text(1.0,0.1,text)
    wb = ex.dict_position(**kwargs)
    lines = mi.LineBuilder(line,m=m,ex=wb)
    print 'after line builder'
    plt.show()
    print 'after show'
    plt.gcf().canvas._tkcanvas.master.geometry("900x1000")
    print 'after canvas'
    g = gui.gui(lines)
    g.make_gui()
    print 'after gui'
    return lines
Beispiel #28
0
def main():

    parser = argparse.ArgumentParser(description="Display space points")
    group = parser.add_mutually_exclusive_group()
    parser.add_argument("file", help = "The file you wish " + \
                    "to read.", type = str)
    args = parser.parse_args()

    input_file = args.file

    app = QtGui.QApplication(sys.argv)

    manager = view_manager.view_manager()
    manager.setInputFile(input_file)

    thisgui = gui.gui()
    thisgui.setManager(manager)
    thisgui.initUI()

    manager.eventChanged.connect(thisgui.update)

    sys.exit(app.exec_())
Beispiel #29
0
def run():  
    validator = validation()
    human_visible_map = game_table()            
    computer_invisible_map = game_table()        
    computer_visible_map = game_table()
    human_invisible_map = game_table()
    
    human_player = player(human_visible_map, computer_invisible_map, computer_visible_map)
    computer_player = player(computer_visible_map, human_invisible_map, human_visible_map)
    game_controller = game_development(validator, human_player, computer_player)
    try:
        with open("settings.properties", "r") as settings_file:
            chosen_ui = settings_file.readlines()[2].split()[2]
            if chosen_ui == "ConsoleUI":
                chosen_ui = console_ui(game_controller)
                chosen_ui.run() 
            elif chosen_ui == "GUI":
                chosen_ui = gui(game_controller)
                chosen_ui.run() 
            else:
                raise InvalidUI("Invalid UI! Please check the 'settings.properties' file!")
    except InvalidUI as exception_message:
        print(exception_message)
Beispiel #30
0
    def __init__(self):
        self.version = gamemod.VERSION

        self.bannedservers = serverlist()
        self.registeredservers = serverlist(banned=self.bannedservers)
        self.pendingservers = serverlist(banned=self.bannedservers)

        self.masterclient = masterclient(
            self.pendingservers)  # fetch gameservers from sauerbraten.org

        self.additionalservers = additionalservers(
            self.registeredservers, self.pendingservers, self.bannedservers
        )  # fetch additional gameserver from servers.cfg and ban servers in banned.cfg
        self.additionalservers.load()

        self.gui = gui(self)
        self.gui.load()

        self.masterserver = masterserver(
            self.registeredservers, self.pendingservers
        )  # let gameservers register at this (regserv) and let gameservers be registered by someone else (suggest)
        self.guiprovider = guiprovider(
            self.onguirequest)  # provide the gamemod gui & server list
        self.statsprovider = statsprovider(
            self)  # provide access to stats via additional commands

        # listen for connections from both clients requesting list of servers and servers trying to register and forward them to all functions in list respectively, until one of them returns a reply
        self.netserver = netserver([
            self.onrequest, self.masterserver.onrequest,
            self.guiprovider.onrequest, self.statsprovider.onrequest
        ])

        # ping servers and kick them out if they time out / add pending servers as registered if they reply in time
        # handle replies from servers
        self.servercommunicator = servercommunicator(self.registeredservers,
                                                     self.pendingservers)
from PySimpleGUI import WIN_CLOSED
from utils import *
from get_music import *
from gui import gui

if __name__ == "__main__":
    window = gui()

    def error(error):
        window.Element("error").Update(value=error)

    def download_visible(bool=True):
        window.Element('music_title').Update(visible=bool)
        if not bool:
            window.Element('-IMAGE-').Update('')
        window.Element('download').Update(visible=bool)
        window.Element('sucess').Update(visible=False)

    while True:

        event, values = window.read()

        if event == "search":
            url = values["url"]
            download_visible(False)

            if not url:
                error("Insira um link!")
            else:
                error("")
                music = get_music(url)
Beispiel #32
0
 def __init__(self):
     gui()
def build_buttons(ui,lines,vertical=True):
    'Program to set up the buttons'
    import gui
    import Tkinter as tk
    from matplotlib.colors import cnames
    if vertical:
        side = tk.TOP
        h = 2
        w = 20
    else:
        side = tk.LEFT
        h = 20
        w = 2
    g = gui.gui(lines,root=ui.root,noplt=True)
    g.refresh = tk.Button(g.root,text='Refresh',
                          command=g.refresh,
                          bg='chartreuse')
    g.bopenfile = tk.Button(g.root,text='Open Excel file',
                            command=g.gui_open_xl)
    g.bsavexl = tk.Button(g.root,text='Save Excel file',
                          command=g.gui_save_xl)
    g.bsavetxt = tk.Button(g.root,text='Save text file',
                          command=g.gui_save_txt)
    g.bsaveas2kml = tk.Button(g.root,text='SaveAs to Kml',
                              command=g.gui_saveas2kml)
    g.bsave2kml = tk.Button(g.root,text='Update Kml',
                            command=g.gui_save2kml)
    g.bsave2gpx = tk.Button(g.root,text='Save to GPX',
                            command=g.gui_save2gpx)
    g.refresh.pack(in_=ui.top,side=side,fill=tk.X,pady=8)
    tk.Label(g.root,text='File options').pack(in_=ui.top,side=side) 
    g.bopenfile.pack(in_=ui.top,side=side)
    g.bsavexl.pack(in_=ui.top,side=side)
    g.bsavetxt.pack(in_=ui.top,side=side)
    g.bsaveas2kml.pack(in_=ui.top,side=side)
    g.bsave2kml.pack(in_=ui.top,side=side)
    g.bsave2gpx.pack(in_=ui.top,side=side)
    tk.Frame(g.root,height=h,width=w,bg='black',relief='sunken'
             ).pack(in_=ui.top,side=side,padx=8,pady=5)
    tk.Label(g.root,text='Other plots').pack(in_=ui.top,side=side)
    g.bplotalt = tk.Button(g.root,text='Plot alt vs time',
                           command=g.gui_plotalttime)
    g.bplotalt.pack(in_=ui.top,side=side)
    g.bplotsza = tk.Button(g.root,text='Plot SZA',
                           command=g.gui_plotsza)
    g.bplotsza.pack(in_=ui.top,side=side)
    tk.Frame(g.root,height=h,width=w,bg='black',relief='sunken'
             ).pack(in_=ui.top,side=side,padx=8,pady=5)
    g.frame_select = tk.Frame(g.root,relief=tk.SUNKEN,bg='white')
    g.frame_select.pack(in_=ui.top,side=side,fill=tk.BOTH)
    tk.Label(g.root,text='Flight paths:',bg='white').pack(in_=g.frame_select,side=side)
    g.newflight_off = False
    g.flightselect_arr = []
    g.flightselect_arr.append(tk.Radiobutton(g.root,text=lines.ex.name,
                                             fg=lines.ex.color,
                                             variable=g.iactive,value=0,
                                             indicatoron=0,
                                             command=g.gui_changeflight,
                                             state=tk.ACTIVE,bg='white'))
    g.flightselect_arr[0].pack(in_=g.frame_select,side=side,padx=4,pady=2,fill=tk.BOTH)
    g.flightselect_arr[0].select()
    g.iactive.set(0)
    g.newflightpath = tk.Button(g.root,text='New flight path',
                                command = g.gui_newflight)
    g.newflightpath.pack(in_=ui.top,padx=5,pady=2)
    #g.removeflightpath = tk.Button(g.root,text='Remove flight path',
    #                               command = g.gui_removeflight)
    #g.removeflightpath.pack(in_=ui.top,padx=5,pady=5)
    g.addpoint = tk.Button(g.root,text='Add point dialog',
                           command = g.gui_addpoint)
    g.addpoint.pack(in_=ui.top,padx=5,pady=2)
    g.movepoints = tk.Button(g.root,text='Move points',
                             command = g.gui_movepoints)
    g.movepoints.pack(in_=ui.top,padx=5,pady=2)
    tk.Frame(g.root,height=h,width=w,bg='black',relief='sunken'
             ).pack(in_=ui.top,side=side,padx=8,pady=5)
    tk.Label(g.root,text='Extra info:').pack(in_=ui.top,side=side)
    g.baddsat = tk.Button(g.root,text='Add Satellite tracks',
                         command = g.gui_addsat_tle)
    g.baddsat.pack(in_=ui.top)
    g.baddbocachica = tk.Button(g.root,text='Add Forecast\nfrom Bocachica',
                         command = g.gui_addbocachica)
    g.baddbocachica.pack(in_=ui.top)
    g.baddfigure = tk.Button(g.root,text='Add Forecast\nfrom image',
                         command = g.gui_addfigure)
    g.baddfigure.pack(in_=ui.top)
    #g.baddgeos = tk.Button(g.root,text='Add GEOS',
    #                     command = g.gui_addgeos)
    #g.baddgeos.pack(in_=ui.top)
    tk.Frame(g.root,height=h,width=w,bg='black',relief='sunken'
             ).pack(in_=ui.top,side=side,padx=8,pady=5)
    tk.Button(g.root,text='Quit',command=g.stopandquit,bg='lightcoral'
              ).pack(in_=ui.top,side=side)
    ui.g = g
Beispiel #34
0
 def run(self):
     g=gui.gui()
     g.run()
Beispiel #35
0
import gtk
import gobject

if __name__ == "__main__":

    gobject.threads_init()

    config = ConfigParser.ConfigParser()
    conf_file = os.path.abspath(os.path.dirname(__file__)+"/kaeruftpload.conf")
    
    config.read(conf_file)
    
    host = config.get("config", "host");
    user = config.get("config", "user");
    password = config.get("config", "password");
    directory = config.get("config", "directory");
    url = config.get("config", "url");
    
    if not sys.argv == None:
        file_names = sys.argv
        del file_names[0]
    else:
        file_names = []

    gui = gui.gui()
    gui.ftp_details(host, user, password, directory, url)
    gui.file_names(file_names)
    gui.run()
    
    gtk.main()
Beispiel #36
0
    port1.tx.down()
    port2.tx.down()
    GPIO.cleanup()
    #p0.terminate()
    sys.exit(-1)


signal.signal(signal.SIGHUP, hup_handler)
signal.signal(signal.SIGINT, int_handler)

# lists of the data that will be stored in the xml configuration
xmlvars = ()
GPIO.setmode(GPIO.BOARD)
q1 = queue.Queue()
q2 = queue.Queue()
gui = gui.gui(top)
globalState = state.state(top, gui)
port1 = radioPort.radioPort(1, q1, globalState)
port2 = radioPort.radioPort(2, q2, globalState)
port1.other = port2
port2.other = port1
hwio = hwio.hwio(top)
port1.hwio = hwio
port2.hwio = hwio
top.port1 = port1
top.port2 = port2
top.gui = gui
top.hwio = hwio
top.globalState = globalState
fp = fpPixels.fpPixels(top.globalState)
cmdSock = tcpSocketCmd.tcpSocketCmd(globals(), q1, q2)
Beispiel #37
0
def build_buttons(ui,lines,vertical=True):
    'Program to set up the buttons'
    import gui
    import Tkinter as tk
    from matplotlib.colors import cnames
    if vertical:
        side = tk.TOP
        h = 2
        w = 20
    else:
        side = tk.LEFT
        h = 20
        w = 2
    g = gui.gui(lines,root=ui.root,noplt=True)
    g.refresh = tk.Button(g.root,text='Refresh',
                          command=g.refresh,
                          bg='chartreuse')
    g.refreshspeed = tk.Button(g.root,text='Refresh without Speeds',
                          command=g.refresh_nospeed)
    g.bopenfile = tk.Button(g.root,text='Open',
                            command=g.gui_open_xl)
    g.bsavexl = tk.Button(g.root,text='Save',
                          command=g.gui_save_xl)
    g.bsavexl_pilot = tk.Button(g.root,text='for pilot',
                          command=g.gui_save_xl_pilot)
    g.bsavetxt = tk.Button(g.root,text='TXT',
                          command=g.gui_save_txt)
    g.bsaveas2kml = tk.Button(g.root,text='SaveAs',
                              command=g.gui_saveas2kml)
    g.bsave2kml = tk.Button(g.root,text='Update',
                            command=g.gui_save2kml)
    g.bsave2gpx = tk.Button(g.root,text='GPX',
                            command=g.gui_save2gpx)
    g.bsave2ict = tk.Button(g.root,text='ICT',
			    command=g.gui_save2ict)
    g.bsavepng = tk.Button(g.root,text='map to PNG',
			    command=g.gui_savefig)    
    g.bsaveall = tk.Button(g.root,text='Save All',
			    command=g.gui_saveall,bg='lightskyblue')
    g.refresh.pack(in_=ui.top,side=side,fill=tk.X,pady=6)
    g.refreshspeed.pack(in_=ui.top,side=side,fill=tk.X,pady=2)
    tk.Label(g.root,text='File options').pack(in_=ui.top,side=side) 
    g.frame_xl = tk.Frame(ui.top)
    g.frame_xl.pack(in_=ui.top,side=side,fill=tk.X,pady=2)
    tk.Label(ui.top,text='Excel file:').pack(in_=g.frame_xl,side=tk.LEFT)
    g.bopenfile.pack(in_=g.frame_xl,side=tk.LEFT)
    g.bsavexl.pack(in_=g.frame_xl,side=tk.LEFT)
    g.bsavexl_pilot.pack(in_=g.frame_xl,side=tk.LEFT)
    g.frame_kml = tk.Frame(ui.top)
    g.frame_kml.pack(in_=ui.top,side=side,fill=tk.X,pady=2)
    tk.Label(ui.top,text='Kml file:').pack(in_=g.frame_kml,side=tk.LEFT)
    g.bsaveas2kml.pack(in_=g.frame_kml,side=tk.LEFT)
    g.bsave2kml.pack(in_=g.frame_kml,side=tk.LEFT)
    g.frame_save = tk.Frame(ui.top)
    g.frame_save.pack(in_=ui.top,side=side,fill=tk.X,pady=2)
    tk.Label(ui.top,text='Saving to:').pack(in_=g.frame_save,side=tk.LEFT)
    g.bsavetxt.pack(in_=g.frame_save,side=tk.RIGHT)
    g.bsave2gpx.pack(in_=g.frame_save,side=tk.RIGHT)
    g.bsave2ict.pack(in_=g.frame_save,side=tk.RIGHT)
    g.frame_save2 = tk.Frame(ui.top)
    g.frame_save2.pack(in_=ui.top,side=side,fill=tk.X,pady=2)
    g.bsavepng.pack(in_=g.frame_save2,side=tk.RIGHT)
    g.bsaveall.pack(in_=g.frame_save2,side=tk.LEFT)         
    tk.Frame(g.root,height=h,width=w,bg='black',relief='sunken'
             ).pack(in_=ui.top,side=side,padx=8,pady=5)
    g.frame_plot = tk.Frame(ui.top)
    g.frame_plot.pack(in_=ui.top,side=side,fill=tk.X,pady=2)
    tk.Label(ui.top,text='Plots:').pack(in_=g.frame_plot,side=tk.LEFT)
    g.bplotlat = tk.Button(g.root,text='Alt vs Lat',
                           command=g.gui_plotaltlat)
    g.bplotlat.pack(in_=g.frame_plot,side=tk.RIGHT)
    g.bplotalt = tk.Button(g.root,text='Alt vs time',
                           command=g.gui_plotalttime)
    g.bplotalt.pack(in_=g.frame_plot,side=tk.RIGHT)
    g.bplotsza = tk.Button(g.root,text='SZA',
                           command=g.gui_plotsza)
    g.bplotsza.pack(in_=g.frame_plot,side=tk.RIGHT)
    tk.Frame(g.root,height=h,width=w,bg='black',relief='sunken'
             ).pack(in_=ui.top,side=side,padx=8,pady=5)
    g.frame_select = tk.Frame(g.root,relief=tk.SUNKEN,bg='white')
    g.frame_select.pack(in_=ui.top,side=side,fill=tk.BOTH)
    tk.Label(g.root,text='Flight paths:',bg='white').pack(in_=g.frame_select,side=side)
    g.newflight_off = False
    g.flightselect_arr = []
    g.flightselect_arr.append(tk.Radiobutton(g.root,text=lines.ex.name,
                                             fg=lines.ex.color,
                                             variable=g.iactive,value=0,
                                             indicatoron=0,
                                             command=g.gui_changeflight,
                                             state=tk.ACTIVE,bg='white'))
    g.flightselect_arr[0].pack(in_=g.frame_select,side=side,padx=4,pady=2,fill=tk.BOTH)
    g.flightselect_arr[0].select()
    g.iactive.set(0)
    g.newflightpath = tk.Button(g.root,text='New flight path',
                                command = g.gui_newflight)
    g.newflightpath.pack(in_=ui.top,padx=5,pady=2)
    #g.removeflightpath = tk.Button(g.root,text='Remove flight path',
    #                               command = g.gui_removeflight)
    #g.removeflightpath.pack(in_=ui.top,padx=5,pady=5)
    g.frame_points = tk.Frame(ui.top)
    g.frame_points.pack(in_=ui.top,side=side,fill=tk.X,pady=2)
    tk.Label(ui.top,text='Points:').pack(in_=g.frame_points,side=tk.LEFT)
    g.addpoint = tk.Button(g.root,text='Add',
                           command = g.gui_addpoint)
    g.addpoint.pack(in_=g.frame_points,padx=0,pady=0,side=tk.LEFT)
    g.movepoints = tk.Button(g.root,text='Move',
                             command = g.gui_movepoints)
    g.movepoints.pack(in_=g.frame_points,padx=0,pady=0,side=tk.LEFT)
    g.rotpoints = tk.Button(g.root,text='Rotate',
                             command = g.gui_rotatepoints)
    g.rotpoints.pack(in_=g.frame_points,padx=0,pady=0,side=tk.LEFT)
    g.add_flt_module = tk.Button(g.root,text='Add flt module', command=g.gui_flt_module)
    g.add_flt_module.pack(in_=ui.top)
    tk.Frame(g.root,height=h,width=w,bg='black',relief='sunken'
             ).pack(in_=ui.top,side=side,padx=8,pady=5)
    #tk.Label(g.root,text='Extra info:').pack(in_=ui.top,side=side)
    g.baddsat = tk.Button(g.root,text='Add Satellite tracks',
                         command = g.dummy_func)
    g.baddsat.pack(in_=ui.top)
    g.baddsat.config(command=g.gui_addsat_tle)
    g.baddaeronet = tk.Button(g.root,text='Add current\nAERONET AOD',
                         command = g.dummy_func)
    g.baddaeronet.pack(in_=ui.top)
    g.baddaeronet.config(command=g.gui_addaeronet)
    g.baddbocachica = tk.Button(g.root,text='Add Forecast\nfrom Bocachica',
                         command = g.gui_addbocachica)
    g.baddbocachica.pack(in_=ui.top)
    g.baddtrajectory = tk.Button(g.root,text='Add trajectory\nImage',
                         command = g.gui_addtrajectory)
    g.baddtrajectory.pack(in_=ui.top)
    g.baddfigure = tk.Button(g.root,text='Add Forecast\nfrom image',
                         command = g.gui_addfigure)
    g.baddfigure.pack(in_=ui.top)
    g.baddgeos = tk.Button(g.root,text='Add GEOS Forecast',
                         command = g.gui_addgeos)
    g.baddgeos.pack(in_=ui.top)
    g.baddsua = tk.Button(g.root,text='Add Special Use Airspace',
                         command = g.gui_add_SUA_WMS)
    g.baddsua.pack(in_=ui.top)
    g.baddwms = tk.Button(g.root,text='Add WMS layer',
                         command = g.gui_add_any_WMS)
    g.baddwms.pack(in_=ui.top)

    #g.bpythoncmd = tk.Button(g.root,text='Python command line',
    #                     command = g.gui_python)
    #g.bpythoncmd.pack(in_=ui.top)
    
    tk.Frame(g.root,height=h,width=w,bg='black',relief='sunken'
             ).pack(in_=ui.top,side=side,padx=8,pady=5)
    tk.Button(g.root,text='Quit',command=g.stopandquit,bg='lightcoral'
              ).pack(in_=ui.top,side=side)
    g.bg = g.baddsat.cget('bg')
    ui.g = g
Beispiel #38
0
from connection import Connection
from config import Config
from gui import gui

# Read configuration file for api_token and url of OctoPrint
config = Config()
api_token = config.get_api_token()
url = config.get_url()

# Make connection to OctoPrint
con = Connection(url, api_token)

# Start Gui
gui(con, config)
Beispiel #39
0
def main():
    """Main function
    """

    global lock
    global conf
    global gui_thr
    global mail_thrs
    global checker
    global messages

    # parse command-line arguments
    usage = 'usage: %prog [options]... args...'
    parser = OptionParser(usage)
    parser.add_option('-c', '--config-file', dest = 'config',
                      help = 'configuration file path')
    parser.add_option('-w', '--width', dest = 'width', type = 'int',
                      help = 'width of the window')
    parser.add_option('-g', '--height', dest = 'height', type = 'int',
                      help = 'height of the window')
    parser.add_option('--bg', dest = 'background', help = 'backgound color')
    parser.add_option('--fg', dest = 'foreground',
                      help = 'foreground color')
    parser.add_option('--fgn', dest = 'foreground new',
                      help = 'foreground color for new messages')
    parser.add_option('-l', '--log', dest = 'log',
                      help = 'Log file')
    parser.add_option('--level', dest = 'level',
                      help = 'Log level: critial, error, warning, info, debug')
    (options, args) = parser.parse_args()

    if options.config:
        exp_path = os.path.expanduser(options.config)
        config_file = os.path.isabs(exp_path) and exp_path or \
            os.path.join(cwd, exp_path)
    else:
        # default config file location
        if is_posix():
            config_file = os.path.expanduser('~/.pymailheadersrc')
        else:
            config_file = 'config.ini'

    try:
        # read in config file if there is any
        conf = config.config(config_file)
    except:
        sys.exit(1)

    # get all configurations
    #
    # command line arguments have higher priorities, so they can overwrite
    # config file options
    opts = conf.get_all()

    # this is way too ugly, it's not a proper use of optparse, but had to
    # use this hack to get arround.
    options = options.__dict__.copy()
    del options['config']

    # don't use opts.update() because that will write all None values
    for k in options.iterkeys():
        if not opts.has_key(k) or options[k]:
            opts[k] = options[k]

    # Logging information
    if 'log' in opts:
        TARGET = opts['log']
        del opts['log']
    else:
        TARGET = None
    LEVEL_LIST = {'critical': logging.CRITICAL,
                  'error': logging.ERROR,
                  'warning': logging.WARNING,
                  'info': logging.INFO,
                  'debug': logging.DEBUG}
    if 'level' in opts and opts['level'] in LEVEL_LIST:
        LEVEL = LEVEL_LIST[opts['level']]
    else:
        LEVEL = LEVEL_LIST['error']
    if 'level' in opts:
        del opts['level']
    FORMAT = '%(asctime)s [(%(threadName)-13s) %(name)-11s:%(lineno)-4d]' + \
        ' %(levelname)-5s: %(message)s'
    logging.basicConfig(level = LEVEL,
                        format = FORMAT,
                        datefmt = '%H:%M:%S',
                        filename = TARGET)

    # setup signal handler so that settings will be saved even if the
    # process is killed
    signal.signal(signal.SIGTERM, on_exit)

    # create threads
    gui_thr = gui.gui(opts)

    # set up signal handlers
    handlers = {'on_refresh_activate': on_refresh_activate,
                'on_config_save': on_config_save,
                'on_account_changed': on_account_changed,
                'on_account_removed': on_account_removed}
    gui_thr.signal_autoconnect(handlers)

    new_mail_thrs(opts['accounts'])
    checker = mail_checker()

    try:
        # start all threads
        checker.start()

        for mail_thr in mail_thrs.itervalues():
            if not mail_thr.isAlive():
                mail_thr.start()

        gui.gtk.gdk.threads_enter()
        gui.gtk.main()
        gui.gtk.gdk.threads_leave()
    except KeyboardInterrupt:
        pass

    checker.quit()

    delete_mail_thrs()
Beispiel #40
0
# run_gui.py
# 
# Init script, meant to generate gui. Called by gui thread of daq. When this
# terminates, the whole app will terminate. It is run as a text file, not a 
# module (this affects the scope of variables defined/changed)
#
import gtk
import posix
import gui

app = gui.gui()

# These variables are used to change the state of user interface upon 
# completion of a task, to plot data, change progressbar val etc. 
gui_exports = {'purgatory' : app.purgatory,
               'on_finished' : app.on_logic_finished,
               'plot' : app.wTree.plot,
               'progressbar' : app.wTree.progressbar}

gtk.gdk.threads_init()
gtk.gdk.threads_enter()
gtk.main()
gtk.gdk.threads_leave()
            # that is closest to the current sonar location
            intersect = self.math.get_intersect_point(self.loc, ln, self.map)
            # calculate the distance to the intersection point, with
            # some parameters which limit the data to a certain range
            dist = self.math.intersect_distance(self.loc, intersect, self.min_range, self.max_range,)
            self.ranges.append(dist) # store the calculated distance
            # Store the other objects for drawing later if necessary
            self.scan_lines.append(ln)
            self.intersection_points.append(intersect)
            self.current_angle += self.step # increment the angle to the angle of the next measurement
        
    def generate_particles(self, number):
        """Create a number of particles."""
        if not self.particles.list():
            for i in range(number):
                # Create a particle within a gaussian range of the current sonar location
                self.particles.add(particle.Particle(Point(self.math.apply_point_noise(self.loc.x, self.loc.y, self.loc_noise, self.loc_noise)), self))
                
if __name__ == '__main__':
    simple_map = map_rep.map_(sys.argv[1])
    mvlist = move_list.MoveList()
    mvlist.read_from_file(sys.argv[2])
    #mvlist = move_list.MoveList([Point(0,0)])
    #param = {'map_':simple_map, 'move_list':mvlist, 'max_rng':50, 'step': 15, 'particle_number': 10, 'out_file': 'data.txt', 'param_file': 'params.txt'}
    param = {'map_':simple_map, 'move_list':mvlist, 'max_rng':50, 'step': 15, 'particle_number': 10, 'out_file': 'data.txt'}
    sonar = sonar(**param)
    #sonar = sonar(simple_map, mvlist, rng=50, step=15, particle_number=5)
    #a = particle.Particle(sonar.loc, sonar)
    #a.get_ranges()
    ab = gui.gui(sonar)
Beispiel #42
0
def gui(cmdline):
    survey = model.survey.Survey.load(cmdline['project'])
    import gui
    return gui.gui(survey, cmdline)
Beispiel #43
0
#!/usr/bin/env python
#  Korean Text to ePUB Converter
#
#  For more detail info, visit http://code.google.com/p/epubia 
__program__ = 'epubia'
__version__ = '0.5.2'
__config__  = 'config.xml'

# load config file
import config_file
config = config_file.load(__config__)

# start GUI
import gui
gui.gui( config )

# save config file
config_file.save(__config__, config)

# vim:ts=4:sw=4:et
Beispiel #44
0
import gui
import sys

if __name__ == '__main__':
    gui.gui()
    sys.exit(0)
class Model():
	def __init__(self):
		print "MODEL INITIALIZED"
		self.board = createBreadboard()
		self.compList = []

	def placeCompOnBreadBoard(self,component,board,compList):
		if len(compList) == 0:
			placeFirstComponent(component,board,compList)
		else:
			placeComponent(component,board,compList)

	def placeCompOnSchema(self,compList):
		placingCD(compList)

class Controller():
	pass
	

if __name__ == '__main__':
    Test = Model()
    print Test.board[3][0].Occupied
    Resistor1 = resistor(1,0,0,4,5,'h',{1:[],2:[]})
    Test.placeCompOnBreadBoard(Resistor1,Test.board,Test.compList)
    print Test.compList[0].x
    Test.placeCompOnSchema(Test.compList)
    print Test.compList[0].cx
    
    app = g.gui(None)
    app.title('C.I.R.C.U.I.T')
    app.mainloop()
Beispiel #46
0
import gui


# temp moter
class Moterz:
    def __init__(self, Ena, in1, in2):
        # in1= input 1 forward
        # in2=input 2 backward
        print("strt")

    def movef(self, s=30):
        print("f speed=", s)

    def ChangeSpeed(self, s=30):

        print("speed change ", s)

    def Stop(self):
        pass

    def moveB(self, s=30):
        print("b speed=", s)

    def q(self):
        print("GPIO cleaning up")


wmoter = Moterz(1, 2, 3)
emoter = Moterz(4, 5, 6)
mgui = gui.gui(wmoter, emoter)
Beispiel #47
0
elif os.name == 'posix':
    from linterface import Interface
    pass
from remapper import remapper

pygame.init()            # Starts pygame
t = pygame.time.Clock()        # Make a tracker
interface = Interface()
os.system('cls' if os.name=='nt' else 'clear') # Clear terminal // remove "there is no soundcard"
try: 

    print "Number of Devices:", pygame.joystick.get_count()
    d = pygame.joystick.Joystick(0)
    d.init()            # Start pygame.joystick.Joystick(0)
    rem = remapper(d.get_name())
    maingui = gui.gui(rem)

# Gives info about the device
    print "Connected device", d.get_name()
    print d.get_name(), "have"
    print "Buttons:", d.get_numbuttons()
    print "Axes:", d.get_numaxes()
    print "Hats:", d.get_numhats()
    print "Balls:", d.get_numballs()
    print "The device ID is", d.get_id()
    print "Press button 0 to exit"

# Start showing the info in terminal

    def loop():
        global d, t
Beispiel #48
0
from InputData import input_data
from calculation import cal
from gui import gui
from web import web

web()
data = input_data()
maxNum, maxDay, minNum, minDay, ave, mid = cal(data)
gui(maxNum, maxDay, minNum, minDay, ave, mid, data)
Beispiel #49
0
 def __init__(self, firstHost = None, port = None, name = "temp", ip = None, testmode = False):
     
     self.name = name # set peer name
     self.inSocket = None # Socket für eingehende Verbindungen
     self.hosts = {} # Dict. der bekannten Hosts
     self.knownPeers = {} # Dict (ip:port) : name
     self.msgParts = {}
     
     # set own ip if you already know it
     if ip != None:
         self.ip = ip
     else:
         self.ip = "null"
     
     # open socket
     self.inSocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
     if port == None:
         # bind on random port
         self.inSocket.bind(('', 0))
     else:
         # bind on given port
         self.inSocket.bind(('', int(port)))
         
     self.port = int(self.inSocket.getsockname()[1]) # port where peer listens on
     logging.info("Listening on port " + str(self.port))
         
     self.history = message.History(const.HISTORY_SAVEDMSGSLIMIT, const.HISTORY_SAVEDHASHESLIMIT)
     
     self.gui = gui.gui(self)
     
     # lock for hostlist (not needed atm)
     # self.hostlock = threading.RLock()
     
     # start receiveLoop
     self.rThread = threading.Thread(target=self.startRecvLoop)
     self.rThread.daemon = True
     self.rThread.start()
     
     # start sendLoop
     if testmode == True:
         #if testmode is true, sendLoop will drop random parts of msgs
         self.sThread = threading.Thread(target=self.sendLoop, args=(True,))
         self.sThread.daemon = True
         self.sThread.start()
     else:
         self.sThread = threading.Thread(target=self.sendLoop, args=(False,))
         self.sThread.daemon = True
         self.sThread.start()
         
     
     # start maintenance Loop
     self.counter = 0
     self.mThread = threading.Thread(target=self.maintenanceLoop)
     self.mThread.daemon = True
     self.mThread.start()
     
     # send HELO to first host if you know one
     if firstHost != None:
         self.key = None
         (hostIP, hostPort) = firstHost
         h = Host(self, hostIP, hostPort)
         h.bootstrap = True
         
         # wait until you're connected to the network
         while self.key == None:
             time.sleep(0.5)
             
         #Initial Request for some more hosts from firstHost
         key = h.constructKey(hostIP, hostPort)
         logging.debug("Initial Request for some peers from " + key)
         self.requestHosts(key, const.MIN_PEERLIMIT) # and get some more hosts
         
         #Initial Request for History
         logging.debug("Initial Request for History from " + key)
         self.getHistory(key, initial=True)
     else:
         self.key = Host.constructKey(self.ip, self.port)
         logging.info("You created a new Hachat-network. Your key is " + self.key)
     
     if testmode == True:
         self.generateMsgParts(10, 3000) #generates Randome Text-Msgs
     
     #start gui
     self.gui.run()                
Beispiel #50
0
def main():

    app = QtGui.QApplication(sys.argv)

    # convert from units of photon energy to frequency in Hz
    def freq_hz1 (hz): # frequency (Hz)
        return hz
    def freq_thz1 (thz): # frequency (THz)
        return 1e12 * thz
    def wl_m1 (m): # wavelength (m)
        return const.c / m
    def wl_microns1(um): # wavelength (microns)
        return const.c / (1e-6 * um)
    def wl_nm1 (nm): # wavelength (nm)
        return const.c / (1e-9 * nm)
    def wn_m_inv1 (m_inv): # wavenumber (m^-1)
        return const.c * m_inv
    def wn_cm_inv1 (cm_inv): # wavenumber (cm^-1)
        return const.c * (1e-2 * cm_inv)

    # convert from frequency in Hz to units of photon energy
    def freq_hz2 (hz): # frequency (Hz)
        return hz
    def freq_thz2 (hz): # frequency (THz)
        return 1e-12 * hz
    def wl_m2 (hz): # wavelength (m)
        return const.c / hz
    def wl_microns2 (hz): # wavelength (microns)
        return 1e6 * const.c / hz
    def wl_nm2 (hz): # wavelength (nm)
        return 1e9 * const.c / hz
    def wn_m_inv2 (hz): # wavenumber (m^-1)
        return hz / const.c
    def wn_cm_inv2 (hz): # wavenumber (cm^-1)
        return 1e2 * hz / const.c

    # convert from units of photon energy to wavelength in m
    def freq_hz3 (hz): # frequency (Hz)
        return const.c / hz
    def freq_thz3 (thz): # frequency (THz)
        return const.c / (1e12 * thz)
    def wl_m3 (m): # wavelength (m)
        return m
    def wl_microns3(um): # wavelength (microns)
        return 1e-6 * um
    def wl_nm3 (nm): # wavelength (nm)
        return 1e-9 * nm
    def wn_m_inv3 (m_inv): # wavenumber (m^-1)
        return 1.0 / m_inv
    def wn_cm_inv3 (cm_inv): # wavenumber (cm^-1)
        return 1.0 / (1e-2 * cm_inv)

    energy_list = \
        [aux.energy_form("Frequency", "Hz", freq_hz1, freq_hz2, freq_hz3, True),
         aux.energy_form("Frequency", "THz", freq_thz1, freq_thz2,
                                             freq_thz3, True),
         aux.energy_form("Wavelength", "m", wl_m1, wl_m2, wl_m3, False),
         aux.energy_form("Wavelength", "microns", wl_microns1, wl_microns2,
                                                  wl_microns3, False),
         aux.energy_form("Wavelength", "nm", wl_nm1, wl_nm2, wl_nm3, False),
         aux.energy_form("Wavenumber", "m^-1", wn_m_inv1, wn_m_inv2,
                                               wn_m_inv3, True),
         aux.energy_form("Wavenumber", "cm^-1", wn_cm_inv1, wn_cm_inv2,
                                                wn_cm_inv3, True)]

    # create name file pairs
    atmos_files = []
    add_files(atmos_files, "data/Backgrounds/Atmospheric sites/")

    source_files = []
    add_files(source_files, "data/Sources/")

    galactic_files = []
    add_files(galactic_files, "data/Backgrounds/Galactic Emission/")

    # material constants for thermal mirror emission
    mirror_consts = {"Aluminum (Al)" : 3.538e7,
                     "Beryllium (Be)": 2.500e7,
                     "Gold (Au)"     : 4.060e7,
                     "Silver (Ag)"   : 6.287e7}

    zodiac_files = []
    add_files(zodiac_files, "data/Backgrounds/Zodiacal Emission/")

    main_gui = gui(energy_list, atmos_files, source_files, galactic_files,
                   mirror_consts, zodiac_files)

    sys.exit(app.exec_())
Beispiel #51
0
import os
dir = os.path.dirname(os.path.abspath(__file__))
os.chdir(dir)

from gui import gui
import tkinter as tk

root = tk.Tk()
app = gui(master=root)
app.mainloop()
Beispiel #52
0
def mainloop(stdscr):
	while(True): # loop for games
		screen=gui.gui(stdscr)
		screen.update()
	        #c = stdscr.getch()
		theBoard = Board()
		mode = 'pvc' #getGameMode()
		playerLetter, player2letter = "X", "O" #inputPlayerLetter()
		#turn = whoGoesFirst()
		turn = 'player 1'
		screen.printstr('The ' + turn + ' will go first.')
		lastMark = None # needed for keeping track of the last mark in order to facilitate collapse
		rec = 2
		
		while (True): # loop for turns
	       		#if c == ord('q'):
	       		#	exit()  # Exit the while()
	       		#elif c == ord('r'):
	       		#	stdscr.refresh()
			if turn == 'player 1':
				screen.printstr("It's player 1's turn")
				# Player 1's turn.
				theBoard.printBoard(screen)
				# Check whether there is entanglement after player 2's move
				if lastMark:
					if theBoard.findCycle(lastMark.pos):
						col = getPlayerCollapse(theBoard, lastMark,screen) # let player 1 decide where to put the last mark
						theBoard.collapse(lastMark.letter, lastMark.num, col[0], col[1]) 
						theBoard.printBoard(screen)
						
		  
				# look at winning conditions:
				p1won, p1lms = theBoard.hasWon(playerLetter)
				p2won, p2lms = theBoard.hasWon(player2letter)
				if p1won:
					if p2won:
						if p1lms < p2lms:
							#screen.printstr("\n")
							theBoard.printBoard(screen)
							screen.printstr("Player 1 has won the game!")
							break
						else:
							#screen.printstr("\n")
							theBoard.printBoard(screen)
							screen.printstr("Player 2 has won the game!")
							break	   			
					else:
						#screen.printstr("\n")
						theBoard.printBoard(screen)
						screen.printstr("Player 1 has won the game!")
						break
				elif p2won:
					#screen.printstr("\n")
					theBoard.printBoard(screen)
					screen.printstr("Player 2 has won the game!")
					break
				else:
					if isBoardFull(theBoard):
					  #print("\n")
					  theBoard.printBoard(screen)
					  print("The game is a tie!")
					  break
			
				turn = "player2"
			   # if the game hasn't ended, make a move
				pos1, pos2 = getPlayerMove(theBoard,screen)
				screen.update_moves(playerLetter,pos1, pos2)
				if lastMark:
					lastMark = theBoard.addPreMark(playerLetter, lastMark.num+1, pos1, pos2)
				else:
					lastMark = theBoard.addPreMark(playerLetter, 1, pos1, pos2)
				if mode != 'pvp':
					rec = getNumRecursions(screen)
			else:      
				screen.printstr("It's player 2's turn")
				# Player 2's turn or computer.
				theBoard.printBoard(screen)
				val = None
				move = None
				if mode != 'pvp':
					if lastMark:
						[val, moves] = minimax(theBoard, rec, rec, True, player2letter, lastMark.num+1, playerLetter, lastMove = lastMark, savedMoves = [])
					else:
						[val, moves] = minimax(theBoard, rec, rec, True, player2letter, 1, playerLetter, lastMove = None, savedMoves = [])
					move = random.choice(moves)
			   # Check whether there is entanglement after player 1's move
				if lastMark:
					if theBoard.findCycle(lastMark.pos):
						if mode == 'pvp': # if player vs player
							col = getPlayerCollapse(theBoard, lastMark,screen) # let player 2 decide where to put the last mark
							theBoard.collapse(lastMark.letter, lastMark.num, col[0], col[1])
							theBoard.printBoard(screen)
						else:
							
							#col = getComputerCollapse_Random(theBoard, lastMark)
							#theBoard.collapse(lastMark.letter, lastMark.num, col[0], col[1])
							theBoard.collapse(move[0][0], move[0][1], move[0][2], move[0][3])
							theBoard.printBoard(screen)
				p1won, p1lms = theBoard.hasWon(playerLetter)
				p2won, p2lms = theBoard.hasWon(player2letter)
				if p1won:
					if p2won:
						if p1lms < p2lms:
							#screen.printstr("\n")
							theBoard.printBoard(screen)
							screen.printstr("Player 1 has won the game!")
							break
						else:
							#screen.printstr("\n")
							theBoard.printBoard(screen)
							if mode == 'pvp':
								screen.printstr("Player 2 has won the game!")
							else:
								screen.printstr("The computer has won the game!")
							break	   			
					else:
						#screen.printstr("\n")
						theBoard.printBoard(screen)
						screen.printstr("Player 1 has won the game!")
						break
				elif p2won:
					#screen.printstr("\n")
					theBoard.printBoard(screen)
					if mode == 'pvp':
						screen.printstr("Player 2 has won the game!")
					else:
						screen.printstr("The computer has won the game!")
					break	
				else:
					if isBoardFull(theBoard):
					  #print("\n")
					  theBoard.printBoard(screen)
					  print("The game is a tie!")
					  break
				turn = "player 1"
			  
			   # if the game hasn't ended, make a move
				if mode == 'pvp':
					pos1, pos2 = getPlayerMove(theBoard,screen)
					if lastMark:
						lastMark = theBoard.addPreMark(player2letter, lastMark.num+1, pos1, pos2)
						screen.update_moves(player2letter,pos1, pos2)
					else:
						lastMark = theBoard.addPreMark(player2letter, 1, pos1, pos2)
						screen.update_moves(player2letter,pos1, pos2)
				else:
					#pos1, pos2 = getComputerMove_Random(theBoard)
					lastMark = theBoard.addPreMark(move[1][0], move[1][1], move[1][2], move[1][3])
					screen.update_moves(move[1][0],move[1][2], move[1][3])
	
		if not playAgain(screen):
			break
Beispiel #53
0
def gui_loop(gui_hard, gui_post):
    from gui import gui

    s = gui(gui_hard, gui_post)
    s.mainloop()
Beispiel #54
0
# run_gui.py
#
# Init script, meant to generate gui. Called by gui thread of daq. When this
# terminates, the whole app will terminate. It is run as a text file, not a
# module (this affects the scope of variables defined/changed)
#
import gtk
import posix
import gui

app = gui.gui()

# These variables are used to change the state of user interface upon
# completion of a task, to plot data, change progressbar val etc.
gui_exports = {
    'purgatory': app.purgatory,
    'on_finished': app.on_logic_finished,
    'plot': app.wTree.plot,
    'progressbar': app.wTree.progressbar
}

gtk.gdk.threads_init()
gtk.gdk.threads_enter()
gtk.main()
gtk.gdk.threads_leave()
Beispiel #55
0
import gui
import enemy

#global constants
screen_dimensions = 640, 480

#initialize pygame library
pygame.init()

#set up the screen
screen = pygame.display.set_mode(screen_dimensions)
#set window title
pygame.display.set_caption("Poncho")

#create the gui overlay that gives info about the game to the player
gui_overlay = gui.gui()

#create kid and set default position
kid = character.character()

#hook up the player to the gui
gui_overlay.set_player(kid)

#convert image for bullet to screen format
bullet.bullet_image = bullet.bullet_image.convert_alpha()

#create a red tile for testing
red_tile = pygame.Surface((tilemap.tile_size,tilemap.tile_size))
red_tile.fill(0xFF0000)

#create a blue tile for testing