本文整理汇总了Python中version.Version.new_available方法的典型用法代码示例。如果您正苦于以下问题:Python Version.new_available方法的具体用法?Python Version.new_available怎么用?Python Version.new_available使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类version.Version
的用法示例。
在下文中一共展示了Version.new_available方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from version import Version [as 别名]
# 或者: from version.Version import new_available [as 别名]
def __init__(self, args):
# Load the database
home = expanduser("~")
with open(home + '/.hackertray.json', 'a+') as content_file:
content_file.seek(0)
content = content_file.read()
try:
self.db = set(json.loads(content))
except ValueError:
self.db = set()
# create an indicator applet
self.ind = appindicator.Indicator("Hacker Tray", "hacker-tray", appindicator.CATEGORY_APPLICATION_STATUS)
self.ind.set_status(appindicator.STATUS_ACTIVE)
self.ind.set_icon(get_icon_filename("hacker-tray.png"))
# create a menu
self.menu = gtk.Menu()
# The default state is false, and it toggles when you click on it
self.commentState = args.comments
# create items for the menu - refresh, quit and a separator
menuSeparator = gtk.SeparatorMenuItem()
menuSeparator.show()
self.menu.append(menuSeparator)
btnComments = gtk.CheckMenuItem("Show Comments")
btnComments.show()
btnComments.set_active(args.comments)
btnComments.connect("activate", self.toggleComments)
self.menu.append(btnComments)
btnAbout = gtk.MenuItem("About")
btnAbout.show()
btnAbout.connect("activate", self.showAbout)
self.menu.append(btnAbout)
btnRefresh = gtk.MenuItem("Refresh")
btnRefresh.show()
# the last parameter is for not running the timer
btnRefresh.connect("activate", self.refresh, True, args.chrome)
self.menu.append(btnRefresh)
if Version.new_available():
btnUpdate = gtk.MenuItem("New Update Available")
btnUpdate.show()
btnUpdate.connect('activate', self.showUpdate)
self.menu.append(btnUpdate)
btnQuit = gtk.MenuItem("Quit")
btnQuit.show()
btnQuit.connect("activate", self.quit)
self.menu.append(btnQuit)
self.menu.show()
self.ind.set_menu(self.menu)
self.refresh(chrome_data_directory=args.chrome, firefox_data_directory=args.firefox)
self.launch_analytics(args)