Beispiel #1
0
 def get_color_def(self, color_id_or_desc):
     color_id = color_id_or_desc
     color_desc = None
     if not isinstance(color_id, (int, long)):
         color_desc = color_id_or_desc
         color_id = self.resolve_color_desc(color_id_or_desc)
     if color_id in self.colordefs:
         return self.colordefs[color_id]
     if not color_desc:
         color_desc = self.find_color_desc(color_id)
         if not color_desc:
             raise Exception("color id not found")
     cd = ColorDefinition.from_color_desc(color_id, color_desc)
     self.colordefs[color_id] = cd
     return cd
Beispiel #2
0
 def get_color_def(self, color_id_or_desc):
     color_id = color_id_or_desc
     color_desc = None
     if not isinstance(color_id, (int, long)):
         color_desc = color_id_or_desc
         color_id = self.resolve_color_desc(color_id_or_desc)
     if color_id in self.colordefs:
         return self.colordefs[color_id]
     if not color_desc:
         color_desc = self.find_color_desc(color_id)
         if not color_desc:
             raise Exception("color id not found")
     cd = ColorDefinition.from_color_desc(color_id, color_desc)
     self.colordefs[color_id] = cd
     return cd
Beispiel #3
0
 def get_color_def(self, color_id_or_desc):
     """ Finds a color definition given an id or description """
     if color_id_or_desc == 0 or color_id_or_desc == '':
         return UNCOLORED_MARKER
     color_id = color_id_or_desc
     color_desc = None
     if not isinstance(color_id, (int, long)):
         color_desc = color_id_or_desc
         color_id = self.resolve_color_desc(color_id_or_desc)
     if color_id in self.colordefs:
         return self.colordefs[color_id]
     if not color_desc:
         color_desc = self.find_color_desc(color_id)
         if not color_desc:
             raise InvalidColorIdError("color id not found")
     cd = ColorDefinition.from_color_desc(color_id, color_desc)
     self.colordefs[color_id] = cd
     return cd
Beispiel #4
0
 def get_color_def(self, color_id_or_desc):
     """ Finds a color definition given an id or description """
     if color_id_or_desc == 0 or color_id_or_desc == '':
         return UNCOLORED_MARKER
     color_id = color_id_or_desc
     color_desc = None
     if not isinstance(color_id, (int, long)):
         color_desc = color_id_or_desc
         color_id = self.resolve_color_desc(color_id_or_desc)
     if color_id in self.colordefs:
         return self.colordefs[color_id]
     if not color_desc:
         color_desc = self.find_color_desc(color_id)
         if not color_desc:
             raise InvalidColorIdError("Color id '%s' not found!" % color_id)
     cd = ColorDefinition.from_color_desc(
         color_id, color_desc)
     self.colordefs[color_id] = cd
     return cd
Beispiel #5
0
 def get_color_def(self, color_id_or_desc):
     """ Finds a color definition given an id or description """
     if color_id_or_desc == 0:
         return UNCOLORED_MARKER
     color_id = color_id_or_desc
     color_desc = None
     if not isinstance(color_id, (int, long)):
         color_desc = color_id_or_desc
         color_id = self.resolve_color_desc(color_id_or_desc)
     if color_id in self.colordefs:
         return self.colordefs[color_id]
     if not color_desc:
         color_desc = self.find_color_desc(color_id)
         if not color_desc:
             raise Exception("color id not found")
     cd = ColorDefinition.from_color_desc(
         color_id, color_desc)
     self.colordefs[color_id] = cd
     return cd