diff --git a/README b/README index 59c2105..bd9307d 100644 --- a/README +++ b/README @@ -45,13 +45,19 @@ BeOS/ZETA/Haiku, QNX or MacOSX). INSTALATION =========== -All you have to do is: +You don't have to install it if you don't want to. You can just change current +directory to pyGTKtalog and simply run: + +./pyGTKtalog + +That's it. Alternatively, if you like to put it in more system wide place, all +you have to do is: - put pyGTKtalog directory into your destination of choice (/usr/local/share, /opt or ~/ is typical choice) -- modify pyGTKtalog/pyGTKtalog line 4 to match right directory -- copy/link pyGTKtalog/pyGTKtalog shell script to /usr/bin, /usr/local/bin or in +- copy pyGTKtalog shell script to /usr/bin, /usr/local/bin or in other place, where PATH variable is pointing or you feel like. +- then modify pyGTKtalog line 6 to match right pygtktalog.py directory Then, just run pyGTKtalog script. @@ -116,9 +122,9 @@ Removed: NOTES ===== -Catalog file is tared and optionaly compressed sqlite database and directories -with images and thumbnails. If there are more images, the size of catalog file -will grow. So be carefull with adding big images in your catalog file! +Catalog file is tared and optionaly gziped sqlite database and directories with +images and thumbnails. If there are more images, the size of catalog file will +grow. So be carefull with adding big images in your catalog file! BUGS ==== diff --git a/pyGTKtalog b/pyGTKtalog index 112ee8e..57a5376 100755 --- a/pyGTKtalog +++ b/pyGTKtalog @@ -1,11 +1,11 @@ #!/bin/sh -# Simple wraper to launch python application from desired place. -# adjust to your needs: -data_dir="/home/gryf/Devel/Python/pyGTKtalog" +# Simple shell wraper to launch pyGTKtalog + +# change path to pygtktalog.py file full path, then you can move this shell +# script to desired place (like /usr/bin, /usr/local/bin, ~/bin and so on) +path_to_gtktalog_directory="." + +# python interpreter python_intrpreter="/usr/bin/python" -# don't change anything below. -current_dir="`pwd`" -cd $data_dir -exec $python_intrpreter -OO pygtktalog.py "$current_dir" "$@" -#exec $python_intrpreter pygtktalog.py "$current_dir" "$@" +exec $python_intrpreter -OO ${path_to_gtktalog_directory}/pygtktalog.py "$@" diff --git a/pygtktalog.py b/pygtktalog.py index 4d3b2d9..8a62ce1 100644 --- a/pygtktalog.py +++ b/pygtktalog.py @@ -22,6 +22,7 @@ # ------------------------------------------------------------------------- import sys +import os try: import gtk except ImportError: @@ -87,26 +88,25 @@ def check_requirements(): print "want to make\nthumbnails!" return +if __name__ == "__main__": + # Directory from where pygtkatalog was invoced. We need it for calculate + # path for argument (catalog file) + execution_dir = os.path.abspath(os.path.curdir) + # Directory, where this files lies. We need it to setup private source + # paths + libraries_dir = os.path.dirname(__file__) + os.chdir(libraries_dir) -def get_parameters(): - """Determine application command line options, return db full pathname""" - import os - # if we've got two arguments, shell script passed through command line - # options: current path and probably filename of compressed collection - if len(sys.argv) > 2: - return os.path.join(sys.argv[1], sys.argv[2]) - return False + setup_path() + check_requirements() - -def main(*args): - """Main function of module pyGTKtalog""" from models.m_main import MainModel from ctrls.c_main import MainController from views.v_main import MainView model = MainModel() - if args and args[0]: - model.open(args[0]) + if len(sys.argv) > 1: + model.open(os.path.join(execution_dir, sys.argv[1])) controler = MainController(model) view = MainView(controler) @@ -116,11 +116,3 @@ def main(*args): model.config.save() model.cleanup() gtk.main_quit - pass - return - -if __name__ == "__main__": - setup_path() - check_requirements() - main(get_parameters()) - pass