Пример #1
0
def get_image_label(name, default="not_found.png"):
    """
    Construct a QLabel from the file with specified name
    name, default: filenames with extensions
    """
    label = QLabel()
    pixmap = QPixmap(get_image_file_path(name, default))
    label.setPixmap(pixmap)
    return label
Пример #2
0
 def update(self, value):
     """Reimplement LineEditWidget method"""
     LineEditWidget.update(self, value)
     color = text_to_qcolor(value)
     if color.isValid():
         bitmap = QPixmap(16, 16)
         bitmap.fill(color)
         icon = QIcon(bitmap)
     else:
         icon = get_icon("not_found")
     self.button.setIcon(icon)