Adds -c argument for showing comments

- Adds support for short args (-v,-c)
- Removes crate.io links
- Bumps version to 2.0.0
This commit is contained in:
Abhay Rana 2014-01-29 20:04:10 +05:30
parent e48521b1ed
commit 0b1353131d
3 changed files with 10 additions and 11 deletions

View File

@ -1,7 +1,7 @@
HackerTray
==========
[![HackerTray on crate.io](https://pypip.in/v/hackertray/badge.png)](https://crate.io/packages/hackertray/)
[![HackerTray on PyPi](https://pypip.in/v/hackertray/badge.png)](https://pypi.python.org/pypi/hackertray/)
[![HackerTray on PyPi](https://pypip.in/d/hackertray/badge.png)](https://pypi.python.org/pypi/hackertray/)
[![Build Status](https://travis-ci.org/captn3m0/hackertray.png?branch=master)](https://travis-ci.org/captn3m0/hackertray)
@ -57,10 +57,6 @@ need to clear the pip cache before upgrading:
3. Remembers which links you opened
4. Shows Points/Comment count in a simple format
##To-Do
- Auto Start
- Try to convert right click to comments link
##Author Information
- Abhay Rana (<me@captnemo.in>)

View File

@ -32,7 +32,7 @@ from hackernews import HackerNews
class HackerNewsApp:
HN_URL_PREFIX = "https://news.ycombinator.com/item?id="
def __init__(self):
def __init__(self, comments):
#Load the database
home = expanduser("~")
with open(home + '/.hackertray.json', 'a+') as content_file:
@ -52,7 +52,7 @@ class HackerNewsApp:
self.menu = gtk.Menu()
#The default state is false, and it toggles when you click on it
self.commentState = False
self.commentState = comments
# create items for the menu - refresh, quit and a separator
menuSeparator = gtk.SeparatorMenuItem()
@ -61,6 +61,7 @@ class HackerNewsApp:
btnComments = gtk.CheckMenuItem("Show Comments")
btnComments.show()
btnComments.set_active(comments)
btnComments.connect("activate", self.toggleComments)
self.menu.append(btnComments)
@ -162,7 +163,9 @@ class HackerNewsApp:
def main():
parser = argparse.ArgumentParser(description='Hacker News in your System Tray')
parser.add_argument('--version', action='version', version=__version)
parser.parse_args()
indicator = HackerNewsApp()
parser.add_argument('-v','--version', action='version', version=__version)
parser.add_argument('-c','--comments', dest='comments',action='store_true', help="Load the HN comments link for the article as well")
parser.set_defaults(comments=False)
args = parser.parse_args()
indicator = HackerNewsApp(args.comments)
indicator.run()

View File

@ -9,7 +9,7 @@ if sys.version_info < (2, 7):
requirements.append('argparse')
setup(name='hackertray',
version='1.9.5',
version='2.0.0',
description='Hacker News app that sits in your System Tray',
long_description='HackerTray is a simple Hacker News Linux application that lets you view top HN stories in your System Tray. It relies on appindicator, so it is not guaranteed to work on all systems. It also provides a Gtk StatusIcon fallback in case AppIndicator is not available.',
keywords='hacker news hn tray system tray icon hackertray',