LogoSearch packages:      

Sourcecode: screenlets version File versions  Download package

def lib::session::ScreenletSession::__unregister_screenlet (   self,
  name = None 
) [private]

Delete this session's entry from the gloabl tempfile (and delete the
entire file if no more running screenlets are set.

Definition at line 298 of file session.py.

00298                                                   :
            """Delete this session's entry from the gloabl tempfile (and delete the
            entire file if no more running screenlets are set."""
            if not name:
                  name = self.screenlet.__name__
            # WORKAROUND: for now we manually unregister from the daemon,
            #             ideally the daemon should watch the tmpfile for changes
            if self.daemon_iface:
                  try:
                        self.daemon_iface.unregister_screenlet(name)
                  except Exception, ex:
                        print _("Failed to unregister from daemon: %s") % ex
            # /WORKAROUND
            # get running screenlets
            running = utils.list_running_screenlets()
            if running and len(running) > 0:
                  print _("Removing entry for %s from global tempfile %s") % (name, self.tempfile)
                  try:
                        running.remove(name)
                  except:
                        # not found, so ok
                        print _("Entry not found. Will (obviously) not be removed.")
                        return True
                  # still running screenlets?
                  if running and len(running) > 0:
                        # re-save new list of running screenlets
                        f = open(self.tempfile, 'w')
                        if f:
                              for r in running:
                                    f.write(r + '\n')
                              f.close()
                              return True
                        else:
                              print _("Error global tempfile not found. Some error before?")
                        return False
                  else:
                        print _('No more screenlets running.')
                        self.__delete_tempfile(name)
            else:
                  print _('No screenlets running?')
                  return False
      
      def __delete_tempfile (self, name=None):


Generated by  Doxygen 1.5.1   Back to index