Ejemplo n.º 1
0
    def restart( self ):
        """
        use to restart the app without ending it - also extend init
        parameters will be reloaded and the gui rebuilt
        args: zip
        ret: zip ... all sided effects
        """
        #rint( "===================restart===========================" )
        self.no_restarts    += 1
        if self.gui is not None:

            self.logger.info( self.app_name + ": restart" )

            # self.post_to_queue( "stop", None  , (  ) ) # need to shut down other thread
            # self.helper_thread.join()

            self.gui.close()

            importlib.reload( parameters )    #
        self.polling_mode = "off"
        #self._polling_fail        = False   # flag set if _polling in gui thread fails

#        self.is_first_gui_loop    = True
        #self.ext_processing       = None    # built later from parameters if specified
        self.logger             = None    # set later none value protects against call against nothing

        # ----- parameters
        self.parmeters_x        = "none"        # name without .py for parameters
                                                #extension may ?? be replaced by command line args

        self.select_manager     = None          # populate in cb_change_select_type
        self.parameters         = parameters.Parameters( )
        self.starting_dir       = os.getcwd()

        self.logger_id          = self.parameters.logger_id       # std name
        self.logger             = self.config_logger()            # std name

        AppGlobal.logger        = self.logger
        AppGlobal.logger_id     = self.logger_id

        self.prog_info()

        self.gui                = gui.GUI(  )
        self.last_begin_dt,  self.last_end_dt  = self.gui.get_dt_begin_end() # after gui is built

        # now most of setup memory has been allocated -- may want to check in again later, save this value ??
        process      = psutil.Process(os.getpid())    #  import psutil
        mem          = process.memory_info().rss
        # convert to mega and format
        mem_mega     = mem/( 1e6 )
        msg          = f"process memory = {mem_mega:10,.2f} mega bytes "
        print( msg )
        # set up gui thread polling if delta > 0
        self.logger.log( AppGlobal.force_log_level, msg )
        self.polling_delta  = self.parameters.polling_delta
        if self.polling_delta > 0:
            self.gui.root.after( self.polling_delta, self.polling_0 )
        self.gui.run()

        self.logger.info( self.app_name + ": all done" )
    def __init__(self):
        # pygame setup
        pygame.init()
        pygame.key.set_repeat(300, 30)
        self.screen = pygame.display.set_mode((1280, 720), pygame.SRCALPHA)
        self.screen.fill((255, 255, 255))
        self.clock = pygame.time.Clock()

        # Create a white background
        self.background = pygame.Surface(self.screen.get_size(),
                                         pygame.SRCALPHA)
        self.background = self.background.convert()
        self.background.fill((255, 255, 255))
        self.menu_background = copy.copy(self.background)
        self.menu_background.fill((57, 65, 101))

        pygame.display.flip()

        # Setup classes
        self.world = World(self.screen)
        self.robot = RobotControl(self.screen, self.world)
        self.slam = SLAM(self.screen, self.robot)
        self.gui = gui.GUI(self.screen, self.world, self.robot, self.slam)

        self.font = pygame.font.Font(None, 30)

        self.state = 0
        self.main()
Ejemplo n.º 3
0
def doSearch():
    searchstring = None
    if len(sys.argv) > 1:
        try:
            param = sys.argv[1]
            if param.startswith('searchstring:'):
                import urllib
                searchstring = param.split(':', 1)[-1]
                searchstring = urllib.unquote_plus(searchstring)
                searchstring = searchstring.replace('\'', '')
                searchstring = searchstring.replace('"', '')
        except:
            searchstring = None

    if not searchstring:
        keyboard = xbmc.Keyboard('', LANGUAGE(32101), False)
        keyboard.doModal()
        if (keyboard.isConfirmed()):
            searchstring = keyboard.getText()

    if searchstring:
        params = {}
        import gui
        ui = gui.GUI("script-globalsearch-main.xml",
                     CWD,
                     "Default",
                     searchstring=searchstring,
                     params=params)
        ui.doModal()
        del ui
        sys.modules.clear()
Ejemplo n.º 4
0
 def __init__(self):
     self.display = gui.GUI(self.root, self, self.board, self.player_turns)
     self.display.pack(side='top',
                       fill='both',
                       expand='true',
                       padx=4,
                       pady=4)
Ejemplo n.º 5
0
    def _manage_shortcuts(self, group, defaultGroup, nolabels, groupname):
        homeWindow = xbmcgui.Window(10000)
        if homeWindow.getProperty("skinshortcuts-loading") and int(
                calendar.timegm(gmtime())) - int(
                    homeWindow.getProperty("skinshortcuts-loading")) <= 5:
            return

        homeWindow.setProperty("skinshortcuts-loading",
                               str(calendar.timegm(gmtime())))
        import gui
        ui = gui.GUI("script-skinshortcuts.xml",
                     CWD,
                     "default",
                     group=group,
                     defaultGroup=defaultGroup,
                     nolabels=nolabels,
                     groupname=groupname)
        ui.doModal()
        del ui

        # Update home window property (used to automatically refresh type=settings)
        homeWindow.setProperty("skinshortcuts",
                               strftime("%Y%m%d%H%M%S", gmtime()))

        # Clear window properties for this group, and for backgrounds, widgets, properties
        homeWindow.clearProperty("skinshortcuts-" + group)
        homeWindow.clearProperty("skinshortcutsWidgets")
        homeWindow.clearProperty("skinshortcutsCustomProperties")
        homeWindow.clearProperty("skinshortcutsBackgrounds")
Ejemplo n.º 6
0
    def __init__(self):
        # Use a service account to authenticate
        firebase_admin.initialize_app(
            credentials.Certificate("service_account.json"))
        client = firestore.client()
        self.systems = client.collection("systems")
        self.event_flows = client.collection("event_flows")

        self.widgets = []
        self.systems.on_snapshot(self.on_systems_change)
        self.server_doc = self.systems.document("server")
        self.state_doc = client.collection("state").document("state")
        self.deps_doc = client.collection("dependencies").document(
            "dependencies")
        self.state = {}
        self.state_doc.on_snapshot(self.on_state_change)

        # This variable statically stores what widget ID an event was sent to, if one was sent. It allows us to know
        # where the incoming event eventually went so that we can track it in the AR app.
        self.EVENT_SENT_TO: List[int] = []

        # Set up the listener for changes to the server document
        self.server_doc.on_snapshot(self.on_change)

        # Start the GUI
        gui.GUI(self)
Ejemplo n.º 7
0
def Single_Velocity():
    # Set goals to go to
    GOALS = [(0.5,0,2),(0,0.5,2),(-0.5,0,2),(0,-0.5,2)]
    # Define the quadcopters
    QUADCOPTER={'q1':{'position':[0,0,0],'orientation':[0,0,0],'L':0.3,'r':0.1,'prop_size':[10,4.5],'weight':1.2}}
    # Controller parameters
    CONTROLLER_PARAMETERS = {'Motor_limits':[4000,9000],
                        'Tilt_limits':[-10,10],
                        'Yaw_Control_Limits':[-900,900],
                        'Z_XY_offset':500,
                        'Linear_PID':{'P':[2000,2000,7000],'I':[0.25,0.25,4.5],'D':[50,50,5000]},
                        'Linear_To_Angular_Scaler':[1,1,0],
                        'Yaw_Rate_Scaler':0.18,
                        'Angular_PID':{'P':[22000,22000,1500],'I':[0,0,1.2],'D':[12000,12000,0]},
                        }

    # Catch Ctrl+C to stop threads
    signal.signal(signal.SIGINT, signal_handler)
    # Make objects for quadcopter, gui and controller
    quad = quadcopter.Quadcopter(QUADCOPTER)
    gui_object = gui.GUI(quads=QUADCOPTER)
    ctrl = controller.Controller_PID_Velocity(quad.get_state,quad.get_time,quad.set_motor_speeds,params=CONTROLLER_PARAMETERS,quad_identifier='q1')
    # Start the threads
    quad.start_thread(dt=QUAD_DYNAMICS_UPDATE,time_scaling=TIME_SCALING)
    ctrl.start_thread(update_rate=CONTROLLER_DYNAMICS_UPDATE,time_scaling=TIME_SCALING)
    # Update the GUI while switching between destination poitions
    while(run==True):
        for goal in GOALS:
            ctrl.update_target(goal)
            for i in range(150):
                gui_object.quads['q1']['position'] = quad.get_position('q1')
                gui_object.quads['q1']['orientation'] = quad.get_orientation('q1')
                gui_object.update()
    quad.stop_thread()
    ctrl.stop_thread()
Ejemplo n.º 8
0
def main():
    
    # Clear the screen, prepare the mainlopp, create graph_list, create graph_path
    os.system("clear")
    flag = True
    graph_path = "./graphs/"
    graph_list = os.listdir(graph_path)

    # Print welcome message including the premade graph information
    print ("Project Module #2: \n"
            "A*-GAC \n"
            "\n"
            "Premade problems are:")
    
    for i in range(len(graph_list)):
        print i, graph_list[i]
    
    print ("\n"
            "'Run 0-X' for premade problem \n"
            "'Exit' ends the script \n"
            "\n")

    # This is the mainloop - It reads input from the user and executes the commands
    while flag:
        the_input = raw_input(" > ")
        
        # Run a premade graph
        if the_input != "Run new" and the_input.startswith("Run"):

            # Get the correct premade graph and add its numbers to a list
            number = int(the_input[4:])
            f = open(graph_path + str(graph_list[number]), "r")
            line_list = map(int, re.findall(r'\d+', f.readline()))
            
            # Structure the input from file f
            number_of_vertices = line_list[0]
            number_of_edges = line_list[1]
            vertices = []
            edges = []
            
            # Fill the vertices and edges, then close f
            for i in range(number_of_vertices):
                vertex = []
                for word in f.readline().split():
                    vertex.append(float(word))
                vertices.append(vertex)
            for j in range(number_of_edges):
                edge = map(int, re.findall(r'\d+', f.readline()))
                edges.append(edge)
            f.close()
             
            # Initialize run
            graph = Graph(nv=number_of_vertices, ne=number_of_edges, vertices=vertices, edges=edges)
            graph_gui = gui.GUI(graph=graph)
            _run_gui(graph_gui)

        # Exit the loop
        elif the_input == "Exit":
            flag = False
Ejemplo n.º 9
0
 def onPlayBackStarted(self):
     if xbmc.getInfoLabel('Container.FolderPath').startswith(self.trigger):
         self.ui = gui.GUI(
             'script-chatdialog-main.xml',
             xbmcaddon.Addon().getAddonInfo('path').decode('utf-8'))
         self.callback()
         self.ui.doModal()
         del self.ui
Ejemplo n.º 10
0
    def __init__(self, starting_player=True):

        self.is_player_white = starting_player
        pieces = self.create_pieces()
        b = board.Board(pieces)
        self.g = g.GUI(b)
        self.ai = ai.AI(b, self.is_player_white)
        self.game_loop(b)
Ejemplo n.º 11
0
    def test_gui(self):
        gui_test = gui.GUI(self.log)
        gui_test.set_console_log_button_states(True)
        gui_test.set_launch_tf2_button_state(True)

        for state in [i for i in range(5)]:
            gui.test_state(gui_test, state)
            gui_test.safe_update()

        self.assertEqual((gui_test.text_state, gui_test.bg_state,
                          gui_test.fg_state, gui_test.class_state),
                         (('Map: cp_catwalk_a5c (hosting)', 'Players: ?/?',
                           'Time on map: 2:39', '06:21 elapsed'),
                          ('bg_modes/control-point', 77,
                           172), 'fg_modes/control-point', 'classes/pyro'))

        for state in [4 - i for i in range(5)]:
            gui.test_state(gui_test, state)
            gui_test.safe_update()

        self.assertEqual(
            (gui_test.text_state, gui_test.bg_state, gui_test.fg_state,
             gui_test.class_state),
            (("Team Fortress 2 isn't running", ), ('default', 0, 0), '', ''))

        gui_test.bottom_text_queue_state = "Queued for Casual"
        self.assertEqual(gui_test.set_bottom_text('queued', True),
                         "Queued for Casual")
        self.assertEqual(gui_test.set_bottom_text('discord', True),
                         "Can't connect to Discord")
        self.assertEqual(gui_test.set_bottom_text('discord', False),
                         "Queued for Casual")
        self.assertEqual(gui_test.set_bottom_text('queued', False), "")

        gui_test.pause()
        gui_test.unpause()
        gui_test.enable_update_notification()
        gui_test.holiday()
        gui_test.menu_open_settings()
        gui_test.menu_about(silent=True)

        gui_test.update_checker.initiate_update_check(True)
        while not gui_test.update_checker.update_check_ready():
            time.sleep(0.2)
        gui_test.handle_update_check(
            gui_test.update_checker.receive_update_check())

        fg_image = gui_test.fg_image_load('tf2_logo', 120)
        self.assertEqual((fg_image.width(), fg_image.height()), (120, 120))
        gui_test.scale = 2
        gui_test.fg_image_load.cache_clear()
        fg_image = gui_test.fg_image_load('tf2_logo', 120)
        self.assertEqual((fg_image.width(), fg_image.height()), (240, 240))

        with self.assertRaises(SystemExit):
            gui_test.menu_exit()

        gui_test.master.destroy()
Ejemplo n.º 12
0
    def __init__(self, start, obstacles):
        """
        initializer
        
        start: 3d-vector with the starting coordinates of the drone
        obestacles: list of 6d-vectors with the rectangular obstacles. format{pos_x, pos_y, pos_z, len_x, len_y, len_z}
        """

        self.start = start
        self.obs = obstacles
        self.path = []
        self.iteration_data = []
        self.planReady = False
        self.iterRunGo = False
        self.pathIter = 0
        self.goalIter = 0

        self.QUADCOPTER = {
            'q1': {
                'position': start,
                'orientation': [0, 0, 0],
                'L': 0.175,
                'r': 0.0665,
                'prop_size': [8, 3.8],
                'weight': 0.5,
                'motorWeight': 0.035
            }
        }
        # Controller parameters
        self.CONTROLLER_PARAMETERS = {
            'Motor_limits': [2000, 12000],  #4000,12000
            'Tilt_limits': [-10, 10],
            'Yaw_Control_Limits': [-900, 900],
            'Z_XY_offset': 500,
            'Linear_PID': {
                'P': [300, 300, 7000],
                'I': [0.03, 0.03, 6],
                'D': [450, 450, 4200]
            },
            'Linear_To_Angular_Scaler': [1, 1, 0],
            'Yaw_Rate_Scaler': 0.18,
            'Angular_PID': {
                'P': [22000, 22000, 1500],
                'I': [0, 0, 1.2],
                'D': [12000, 12000, 0]
            },
        }

        # Make objects for quadcopter, gui and controller
        self.quad = quadcopter.Quadcopter(self.QUADCOPTER)
        self.gui_object = gui.GUI(quads=self.QUADCOPTER, obs=obstacles)
        self.ctrl = controller.Controller_PID_Point2Point(
            self.quad.get_state,
            self.quad.get_time,
            self.quad.set_motor_speeds,
            params=self.CONTROLLER_PARAMETERS,
            quad_identifier='q1')
        self.rrt = RRTStar(obstacle_list=self.obs)
Ejemplo n.º 13
0
 def closeDialog(self):
     import gui
     mainUI = gui.GUI("script_linux_nm-main.xml",
                      __cwd__,
                      "default",
                      msg=self.msg,
                      first=False)
     self.close()
     del mainUI
Ejemplo n.º 14
0
    def __init__(self):
        self.world = world.World()

        self.player = player.Player(self.world)
        self.player.place(10, 10)

        self.gui = gui.GUI(self, 100, 40)

        self.context = list()
        self.key = None
Ejemplo n.º 15
0
    def __init__(self, gps_rate=None):
        # initialize objects
        self._gui = gui.GUI()
        self._buttons = buttons.Buttons(on_green=self.green_callback,
                                        on_blue=self.blue_callback,
                                        on_red=self.red_callback)
        self.rs = RobotState()
        print("The first state in the state machine is: %s" % rs.state)

        self._gps = gps.GPS()
Ejemplo n.º 16
0
 def run(self):
     try:
         self.root = Tk.Tk()
         self.gui = gui.GUI(self.root, self.dcb, self.trainer, self.player)
         self.root.protocol('WM_DELETE_WINDOW', self.closed_window)
         self.root.mainloop()
     except BaseException:
         pass
     finally:
         self.closed_window()
Ejemplo n.º 17
0
    def __init__(self):
        """  
        This starts the Tk framework up, instantiates the Model (a Counter object), instantiates the View (a MyFrame object), and starts the event loop that waits for the user to press a Button on the View.
        """
        root = tkinter.Tk()
        self.model = tempconvert.TempConvert
        self.view = gui.GUI(self)
        self.view.mainloop()

        root.destroy()
Ejemplo n.º 18
0
 def update(self):
     self.player.update()
     if not self.player.died:
         for e in self.world.enemies:
             e.update()
     if self.player.restart:
         self.info = info.InfoBar()
         self.world = world.World(50, 50, self.info, seed=time.time())
         self.player = player.Player("Frederico", self.world)
         self.world.create_enemies()
         self.gui = gui.GUI(self.player)
Ejemplo n.º 19
0
def PIDExperiment():
    # Set goals to go to
    GOALS_1 = [(0, -0.5, 0), (0, 0.5, 0)]
    # Define the quadcopters
    quad_list = [
        quadcopter.Quadcopter([0, 0, 0], [0, 0, 0], 0.3, 0.1, [10, 4.5], 1.2)
    ]
    # Controller parameters

    # Catch Ctrl+C to stop threads
    signal.signal(signal.SIGINT, signal_handler)
    # Make objects for quadcopter, gui and controllers
    gui_object = gui.GUI(quads=quad_list)
    #quad = quadcopter.Quadcopter(quads=QUADCOPTERS)

    quad_manager = quadcopter.QuadManager(quad_list)

    ctrl1 = controller.Controller_PID_Velocity(quad_list[0].get_state,
                                               quad_manager.get_time,
                                               quad_list[0].set_motor_speeds,
                                               [4000, 9000], [-10, 10],
                                               [-900, 900], 500, {
                                                   'P': [300, 300, 7000],
                                                   'I': [0.04, 0.04, 4.5],
                                                   'D': [450, 450, 5000]
                                               }, [1, 1, 0], 0.18, {
                                                   'P': [22000, 22000, 1500],
                                                   'I': [0, 0, 1.2],
                                                   'D': [12000, 12000, 0]
                                               })

    # Start the threads
    quad_manager.start_thread(dt=QUAD_DYNAMICS_UPDATE,
                              time_scaling=TIME_SCALING)
    ctrl1.start_thread(update_rate=CONTROLLER_DYNAMICS_UPDATE,
                       time_scaling=TIME_SCALING)
    # ctrl2.start_thread(update_rate=CONTROLLER_DYNAMICS_UPDATE,time_scaling=TIME_SCALING)
    # Update the GUI while switching between destination poitions

    update_rate = 0.01
    while (run == True):
        for goal1 in GOALS_1:
            ctrl1.update_target(goal1)
            last_update = datetime.datetime.now()
            #ctrl2.update_target(goal2)
            #for i in range(10):
            while ((datetime.datetime.now() - last_update).total_seconds() <
                   update_rate):
                for q in gui_object.quads:
                    q.position = q.get_position()
                    q.orientation = q.get_orientation()
                gui_object.update()
    quad_manager.stop_thread()
    ctrl1.stop_thread()
Ejemplo n.º 20
0
 def __init__(self, gps_rate=None):
     # initialize objects
     self.stop_blink = threading.Event()
     self._gui = gui.GUI()
     self._buttons = buttons.Buttons(on_green=self.green_callback,
                                     on_blue=self.blue_callback,
                                     on_red=self.red_callback)
     self.rs = RobotState()
     print("The first state in the state machine is: %s" % self.rs.state)
     print("Mac Address: " + gma())
     self._gps = gpsCode.GPS()
Ejemplo n.º 21
0
 def __init__(self):
     try:
         self.loader = fileLoad.FileLoad()
     except IOError:
         messagebox.showerror('Error', 'Missing data files')
     else:
         root = tk.Tk()  # root to contain GUI
         savedFilePath = self.loader.loadSavedFilePath(
         )  # user's file path for ISO
         self.gui = gui.GUI(self, root, savedFilePath, self.versionName)
         root.mainloop()  # start GUI
Ejemplo n.º 22
0
 def __init__(self,background_img,splat_img,food_no):
     self.gui = gui.GUI(splat_img)
     self.player = player.Player()
     self.background = pygame.image.load(os.path.join('images', background_img)).convert()
     self.foods = []
     for x in range(food_no):
         x = food.Food()
         self.foods.append(x)
     self.time = 70
     t = threading.Timer(1.0,self.countdown)
     t.start()
Ejemplo n.º 23
0
 def run(self):
     self.parseArgs()
     # GUI, if -g option
     if self.args.g:
         self.gui = gui.GUI(self.shutdown)
         self.gui.start(self.logFiles)
     # Reader
     self.reader = self.readerFactory(self.args[0])
     # Everything starts with my load method
     reactor.callWhenRunning(self.load)
     # GO!
     reactor.run()
Ejemplo n.º 24
0
Archivo: wc.py Proyecto: hoka-17/WC
def wc_main():
    args = parse_test()
    if args.x:
        args.c = True
        args.w = True
        args.l = True
        args.a = True
        args.directory = ""
        gui.GUI(args)
    else:
        wc = WC(args)
        wc.main()
Ejemplo n.º 25
0
    def chkFEED(self, user):
        log('chkFEED, user = '******'img' , {'class': 'ProfileAvatar-image'})[0].attrs['src']
            twitterAlt  = soup('img' , {'class': 'ProfileAvatar-image'})[0].attrs['alt']
            twitterVer  = True if soup.find(href='/help/verified') else False
            tweetTimes  = soup('a'   , {'class': 'tweet-timestamp js-permalink js-nav js-tooltip'})
            tweetMsgs   = soup('div' , {'class': 'js-tweet-text-container'})
            tweetAtts   = soup('div' , {'class': 'AdaptiveMediaOuterContainer'})
            tweetStats  = soup('span', {'class': 'ProfileTweet-actionCountForAria'})
            twitterPin  = len(soup('span' , {'class': 'js-pinned-text'})) > 0
            tmpThumb    = None
            tmpVideo    = None
            tmpImage    = None
            
            for idx, item in enumerate(tweetTimes):
                if idx == 0 and twitterPin == True and user.lower() in item.attrs['href'].lower(): continue
                elif self.incRetweets == True: break
                elif user.lower() in item.attrs['href'].lower(): break
            
            try:                 
                tmpAttach = tweetMsgs[idx]('a', {'class': 'twitter-timeline-link u-hidden'})[0].get_text()
                tmpImage = tweetAtts[idx].find('img').attrs['src'] if tmpAttach.startswith('pic.twitter.com') else None
            except: tmpImage = None

            try:
                tmpThumb    = tweetAtts[idx]('div', {'class': 'PlayableMedia-container'})
                tmpThumb    = tmpThumb[0]('div', {'class': 'PlayableMedia-player'})[0]
                tmpThumb    = re.findall("background-image:url(.*)'", str(tmpThumb))[0].replace("('",'')
            except: tmpThumb = None
            
            if tmpThumb is not None:
                tmpVideo    = tmpThumb.replace('pbs.twimg.com/tweet_video_thumb/','video.twimg.com/tweet_video/').replace('.jpg','.mp4')
            
            tmpImage    = tmpImage if tmpThumb is None else tmpThumb
            tweetTime   = self.correctTime(tweetTimes[idx]["title"].encode("utf-8"))
            tweetMsg    = self.cleanString((tweetMsgs[idx]('p' , {'class': 'TweetTextSize TweetTextSize--normal js-tweet-text tweet-text'})[0].get_text()).encode("utf-8"))
            tweetStats  = [stat.get_text().encode("utf-8") for stat in tweetStats]
            tweetStats  = [tweetStats[x:x+3] for x in xrange(0, len(tweetStats), 3)]
            tweetStats = tweetStats[idx]
            if len(tweetMsg) == 0: return
            
            # test
            # tmpImage = 'https://pbs.twimg.com/tweet_video_thumb/DOubaqGWAAEBPWn.jpg'
            # tmpVideo = 'https://video.twimg.com/tweet_video/DOubaqGWAAEBPWn.mp4'
            # test
            
            if getProperty('%s.%s.time' %(ADDON_ID,user)) != tweetTime:
                setProperty('%s.%s.time'%(ADDON_ID,user),tweetTime)
                ui = gui.GUI("%s.default.xml" %ADDON_ID,ADDON_PATH,"default",params=({'user':user,'video':tmpVideo,'image':tmpImage,'icon':twitterPic,'username':twitterAlt,'title':tweetMsg,'time':tweetTime,'stats':tweetStats,'verified':twitterVer}))
                ui.doModal()
        except Exception as e: log('chkFEED, failed! ' + str(e))
Ejemplo n.º 26
0
def main(args):
    """Hauptfenster, Hauptanwendung Initialisierung und Schliessen Signal anbinden"""
    app = QtGui.QApplication(args)
    win = gui.GUI()
    win.show()
    app.connect(
        app,  # Sender-Widget
        Qt.SIGNAL('lastWindowClosed()'),  # Signal
        app,  # Empfaenger
        Qt.SLOT('quit()')  # aktivierter Slot
    )
    return app.exec_()
Ejemplo n.º 27
0
    def __init__(self, isdebug):
        pygame.init()
        pygame.font.init()
        pygame.mixer.init()
        self.is_running = False
        self.to_move = [0, 0, 0]
        self.isdebug = isdebug
        '''GameInit'''
        frame_size = (gui.card_size[0] * 3, gui.card_size[1] * 2 +
                      gui.height_interface_bottom + gui.height_interface_top
                      )  # init frame
        print(frame_size)
        if os.uname().nodename == 'raspberrypi' and not self.isdebug:
            self.screen = pygame.display.set_mode(
                frame_size, pygame.FULLSCREEN | pygame.HWSURFACE
                | pygame.DOUBLEBUF)  # display frame ,pygame.FULLSCREEN
        else:
            self.screen = pygame.display.set_mode(
                frame_size)  # display frame ,pygame.FULLSCREEN
        self.clock = pygame.time.Clock()
        self.sound_no_money = pygame.mixer.Sound("../sounds/error0.wav")
        self.sound_chatter = pygame.mixer.Sound(
            "../sounds/chattering_teeth.wav")
        self.sound_win = pygame.mixer.Sound(
            "../sounds/win.wav")  # init all sound effects
        self.interface = gui.GUI(self)  # init GUI
        reel_rect = pygame.Rect(0, gui.height_interface_top,
                                gui.card_size[0] * 3, gui.card_size[1] * 2)
        self.reel_screen = self.screen.subsurface(
            reel_rect)  # define reel subsurface
        self.reel = [
            model.Reel(self.reel_screen, 0),
            model.Reel(self.reel_screen, gui.card_size[0]),
            model.Reel(self.reel_screen, gui.card_size[0] * 2)
        ]  # init all reels
        self.roll = [0, 0, 0]
        self.roll_speed = [0, 0, 0]
        self.result = [NO_RESULT, NO_RESULT, NO_RESULT]
        self.extra_rolls = 50
        self.coinLock = Lock()
        self.coins = 0

        pygame.mouse.set_visible(False)

        self.photo_seconds = 0
        self.camera = cam.Camera()
        if os.uname(
        ).nodename == 'raspberrypi':  # first check if the os is windows(windows doesn't provide uname) | os.name is not 'nt' and
            print('CoinThread started')
            from coins import CoinThread
            from trigger import TriggerThread
            self.triggerThread = TriggerThread(self)
            self.coinThread = CoinThread(self)
Ejemplo n.º 28
0
 def setUp(self):
     #         self.training_set = model.TrainingSets()
     #         self.face_detector = fd.FaceDetector()
     #         self.gui = gui.GUI()
     app = QtGui.QApplication('')
     win = gui.GUI()
     win.show()
     app.connect(
         app,  # Sender-Widget
         Qt.SIGNAL('lastWindowClosed()'),  # Signal
         app,  # Empfaenger
         Qt.SLOT('quit()')  # aktivierter Slot
     )
Ejemplo n.º 29
0
def main():
    data_in = LaptopCamera()
    data_out = GameController()
    gui = g.GUI()
    autonomous_control = m.ML()

    gui.setDataIn(data_in)
    gui.setDataOut(data_out)
    gui.setAutonomousControl(autonomous_control)

    autonomous_control.setDataIn(data_in)
    #Empieza La GUI
    gui.start()
Ejemplo n.º 30
0
    def start(self):
        pingur = threading.Thread(target=pinger.Pinger().timer,args=(self.sharedFile,0))
        pingur.daemon=True
        pingur.start()

        
        g = threading.Thread(target=gui.GUI().p,args=(self.sharedFile,))
        g.daemon=True
        g.start()

        status = threading.Thread(target=self.status_print)
        status.daemon=True
        status.start()