本文整理汇总了Python中PyQt4.QtCore.QSettings方法的典型用法代码示例。如果您正苦于以下问题:Python QtCore.QSettings方法的具体用法?Python QtCore.QSettings怎么用?Python QtCore.QSettings使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtCore
的用法示例。
在下文中一共展示了QtCore.QSettings方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QSettings [as 别名]
def __init__(self):
QDialog.__init__(self)
self.settings = QSettings()
self.ui = Ui_ConnectionManager()
self.ui.setupUi(self)
self.populateConnectionList()
self.ui.newConnectionBT.clicked.connect(self.openNewConnectionDialog)
self.ui.editConnectionBT.clicked.connect(self.editConnectionDialog)
self.ui.deleteConnectionBT.clicked.connect(self.deleteConnectionDialog)
self.ui.connectBT.clicked.connect(self.connect)
self.currentUser = None
self.currentApiKey = None
self.currentMultiuser = None
示例2: readSettings
# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QSettings [as 别名]
def readSettings(self):
settings = QtCore.QSettings("Arabeyes.org", "Qutrub")
try:
family=settings.value("font_base_family", QtCore.QVariant(QString("Traditional Arabic"))).toString()
size,ok=settings.value("font_base_size", QtCore.QVariant(12)).toInt();
bold=settings.value("font_base_bold", QtCore.QVariant(True)).toBool()
dictsetting,ok=settings.value("DictSetting", QtCore.QVariant(1)).toInt();
except TypeError:
family=settings.value("font_base_family", "Traditional Arabic")
size=settings.value("font_base_size", "12")
size= int(size)
ok = bool(size)
bold=settings.value("font_base_bold", True)
bold = bool(bold)
dictsetting =settings.value("DictSetting", "1")
dictsetting = int(dictsetting)
if not ok:size=12;
self.font_result.setFamily(family)
self.font_result.setPointSize(size)
self.font_result.setBold(bold)
#read of dictsetting options
if not ok:dictsetting=1;
## self.BDictSetting.setCheckState(dictsetting);
示例3: __init__
# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QSettings [as 别名]
def __init__(self):
# check if settings file exists and creates it if it doesn't
if not os.path.exists('./sparta.conf'):
print '[+] Creating settings file..'
self.createDefaultSettings()
else:
print '[+] Loading settings file..'
self.actions = QtCore.QSettings('./sparta.conf', QtCore.QSettings.NativeFormat)
# This function creates the default settings file. Note that, in general, everything is case sensitive.
# Each action should be in the following format:
#
# (key, [label, command, service])
# key - must be unique within the group and is used to retrieve each action. is used to create the tab titles and also to recognise nmap commands so we can parse the output (case sensitive)
# label - is what appears in the context menu in the gui
# command - command that will be run. These placeholders will be replaced on-the-fly: [IP] [PORT] [OUTPUT]
# service - service(s) to which the tool applies (comma-separated). Leave empty if valid for all services.
示例4: readSettings
# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QSettings [as 别名]
def readSettings(self):
""" Load settings from previous session """
rospy.logdebug("Loading previous session settings")
settings = QSettings("omwdunkley", "reset" if self.options.reset else "flieROS"+str(self.options.radio) )
self.resize(settings.value("size", QVariant(QSize(300, 500))).toSize())
self.move(settings.value("pos", QVariant(QPoint(200, 200))).toPoint())
self.ui.checkBox_reconnect.setChecked(settings.value("autoReconnect", QVariant(self.ui.checkBox_reconnect.isChecked())).toBool())
self.ui.checkBox_beep.setChecked(settings.value("beepOn", QVariant(self.ui.checkBox_beep.isChecked())).toBool())
self.ui.checkBox_xmode.setChecked(settings.value("xmodeOn", QVariant(self.ui.checkBox_xmode.isChecked())).toBool())
self.ui.checkBox_kill.setChecked(settings.value("killOn", QVariant(self.ui.checkBox_kill.isChecked())).toBool())
self.ui.checkBox_startupConnect.setChecked(settings.value("startConnect", QVariant(self.ui.checkBox_startupConnect)).toBool())
self.ui.checkBox_pktHZ.setChecked(settings.value("pktHzOn", QVariant(self.ui.checkBox_pktHZ.isChecked())).toBool())
self.ui.checkBox_logHZ.setChecked(settings.value("logHzOn", QVariant(self.ui.checkBox_logHZ.isChecked())).toBool())
self.ui.horizontalSlider_pktHZ.setValue(settings.value("pktHzVal", QVariant(self.ui.horizontalSlider_pktHZ.value())).toInt()[0])
self.ui.horizontalSlider_logHZ.setValue(settings.value("logHzVal", QVariant(self.ui.horizontalSlider_logHZ.value())).toInt()[0])
self.ui.horizontalSlider_guiHZ.setValue(settings.value("guiHzVal", QVariant(self.ui.horizontalSlider_guiHZ.value())).toInt()[0])
self.ui.horizontalSlider_AI.setValue(settings.value("aiHzVal", QVariant(self.ui.horizontalSlider_AI.value())).toInt()[0])
self.logManager.header().restoreState(settings.value("logTreeH", self.logManager.header().saveState()).toByteArray())
self.paramManager.header().restoreState(settings.value("paramTreeH", self.paramManager.header().saveState()).toByteArray())
示例5: read
# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QSettings [as 别名]
def read(self, items):
"""
Get the value of the user defined items from the STDM registry tree
param items: List of registry keys to fetch.
type items: list
"""
userKeys = {}
settings = QSettings()
settings.beginGroup("/")
groups = settings.childGroups()
for group in groups:
if str(group) == self._base_group():
for t in items:
tKey = self.groupPath + "/" + t
if settings.contains(tKey):
tValue = settings.value(tKey)
userKeys[t] = tValue
break
return userKeys
示例6: getQGISDbs
# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QSettings [as 别名]
def getQGISDbs(self):
"""Return all PostGIS connection settings stored in QGIS
:return: connection dict() with name and other settings
"""
con_settings = []
settings = QSettings()
settings.beginGroup('/PostgreSQL/connections')
for item in settings.childGroups():
con = dict()
con['name'] = unicode(item)
con['host'] = unicode(settings.value(u'%s/host' % unicode(item)))
con['port'] = unicode(settings.value(u'%s/port' % unicode(item)))
con['database'] = unicode(settings.value(u'%s/database' % unicode(item)))
con['username'] = unicode(settings.value(u'%s/username' % unicode(item)))
con['password'] = unicode(settings.value(u'%s/password' % unicode(item)))
con_settings.append(con)
settings.endGroup()
dbs = {}
if len(con_settings) > 0:
for conn in con_settings:
dbs[conn['name']]= conn
return dbs
示例7: __init__
# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QSettings [as 别名]
def __init__(self, toolbar, parent=None):
QDialog.__init__(self, parent)
self.toolbar = toolbar
self.settings = QSettings()
self.currentUser = self.toolbar.currentUser
self.currentApiKey = self.toolbar.currentApiKey
self.currentMultiuser = self.toolbar.currentMultiuser
self.currentUserData = self.toolbar.currentUserData
worker = CartoDBPluginWorker(self, 'connectUser')
worker.start()
示例8: __init__
# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QSettings [as 别名]
def __init__(self, user=None):
QDialog.__init__(self)
self.ui = Ui_NewConnection()
self.ui.setupUi(self)
self.settings = QSettings()
self.user = None
self.user_orig = user
示例9: setConnectionListPosition
# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QSettings [as 别名]
def setConnectionListPosition(self):
# Set the current index to the selected connection.
toSelect = self.settings.value('/CartoDBPlugin/selected')
conCount = self.ui.connectionList.count()
self.setConnectionsFound(conCount > 0)
exists = False
for i in range(conCount):
if self.ui.connectionList.itemText(i) == toSelect:
self.ui.connectionList.setCurrentIndex(i)
exists = True
break
# If we couldn't find the stored item, but there are some, default
# to the last item (this makes some sense when deleting items as it
# allows the user to repeatidly click on delete to remove a whole
# lot of items)
if not exists and conCount > 0:
# If toSelect is null, then the selected connection wasn't found
# by QSettings, which probably means that this is the first time
# the user has used CartoDBPlugin, so default to the first in the list
# of connetions. Otherwise default to the last.
if not toSelect:
currentIndex = 0
else:
currentIndex = conCount - 1
self.ui.connectionList.setCurrentIndex(currentIndex)
if conCount == 0:
self.notfoundconnections.emit()
示例10: __init__
# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QSettings [as 别名]
def __init__(self, parent=None, flags=Qt.WindowFlags(0)):
QWidget.__init__(self, parent, flags)
self.settings = QSettings()
self.setupUi()
self.currentUser = self.settings.value('/CartoDBPlugin/selected')
if self.currentUser:
self.currentApiKey = self.settings.value('/CartoDBPlugin/%s/api' % self.currentUser)
self.currentMultiuser = self.settings.value('/CartoDBPlugin/%s/multiuser' % self.currentUser, False)
self.currentMultiuser = self.currentMultiuser in ['True', 'true', True]
else:
self.currentApiKey = None
self.currentMultiuser = None
self.click = None
示例11: readSettings
# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QSettings [as 别名]
def readSettings(self):
settings = QtCore.QSettings("Arabeyes.org", "Qutrub")
try:
family=settings.value("font_base_family", QtCore.QVariant(QString("Traditional Arabic"))).toString()
except TypeError:
family = str(settings.value("font_base_family", "Traditional Arabic"))
try:
size,ok=settings.value("font_base_size", QtCore.QVariant(12)).toInt();
except TypeError:
size = settings.value("font_base_size", 12)
size = int(size)
ok = bool(size)
if not ok:size=12;
try:
bold=settings.value("font_base_bold", QtCore.QVariant(True)).toBool()
except TypeError:
bold= bool(settings.value("font_base_bold", True))
self.font_result.setFamily(family)
self.font_result.setPointSize(size)
self.font_result.setBold(bold)
#read of dictsetting options
try:
dictsetting,ok = settings.value("DictSetting", QtCore.QVariant(1)).toInt();
except TypeError:
dictsetting = settings.value("DictSetting", 1);
ok = bool(dictsetting)
if not ok:dictsetting=1;
self.BDictOption=dictsetting;
示例12: writeSettings
# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QSettings [as 别名]
def writeSettings(self):
settings = QtCore.QSettings("Arabeyes.org", "Qutrub")
try:
settings.setValue("font_base_family", QtCore.QVariant(self.font_result.family()))
settings.setValue("font_base_size", QtCore.QVariant(self.font_result.pointSize()))
settings.setValue("font_base_bold", QtCore.QVariant(self.font_result.bold()))
except:
settings.setValue("font_base_family", self.font_result.family())
settings.setValue("font_base_size", self.font_result.pointSize())
settings.setValue("font_base_bold", self.font_result.bold())
#write of dictsetting options
## settings.setValue("DictSetting", QtCore.QVariant(self.BDictSetting.checkState()));
示例13: readSettings
# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QSettings [as 别名]
def readSettings(self):
""" Read the HZ and selected things to log from previous session """
settings = QSettings("omwdunkley", "flieROS")
# Read target HZ
hzQv = settings.value("log_"+self.name+"_hz",QVariant(20))
QtGui.QTreeWidgetItem.setData(self, 2, Qt.DisplayRole, hzQv)
self.hzTarget = self.getValidHZ(hzQv.toFloat()[0])
# Read if checked. If partially checked, uncheck
onQv = settings.value("log_"+self.name+"_on", QVariant(Qt.Unchecked))
QtGui.QTreeWidgetItem.setData(self, 0, Qt.CheckStateRole, onQv if onQv.toInt()[0]!=Qt.PartiallyChecked else Qt.Unchecked)
#onRos = settings.value("ros_"+self.name+"_on", QVariant(Qt.Unchecked))
#QtGui.QTreeWidgetItem.setData(self, 0, Qt.CheckStateRole, onRos)
示例14: writeSettings
# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QSettings [as 别名]
def writeSettings(self):
""" Save the HZ and selected things to log between sessions"""
settings = QSettings("omwdunkley", "flieROS")
# Save target HZ
settings.setValue("log_"+self.name+"_hz", self.data(2, Qt.DisplayRole))
# Save checked state
settings.setValue("log_"+self.name+"_on", self.data(0, Qt.CheckStateRole))
#settings.setValue("ros_"+self.name+"_on", self.data(4, Qt.CheckStateRole))
# Save children state too
for x in range(self.childCount()):
self.child(x).writeSettings()
示例15: group_children
# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QSettings [as 别名]
def group_children(self):
"""
:return: Names of the child groups in the path specified in the constructor.
:rtype: list
"""
settings = QSettings()
settings.beginGroup(self.groupPath)
group_children = settings.childGroups()
settings.endGroup()
return group_children