本文整理汇总了Python中Settings.Settings类的典型用法代码示例。如果您正苦于以下问题:Python Settings类的具体用法?Python Settings怎么用?Python Settings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Settings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: mark
def mark(cls, look, displayname=None):
"""
Create xplanet marker based on observation
"""
key1 = str(look.wave.time.tt)
key2 = look.planet.origname
if key2 in Settings().locationstorage:
if key1 in Settings().locationstorage[key2]:
l1 = Settings().locationstorage[key2][key1]
# print("found")
else:
l1 = cls.calculate_lat_long(look.wave.time, look)
tmp = Settings().locationstorage[key2]
tmp.update({key1: l1})
Settings().locationstorage[key2] = tmp
else:
l1 = cls.calculate_lat_long(look.wave.time, look)
Settings().locationstorage[key2] = {key1: l1}
if displayname is None:
displayname = look.planet.name
return '{} {} "{}" {}'.format(str(l1[0]),
str(l1[1]),
displayname,
look.planet.color)
示例2: testLoadSettings
def testLoadSettings(self):
settings = Settings()
settings.load('testSettings.ini')
notepads = settings.getNotepads()
self.assertEqual(2, len(notepads))
self.assertEqual('SampleWiki', notepads[0]['name'])
示例3: pole
def pole(cls, look):
"""
Create xplanet pole as arc based on observation
"""
key1 = str(look.wave.time.tt)
key2 = look.planet.origname
if key2 in Settings().locationstorage:
if key1 in Settings().locationstorage[key2]:
l1 = Settings().locationstorage[key2][key1]
else:
l1 = cls.calculate_lat_long(look.wave.time, look)
tmp = Settings().locationstorage[key2]
tmp.update({key1: l1})
Settings().locationstorage[key2] = tmp
else:
l1 = cls.calculate_lat_long(look.wave.time, look)
Settings().locationstorage[key2] = {key1: l1}
l2 = Settings().midpoint
return '{} {} {} {} {}'.format(str(l1[0]),
str(l1[1]),
str(l2[0]),
str(l2[1]),
look.planet.color + " spacing=0.5")
示例4: checkForUpdate
def checkForUpdate(self):
update = 0
settings = Settings(os.getcwd() + '/' +"wlc_load.db") # i coded myself into a corner
while True:
if update < settings.get("lastUpdate"):
#send data to client
self.broadCast_Msg("Hello....smells like success")
time.sleep(2)
示例5: test_phases
def test_phases(self):
'''
python3 -m unittest TestRun.TestRun.test_phases
'''
settings = Settings()
settings.setValue('XOphases', True)
rpt = ConsoleStreamReporter()
ctx = RunnerContext.RunnerContext(rpt, X64CodeGenContext(), settings)
ctx.run(self.cu)
示例6: uploadFile
def uploadFile(file, resultCallbackFunction=printLink, progressCallbackFunction=printProgressToCLI, file_number = 0, semaphore = BoundedSemaphore(2), username="", password=""):
rs = Rapidshare_com(file, resultCallbackFunction, progressCallbackFunction, file_number)
from Settings import Settings
set = Settings()
if set.getUseRSPassword():
username,password = set.getRSCredentials()
rs.upload(semaphore, username, password)
del username
del password
示例7: showNotification_
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)
示例8: getUploader
def getUploader(file):
preferredUploaders = Settings().getPreferredUploaders()
extension = file.split('.')[-1].lower()
filetype = __getFiletype(extension)
if filetype in preferredUploaders.keys():
prefferedUploader = preferredUploaders[filetype]
else:
prefferedUploader = preferredUploaders["*"]
return getPluginByHostingName(prefferedUploader)
示例9: testPageSequence
def testPageSequence(self):
settings = Settings()
settings.load('testSettings.ini')
npDef = settings.getNotepads()[0]
self.assertEqual('SampleWiki', npDef['name'])
notepad = LocalNotepad(npDef)
self.assertEqual('SampleWiki', notepad.getName())
pageId = notepad.getNextPageId()
示例10: projectChange_
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()
示例11: __init__
def __init__(self) :
self.videos = dict()
self.services = dict()
self.locSettings = Settings('location')
self.storageSettings = Settings('storage')
if not os.path.exists(self.thumbnailDir()) :
os.mkdir(self.thumbnailDir())
if not os.path.exists(self.videoDir()) :
os.mkdir(self.videoDir())
示例12: start
def start(self, tray):
startDB = DB();
settings = Settings(startDB);
settings = settings.currentSettings();
FeedBox.FeedBox.setTheme(settings['theme']);
if(settings['startMinimalized']):
tray.minimalization();
if(settings['startup']):
self.updateAllFeeds();
示例13: piece
class GameState:
#update game round i -> The number of the current round
#update game this_piece_type s -> The type of the piece that has just spawned on the field
#update game next_piece_type s -> The type of the piece that will spawn the next round
#update game this_piece_position i,i -> The starting position in the field for the current piece (top left corner of the piece bounding box)
def __init__(self):
self.round = 0
self.this_piece_type = 'n'
self.next_piece_type = 'n'
self.this_piece_position = {"x":1 , "y":2}
self.players = {"me":PlayerState(), "opponent":PlayerState()}
self.settings = Settings()
def parseSettingsMessage(self, parts):
self.settings.parseSetting(parts)
def parseGameMessage(self, parts):
if parts[0] == "game":
gameStateMessage = parts[1]
if gameStateMessage== 'round':
#update game round i
self.round = int(parts[2])
elif gameStateMessage == 'this_piece_type':
#update game this_piece_type s
self.this_piece_type = parts[2]
elif gameStateMessage == 'next_piece_type':
#update game next_piece_type s
self.next_piece_type = parts[2]
elif gameStateMessage == 'this_piece_position':
#update game this_piece_position i,i
position = parts[2].split(',')
self.this_piece_position["x"] = int(position[0])
self.this_piece_position["y"] = int(position[1])
else:
stderr.write('Unknown gameStateMessage: %s\n' % (parts[1]))
stderr.flush()
elif parts[0] == self.settings.bots["me"]:
self.players["me"].parsePlayerState(parts[1:])
elif parts[0] == self.settings.bots["opponent"]:
self.players["opponent"].parsePlayerState(parts[1:])
else:
stderr.write('Unknown gameStateMessage: %s\n' % (parts[0]))
stderr.flush()
示例14: showStartHelpMessage
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()
示例15: leftSeconds
def leftSeconds(self):
"""Return time left to work"""
res = Settings.get("workDayLength") - self.spentSeconds
if res < 0:
return 0
else:
return res