def set_passphrase_cb(self, func, hook=None): """Sets the passphrase callback to the function specified by func. When the system needs a passphrase, it will call func with three args: hint, a string describing the key it needs the passphrase for; desc, a string describing the passphrase it needs; prev_bad, a boolean equal True if this is a call made after unsuccessful previous attempt. If hook has a value other than None it will be passed into the func as a forth argument. Please see the GPGME manual for more information. """ self._free_passcb() if func == None: hookdata = None else: self.last_passcb = pygpgme.new_PyObject_p_p() if hook == None: hookdata = func else: hookdata = (func, hook) pygpgme.pygpgme_set_passphrase_cb(self.wrapped, hookdata, self.last_passcb)
def new_from_cbs(self, funcs, hook): """Argument funcs must be a 4 element tuple with callbacks: (read_cb, write_cb, seek_cb, release_cb)""" tmp = pygpgme.new_gpgme_data_t_p() self._free_readcb() self.last_readcb = pygpgme.new_PyObject_p_p() hookdata = (funcs, hook) pygpgme.pygpgme_data_new_from_cbs(tmp, hookdata, self.last_readcb) self.wrapped = pygpgme.gpgme_data_t_p_value(tmp) pygpgme.delete_gpgme_data_t_p(tmp)
def set_progress_cb(self, func, hook=None): """Sets the progress meter callback to the function specified by This function will be called to provide an interactive update of the system's progress. Please see the GPGME manual for more information.""" self._free_progresscb() if func == None: hookdata = None else: self.last_progresscb = pygpgme.new_PyObject_p_p() if hook == None: hookdata = func else: hookdata = (func, hook) pygpgme.pygpgme_set_progress_cb(self.wrapped, hookdata, self.last_progresscb)