本文整理汇总了Python中Settings.Settings.set方法的典型用法代码示例。如果您正苦于以下问题:Python Settings.set方法的具体用法?Python Settings.set怎么用?Python Settings.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Settings.Settings
的用法示例。
在下文中一共展示了Settings.set方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: showNotification_
# 需要导入模块: from Settings import Settings [as 别名]
# 或者: from Settings.Settings import set [as 别名]
def showNotification_(self, sender):
result = bool(self.chbShowNotification.state())
Settings.set("showNotification", result)
self.stprNotificationTime.setEnabled_(result)
self.edtNotificationTime.setEnabled_(result)
self.stprNotificationRepeatTime.setEnabled_(result)
self.edtNotificationRepeatTime.setEnabled_(result)
self.chbSoundOnNotification.setEnabled_(result)
self.btnPreviewPopup.setEnabled_(result)
示例2: projectChange_
# 需要导入模块: from Settings import Settings [as 别名]
# 或者: from Settings.Settings import set [as 别名]
def projectChange_(self, sender):
"""Project changed event"""
if self.pbtnProject.titleOfSelectedItem():
self.cbxInput.removeAllItems()
self.cbxInput.addItemsWithObjectValues_(Projects.getAutocomleteList(
self.pbtnProject.titleOfSelectedItem(), SlackingAutocompletes.get()))
if sender:
Settings.set("selectedProject", unicode(self.pbtnProject.titleOfSelectedItem()))
Settings.sync()
示例3: showStartHelpMessage
# 需要导入模块: from Settings import Settings [as 别名]
# 或者: from Settings.Settings import set [as 别名]
def showStartHelpMessage(self):
"""Show alert with help message"""
alert = NSAlert.alloc().init()
alert.addButtonWithTitle_('OK')
alert.setMessageText_("Congrats, you started your working day!")
alert.setInformativeText_("Now start doing your working activity (e.g reading mail). "
"When you finish with your activity go back to MacTimeLog and type it in. "
"If your activity is slacking, use 2 asterisks (**) at the end of the activity's name.")
alert.setShowsSuppressionButton_(True)
alert.runModal()
if alert.suppressionButton().state() == NSOnState:
Settings.set("showHelpMessageOnStart", False)
Settings.sync()
示例4: SettingsDialog
# 需要导入模块: from Settings import Settings [as 别名]
# 或者: from Settings.Settings import set [as 别名]
class SettingsDialog(QDialog) :
def __init__(self, parent = None) :
QDialog.__init__(self, parent)
layout = QVBoxLayout()
self.settings = Settings()
self.edits = dict()
for key in Settings.values.keys():
layout.addLayout(self.createSettingField(key))
buttons = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
buttons.accepted.connect(self.accept)
buttons.rejected.connect(self.reject)
layout.addWidget(buttons)
self.setLayout(layout)
def createSettingField(self, key) :
layout = QHBoxLayout()
layout.addWidget(QLabel(key))
value = Settings.values[key]
edit = QLineEdit(str(value))
if value == True or value == False :
edit = QCheckBox()
if value :
edit.setCheckState(Qt.Checked)
elif isinstance(value, int) :
edit.setValidator(QIntValidator())
elif isinstance(value, float) :
edit.setValidator(QDoubleValidator())
self.edits[key] = edit
layout.addWidget(edit)
return layout
def accept(self) :
value = Settings.values[key]
for key in self.keys :
if isinstance(value, int) :
self.settings.set(key, int(edit.text()))
elif isinstance(value, float) :
self.settings.set(key, float(edit.text()))
elif isinstance(value, bool) :
self.settings.set(key, edit.checkState() == Qt.Checked)
else :
self.settings.set(key, edit.text())
self.setVisible(False)
def reject(self) :
self.setVisible(False)
示例5: SettingsTest
# 需要导入模块: from Settings import Settings [as 别名]
# 或者: from Settings.Settings import set [as 别名]
class SettingsTest(unittest.TestCase) :
SETTINGS_PATH = os.path.expanduser('settingstest.xml')
@classmethod
def setUpClass(self) :
Settings.loadSettings(self.SETTINGS_PATH)
self.settings = Settings("test")
def test_string(self) :
defaulttest = self.settings.get('defaulttest', 'defaulttest')
self.settings.set('gettest', 'gettest')
gettest2 = self.settings.get('gettest', 'defaulttest')
self.assertEquals(defaulttest, 'defaulttest')
self.assertEquals(gettest2, 'gettest')
def test_int(self) :
gettest1 = self.settings.get('gettest', 4)
self.settings.set('gettest', 1)
gettest2 = self.settings.get('gettest', 4)
self.assertEquals(gettest1, 4)
self.assertEquals(gettest2, 1)
def test_bool(self) :
gettest1 = self.settings.get('gettest', False)
self.settings.set('gettest2', True)
self.settings.set('gettest3', False)
gettest2 = self.settings.get('gettest2', False)
gettest3 = self.settings.get('gettest3', False)
self.assertEquals(gettest1, False)
self.assertEquals(gettest2, True)
self.assertEquals(gettest3, False)
def test_write(self) :
self.settings.write()
self.assertTrue(os.path.exists(self.SETTINGS_PATH))
@classmethod
def tearDownClass(self) :
os.remove(self.SETTINGS_PATH)
示例6: saveSettings
# 需要导入模块: from Settings import Settings [as 别名]
# 或者: from Settings.Settings import set [as 别名]
def saveSettings(self):
Settings.set("workDayLength", fh.hoursToSeconds(self.stprWorkHours.intValue()))
dateStr = str(self.dpkrWorkStarts.dateValue())
Settings.set("workEndTime", dateStr[11:16])
Settings.set("logEditCommand", self.edtLogEditCommand.stringValue())
Settings.set("logDateTimeFormat", self.edtDateTimeFormat.stringValue())
Settings.set("notificationTime", self.stprNotificationTime.intValue())
Settings.set("notificationRepeatTime", self.stprNotificationRepeatTime.intValue())
Settings.sync()
示例7: soundOnNotificaiton_
# 需要导入模块: from Settings import Settings [as 别名]
# 或者: from Settings.Settings import set [as 别名]
def soundOnNotificaiton_(self, sender):
Settings.set("soundOnNotification", bool(self.chbSoundOnNotification.state()))
示例8: showWorkTill_
# 需要导入模块: from Settings import Settings [as 别名]
# 或者: from Settings.Settings import set [as 别名]
def showWorkTill_(self, sender):
Settings.set("showWorkTill", bool(self.chbShowWorkTill.state()))
示例9: showDateTime_
# 需要导入模块: from Settings import Settings [as 别名]
# 或者: from Settings.Settings import set [as 别名]
def showDateTime_(self, sender):
self.edtDateTimeFormat.setEnabled_(self.chbShowDateTime.state())
Settings.set("showDateTime", bool(self.chbShowDateTime.state()))