571 self.annotationsStyleWarningSample, |
577 self.annotationsStyleWarningSample, |
572 self.editorColours["AnnotationsStyleForeground"], |
578 self.editorColours["AnnotationsStyleForeground"], |
573 self.editorColours["AnnotationsStyleBackground"], |
579 self.editorColours["AnnotationsStyleBackground"], |
574 ) |
580 ) |
575 |
581 |
|
582 self.__setSampleStyleSheet( |
|
583 self.annotationsInformationSample, |
|
584 self.editorColours["AnnotationsInfoForeground"], |
|
585 self.editorColours["AnnotationsInfoBackground"], |
|
586 ) |
|
587 |
|
588 def __selectAnnotationColor(self, annotationType, isBackground, annotationSample): |
|
589 """ |
|
590 Private method to select an annotation color and update the sample. |
|
591 |
|
592 @param annotationType type of the annotation |
|
593 @type str |
|
594 @param isBackground flag indicating the background color |
|
595 @type bool |
|
596 @param annotationSample reference to the annotation sample widget |
|
597 @type QLineEdit |
|
598 """ |
|
599 bgColorStr = f"Annotations{annotationType}Background" |
|
600 fgColorStr =f"Annotations{annotationType}Foreground" |
|
601 |
|
602 color = QColorDialog.getColor( |
|
603 self.editorColours[bgColorStr] |
|
604 if isBackground |
|
605 else self.editorColours[fgColorStr] |
|
606 ) |
|
607 if color.isValid(): |
|
608 self.__setSampleStyleSheet( |
|
609 annotationSample, |
|
610 self.editorColours[fgColorStr] if isBackground else color, |
|
611 color if isBackground else self.editorColours[bgColorStr], |
|
612 ) |
|
613 self.editorColours[ |
|
614 bgColorStr if isBackground else fgColorStr |
|
615 ] = color |
|
616 |
576 @pyqtSlot() |
617 @pyqtSlot() |
577 def on_annotationsWarningFgButton_clicked(self): |
618 def on_annotationsWarningFgButton_clicked(self): |
578 """ |
619 """ |
579 Private slot to set the foreground colour of the warning annotations. |
620 Private slot to set the foreground colour of the warning annotations. |
580 """ |
621 """ |
581 colour = QColorDialog.getColor( |
622 self.__selectAnnotationColor("Warning", False, self.annotationsWarningSample) |
582 self.editorColours["AnnotationsWarningForeground"] |
|
583 ) |
|
584 if colour.isValid(): |
|
585 self.__setSampleStyleSheet( |
|
586 self.annotationsWarningSample, |
|
587 colour, |
|
588 self.editorColours["AnnotationsWarningBackground"], |
|
589 ) |
|
590 self.editorColours["AnnotationsWarningForeground"] = colour |
|
591 |
623 |
592 @pyqtSlot() |
624 @pyqtSlot() |
593 def on_annotationsWarningBgButton_clicked(self): |
625 def on_annotationsWarningBgButton_clicked(self): |
594 """ |
626 """ |
595 Private slot to set the background colour of the warning annotations. |
627 Private slot to set the background colour of the warning annotations. |
596 """ |
628 """ |
597 colour = QColorDialog.getColor( |
629 self.__selectAnnotationColor("Warning", True, self.annotationsWarningSample) |
598 self.editorColours["AnnotationsWarningBackground"] |
|
599 ) |
|
600 if colour.isValid(): |
|
601 self.__setSampleStyleSheet( |
|
602 self.annotationsWarningSample, |
|
603 self.editorColours["AnnotationsWarningForeground"], |
|
604 colour, |
|
605 ) |
|
606 self.editorColours["AnnotationsWarningBackground"] = colour |
|
607 |
630 |
608 @pyqtSlot() |
631 @pyqtSlot() |
609 def on_annotationsErrorFgButton_clicked(self): |
632 def on_annotationsErrorFgButton_clicked(self): |
610 """ |
633 """ |
611 Private slot to set the foreground colour of the error annotations. |
634 Private slot to set the foreground colour of the error annotations. |
612 """ |
635 """ |
613 colour = QColorDialog.getColor(self.editorColours["AnnotationsErrorForeground"]) |
636 self.__selectAnnotationColor("Error", False, self.annotationsErrorSample) |
614 if colour.isValid(): |
|
615 self.__setSampleStyleSheet( |
|
616 self.annotationsErrorSample, |
|
617 colour, |
|
618 self.editorColours["AnnotationsErrorBackground"], |
|
619 ) |
|
620 self.editorColours["AnnotationsErrorForeground"] = colour |
|
621 |
637 |
622 @pyqtSlot() |
638 @pyqtSlot() |
623 def on_annotationsErrorBgButton_clicked(self): |
639 def on_annotationsErrorBgButton_clicked(self): |
624 """ |
640 """ |
625 Private slot to set the background colour of the error annotations. |
641 Private slot to set the background colour of the error annotations. |
626 """ |
642 """ |
627 colour = QColorDialog.getColor(self.editorColours["AnnotationsErrorBackground"]) |
643 self.__selectAnnotationColor("Error", True, self.annotationsErrorSample) |
628 if colour.isValid(): |
|
629 self.__setSampleStyleSheet( |
|
630 self.annotationsErrorSample, |
|
631 self.editorColours["AnnotationsErrorForeground"], |
|
632 colour, |
|
633 ) |
|
634 self.editorColours["AnnotationsErrorBackground"] = colour |
|
635 |
644 |
636 @pyqtSlot() |
645 @pyqtSlot() |
637 def on_annotationsStyleWarningFgButton_clicked(self): |
646 def on_annotationsStyleWarningFgButton_clicked(self): |
638 """ |
647 """ |
639 Private slot to set the foreground colour of the style annotations. |
648 Private slot to set the foreground colour of the style annotations. |
640 """ |
649 """ |
641 colour = QColorDialog.getColor(self.editorColours["AnnotationsStyleForeground"]) |
650 self.__selectAnnotationColor("Style", False, self.annotationsStyleWarningSample) |
642 if colour.isValid(): |
|
643 self.__setSampleStyleSheet( |
|
644 self.annotationsStyleWarningSample, |
|
645 colour, |
|
646 self.editorColours["AnnotationsStyleBackground"], |
|
647 ) |
|
648 self.editorColours["AnnotationsStyleForeground"] = colour |
|
649 |
651 |
650 @pyqtSlot() |
652 @pyqtSlot() |
651 def on_annotationsStyleWarningBgButton_clicked(self): |
653 def on_annotationsStyleWarningBgButton_clicked(self): |
652 """ |
654 """ |
653 Private slot to set the background colour of the style annotations. |
655 Private slot to set the background colour of the style annotations. |
654 """ |
656 """ |
655 colour = QColorDialog.getColor(self.editorColours["AnnotationsStyleBackground"]) |
657 self.__selectAnnotationColor("Style", True, self.annotationsStyleWarningSample) |
656 if colour.isValid(): |
658 |
657 self.__setSampleStyleSheet( |
659 @pyqtSlot() |
658 self.annotationsStyleWarningSample, |
660 def on_annotationsInformationFgButton_clicked(self): |
659 self.editorColours["AnnotationsStyleForeground"], |
661 """ |
660 colour, |
662 Private slot to set the foreground colour of the information annotations. |
661 ) |
663 """ |
662 self.editorColours["AnnotationsStyleBackground"] = colour |
664 self.__selectAnnotationColor("Info", False, self.annotationsInformationSample) |
|
665 |
|
666 @pyqtSlot() |
|
667 def on_annotationsInformationBgButton_clicked(self): |
|
668 """ |
|
669 Private slot to set the background colour of the information annotations. |
|
670 """ |
|
671 self.__selectAnnotationColor("Info", True, self.annotationsInformationSample) |
663 |
672 |
664 |
673 |
665 def create(dlg): # noqa: U100 |
674 def create(dlg): # noqa: U100 |
666 """ |
675 """ |
667 Module function to create the configuration page. |
676 Module function to create the configuration page. |