本文整理汇总了Python中actions.Actions.performActions方法的典型用法代码示例。如果您正苦于以下问题:Python Actions.performActions方法的具体用法?Python Actions.performActions怎么用?Python Actions.performActions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类actions.Actions
的用法示例。
在下文中一共展示了Actions.performActions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TPBattStat
# 需要导入模块: from actions import Actions [as 别名]
# 或者: from actions.Actions import performActions [as 别名]
class TPBattStat():
def __init__(self, mode, forceDelay=None, forceIconSize=None):
self.mode = mode
self.forceDelay = forceDelay
self.prefs = Prefs()
self.battStatus = BattStatus(self.prefs)
self.actions = Actions(self.prefs, self.battStatus)
if self.mode == "gtk" or self.mode == "prefs":
self.gui = Gui(self.prefs, self.battStatus)
elif self.mode == "json" or self.mode == "dzen":
self.guiMarkupPrinter = GuiMarkupPrinter(
self.prefs, self.battStatus, forceIconSize)
def getGui(self):
return self.gui
def startUpdate(self):
self.curDelay = -1
self.update()
def update(self):
try:
self.prefs.update()
except Exception as e:
print 'ignoring prefs'
print e.message
if self.forceDelay != None:
self.prefs['delay'] = self.forceDelay
self.battStatus.update(self.prefs)
self.actions.performActions()
if self.mode == "gtk":
self.gui.update()
elif self.mode == "json" or self.mode == "dzen":
try:
if self.mode == "json":
markup = self.guiMarkupPrinter.getMarkupJson()
elif self.mode == "dzen":
markup = self.guiMarkupPrinter.getMarkupDzen()
print markup
sys.stdout.flush()
except IOError, e:
print >> sys.stderr, "STDOUT is broken, assuming external gui is dead"
sys.exit(1)
if self.prefs['delay'] != self.curDelay:
self.curDelay = self.prefs['delay']
if self.curDelay <= 0:
self.curDelay = 1000
gobject.timeout_add(self.curDelay, self.update)
return False
else:
return True