eric6/Preferences/ConfigurationDialog.py

changeset 7263
c1af2e327675
parent 7229
53054eb5b15a
child 7286
7eb04391adf7
child 7360
9190402e4505
equal deleted inserted replaced
7262:c4b5f3393d63 7263:c1af2e327675
11 import os 11 import os
12 import types 12 import types
13 13
14 from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QMetaObject, QRect 14 from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QMetaObject, QRect
15 from PyQt5.QtGui import QPixmap 15 from PyQt5.QtGui import QPixmap
16 from PyQt5.QtWidgets import QSizePolicy, QSpacerItem, QWidget, QTreeWidget, \ 16 from PyQt5.QtWidgets import (
17 QStackedWidget, QDialog, QSplitter, QScrollArea, QApplication, \ 17 QSizePolicy, QSpacerItem, QWidget, QTreeWidget, QStackedWidget, QDialog,
18 QDialogButtonBox, QFrame, QVBoxLayout, QTreeWidgetItem, QLabel 18 QSplitter, QScrollArea, QApplication, QDialogButtonBox, QFrame,
19 QVBoxLayout, QTreeWidgetItem, QLabel
20 )
19 21
20 from E5Gui.E5Application import e5App 22 from E5Gui.E5Application import e5App
21 from E5Gui.E5LineEdit import E5ClearableLineEdit 23 from E5Gui.E5LineEdit import E5ClearableLineEdit
22 from E5Gui import E5MessageBox 24 from E5Gui import E5MessageBox
23 from E5Gui.E5MainWindow import E5MainWindow 25 from E5Gui.E5MainWindow import E5MainWindow
573 self.buttonBox.setOrientation(Qt.Horizontal) 575 self.buttonBox.setOrientation(Qt.Horizontal)
574 self.buttonBox.setStandardButtons( 576 self.buttonBox.setStandardButtons(
575 QDialogButtonBox.Apply | QDialogButtonBox.Cancel | 577 QDialogButtonBox.Apply | QDialogButtonBox.Cancel |
576 QDialogButtonBox.Ok | QDialogButtonBox.Reset) 578 QDialogButtonBox.Ok | QDialogButtonBox.Reset)
577 self.buttonBox.setObjectName("buttonBox") 579 self.buttonBox.setObjectName("buttonBox")
578 if not self.fromEric and \ 580 if (
579 self.displayMode == ConfigurationWidget.DefaultMode: 581 not self.fromEric and
582 self.displayMode == ConfigurationWidget.DefaultMode
583 ):
580 self.buttonBox.button(QDialogButtonBox.Apply).hide() 584 self.buttonBox.button(QDialogButtonBox.Apply).hide()
581 self.buttonBox.button(QDialogButtonBox.Apply).setEnabled(False) 585 self.buttonBox.button(QDialogButtonBox.Apply).setEnabled(False)
582 self.buttonBox.button(QDialogButtonBox.Reset).setEnabled(False) 586 self.buttonBox.button(QDialogButtonBox.Reset).setEnabled(False)
583 self.verticalLayout_2.addWidget(self.buttonBox) 587 self.verticalLayout_2.addWidget(self.buttonBox)
584 588
617 childEnabled = False 621 childEnabled = False
618 text = text.lower() 622 text = text.lower()
619 for index in range(parent.childCount()): 623 for index in range(parent.childCount()):
620 itm = parent.child(index) 624 itm = parent.child(index)
621 if itm.childCount() > 0: 625 if itm.childCount() > 0:
622 enable = self.__searchChildItems(itm, text) or \ 626 enable = (
623 text == "" or text in itm.text(0).lower() 627 self.__searchChildItems(itm, text) or
628 text == "" or
629 text in itm.text(0).lower()
630 )
624 else: 631 else:
625 enable = text == "" or text in itm.text(0).lower() 632 enable = text == "" or text in itm.text(0).lower()
626 if enable: 633 if enable:
627 childEnabled = True 634 childEnabled = True
628 itm.setDisabled(not enable) 635 itm.setDisabled(not enable)
632 def __initLexers(self): 639 def __initLexers(self):
633 """ 640 """
634 Private method to initialize the dictionary of preferences lexers. 641 Private method to initialize the dictionary of preferences lexers.
635 """ 642 """
636 import QScintilla.Lexers 643 import QScintilla.Lexers
637 from .PreferencesLexer import PreferencesLexer, \ 644 from .PreferencesLexer import (
638 PreferencesLexerLanguageError 645 PreferencesLexer, PreferencesLexerLanguageError
646 )
639 647
640 self.lexers = {} 648 self.lexers = {}
641 for language in QScintilla.Lexers.getSupportedLanguages(): 649 for language in QScintilla.Lexers.getSupportedLanguages():
642 if language not in self.lexers: 650 if language not in self.lexers:
643 try: 651 try:
878 Public method to get an indication, if QtWebEngine is being used. 886 Public method to get an indication, if QtWebEngine is being used.
879 887
880 @return flag indicating the use of QtWebEngine 888 @return flag indicating the use of QtWebEngine
881 @rtype bool 889 @rtype bool
882 """ 890 """
883 return self.__webEngine or \ 891 return (
892 self.__webEngine or
884 self.displayMode == ConfigurationWidget.WebBrowserMode 893 self.displayMode == ConfigurationWidget.WebBrowserMode
894 )
885 895
886 896
887 class ConfigurationDialog(QDialog): 897 class ConfigurationDialog(QDialog):
888 """ 898 """
889 Class for the dialog variant. 899 Class for the dialog variant.

eric ide

mercurial