425 font. |
425 font. |
426 """ |
426 """ |
427 self.monospacedFont = self.selectFont( |
427 self.monospacedFont = self.selectFont( |
428 self.monospacedFontSample, self.monospacedFont, |
428 self.monospacedFontSample, self.monospacedFont, |
429 options=QFontDialog.FontDialogOption.MonospacedFonts) |
429 options=QFontDialog.FontDialogOption.MonospacedFonts) |
430 |
430 |
|
431 def __setSampleStyleSheet(self, sampleLineEdit, color, background): |
|
432 """ |
|
433 Private method to colorize a sample with given foreground and |
|
434 background colors. |
|
435 |
|
436 @param sampleLineEdit line edit element to be colorized |
|
437 @type QLineEdit |
|
438 @param color text color to be shown |
|
439 @type QColor |
|
440 @param background background color to be shown |
|
441 @type QColor |
|
442 """ |
|
443 sampleLineEdit.setStyleSheet( |
|
444 "QLineEdit {{ color: {0}; background-color: {1}; }}" |
|
445 .format(color.name(), background.name()) |
|
446 ) |
|
447 |
431 def polishPage(self): |
448 def polishPage(self): |
432 """ |
449 """ |
433 Public slot to perform some polishing actions. |
450 Public slot to perform some polishing actions. |
434 """ |
451 """ |
435 self.marginsFontSample.setFont(self.marginsFont) |
452 self.marginsFontSample.setFont(self.marginsFont) |
436 self.defaultFontSample.setFont(self.defaultFont) |
453 self.defaultFontSample.setFont(self.defaultFont) |
437 self.monospacedFontSample.setFont(self.monospacedFont) |
454 self.monospacedFontSample.setFont(self.monospacedFont) |
438 |
455 |
439 pl = self.annotationsWarningSample.palette() |
456 self.__setSampleStyleSheet( |
440 pl.setColor(QPalette.ColorRole.Text, |
457 self.annotationsWarningSample, |
441 self.editorColours["AnnotationsWarningForeground"]) |
458 self.editorColours["AnnotationsWarningForeground"], |
442 pl.setColor(QPalette.ColorRole.Base, |
459 self.editorColours["AnnotationsWarningBackground"]) |
443 self.editorColours["AnnotationsWarningBackground"]) |
460 |
444 self.annotationsWarningSample.setPalette(pl) |
461 self.__setSampleStyleSheet( |
445 self.annotationsWarningSample.repaint() |
462 self.annotationsErrorSample, |
446 |
463 self.editorColours["AnnotationsErrorForeground"], |
447 pl = self.annotationsErrorSample.palette() |
464 self.editorColours["AnnotationsErrorBackground"]) |
448 pl.setColor(QPalette.ColorRole.Text, |
465 |
449 self.editorColours["AnnotationsErrorForeground"]) |
466 self.__setSampleStyleSheet( |
450 pl.setColor(QPalette.ColorRole.Base, |
467 self.annotationsStyleWarningSample, |
451 self.editorColours["AnnotationsErrorBackground"]) |
468 self.editorColours["AnnotationsStyleForeground"], |
452 self.annotationsErrorSample.setPalette(pl) |
469 self.editorColours["AnnotationsStyleBackground"]) |
453 self.annotationsErrorSample.repaint() |
|
454 |
|
455 pl = self.annotationsStyleWarningSample.palette() |
|
456 pl.setColor(QPalette.ColorRole.Text, |
|
457 self.editorColours["AnnotationsStyleForeground"]) |
|
458 pl.setColor(QPalette.ColorRole.Base, |
|
459 self.editorColours["AnnotationsStyleBackground"]) |
|
460 self.annotationsStyleWarningSample.setPalette(pl) |
|
461 self.annotationsStyleWarningSample.repaint() |
|
462 |
470 |
463 @pyqtSlot() |
471 @pyqtSlot() |
464 def on_annotationsWarningFgButton_clicked(self): |
472 def on_annotationsWarningFgButton_clicked(self): |
465 """ |
473 """ |
466 Private slot to set the foreground colour of the warning annotations. |
474 Private slot to set the foreground colour of the warning annotations. |
467 """ |
475 """ |
468 colour = QColorDialog.getColor( |
476 colour = QColorDialog.getColor( |
469 self.editorColours["AnnotationsWarningForeground"]) |
477 self.editorColours["AnnotationsWarningForeground"]) |
470 if colour.isValid(): |
478 if colour.isValid(): |
471 pl = self.annotationsWarningSample.palette() |
479 self.__setSampleStyleSheet( |
472 pl.setColor(QPalette.ColorRole.Text, colour) |
480 self.annotationsWarningSample, |
473 self.annotationsWarningSample.setPalette(pl) |
481 colour, |
474 self.annotationsWarningSample.repaint() |
482 self.editorColours["AnnotationsWarningBackground"]) |
475 self.editorColours["AnnotationsWarningForeground"] = colour |
483 self.editorColours["AnnotationsWarningForeground"] = colour |
476 |
484 |
477 @pyqtSlot() |
485 @pyqtSlot() |
478 def on_annotationsWarningBgButton_clicked(self): |
486 def on_annotationsWarningBgButton_clicked(self): |
479 """ |
487 """ |
480 Private slot to set the background colour of the warning annotations. |
488 Private slot to set the background colour of the warning annotations. |
481 """ |
489 """ |
482 colour = QColorDialog.getColor( |
490 colour = QColorDialog.getColor( |
483 self.editorColours["AnnotationsWarningBackground"]) |
491 self.editorColours["AnnotationsWarningBackground"]) |
484 if colour.isValid(): |
492 if colour.isValid(): |
485 pl = self.annotationsWarningSample.palette() |
493 self.__setSampleStyleSheet( |
486 pl.setColor(QPalette.ColorRole.Base, colour) |
494 self.annotationsWarningSample, |
487 self.annotationsWarningSample.setPalette(pl) |
495 self.editorColours["AnnotationsWarningForeground"], |
488 self.annotationsWarningSample.repaint() |
496 colour) |
489 self.editorColours["AnnotationsWarningBackground"] = colour |
497 self.editorColours["AnnotationsWarningBackground"] = colour |
490 |
498 |
491 @pyqtSlot() |
499 @pyqtSlot() |
492 def on_annotationsErrorFgButton_clicked(self): |
500 def on_annotationsErrorFgButton_clicked(self): |
493 """ |
501 """ |
494 Private slot to set the foreground colour of the error annotations. |
502 Private slot to set the foreground colour of the error annotations. |
495 """ |
503 """ |
496 colour = QColorDialog.getColor( |
504 colour = QColorDialog.getColor( |
497 self.editorColours["AnnotationsErrorForeground"]) |
505 self.editorColours["AnnotationsErrorForeground"]) |
498 if colour.isValid(): |
506 if colour.isValid(): |
499 pl = self.annotationsErrorSample.palette() |
507 self.__setSampleStyleSheet( |
500 pl.setColor(QPalette.ColorRole.Text, colour) |
508 self.annotationsErrorSample, |
501 self.annotationsErrorSample.setPalette(pl) |
509 colour, |
502 self.annotationsErrorSample.repaint() |
510 self.editorColours["AnnotationsErrorBackground"]) |
503 self.editorColours["AnnotationsErrorForeground"] = colour |
511 self.editorColours["AnnotationsErrorForeground"] = colour |
504 |
512 |
505 @pyqtSlot() |
513 @pyqtSlot() |
506 def on_annotationsErrorBgButton_clicked(self): |
514 def on_annotationsErrorBgButton_clicked(self): |
507 """ |
515 """ |
508 Private slot to set the background colour of the error annotations. |
516 Private slot to set the background colour of the error annotations. |
509 """ |
517 """ |
510 colour = QColorDialog.getColor( |
518 colour = QColorDialog.getColor( |
511 self.editorColours["AnnotationsErrorBackground"]) |
519 self.editorColours["AnnotationsErrorBackground"]) |
512 if colour.isValid(): |
520 if colour.isValid(): |
513 pl = self.annotationsErrorSample.palette() |
521 self.__setSampleStyleSheet( |
514 pl.setColor(QPalette.ColorRole.Base, colour) |
522 self.annotationsErrorSample, |
515 self.annotationsErrorSample.setPalette(pl) |
523 self.editorColours["AnnotationsErrorForeground"], |
516 self.annotationsErrorSample.repaint() |
524 colour) |
517 self.editorColours["AnnotationsErrorBackground"] = colour |
525 self.editorColours["AnnotationsErrorBackground"] = colour |
518 |
526 |
519 @pyqtSlot() |
527 @pyqtSlot() |
520 def on_annotationsStyleWarningFgButton_clicked(self): |
528 def on_annotationsStyleWarningFgButton_clicked(self): |
521 """ |
529 """ |
522 Private slot to set the foreground colour of the style annotations. |
530 Private slot to set the foreground colour of the style annotations. |
523 """ |
531 """ |
524 colour = QColorDialog.getColor( |
532 colour = QColorDialog.getColor( |
525 self.editorColours["AnnotationsStyleForeground"]) |
533 self.editorColours["AnnotationsStyleForeground"]) |
526 if colour.isValid(): |
534 if colour.isValid(): |
527 pl = self.annotationsStyleWarningSample.palette() |
535 self.__setSampleStyleSheet( |
528 pl.setColor(QPalette.ColorRole.Text, colour) |
536 self.annotationsStyleWarningSample, |
529 self.annotationsStyleWarningSample.setPalette(pl) |
537 colour, |
530 self.annotationsStyleWarningSample.repaint() |
538 self.editorColours["AnnotationsStyleBackground"]) |
531 self.editorColours["AnnotationsStyleForeground"] = colour |
539 self.editorColours["AnnotationsStyleForeground"] = colour |
532 |
540 |
533 @pyqtSlot() |
541 @pyqtSlot() |
534 def on_annotationsStyleWarningBgButton_clicked(self): |
542 def on_annotationsStyleWarningBgButton_clicked(self): |
535 """ |
543 """ |
536 Private slot to set the background colour of the style annotations. |
544 Private slot to set the background colour of the style annotations. |
537 """ |
545 """ |
538 colour = QColorDialog.getColor( |
546 colour = QColorDialog.getColor( |
539 self.editorColours["AnnotationsStyleBackground"]) |
547 self.editorColours["AnnotationsStyleBackground"]) |
540 if colour.isValid(): |
548 if colour.isValid(): |
541 pl = self.annotationsStyleWarningSample.palette() |
549 self.__setSampleStyleSheet( |
542 pl.setColor(QPalette.ColorRole.Base, colour) |
550 self.annotationsStyleWarningSample, |
543 self.annotationsStyleWarningSample.setPalette(pl) |
551 self.editorColours["AnnotationsStyleForeground"], |
544 self.annotationsStyleWarningSample.repaint() |
552 colour) |
545 self.editorColours["AnnotationsStyleackground"] = colour |
553 self.editorColours["AnnotationsStyleBackground"] = colour |
546 |
554 |
547 |
555 |
548 def create(dlg): |
556 def create(dlg): |
549 """ |
557 """ |
550 Module function to create the configuration page. |
558 Module function to create the configuration page. |