예제 #1
0
class AbstractBeeMaster:
	""" This is a class that can be inherited from to provide a bee master object that controls tools, windows, layers, and options
	"""
	def __init__(self):
		# setup tool box
		self.toolbox=BeeToolBox()

		self.curwindow=None

		self.config={}
		self.configlock=qtcore.QReadWriteLock()

	def getConfigOption(self,key,default=None):
		""" This function is used to fetch options, I'm well aware that dictionaries have a get function, but I want this function to output a debug message if the key isn't found """
		lock=qtcore.QReadLocker(self.configlock)
		if key in self.config:
			return self.config[key]
		print_debug("couldn't find config option: %s" % key)
		return default

	def refreshLayerThumb(self,window,layer=0):
		""" Indicates that layer thumbnails need to be updated, this may or may not need to be reimplemented in the subclass """
		return

	def getToolClassByName(self,name):
		return self.toolbox.getToolDescByName(name)

	def getCurToolInst(self,window):
		pass

	def getCurWindow(self,lock=None):
		return self.curwindow

	def getCurToolDesc(self):
		"""	return description object for current tool """
		return self.toolbox.getCurToolDesc()

	def registerWindow(self,window):
		pass

	def getLayerById(self,win_id,layer_id):
		""" return layer of current window that has specified ID, return None if no layer with that ID is found """
		return self.curwindow.getLayerByKey(layer_id)

	#def getLayerById(self,win_id):
	#	return self.curwindow

	def startRemoteDrawingThreads(self):
		pass