def LoadOverlay(self, cmd): """Creates raster legend with d.legend :param cmd: d.legend command as a list :return: bitmap with legend """ Debug.msg(5, "BitmapProvider.LoadOverlay: cmd={c}".format(c=cmd)) fileHandler, filename = tempfile.mkstemp(suffix=".png") os.close(fileHandler) # Set the environment variables for this process _setEnvironment( self.imageWidth, self.imageHeight, filename, transparent=True, bgcolor=(0, 0, 0), ) Debug.msg(1, "Render raster legend " + str(filename)) cmdTuple = cmdlist_to_tuple(cmd) returncode, stdout, messages = read2_command(cmdTuple[0], **cmdTuple[1]) if returncode == 0: return BitmapFromImage(autoCropImageFromFile(filename)) else: os.remove(filename) raise GException(messages)
def LoadOverlay(self, cmd): """Creates raster legend with d.legend :param cmd: d.legend command as a list :return: bitmap with legend """ Debug.msg(5, "BitmapProvider.LoadOverlay: cmd={c}".format(c=cmd)) fileHandler, filename = tempfile.mkstemp(suffix=".png") os.close(fileHandler) # Set the environment variables for this process _setEnvironment(self.imageWidth, self.imageHeight, filename, transparent=True, bgcolor=(0, 0, 0)) Debug.msg(1, "Render raster legend " + str(filename)) cmdTuple = cmdlist_to_tuple(cmd) returncode, stdout, messages = read2_command( cmdTuple[0], **cmdTuple[1]) if returncode == 0: return wx.BitmapFromImage(autoCropImageFromFile(filename)) else: os.remove(filename) raise GException(messages)