本文整理汇总了Python中PyQt4.Qt.QSettings.allKeys方法的典型用法代码示例。如果您正苦于以下问题:Python QSettings.allKeys方法的具体用法?Python QSettings.allKeys怎么用?Python QSettings.allKeys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.Qt.QSettings
的用法示例。
在下文中一共展示了QSettings.allKeys方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MicroblogThread
# 需要导入模块: from PyQt4.Qt import QSettings [as 别名]
# 或者: from PyQt4.Qt.QSettings import allKeys [as 别名]
class MicroblogThread(QThread):
def __init__(self, app, user, service, updateusers = True):
QThread.__init__(self, app)
self.app = app
self.user = user
self.service = service
self.updateusers = updateusers
self.friends = QSettings("blain", "%s-%s-friends" % (user, service))
def run(self):
if not self.service or not self.user:
self.quit()
return
trys = 0
page = -1
new_friends = None
try:
friendscount = api_call(self.service, 'users/show',
{'id': self.user})['friends_count']
except:
print_exc()
self.end()
return
while friendscount > 0:
page = next_page(self.service, page, new_friends)
print "Fetching from friends page %i, %i updates remaining (%s)" % \
(page, friendscount, self.service),"[%i]"%trys
new_friends = get_friends(self.service, self.user, page)
stop = False
friendscount -= len(new_friends)
if len(new_friends) == 0:
trys += 1
for friend in new_friends:
id = str(friend['screen_name'])
if self.friends.contains(id):
print id, "(found)", self.service
stop = True
else:
print id, "(new)", self.service
dump = json.dumps(friend)
self.friends.setValue(id, dump)
if stop or trys > 3: break
#self.yieldCurrentThread()
print "friends list up-to-date. (%s)" % self.service
self.end()
def end(self):
self.app.killThread.emit("__%s__" % self.service)
# update all users
if self.updateusers:
for user in self.friends.allKeys() + [self.user]:
self.app.updateUser.emit(self.service, user)
self.app.updates.updates.friends(self.service, user)
print "done."
self.quit()
示例2: read_settings
# 需要导入模块: from PyQt4.Qt import QSettings [as 别名]
# 或者: from PyQt4.Qt.QSettings import allKeys [as 别名]
def read_settings(self):
logging.debug('Reading settings')
settings = QSettings()
read_settings = self.defaults.copy()
keys = settings.allKeys()
for k in keys:
setting_type = QTouTvSettings._settings_types[k]
read_settings[k] = settings.value(k, type=setting_type)
self.apply_settings(read_settings)
示例3: GroupsThread
# 需要导入模块: from PyQt4.Qt import QSettings [as 别名]
# 或者: from PyQt4.Qt.QSettings import allKeys [as 别名]
class GroupsThread(QThread):
def __init__(self, app, user, updategroups = True):
QThread.__init__(self, app)
self.app = app
self.user = user
self.updategroups = updategroups
self.groups = QSettings("blain", "%s-groups" % user)
def run(self):
if not self.user:
self.quit()
return
trys = 0
new_groups = None
while trys < 4:
trys += 1
new_groups = get_group(self.user)
if new_groups is not None:
break
if new_groups is None:
self.end()
return
for group in new_groups:
id = str(group['nickname'])
if self.groups.contains(id):
print id, "(found)"
else:
print id, "(new)"
dump = json.dumps(clean_urls(group))
self.groups.setValue(id, dump)
print "groups list up-to-date. (%s)" % self.user
self.end()
def end(self):
self.app.killThread.emit("%s groups" % self.user)
# update all groups
if self.updategroups:
for group in self.groups.allKeys():
self.app.updateGroup.emit(group)
self.app.updates.updates.groups(self.user)
print "done."
self.quit()