Support default firefox profile
This commit is contained in:
parent
01ad187150
commit
ff57182c3c
|
@ -17,4 +17,7 @@ var/
|
|||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
pyvenv.cfg
|
||||
bin/
|
||||
|
|
14
.travis.yml
14
.travis.yml
|
@ -1,14 +1,20 @@
|
|||
language: python
|
||||
python:
|
||||
- "2.7"
|
||||
# https://endoflife.date/python
|
||||
# goes away in sep 2020
|
||||
- "3.5"
|
||||
# goes away in dec 2021
|
||||
- "3.6"
|
||||
# goes away in jun 2023
|
||||
- "3.7"
|
||||
# goes away in oct 2024
|
||||
- "3.8"
|
||||
# command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
|
||||
install:
|
||||
install:
|
||||
- pip install requests
|
||||
- pip install nose
|
||||
- pip install mixpanel-py
|
||||
# command to run tests, e.g. python setup.py test
|
||||
script: nosetests --nocapture
|
||||
script: nosetests --nocapture
|
||||
notifications:
|
||||
email:
|
||||
on_success: never
|
||||
|
|
|
@ -3,7 +3,12 @@ This file will only list released and supported versions, usually skipping over
|
|||
Unreleased
|
||||
==========
|
||||
|
||||
* Python 3 upgrade
|
||||
4.0.0
|
||||
=====
|
||||
|
||||
* Upgrades to Python 3.0. Python 2 is no longer supported
|
||||
* Switches from PyGtk to PyGObject.
|
||||
* AppIndicator is no longer supported, because it is Python 2 only
|
||||
|
||||
3.0.0
|
||||
=====
|
||||
|
|
|
@ -87,10 +87,11 @@ class HackerNewsApp:
|
|||
btnQuit.show()
|
||||
btnQuit.connect("activate", self.quit)
|
||||
self.menu.append(btnQuit)
|
||||
|
||||
self.menu.show()
|
||||
|
||||
self.ind.set_menu(self.menu)
|
||||
|
||||
if args.firefox == "auto":
|
||||
args.firefox = Firefox.default_firefox_profile_path()
|
||||
self.refresh(chrome_data_directory=args.chrome, firefox_data_directory=args.firefox)
|
||||
|
||||
def toggleComments(self, widget):
|
||||
|
@ -205,7 +206,7 @@ def main():
|
|||
parser.add_argument('-v', '--version', action='version', version=Version.current())
|
||||
parser.add_argument('-c', '--comments', dest='comments', action='store_true', help="Load the HN comments link for the article as well")
|
||||
parser.add_argument('--chrome', dest='chrome', help="Specify a Google Chrome Profile directory to use for matching chrome history")
|
||||
parser.add_argument('--firefox', default=self.default_firefox_profile(), dest='firefox', help="Specify a Firefox Profile directory to use for matching firefox history")
|
||||
parser.add_argument('--firefox', dest='firefox', help="Specify a Firefox Profile directory to use for matching firefox history. Pass auto to automatically pick the default profile")
|
||||
parser.set_defaults(comments=False)
|
||||
parser.set_defaults(dnt=False)
|
||||
args = parser.parse_args()
|
||||
|
|
|
@ -18,8 +18,8 @@ class Firefox:
|
|||
parser = configparser.ConfigParser()
|
||||
parser.read(profile_file_path)
|
||||
for section in parser.sections():
|
||||
if parser[section]["Default"] == "1":
|
||||
if parser[section]["IsRelative"] == "1":
|
||||
if parser.has_option(section,"Default") and parser[section]["Default"] == "1":
|
||||
if parser.has_option(section,"IsRelative") and parser[section]["IsRelative"] == "1":
|
||||
profile_path = str(Path.home().joinpath(".mozilla/firefox/").joinpath(parser[section]["Path"]))
|
||||
else:
|
||||
profile_path = parser[section]["Path"]
|
||||
|
@ -45,8 +45,8 @@ class Firefox:
|
|||
|
||||
@staticmethod
|
||||
def setup(config_folder_path):
|
||||
file_name = os.path.abspath(config_folder_path+Firefox.HISTORY_FILE_NAME)
|
||||
file_name = os.path.abspath(config_folder_path + Firefox.HISTORY_FILE_NAME)
|
||||
if not os.path.isfile(file_name):
|
||||
print("ERROR: ", "Could not find Firefox history file", file=sys.stderr)
|
||||
print("ERROR: Could not find Firefox history file, using %s" % file_name)
|
||||
sys.exit(1)
|
||||
shutil.copyfile(file_name, Firefox.HISTORY_TMP_LOCATION)
|
||||
|
|
4
setup.py
4
setup.py
|
@ -10,8 +10,8 @@ setup(name='hackertray',
|
|||
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',
|
||||
url='http://captnemo.in/hackertray',
|
||||
author='Abhay Rana',
|
||||
url='https://captnemo.in/hackertray',
|
||||
author='Abhay Rana (Nemo)',
|
||||
author_email='me@captnemo.in',
|
||||
license='MIT',
|
||||
packages=find_packages(),
|
||||
|
|
Loading…
Reference in New Issue