From 160226c6cd4d7d8ccb86fce6dcaf401b53c33f0d Mon Sep 17 00:00:00 2001 From: BasioMeusPuga Date: Thu, 15 Mar 2018 11:24:28 +0530 Subject: [PATCH] Launching with __main__.py --- README.md | 1 + lector/__main__.py | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/README.md b/README.md index a07e86a..6279724 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ pdf support is coming, along with support for a bunch of other formats. Please s $ python setup.py build # python setup.py install +3. OR launch with `lector/__main__.py` ## Reporting issues When reporting issues: diff --git a/lector/__main__.py b/lector/__main__.py index 497c478..023e477 100755 --- a/lector/__main__.py +++ b/lector/__main__.py @@ -19,8 +19,16 @@ import os import sys import hashlib +import pathlib from PyQt5 import QtWidgets, QtGui, QtCore +# This allows for the program to be launched from the +# dir where it's been copied instead of needing to be +# installed +install_dir = os.path.realpath(__file__) +install_dir = pathlib.Path(install_dir).parents[1] +sys.path.append(str(install_dir)) + from lector import database from lector import sorter from lector.toolbars import LibraryToolBar, BookToolBar