Fixes icon issues completely.

-Refers #11
- No longer searches in different places for the icon
- Sets title of GtkStatusIcon for accessibility
- Uses hackertray.data to package the image file
- Bumps version to 1.9

Signed-off-by: Abhay Rana <capt.n3m0@gmail.com>
This commit is contained in:
Abhay Rana 2013-12-04 17:28:35 +05:30
parent 4a604c1527
commit 389da396f4
5 changed files with 13 additions and 21 deletions

View File

@ -1 +1 @@
include images/hacker-tray.png include hackertray/data/hacker-tray.png

View File

@ -16,6 +16,8 @@ import gobject
import os import os
import sys import sys
from pkg_resources import resource_filename
# Types # Types
CATEGORY_APPLICATION_STATUS = 0 CATEGORY_APPLICATION_STATUS = 0
@ -24,25 +26,11 @@ STATUS_ACTIVE = 0
STATUS_ATTENTION = 1 STATUS_ATTENTION = 1
# Locations to search for the given icon # Locations to search for the given icon
search_locations = [ os.path.join(os.path.dirname(sys.executable), "images"),
os.path.join(os.path.dirname(__file__), "images"),
os.path.join(os.path.dirname(__file__), "../images"),
'/usr/share/pixmaps' ]
def get_icon_filename(icon_name): def get_icon_filename(icon_name):
# Determine where the icon is # Determine where the icon is
global search_locations return os.path.abspath(resource_filename('hackertray.data', 'hacker-tray.png'))
for folder in search_locations:
filename = os.path.join(folder, icon_name + ".png")
if os.path.isfile(filename):
return filename
return None
# The main class # The main class
class Indicator: class Indicator:
@ -84,6 +72,7 @@ class Indicator:
self.icon.set_from_file(self.active_icon) self.icon.set_from_file(self.active_icon)
def set_label(self, label): def set_label(self, label):
self.icon.set_title(label)
return return
def set_icon(self, icon): def set_icon(self, icon):

View File

View File

Before

Width:  |  Height:  |  Size: 958 B

After

Width:  |  Height:  |  Size: 958 B

View File

@ -1,4 +1,5 @@
from setuptools import setup from setuptools import setup
from setuptools import find_packages
import sys import sys
requirements = ['requests'] requirements = ['requests']
@ -6,7 +7,7 @@ if sys.version_info < (2, 7):
requirements.append('argparse') requirements.append('argparse')
setup(name='hackertray', setup(name='hackertray',
version='1.8.3', version='1.9',
description='Hacker News app that sits in your System Tray', 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.', 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', keywords='hacker news hn tray system tray icon hackertray',
@ -14,12 +15,14 @@ setup(name='hackertray',
author='Abhay Rana', author='Abhay Rana',
author_email='me@captnemo.in', author_email='me@captnemo.in',
license='MIT', license='MIT',
packages=['hackertray'], packages=find_packages(),
data_files=[('images', ['images/hacker-tray.png'])], package_data={
'hackertray.data':['hacker-tray.png']
},
install_requires=[ install_requires=[
'requests', 'requests',
], ],
entry_points={ entry_points={
'console_scripts': ['hackertray = hackertray:main'], 'console_scripts': ['hackertray = hackertray:main'],
}, },
zip_safe=False) zip_safe=False)