本文整理汇总了Python中PyQt5.QtWidgets.QStyleFactory.keys方法的典型用法代码示例。如果您正苦于以下问题:Python QStyleFactory.keys方法的具体用法?Python QStyleFactory.keys怎么用?Python QStyleFactory.keys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QStyleFactory
的用法示例。
在下文中一共展示了QStyleFactory.keys方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt5.QtWidgets import QStyleFactory [as 别名]
# 或者: from PyQt5.QtWidgets.QStyleFactory import keys [as 别名]
def __init__(self, parent=None):
super(Example, self).__init__(parent)
QApplication.setStyle(QStyleFactory.create('Fusion'))
# -------------- QCOMBOBOX ----------------------
cbx = QComboBox()
# agregar lista de nombres de estilos disponibles
cbx.addItems(QStyleFactory.keys())
# responder al evento cambio de texto
cbx.currentTextChanged.connect(self.textChanged)
# seleccionar el ultimo elemento
cbx.setItemText(4, 'Fusion')
# -------------- QLISTWIDGET ---------------------
items = ['Ubuntu', 'Linux', 'Mac OS', 'Windows', 'Fedora', 'Chrome OS', 'Android', 'Windows Phone']
self.lv = QListWidget()
self.lv.addItems(items)
self.lv.itemSelectionChanged.connect(self.itemChanged)
# -------------- QTABLEWIDGET --------------------
self.table = QTableWidget(10, 3)
# establecer nombre de cabecera de las columnas
self.table.setHorizontalHeaderLabels(['Nombre', 'Edad', 'Nacionalidad'])
# evento producido cuando cambia el elemento seleccionado
self.table.itemSelectionChanged.connect(self.tableItemChanged)
# alternar color de fila
self.table.setAlternatingRowColors(True)
# seleccionar solo filas
self.table.setSelectionBehavior(QTableWidget.SelectRows)
# usar seleccion simple, una fila a la vez
self.table.setSelectionMode(QTableWidget.SingleSelection)
table_data = [
("Alice", 15, "Panama"),
("Dana", 25, "Chile"),
("Fernada", 18, "Ecuador")
]
# agregar cada uno de los elementos al QTableWidget
for i, (name, age, city) in enumerate(table_data):
self.table.setItem(i, 0, QTableWidgetItem(name))
self.table.setItem(i, 1, QTableWidgetItem(str(age)))
self.table.setItem(i, 2, QTableWidgetItem(city))
vbx = QVBoxLayout()
vbx.addWidget(QPushButton('Tutoriales PyQT-5'))
vbx.setAlignment(Qt.AlignTop)
vbx.addWidget(cbx)
vbx.addWidget(self.lv)
vbx.addWidget(self.table)
self.setWindowTitle("Items View")
self.resize(362, 320)
self.setLayout(vbx)
示例2: createQApplication
# 需要导入模块: from PyQt5.QtWidgets import QStyleFactory [as 别名]
# 或者: from PyQt5.QtWidgets.QStyleFactory import keys [as 别名]
def createQApplication(app_name = 'Back In Time'):
global qapp
try:
return qapp
except NameError:
pass
qapp = QApplication(sys.argv + ['-title', app_name])
if os.geteuid() == 0 and \
qapp.style().objectName().lower() == 'windows' and \
'GTK+' in QStyleFactory.keys():
qapp.setStyle('GTK+')
return qapp
示例3: __populateStyleCombo
# 需要导入模块: from PyQt5.QtWidgets import QStyleFactory [as 别名]
# 或者: from PyQt5.QtWidgets.QStyleFactory import keys [as 别名]
def __populateStyleCombo(self):
"""
Private method to populate the style combo box.
"""
curStyle = Preferences.getUI("Style")
styles = sorted(list(QStyleFactory.keys()))
self.styleComboBox.addItem(self.tr('System'), "System")
for style in styles:
self.styleComboBox.addItem(style, style)
currentIndex = self.styleComboBox.findData(curStyle)
if currentIndex == -1:
currentIndex = 0
self.styleComboBox.setCurrentIndex(currentIndex)
示例4: __init__
# 需要导入模块: from PyQt5.QtWidgets import QStyleFactory [as 别名]
# 或者: from PyQt5.QtWidgets.QStyleFactory import keys [as 别名]
def __init__(self, parent=None):
super(WidgetGallery, self).__init__(parent)
self.originalPalette = QApplication.palette()
styleComboBox = QComboBox()
styleComboBox.addItems(QStyleFactory.keys())
styleLabel = QLabel("&Style:")
styleLabel.setBuddy(styleComboBox)
self.useStylePaletteCheckBox = QCheckBox("&Use style's standard palette")
self.useStylePaletteCheckBox.setChecked(True)
disableWidgetsCheckBox = QCheckBox("&Disable widgets")
self.createTopLeftGroupBox()
self.createTopRightGroupBox()
self.createBottomLeftTabWidget()
self.createBottomRightGroupBox()
self.createProgressBar()
styleComboBox.activated[str].connect(self.changeStyle)
self.useStylePaletteCheckBox.toggled.connect(self.changePalette)
disableWidgetsCheckBox.toggled.connect(self.topLeftGroupBox.setDisabled)
disableWidgetsCheckBox.toggled.connect(self.topRightGroupBox.setDisabled)
disableWidgetsCheckBox.toggled.connect(self.bottomLeftTabWidget.setDisabled)
disableWidgetsCheckBox.toggled.connect(self.bottomRightGroupBox.setDisabled)
topLayout = QHBoxLayout()
topLayout.addWidget(styleLabel)
topLayout.addWidget(styleComboBox)
topLayout.addStretch(1)
topLayout.addWidget(self.useStylePaletteCheckBox)
topLayout.addWidget(disableWidgetsCheckBox)
mainLayout = QGridLayout()
mainLayout.addLayout(topLayout, 0, 0, 1, 2)
mainLayout.addWidget(self.topLeftGroupBox, 1, 0)
mainLayout.addWidget(self.topRightGroupBox, 1, 1)
mainLayout.addWidget(self.bottomLeftTabWidget, 2, 0)
mainLayout.addWidget(self.bottomRightGroupBox, 2, 1)
mainLayout.addWidget(self.progressBar, 3, 0, 1, 2)
mainLayout.setRowStretch(1, 1)
mainLayout.setRowStretch(2, 1)
mainLayout.setColumnStretch(0, 1)
mainLayout.setColumnStretch(1, 1)
self.setLayout(mainLayout)
self.setWindowTitle("Styles")
self.changeStyle('Windows')
示例5: createQApplication
# 需要导入模块: from PyQt5.QtWidgets import QStyleFactory [as 别名]
# 或者: from PyQt5.QtWidgets.QStyleFactory import keys [as 别名]
def createQApplication(app_name = 'Back In Time'):
global qapp
try:
return qapp
except NameError:
pass
if StrictVersion(QT_VERSION_STR) >= StrictVersion('5.6') and \
hasattr(Qt, 'AA_EnableHighDpiScaling'):
QApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
qapp = QApplication(sys.argv + ['-title', app_name])
if os.geteuid() == 0 and \
qapp.style().objectName().lower() == 'windows' and \
'GTK+' in QStyleFactory.keys():
qapp.setStyle('GTK+')
return qapp
示例6: __init__
# 需要导入模块: from PyQt5.QtWidgets import QStyleFactory [as 别名]
# 或者: from PyQt5.QtWidgets.QStyleFactory import keys [as 别名]
def __init__(self, parent=None):
super(EmbeddedDialog, self).__init__(parent)
self.ui = Ui_embeddedDialog()
self.ui.setupUi(self)
self.ui.layoutDirection.setCurrentIndex(self.layoutDirection() != Qt.LeftToRight)
for styleName in QStyleFactory.keys():
self.ui.style.addItem(styleName)
if self.style().objectName().lower() == styleName.lower():
self.ui.style.setCurrentIndex(self.ui.style.count() -1)
self.ui.layoutDirection.activated.connect(self.layoutDirectionChanged)
self.ui.spacing.valueChanged.connect(self.spacingChanged)
self.ui.fontComboBox.currentFontChanged.connect(self.fontChanged)
self.ui.style.activated[str].connect(self.styleChanged)
示例7: __init__
# 需要导入模块: from PyQt5.QtWidgets import QStyleFactory [as 别名]
# 或者: from PyQt5.QtWidgets.QStyleFactory import keys [as 别名]
def __init__(self, parent=None):
super(StyleSheetEditor, self).__init__(parent)
self.ui = Ui_StyleSheetEditor()
self.ui.setupUi(self)
regExp = QRegExp(r'.(.*)\+?Style')
defaultStyle = QApplication.style().metaObject().className()
if regExp.exactMatch(defaultStyle):
defaultStyle = regExp.cap(1)
self.ui.styleCombo.addItems(QStyleFactory.keys())
self.ui.styleCombo.setCurrentIndex(
self.ui.styleCombo.findText(defaultStyle, Qt.MatchContains))
self.ui.styleSheetCombo.setCurrentIndex(
self.ui.styleSheetCombo.findText('Coffee'))
self.loadStyleSheet('Coffee')
示例8: loadSettings
# 需要导入模块: from PyQt5.QtWidgets import QStyleFactory [as 别名]
# 或者: from PyQt5.QtWidgets.QStyleFactory import keys [as 别名]
def loadSettings(self):
s = QSettings()
lang = s.value("language", "", str)
try:
index = self._langs.index(lang)
except ValueError:
index = 1
self.lang.setCurrentIndex(index)
style = s.value("guistyle", "", str).lower()
styles = [name.lower() for name in QStyleFactory.keys()]
try:
index = styles.index(style) + 1
except ValueError:
index = 0
self.styleCombo.setCurrentIndex(index)
self.systemIcons.setChecked(s.value("system_icons", True, bool))
self.tabsClosable.setChecked(s.value("tabs_closable", True, bool))
self.splashScreen.setChecked(s.value("splash_screen", True, bool))
self.allowRemote.setChecked(remote.enabled())
示例9: __init__
# 需要导入模块: from PyQt5.QtWidgets import QStyleFactory [as 别名]
# 或者: from PyQt5.QtWidgets.QStyleFactory import keys [as 别名]
def __init__(self, page):
super(General, self).__init__(page)
grid = QGridLayout()
self.setLayout(grid)
self.langLabel = QLabel()
self.lang = QComboBox(currentIndexChanged=self.changed)
grid.addWidget(self.langLabel, 0, 0)
grid.addWidget(self.lang, 0, 1)
self.styleLabel = QLabel()
self.styleCombo = QComboBox(currentIndexChanged=self.changed)
grid.addWidget(self.styleLabel, 1, 0)
grid.addWidget(self.styleCombo, 1, 1)
self.systemIcons = QCheckBox(toggled=self.changed)
grid.addWidget(self.systemIcons, 2, 0, 1, 3)
self.tabsClosable = QCheckBox(toggled=self.changed)
grid.addWidget(self.tabsClosable, 3, 0, 1, 3)
self.splashScreen = QCheckBox(toggled=self.changed)
grid.addWidget(self.splashScreen, 4, 0, 1, 3)
self.allowRemote = QCheckBox(toggled=self.changed)
grid.addWidget(self.allowRemote, 5, 0, 1, 3)
grid.setColumnStretch(2, 1)
# fill in the language combo
self._langs = ["C", ""]
self.lang.addItems(('', ''))
langnames = [(language_names.languageName(lang, lang), lang) for lang in po.available()]
langnames.sort()
for name, lang in langnames:
self._langs.append(lang)
self.lang.addItem(name)
# fill in style combo
self.styleCombo.addItem('')
self.styleCombo.addItems(QStyleFactory.keys())
app.translateUI(self)
示例10: __init__
# 需要导入模块: from PyQt5.QtWidgets import QStyleFactory [as 别名]
# 或者: from PyQt5.QtWidgets.QStyleFactory import keys [as 别名]
def __init__(self):
super().__init__()
self.setWindowTitle('Styles')
self.original_palette = QApplication.palette()
styles = QLabel('Styles :')
self.style_list = QComboBox()
self.style_list.addItems(QStyleFactory.keys())
self.style_list.setCurrentIndex(3)
self.style_list.activated[str].connect(self.change_style)
self.standard_palette = QCheckBox("Standard palette")
self.standard_palette.setChecked(False)
self.standard_palette.toggled.connect(self.change_palette)
self.change_style('Fusion')
grid = QGridLayout()
grid.addWidget(styles, 0, 0, 1, 1)
grid.addWidget(self.style_list, 0, 1, 1, 1)
grid.addWidget(self.standard_palette, 1, 0, 1, 2)
self.setLayout(grid)
示例11: setStyle
# 需要导入模块: from PyQt5.QtWidgets import QStyleFactory [as 别名]
# 或者: from PyQt5.QtWidgets.QStyleFactory import keys [as 别名]
def setStyle(self, styleName, styleSheetFile):
"""
Public method to set the style of the interface.
@param styleName name of the style to set (string)
@param styleSheetFile name of a style sheet file to read to overwrite
defaults of the given style (string)
"""
# step 1: set the style
style = None
if styleName != "System" and styleName in QStyleFactory.keys():
style = QStyleFactory.create(styleName)
if style is None:
style = QStyleFactory.create(self.defaultStyleName)
if style is not None:
QApplication.setStyle(style)
# step 2: set a style sheet
if styleSheetFile:
try:
f = open(styleSheetFile, "r", encoding="utf-8")
styleSheet = f.read()
f.close()
except (IOError, OSError) as msg:
E5MessageBox.warning(
self,
self.tr("Loading Style Sheet"),
self.tr(
"""<p>The Qt Style Sheet file <b>{0}</b> could"""
""" not be read.<br>Reason: {1}</p>""")
.format(styleSheetFile, str(msg)))
return
else:
styleSheet = ""
e5App().setStyleSheet(styleSheet)
示例12: createActions
# 需要导入模块: from PyQt5.QtWidgets import QStyleFactory [as 别名]
# 或者: from PyQt5.QtWidgets.QStyleFactory import keys [as 别名]
def createActions(self):
self.addImagesAct = QAction("&Add Images...", self, shortcut="Ctrl+A",
triggered=self.addImage)
self.removeAllImagesAct = QAction("&Remove All Images", self,
shortcut="Ctrl+R", triggered=self.removeAllImages)
self.exitAct = QAction("&Quit", self, shortcut="Ctrl+Q",
triggered=self.close)
self.styleActionGroup = QActionGroup(self)
for styleName in QStyleFactory.keys():
action = QAction(self.styleActionGroup,
text="%s Style" % styleName, checkable=True,
triggered=self.changeStyle)
action.setData(styleName)
self.guessModeStateAct = QAction("&Guess Image Mode/State", self,
checkable=True, checked=True)
self.aboutAct = QAction("&About", self, triggered=self.about)
self.aboutQtAct = QAction("About &Qt", self,
triggered=QApplication.instance().aboutQt)
示例13: __init__
# 需要导入模块: from PyQt5.QtWidgets import QStyleFactory [as 别名]
# 或者: from PyQt5.QtWidgets.QStyleFactory import keys [as 别名]
def __init__(self, parent, persepolis_setting):
super().__init__(persepolis_setting)
self.persepolis_setting = persepolis_setting
self.parent = parent
self.grandparent = parent.persepolis_main
self.persepolis_setting.beginGroup('settings')
# initialization
self.tries_spinBox.setValue(
int(self.persepolis_setting.value('max-tries')))
self.wait_spinBox.setValue(
int(self.persepolis_setting.value('retry-wait')))
self.time_out_spinBox.setValue(
int(self.persepolis_setting.value('timeout')))
self.connections_spinBox.setValue(
int(self.persepolis_setting.value('connections')))
self.rpc_port_spinbox.setValue(
int(self.persepolis_setting.value('rpc-port')))
# add support for other languages
locale = str(self.persepolis_setting.value('settings/locale'))
QLocale.setDefault(QLocale(locale))
self.translator = QTranslator()
if self.translator.load(':/translations/locales/ui_' + locale, 'ts'):
QCoreApplication.installTranslator(self.translator)
# wait_queue
wait_queue_list = self.persepolis_setting.value('wait-queue')
q_time = QTime(int(wait_queue_list[0]), int(wait_queue_list[1]))
self.wait_queue_time.setTime(q_time)
# change aria2 path
self.aria2_path_pushButton.clicked.connect(self.changeAria2Path)
self.aria2_path_checkBox.toggled.connect(self.ariaCheckBoxToggled)
aria2_path = self.persepolis_setting.value('settings/aria2_path')
self.aria2_path_lineEdit.setEnabled(False)
if aria2_path != None:
self.aria2_path_checkBox.setChecked(True)
self.aria2_path_lineEdit.setText(str(aria2_path))
self.ariaCheckBoxToggled('aria2')
if os_type == 'Linux' or os_type == 'FreeBSD' or os_type == 'OpenBSD':
for widget in self.aria2_path_checkBox, self.aria2_path_lineEdit, self.aria2_path_pushButton:
widget.hide()
# save_as_tab
self.download_folder_lineEdit.setText(
str(self.persepolis_setting.value('download_path')))
self.temp_download_lineEdit.setText(
str(self.persepolis_setting.value('download_path_temp')))
# subfolder
if str(self.persepolis_setting.value('subfolder')) == 'yes':
self.subfolder_checkBox.setChecked(True)
else:
self.subfolder_checkBox.setChecked(False)
# notifications_tab
self.volume_label.setText(
'Volume : ' + str(self.persepolis_setting.value('sound-volume')))
self.volume_dial.setValue(
int(self.persepolis_setting.value('sound-volume')))
# set style
# if style_comboBox is changed, self.styleComboBoxChanged is called.
self.style_comboBox.currentIndexChanged.connect(self.styleComboBoxChanged)
# find available styles(It's depends on operating system and desktop environments).
available_styles = QStyleFactory.keys()
for style in available_styles:
# 'GTK' or 'gtk' styles may cause to crashing! Eliminate them!
if 'gtk' not in str(style) and 'GTK' not in str(style):
self.style_comboBox.addItem(style)
# System >> for system default style
# when user select System for style section, the default system style is using.
self.style_comboBox.addItem('System')
current_style_index = self.style_comboBox.findText(
str(self.persepolis_setting.value('style')))
if current_style_index != -1:
self.style_comboBox.setCurrentIndex(current_style_index)
# available language
available_language = ['en_US', 'fa_IR', 'zh_CN', 'fr_FR']
for lang in available_language:
self.lang_comboBox.addItem(str(QLocale(lang).nativeLanguageName()), lang)
current_locale = self.lang_comboBox.findData(
str(self.persepolis_setting.value('locale')))
self.lang_comboBox.setCurrentIndex(current_locale)
self.lang_comboBox.currentIndexChanged.connect(self.styleComboBoxChanged)
self.styleComboBoxChanged()
current_color_index = self.color_comboBox.findText(
str(self.persepolis_setting.value('color-scheme')))
self.color_comboBox.setCurrentIndex(current_color_index)
#.........这里部分代码省略.........
示例14: returnDefaultSettings
# 需要导入模块: from PyQt5.QtWidgets import QStyleFactory [as 别名]
# 或者: from PyQt5.QtWidgets.QStyleFactory import keys [as 别名]
def returnDefaultSettings():
os_type, desktop_env = osAndDesktopEnvironment()
# persepolis temporary download folder
if os_type != 'Windows':
download_path_temp = str(home_address) + '/.persepolis'
else:
download_path_temp = os.path.join(
str(home_address), 'AppData', 'Local', 'persepolis')
# user download folder path
download_path = os.path.join(str(home_address), 'Downloads', 'Persepolis')
# find available styles(It's depends on operating system and desktop environments).
available_styles = QStyleFactory.keys()
style = 'Fusion'
color_scheme = 'Persepolis Light Blue'
icons = 'Breeze'
if os_type == 'Linux' or os_type == 'FreeBSD' or 'os_type' == 'OpenBSD':
if desktop_env == 'KDE':
if 'Breeze' in available_styles:
style = 'Breeze'
color_scheme = 'System'
else:
style = 'Fusion'
color_scheme = 'Persepolis Light Blue'
else:
# finout user prefers dark theme or light theme :)
# read this links for more information:
# https://wiki.archlinux.org/index.php/GTK%2B#Basic_theme_configuration
# https://wiki.archlinux.org/index.php/GTK%2B#Dark_theme_variant
# find user gtk3 config file path.
gtk3_confing_file_path = os.path.join(home_address, '.config', 'gtk-3.0', 'settings.ini')
if not(os.path.isfile(gtk3_confing_file_path)):
if os.path.isfile('/etc/gtk-3.0/settings.ini'):
gtk3_confing_file_path = '/etc/gtk-3.0/settings.ini'
else:
gtk3_confing_file_path = None
# read this for more information:
dark_theme = False
if gtk3_confing_file_path:
with open(gtk3_confing_file_path) as f:
for line in f:
if "gtk-application-prefer-dark-theme" in line:
if 'true' in line:
dark_theme = True
else:
dark_theme = False
if dark_theme:
icons = 'Breeze-Dark'
if 'Adwaita-Dark' in available_styles:
style = 'Adwaita-Dark'
color_scheme = 'System'
else:
style = 'Fusion'
color_scheme = 'Persepolis Dark Blue'
else:
icons = 'Breeze'
if 'Adwaita' in available_styles:
style = 'Adwaita'
color_scheme = 'System'
else:
style = 'Fusion'
color_scheme = 'Persepolis Light Blue'
elif os_type == 'Darwin':
style = 'Macintosh'
color_scheme = 'System'
icons = 'Breeze'
elif os_type == 'Windows':
style = 'Fusion'
color_scheme = 'Persepolis Old Light Blue'
icons = 'Breeze'
else:
style = 'Fusion'
color_scheme = 'Persepolis Light Blue'
icons = 'Breeze'
# Persepolis default setting
default_setting_dict = {'locale': 'en_US', 'toolbar_icon_size': 32, 'wait-queue': [0, 0], 'awake': 'no', 'custom-font': 'no', 'column0': 'yes',
'column1': 'yes', 'column2': 'yes', 'column3': 'yes', 'column4': 'yes', 'column5': 'yes', 'column6': 'yes', 'column7': 'yes',
'column10': 'yes', 'column11': 'yes', 'column12': 'yes', 'subfolder': 'yes', 'startup': 'no', 'show-progress': 'yes',
'show-menubar': 'no', 'show-sidepanel': 'yes', 'rpc-port': 6801, 'notification': 'Native notification', 'after-dialog': 'yes',
'tray-icon': 'yes', 'max-tries': 5, 'retry-wait': 0, 'timeout': 60, 'connections': 16, 'download_path_temp': download_path_temp,
'download_path': download_path, 'sound': 'yes', 'sound-volume': 100, 'style': style, 'color-scheme': color_scheme,
'icons': icons, 'font': 'Ubuntu', 'font-size': 9, 'aria2_path': '', 'video_finder/enable': 'yes', 'video_finder/hide_no_audio': 'yes',
'video_finder/hide_no_video': 'yes', 'video_finder/max_links': '3'}
return default_setting_dict
示例15: __init__
# 需要导入模块: from PyQt5.QtWidgets import QStyleFactory [as 别名]
# 或者: from PyQt5.QtWidgets.QStyleFactory import keys [as 别名]
def __init__(self, mainWindow):
QWidget.__init__(self)
self.setupUi(self)
self.mw = mainWindow
# UI
for i in range(self.lstMenu.count()):
item = self.lstMenu.item(i)
item.setSizeHint(QSize(item.sizeHint().width(), 42))
item.setTextAlignment(Qt.AlignCenter)
self.lstMenu.setMaximumWidth(150)
# General
self.cmbStyle.addItems(list(QStyleFactory.keys()))
self.cmbStyle.setCurrentIndex([i.lower() for i in list(QStyleFactory.keys())].index(qApp.style().objectName()))
self.cmbStyle.currentIndexChanged[str].connect(self.setStyle)
self.txtAutoSave.setValidator(QIntValidator(0, 999, self))
self.txtAutoSaveNoChanges.setValidator(QIntValidator(0, 999, self))
self.chkAutoSave.setChecked(settings.autoSave)
self.chkAutoSaveNoChanges.setChecked(settings.autoSaveNoChanges)
self.txtAutoSave.setText(str(settings.autoSaveDelay))
self.txtAutoSaveNoChanges.setText(str(settings.autoSaveNoChangesDelay))
self.chkSaveOnQuit.setChecked(settings.saveOnQuit)
self.chkAutoSave.stateChanged.connect(self.saveSettingsChanged)
self.chkAutoSaveNoChanges.stateChanged.connect(self.saveSettingsChanged)
self.chkSaveOnQuit.stateChanged.connect(self.saveSettingsChanged)
self.txtAutoSave.textEdited.connect(self.saveSettingsChanged)
self.txtAutoSaveNoChanges.textEdited.connect(self.saveSettingsChanged)
autoLoad, last = self.mw.welcome.getAutoLoadValues()
self.chkAutoLoad.setChecked(autoLoad)
self.chkAutoLoad.stateChanged.connect(self.saveSettingsChanged)
dtt = [
("t2t", self.tr("Txt2Tags"), "text-x-script"),
("html", self.tr("Rich Text (html)"), "text-html"),
("txt", self.tr("Plain Text"), "text-x-generic"),
]
self.cmbDefaultTextType.clear()
for t in dtt:
self.cmbDefaultTextType.addItem(QIcon.fromTheme(t[2]), t[1], t[0])
i = self.cmbDefaultTextType.findData(settings.defaultTextType)
if i != -1:
self.cmbDefaultTextType.setCurrentIndex(i)
self.cmbDefaultTextType.currentIndexChanged.connect(self.saveSettingsChanged)
# Revisions
opt = settings.revisions
self.chkRevisionsKeep.setChecked(opt["keep"])
self.chkRevisionsKeep.stateChanged.connect(self.revisionsSettingsChanged)
self.chkRevisionRemove.setChecked(opt["smartremove"])
self.chkRevisionRemove.toggled.connect(self.revisionsSettingsChanged)
self.spnRevisions10Mn.setValue(60 / opt["rules"][10 * 60])
self.spnRevisions10Mn.valueChanged.connect(self.revisionsSettingsChanged)
self.spnRevisionsHour.setValue(60 * 10 / opt["rules"][60 * 60])
self.spnRevisionsHour.valueChanged.connect(self.revisionsSettingsChanged)
self.spnRevisionsDay.setValue(60 * 60 / opt["rules"][60 * 60 * 24])
self.spnRevisionsDay.valueChanged.connect(self.revisionsSettingsChanged)
self.spnRevisionsMonth.setValue(60 * 60 * 24 / opt["rules"][60 * 60 * 24 * 30])
self.spnRevisionsMonth.valueChanged.connect(self.revisionsSettingsChanged)
self.spnRevisionsEternity.setValue(60 * 60 * 24 * 7 / opt["rules"][None])
self.spnRevisionsEternity.valueChanged.connect(self.revisionsSettingsChanged)
# Views
self.tabViews.setCurrentIndex(0)
lst = ["Nothing", "POV", "Label", "Progress", "Compile"]
for cmb in self.viewSettingsDatas():
item, part = self.viewSettingsDatas()[cmb]
cmb.setCurrentIndex(lst.index(settings.viewSettings[item][part]))
cmb.currentIndexChanged.connect(self.viewSettingsChanged)
for chk in self.outlineColumnsData():
col = self.outlineColumnsData()[chk]
chk.setChecked(col in settings.outlineViewColumns)
chk.stateChanged.connect(self.outlineColumnsChanged)
for item, what, value in [
(self.rdoTreeItemCount, "InfoFolder", "Count"),
(self.rdoTreeWC, "InfoFolder", "WC"),
(self.rdoTreeProgress, "InfoFolder", "Progress"),
(self.rdoTreeSummary, "InfoFolder", "Summary"),
(self.rdoTreeNothing, "InfoFolder", "Nothing"),
(self.rdoTreeTextWC, "InfoText", "WC"),
(self.rdoTreeTextProgress, "InfoText", "Progress"),
(self.rdoTreeTextSummary, "InfoText", "Summary"),
(self.rdoTreeTextNothing, "InfoText", "Nothing"),
]:
item.setChecked(settings.viewSettings["Tree"][what] == value)
item.toggled.connect(self.treeViewSettignsChanged)
self.populatesCmbBackgrounds(self.cmbCorkImage)
self.setCorkImageDefault()
self.updateCorkColor()
self.cmbCorkImage.currentIndexChanged.connect(self.setCorkBackground)
self.btnCorkColor.clicked.connect(self.setCorkColor)
# Text editor
opt = settings.textEditor
self.setButtonColor(self.btnEditorFontColor, opt["fontColor"])
self.btnEditorFontColor.clicked.connect(self.choseEditorFontColor)
#.........这里部分代码省略.........