Exemple #1
0
    def modulechanged(self):
        # Check that main module has not changed
        test_filename_function_path = os.path.join(jarvis.get_home(), jarvis.TEST_FILENAME_FUNCTION)

        test_filename_function = open(test_filename_function_path).read()
        if test_filename_function != self.filename_function:
            self.filename_function = test_filename_function
            return True
        return False
Exemple #2
0
 def setAudioData(self, data, skip=0.0):
     if self.audio is not None:
         self.audio.terminate()
         self.audio = None
     self.audio_data = data
     self.audio_skip = float(skip)
     self.audio = SoundPlayer(input_file_name=data, tmp_dir=jarvis.get_home(), start=False, loop_nb=0, frames_per_buffer=1024, blocking=False)
     self.audio.set_loop_time(start_time=self.audio_skip, end_time=self.audio_skip + self.loopTime)        
     self.audio.set_time(self.audio_skip + self.current_time, compensate_buffer=False)
Exemple #3
0
    def modulechanged(self):
        # Check that main module has not changed
        test_filename_function_path = os.path.join(
            jarvis.get_home(), jarvis.TEST_FILENAME_FUNCTION)

        test_filename_function = open(test_filename_function_path).read()
        if test_filename_function != self.filename_function:
            self.filename_function = test_filename_function
            return True
        return False
Exemple #4
0
def set_test_filename_function(test_filename_function):
    """Set the module.function that jarvis watches for changes and then executes."""
    # Get the jarvis home directory
    jarvis_home = jarvis.get_home()

    # Find the file that holds the current module.function to test
    testmodulefilename = os.path.join(jarvis_home, jarvis.TEST_FILENAME_FUNCTION)

    # Write the file
    f=open(testmodulefilename, "w")
    f.write(test_filename_function)
    f.close()
Exemple #5
0
def set_test_filename_function(test_filename_function):
    """Set the module.function that jarvis watches for changes and then executes."""
    # Get the jarvis home directory
    jarvis_home = jarvis.get_home()

    # Find the file that holds the current module.function to test
    testmodulefilename = os.path.join(jarvis_home,
                                      jarvis.TEST_FILENAME_FUNCTION)

    # Write the file
    f = open(testmodulefilename, "w")
    f.write(test_filename_function)
    f.close()
Exemple #6
0
    def run(self):
        # Write the current module name to disk
        testmodulepath = os.path.join(jarvis.get_home(), jarvis.TEST_FILENAME_FUNCTION)
        if self.filename_function != None:
            f = open(testmodulepath, "w")
            f.write(self.filename_function)
            f.close()

        try:
            self.run_()
        except KeyboardInterrupt:
            pass
        except Exception, e:
            print traceback.format_exc(e)
Exemple #7
0
    def run(self):
        # Write the current module name to disk
        testmodulepath = os.path.join(jarvis.get_home(),
                                      jarvis.TEST_FILENAME_FUNCTION)
        if self.filename_function != None:
            f = open(testmodulepath, "w")
            f.write(self.filename_function)
            f.close()

        try:
            self.run_()
        except KeyboardInterrupt:
            pass
        except Exception, e:
            print traceback.format_exc(e)
Exemple #8
0
 def setAudioData(self, data, skip=0.0):
     if self.audio is not None:
         self.audio.terminate()
         self.audio = None
     self.audio_data = data
     self.audio_skip = float(skip)
     self.audio = SoundPlayer(input_data=data,
                              tmp_dir=jarvis.get_home(),
                              start=False,
                              loop_nb=0,
                              frames_per_buffer=1024,
                              blocking=False)
     if self.audio is not None:
         self.audio.set_loop_time(start_time=self.audio_skip,
                                  end_time=self.audio_skip + self.loopTime)
         self.audio.set_time(self.audio_skip + self.current_time,
                             compensate_buffer=False)