本文整理汇总了Python中settings.Settings.saveSettings方法的典型用法代码示例。如果您正苦于以下问题:Python Settings.saveSettings方法的具体用法?Python Settings.saveSettings怎么用?Python Settings.saveSettings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类settings.Settings
的用法示例。
在下文中一共展示了Settings.saveSettings方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setFieldName
# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import saveSettings [as 别名]
def setFieldName(self):
text = Settings.fieldName
mykeyboard = virtkeyboard.VirtualKeyboard()
userinput = mykeyboard.run(pygame.display.get_surface(), 200, text)
Settings.fieldName = userinput
Settings.saveSettings()
self.dataTable.changeData("fieldName",data = Settings.fieldName)
globals.BLE.enterMode(0,Settings.fieldName)
示例2: setFieldName
# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import saveSettings [as 别名]
def setFieldName(self):
text = Settings.fieldName
mykeyboard = virtkeyboard.VirtualKeyboard()
userinput = mykeyboard.run(pygame.display.get_surface(), 200, text)
print "got user input of: " + userinput
Settings.fieldName = userinput
Settings.saveSettings()
print(userinput)
self.dataTable.changeData("fieldName",data = Settings.fieldName)
示例3: initGallery
# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import saveSettings [as 别名]
def initGallery(self, path):
"""
Creates new gallery basic structure.
"""
logger.debug('Creating new gallery structure...')
configpath = os.path.join(path, self.CONFIGDIR)
thumbpath = os.path.join(configpath, self.THUMBDIR)
# create config folder and files
if not os.path.isdir(configpath):
os.mkdir(configpath)
if not os.path.isdir(thumbpath):
os.mkdir(thumbpath)
DatabaseModel(configpath)
setmod = Settings(configpath)
setmod.loadSettings()
setmod.saveSettings()
示例4: System
# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import saveSettings [as 别名]
class System():
fileName = 'settings.cfg'
def __init__(self):
try:
self.currentSettings = Settings.loadSettings(System.fileName)
except(IOError):
print 'No settings file found, reverting to default settings...'
self.currentSettings = Settings()
self.currentSettings.saveSettings(self.fileName)
self.manager = Manager()
self.sharedData = self.manager.dict()
self.sharedData.update({
'pad' : 'on',
'sensors' : self.manager.list([Sensor(4), Sensor(17)]),
'temp' : 0,
'hum' : 0,
'alarms' : self.manager.dict(), #if map empty => all green
'fan_in' : 0.5,
'fan_out': 0.5
})
self.sharedData.update(self.currentSettings.set_d)
#self.sharedData.update({ 'biases' : self.manager.list(self.currentSettings.set_d['biases'])})
def dumpSettings(self):
while 1:
self.currentSettings.updateSettings(self.sharedData)
self.currentSettings.saveSettings(self.fileName)
time.sleep(300)
def start(self):
self.processes = [SystemCommand(self.sharedData), Updater(self.sharedData), Process(target=self.dumpSettings)]
for p in self.processes:
p.start()
self.manager.join()
示例5: GalleryManager
# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import saveSettings [as 别名]
class GalleryManager():
"""
Main class of application
"""
CONFIGDIR = '.config'
THUMBDIR = 'thumb'
COOKIEFILE = 'cookies.yaml'
THUMB_MAXSIZE = 180, 270
# reserved category (folder) names
RESERVED = {'new_dir':'_new', 'unsorted_dir':'_unsorted'}
def __init__(self, gallerypath=''):
self.gallerypath = str(gallerypath)
self.configpath = None
self.thumbpath = None
self.dbmodel = None
self.settings = None
self.ehfetcher = None
self.fakkufetcher = None
if self.gallerypath is not '':
self.openPath(self.gallerypath)
def close(self):
"""
Closes connection to gallery.
"""
self.dbmodel.closeDatabase()
def openPath(self, path):
"""
Open path as a gallery and creates connection to its database. If path is not gallery creates empty gallery structure.
"""
self.gallerypath = os.path.abspath(str(path))
# checks if path is existing gallery. if not creates one.
if self.isGallery(self.gallerypath) is False:
self.initGallery(self.gallerypath)
# def paths
self.configpath = os.path.join(self.gallerypath, self.CONFIGDIR)
self.thumbpath = os.path.join(self.configpath, self.THUMBDIR)
# load settings
self.settings = Settings(self.configpath)
self.settings.loadSettings()
# open connection to database
self.dbmodel = DatabaseModel(self.configpath)
self.dbmodel.openDatabase()
# init fetchers
self.ehfetcher = EHFetcher(self)
self.fakkufetcher = FakkuFetcher()
def isGallery(self, path):
"""
Checks if path leads to existing gallery.
"""
configpath = os.path.join(str(path), self.CONFIGDIR)
thumbpath = os.path.join(configpath, self.THUMBDIR)
if os.path.isdir(configpath):
database_path = os.path.join(configpath, DatabaseModel.FILENAME)
if os.path.isfile(database_path) and os.path.isdir(thumbpath):
logger.debug('isGallery: given path is existing gallery.')
return True
logger.debug('isGallery: given path is not gallery.')
return False
def initGallery(self, path):
"""
Creates new gallery basic structure.
"""
logger.debug('Creating new gallery structure...')
configpath = os.path.join(path, self.CONFIGDIR)
thumbpath = os.path.join(configpath, self.THUMBDIR)
# create config folder and files
if not os.path.isdir(configpath):
os.mkdir(configpath)
if not os.path.isdir(thumbpath):
os.mkdir(thumbpath)
DatabaseModel(configpath)
setmod = Settings(configpath)
setmod.loadSettings()
setmod.saveSettings()
# create default category folders
# TODO - show confirm dialog before touching files
#self.initFolders(path, setmod) # disabled for now
def initFolders(self, path, settings):
# TODO - decide if use or remove
"""
#.........这里部分代码省略.........
示例6: Editor
# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import saveSettings [as 别名]
#.........这里部分代码省略.........
if path in self._open_files:
# Map is already open, ask user if he wants to reload the map
mapview = self.getMapviewByPath(path)
YesNoDialog(u"Map is already open. Do you want to reload it?", cbwa(self.reloadMapview, mapview=mapview))
return
""" Opens a file """
try:
map = loaders.loadMapFile(path, self.engine)
mapview = self.newMapView(map)
self._open_files.append(path)
return mapview
except:
traceback.print_exc(sys.exc_info()[1])
errormsg = u"Opening map failed:\n"
errormsg += u"File: "+unicode(path, sys.getfilesystemencoding())+u"\n"
errormsg += u"Error: "+unicode(sys.exc_info()[1])
ErrorDialog(errormsg)
return None
def reloadMapview(self, mapview=None):
if mapview is None:
mapview = self._mapview
if mapview is None:
print "Can't reload map: No maps are open."
return
path = mapview.getMap().getResourceLocation().getFilename()
mapview.close()
self.openFile(path)
def saveAll(self):
""" Saves all open maps """
tmpview = self._mapview
for mapview in self._mapviewlist:
self._mapview = mapview
self._filemanager.save()
self._mapview = tmpview
def quit(self):
""" Quits the editor. An onQuit signal is sent before the application closes """
events.onQuit.send(sender=self)
self._settings.saveSettings()
ApplicationBase.quit(self)
def _pump(self):
""" Called once per frame """
# ApplicationBase and Engine should be done initializing at this point
if self._inited == False:
self._initGui()
self._initTools()
if self._params: self.openFile(self._params)
self._inited = True
events.onPump.send(sender=self)
def __sendMouseEvent(self, event, **kwargs):
""" Function used to capture mouse events for EventListener """
ms_event = fife.MouseEvent
type = event.getType()
if type == ms_event.MOVED:
mouseMoved.send(sender=self._maparea, event=event)
elif type == ms_event.PRESSED:
mousePressed.send(sender=self._maparea, event=event)
elif type == ms_event.RELEASED:
mouseReleased.send(sender=self._maparea, event=event)
elif type == ms_event.WHEEL_MOVED_DOWN:
mouseWheelMovedDown.send(sender=self._maparea, event=event)
elif type == ms_event.WHEEL_MOVED_UP:
mouseWheelMovedUp.send(sender=self._maparea, event=event)
elif type == ms_event.CLICKED:
mouseClicked.send(sender=self._maparea, event=event)
elif type == ms_event.ENTERED:
mouseEntered.send(sender=self._maparea, event=event)
elif type == ms_event.EXITED:
mouseExited.send(sender=self._maparea, event=event)
elif type == ms_event.DRAGGED:
mouseDragged.send(sender=self._maparea, event=event)
def __sendKeyEvent(self, event, **kwargs):
""" Function used to capture key events for EventListener """
type = event.getType()
if type == fife.KeyEvent.PRESSED:
keyPressed.send(sender=self._maparea, event=event)
elif type == fife.KeyEvent.RELEASED:
keyReleased.send(sender=self._maparea, event=event)
示例7: done
# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import saveSettings [as 别名]
def done(self):
# setattr(globalVariables,self.globalName,self.number)
setattr(Settings,self.globalName,self.number)
if self.PT == True:
Settings.saveSettings()
return("back")