Esempio n. 1
0
   def _changeBackgroundFile(self, fileName, nodeId):
      file_obj = open(fileName, 'r+b')
      data_str = ''.join(file_obj.readlines())
      file_obj.close()
      data_list = pbhelpers.string2list(data_str)

      env = maestro.gui.Environment()
      env.mEventManager.emit(nodeId, 'desktop.set_background', fileName,
                             data_list, debug = False)

      img_digest = self._storeImage(data_str)
      self.mSettings[nodeId].setBackgroundImageFile(fileName)
      self.mSettings[nodeId].setBackgroundImageCacheKey(img_digest)
      self._setBackgroundImage(fileName, data_str)
Esempio n. 2
0
   def onQueryBackgroundImageData(self, nodeId, avatar):
      '''
      Reports the actual bytes of the desktop background image as a string. If
      there is no background image or the image could not be read, then an
      empty string is reported.
      '''
      # Tell the requesting node the name of the file that holds our
      # desktop background image.
      env = maestro.core.Environment()
      self.mLogger.debug("Emitting desktop.report_bg_image_data")
      img_data_list = \
         pbhelpers.string2list(self._getBackgroundImageData(avatar))

      env.mEventManager.emit(nodeId, 'desktop.report_bg_image_data',
                             img_data_list, debug = False)