當前位置: 首頁>>代碼示例>>Python>>正文


Python QtCore.QSettings方法代碼示例

本文整理匯總了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 
開發者ID:gkudos,項目名稱:qgis-cartodb,代碼行數:18,代碼來源:ConnectionManager.py

示例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); 
開發者ID:linuxscout,項目名稱:mishkal,代碼行數:27,代碼來源:setting.py

示例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. 
開發者ID:SECFORCE,項目名稱:sparta,代碼行數:19,代碼來源:settings.py

示例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()) 
開發者ID:omwdunkley,項目名稱:crazyflieROS,代碼行數:24,代碼來源:driverWindow.py

示例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 
開發者ID:gltn,項目名稱:stdm,代碼行數:22,代碼來源:registryconfig.py

示例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 
開發者ID:SpaceGroupUCL,項目名稱:qgisSpaceSyntaxToolkit,代碼行數:24,代碼來源:RoadNetworkCleanerTool.py

示例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() 
開發者ID:gkudos,項目名稱:qgis-cartodb,代碼行數:14,代碼來源:Basic.py

示例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 
開發者ID:gkudos,項目名稱:qgis-cartodb,代碼行數:9,代碼來源:NewConnection.py

示例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() 
開發者ID:gkudos,項目名稱:qgis-cartodb,代碼行數:34,代碼來源:ConnectionManager.py

示例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 
開發者ID:gkudos,項目名稱:qgis-cartodb,代碼行數:17,代碼來源:CartoDBToolbar.py

示例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; 
開發者ID:linuxscout,項目名稱:mishkal,代碼行數:32,代碼來源:appgui.py

示例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())); 
開發者ID:linuxscout,項目名稱:mishkal,代碼行數:14,代碼來源:setting.py

示例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) 
開發者ID:omwdunkley,項目名稱:crazyflieROS,代碼行數:17,代碼來源:logManager.py

示例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() 
開發者ID:omwdunkley,項目名稱:crazyflieROS,代碼行數:17,代碼來源:logManager.py

示例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 
開發者ID:gltn,項目名稱:stdm,代碼行數:15,代碼來源:registryconfig.py


注:本文中的PyQt4.QtCore.QSettings方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。