本文整理汇总了Python中PyQt5.QtCore.QSettings.IniFormat方法的典型用法代码示例。如果您正苦于以下问题:Python QSettings.IniFormat方法的具体用法?Python QSettings.IniFormat怎么用?Python QSettings.IniFormat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtCore.QSettings
的用法示例。
在下文中一共展示了QSettings.IniFormat方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: init
# 需要导入模块: from PyQt5.QtCore import QSettings [as 别名]
# 或者: from PyQt5.QtCore.QSettings import IniFormat [as 别名]
def init() -> None:
"""Initialize config storage not related to the main config."""
global state
try:
state = StateConfig()
except (configparser.Error, UnicodeDecodeError) as e:
msg = "While loading state file from {}".format(standarddir.data())
desc = configexc.ConfigErrorDesc(msg, e)
raise configexc.ConfigFileErrors('state', [desc], fatal=True)
# Set the QSettings path to something like
# ~/.config/qutebrowser/qsettings/qutebrowser/qutebrowser.conf so it
# doesn't overwrite our config.
#
# This fixes one of the corruption issues here:
# https://github.com/qutebrowser/qutebrowser/issues/515
path = os.path.join(standarddir.config(auto=True), 'qsettings')
for fmt in [QSettings.NativeFormat, QSettings.IniFormat]:
QSettings.setPath(fmt, QSettings.UserScope, path)
示例2: __init__
# 需要导入模块: from PyQt5.QtCore import QSettings [as 别名]
# 或者: from PyQt5.QtCore.QSettings import IniFormat [as 别名]
def __init__(self):
self.settings = QSettings(QSettings.IniFormat,
QSettings.UserScope,
'Azavea', 'RasterVision')
示例3: __init__
# 需要导入模块: from PyQt5.QtCore import QSettings [as 别名]
# 或者: from PyQt5.QtCore.QSettings import IniFormat [as 别名]
def __init__(self, appid, *argv):
super(SingleApplication, self).__init__(*argv)
self._appid = appid
self._activationWindow = None
self._activateOnMessage = False
self._outSocket = QLocalSocket()
self._outSocket.connectToServer(self._appid)
self._isRunning = self._outSocket.waitForConnected()
self._outStream = None
self._inSocket = None
self._inStream = None
self._server = None
self.settings = QSettings(SingleApplication.getSettingsPath(), QSettings.IniFormat)
self.singleInstance = self.settings.value('singleInstance', 'on', type=str) in {'on', 'true'}
if self._isRunning and self.singleInstance:
self._outStream = QTextStream(self._outSocket)
for a in argv[0][1:]:
a = os.path.join(os.getcwd(), a)
if os.path.isfile(a):
self.sendMessage(a)
break
sys.exit(0)
else:
error = self._outSocket.error()
if error == QLocalSocket.ConnectionRefusedError:
self.close()
QLocalServer.removeServer(self._appid)
self._outSocket = None
self._server = QLocalServer()
self._server.listen(self._appid)
self._server.newConnection.connect(self._onNewConnection)
示例4: __init__
# 需要导入模块: from PyQt5.QtCore import QSettings [as 别名]
# 或者: from PyQt5.QtCore.QSettings import IniFormat [as 别名]
def __init__(self):
self.handle = QSettings(QSettings.IniFormat, QSettings.UserScope,
"fre-sch.github.com", "MHW-Editor-Suite")
示例5: init_settings
# 需要导入模块: from PyQt5.QtCore import QSettings [as 别名]
# 或者: from PyQt5.QtCore.QSettings import IniFormat [as 别名]
def init_settings(self):
self.settings = QSettings('config/settings.ini', QSettings.IniFormat)
示例6: open
# 需要导入模块: from PyQt5.QtCore import QSettings [as 别名]
# 或者: from PyQt5.QtCore.QSettings import IniFormat [as 别名]
def open(self, t_filename=None):
settings = QSettings(QSettings.IniFormat, QSettings.UserScope, "pySPM", "pySPM")
if t_filename is None:
home = QDir.cleanPath(os.getenv("HOMEPATH"))
path = settings.value("lastPath", home)
self.filename = QFileDialog.getOpenFileName(None, "Choose measurement file", path, "*.ita")[0]
else:
self.filename = t_filename
check_file = QFileInfo(self.filename)
self.setWindowTitle(check_file.fileName())
if not check_file.exists() or not check_file.isFile():
return
settings.setValue("lastPath", check_file.path())
self.ita = pySPM.ITA(self.filename, readonly=False)
self.t, self.S = self.ita.getSpectrum(time=True)
self.sf, self.k0 = self.ita.get_mass_cal()
self.mass = pySPM.utils.time2mass(self.t, self.sf, self.k0)
self.spec = self.ax.plot(self.mass, self.S)[0]
SatLevel = self.ita.size['pixels']['x']*self.ita.size['pixels']['y']*self.ita.Nscan
self.sat_level = self.ax.axhline(SatLevel, color='r')
if 'pySPM' in self.ita.root.goto("MassScale"):
self.MassCal = []
N = self.ita.root.goto("MassScale/pySPM/N").get_ulong()
for i in range(N):
elt = self.ita.root.goto("MassScale/pySPM/"+str(i)+"/elt").value.decode('utf8')
mass = self.ita.root.goto("MassScale/pySPM/"+str(i)+"/mass").get_double()
time = self.ita.root.goto("MassScale/pySPM/"+str(i)+"/time").get_double()
self.MassCal.append(dict(elt=elt, mass=mass, time=time))
else:
self.MassCal = []
for x in self.ita.root.goto("MassScale/calib"):
if x.name == 'assign':
self.MassCal.append({'elt':x.get_string()})
if x.name == 'mcp':
mcp = struct.unpack("<10d", x.value)
self.MassCal[-1]['time'] = mcp[0]
self.MassCal[-1]['mass'] = mcp[1]
self.DoMassCal()
示例7: __get_qt_settings
# 需要导入模块: from PyQt5.QtCore import QSettings [as 别名]
# 或者: from PyQt5.QtCore.QSettings import IniFormat [as 别名]
def __get_qt_settings():
global __qt_settings
try:
__qt_settings.fileName()
except:
__qt_settings = QSettings(QSettings.IniFormat, QSettings.UserScope, 'urh', 'urh')
return __qt_settings
示例8: __init__
# 需要导入模块: from PyQt5.QtCore import QSettings [as 别名]
# 或者: from PyQt5.QtCore.QSettings import IniFormat [as 别名]
def __init__(self, name: str):
super().__init__()
self.__enabled = Qt.Unchecked
self.name = name
self.plugin_path = ""
self.description = ""
self.__settings_frame = None
self.qsettings = QSettings(QSettings.IniFormat, QSettings.UserScope, "urh", self.name + "-plugin")
示例9: __init__
# 需要导入模块: from PyQt5.QtCore import QSettings [as 别名]
# 或者: from PyQt5.QtCore.QSettings import IniFormat [as 别名]
def __init__(self, tasmota_env):
super().__init__()
self.settings = QSettings("{}/TDM/tdm.cfg".format(QDir.homePath()), QSettings.IniFormat)
self.devices = QSettings("{}/TDM/devices.cfg".format(QDir.homePath()), QSettings.IniFormat)
self.tasmota_env = tasmota_env
self.columns = []
self.devices_short_version = self.settings.value("devices_short_version", True, bool)
for d in self.tasmota_env.devices:
d.property_changed = self.notify_change
d.module_changed = self.module_change
示例10: __init__
# 需要导入模块: from PyQt5.QtCore import QSettings [as 别名]
# 或者: from PyQt5.QtCore.QSettings import IniFormat [as 别名]
def __init__(self, *args, **kwargs):
super(BSSIdDialog, self).__init__(*args, **kwargs)
self.setMinimumHeight(400)
self.setMinimumWidth(400)
self.setWindowTitle("BSSId aliases")
self.settings = QSettings("{}/TDM/tdm.cfg".format(QDir.homePath()), QSettings.IniFormat)
self.settings.beginGroup("BSSId")
vl = VLayout()
cols = ["BSSId", "Alias"]
self.tw = QTableWidget(0,2)
self.tw.setHorizontalHeaderLabels(cols)
self.tw.verticalHeader().hide()
for c in range(2):
self.tw.horizontalHeader().setSectionResizeMode(c, QHeaderView.Stretch)
for k in self.settings.childKeys():
row = self.tw.rowCount()
self.tw.insertRow(row)
self.tw.setItem(row, 0, QTableWidgetItem(k))
self.tw.setItem(row, 1, QTableWidgetItem(self.settings.value(k)))
vl.addWidget(self.tw)
hl_btns = HLayout([0,3,0,3])
btnAdd = QPushButton("Add")
btnDel = QPushButton("Delete")
btnCancel = QPushButton("Cancel")
btnSave = QPushButton("Save")
hl_btns.addWidgets([btnAdd, btnDel, btnSave, btnCancel])
hl_btns.insertStretch(2)
vl.addLayout(hl_btns)
self.setLayout(vl)
self.idx = None
self.tw.clicked.connect(self.select)
btnAdd.clicked.connect(self.add)
btnDel.clicked.connect(self.delete)
btnSave.clicked.connect(self.accept)
btnCancel.clicked.connect(self.reject)
示例11: __init__
# 需要导入模块: from PyQt5.QtCore import QSettings [as 别名]
# 或者: from PyQt5.QtCore.QSettings import IniFormat [as 别名]
def __init__(self, *args, **kwargs):
super(PrefsDialog, self).__init__(*args, **kwargs)
self.setWindowTitle("Preferences")
# self.setMinimumSize(QSize(300, 200))
self.settings = QSettings("{}/TDM/tdm.cfg".format(QDir.homePath()), QSettings.IniFormat)
self.devices_short_version = self.settings.value("devices_short_version", True, bool)
self.console_word_wrap = self.settings.value("console_word_wrap", True, bool)
self.console_font_size = self.settings.value("console_font_size", 9, int)
vl = VLayout()
gbDevices = QGroupBox("Device list")
fl_dev = QFormLayout()
self.cbDevShortVersion = QCheckBox()
self.cbDevShortVersion.setChecked(self.devices_short_version)
fl_dev.addRow("Show short Tasmota version", self.cbDevShortVersion)
fl_dev.setAlignment(self.cbDevShortVersion, Qt.AlignTop | Qt.AlignRight)
gbDevices.setLayout(fl_dev)
gbConsole = QGroupBox("Console")
fl_cons = QFormLayout()
self.cbConsWW = QCheckBox()
self.cbConsWW.setChecked(self.console_word_wrap)
self.sbConsFontSize = SpinBox(minimum=9, maximum=100)
self.sbConsFontSize.setValue(self.console_font_size)
gbConsole.setLayout(fl_cons)
fl_cons.addRow("Word wrap", self.cbConsWW)
fl_cons.addRow("Font size", self.sbConsFontSize)
fl_cons.setAlignment(self.cbConsWW, Qt.AlignTop | Qt.AlignRight)
fl_cons.setAlignment(self.sbConsFontSize, Qt.AlignTop | Qt.AlignRight)
btns = QDialogButtonBox(QDialogButtonBox.Save | QDialogButtonBox.Close)
btns.accepted.connect(self.accept)
btns.rejected.connect(self.reject)
vl.addWidgets([gbDevices, gbConsole, btns])
self.setLayout(vl)
示例12: __init__
# 需要导入模块: from PyQt5.QtCore import QSettings [as 别名]
# 或者: from PyQt5.QtCore.QSettings import IniFormat [as 别名]
def __init__(self, *args, **kwargs):
super(PatternsDialog, self).__init__(*args, **kwargs)
self.setMinimumHeight(400)
self.setMinimumWidth(400)
self.setWindowTitle("Autodiscovery patterns")
self.settings = QSettings("{}/TDM/tdm.cfg".format(QDir.homePath()), QSettings.IniFormat)
self.settings.beginGroup("Patterns")
vl = VLayout()
cols = ["Pattern"]
self.tw = QTableWidget(0, 1)
self.tw.setHorizontalHeaderLabels(cols)
self.tw.verticalHeader().hide()
self.tw.horizontalHeader().setSectionResizeMode(0, QHeaderView.Stretch)
for k in self.settings.childKeys():
row = self.tw.rowCount()
self.tw.insertRow(row)
self.tw.setItem(row, 0, QTableWidgetItem(self.settings.value(k)))
vl.addWidgets([QLabel("Add your modified FullTopic patterns to enable auto-discovery of such devices\n"
"Patterns MUST include %prefix%, %topic% and trailing /\n"
"Default Tasmota FullTopics are built-in\n\n"
"You have to reconnect to your Broker after topic changes."), self.tw])
hl_btns = HLayout([0, 3, 0, 3])
btnAdd = QPushButton("Add")
btnDel = QPushButton("Delete")
btnCancel = QPushButton("Cancel")
btnSave = QPushButton("Save")
hl_btns.addWidgets([btnAdd, btnDel, btnSave, btnCancel])
hl_btns.insertStretch(2)
vl.addLayout(hl_btns)
self.setLayout(vl)
self.idx = None
self.tw.clicked.connect(self.select)
btnAdd.clicked.connect(self.add)
btnDel.clicked.connect(self.delete)
btnSave.clicked.connect(self.accept)
btnCancel.clicked.connect(self.reject)
示例13: __init__
# 需要导入模块: from PyQt5.QtCore import QSettings [as 别名]
# 或者: from PyQt5.QtCore.QSettings import IniFormat [as 别名]
def __init__(self, *args, **kwargs):
super(BrokerDialog, self).__init__(*args, **kwargs)
self.setWindowTitle("MQTT Broker")
self.settings = QSettings("{}/TDM/tdm.cfg".format(QDir.homePath()), QSettings.IniFormat)
gbHost = QGroupBox("Hostname and port")
hfl = QFormLayout()
self.hostname = QLineEdit()
self.hostname.setText(self.settings.value("hostname", "localhost"))
self.port = SpinBox(maximum=65535)
self.port.setValue(self.settings.value("port", 1883, int))
hfl.addRow("Hostname", self.hostname)
hfl.addRow("Port", self.port)
gbHost.setLayout(hfl)
gbLogin = QGroupBox("Credentials [optional]")
lfl = QFormLayout()
self.username = QLineEdit()
self.username.setText(self.settings.value("username", ""))
self.password = QLineEdit()
self.password.setEchoMode(QLineEdit.PasswordEchoOnEdit)
self.password.setText(self.settings.value("password", ""))
lfl.addRow("Username", self.username)
lfl.addRow("Password", self.password)
gbLogin.setLayout(lfl)
gbClientId = QGroupBox("Client ID [optional]")
cfl = QFormLayout()
self.clientId = QLineEdit()
self.clientId.setText(self.settings.value("client_id", "tdm-" + self.random_generator()))
cfl.addRow("Client ID", self.clientId)
gbClientId.setLayout(cfl)
self.cbConnectStartup = QCheckBox("Connect on startup")
self.cbConnectStartup.setChecked(self.settings.value("connect_on_startup", False, bool))
hlBtn = HLayout()
btnSave = QPushButton("Save")
btnCancel = QPushButton("Cancel")
hlBtn.addWidgets([btnSave, btnCancel])
vl = VLayout()
vl.addWidgets([gbHost, gbLogin, self.cbConnectStartup])
vl.addLayout(hlBtn)
self.setLayout(vl)
btnSave.clicked.connect(self.accept)
btnCancel.clicked.connect(self.reject)