Ejemplo n.º 1
0
def begin_upgrade(mainloop,
                  package_path,
                  device_info,
                  completed_handler,
                  progress_handler,
                  cancancel_handler):
    """
        Parameters:
            - mainloop: either a Mainloop or MainloopThread
            - package_path: path to a tobiipkg file
            - device_info: an EyetrackerInfo
            - completed_handler: will be called like this:
                    completed_handler(error_code)
            - progress_handler: will be called like this:
                    progress_handler(current_step, number_of_steps, step_percentage)
    """
    _check_init()
    
    _require_callable(completed_handler, optional=False, argument_name="completed_handler")
    _require_callable(progress_handler, optional=True, argument_name="progress_handler")
    _require_callable(cancancel_handler, optional=True, argument_name="cancancel_handler")
        
    package_bytes = _load_package_file(package_path)
    if len(package_bytes) == 0:
        raise ValueError("file '%s' was empty" % (package_path))
    
    tobiisdkpy.upgrade_begin(_get_native_mainloop(mainloop),
                             package_bytes,
                             _get_native_device_info(device_info),
                             completed_handler,
                             progress_handler,
                             cancancel_handler)
Ejemplo n.º 2
0
def package_is_compatible_with_device(mainloop, package_path, device_info):
    _check_init()
    
    package_bytes = _load_package_file(package_path)    
    if len(package_bytes) == 0:
        raise ValueError("file '%s' was empty" % (package_path))
        
    return tobiisdkpy.upgrade_package_is_compatible(_get_native_mainloop(mainloop),
                                                    package_bytes,
                                                    _get_native_device_info(device_info))
Ejemplo n.º 3
0
 def __init__(self, mainloop=None, delay_start=False):
     """Creates a new MainloopThread and either attaches an
     existing Mainloop to it or creates a new Mainloop.
     The argument delay_start (default: False) controls whether
     the thread should be started directly or not.
     """
     _check_init()
     
     if mainloop is None:
         self._mainloop = Mainloop()
     else:
         self._mainloop = mainloop
     
     self._thread = None
     if not delay_start:
         self.start()
Ejemplo n.º 4
0
 def __init__(self):
     _check_init()
     self.mainloop = tobiisdkpy.Mainloop()