1
0
mirror of https://github.com/gryf/pygtktalog.git synced 2025-12-17 19:40:21 +01:00

* Changed the way that program starts: it's possible to run it from its

directory or place in desired directory, copy pyGTKtalog script in
   place pointed in $PATH (or not), and change path to pygtktalog.py
   file.
This commit is contained in:
2008-05-08 11:58:41 +00:00
parent d0b23f9202
commit 1eaad783f9
3 changed files with 33 additions and 35 deletions

18
README
View File

@@ -45,13 +45,19 @@ BeOS/ZETA/Haiku, QNX or MacOSX).
INSTALATION 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, - put pyGTKtalog directory into your destination of choice (/usr/local/share,
/opt or ~/ is typical choice) /opt or ~/ is typical choice)
- modify pyGTKtalog/pyGTKtalog line 4 to match right directory - copy pyGTKtalog shell script to /usr/bin, /usr/local/bin or in
- copy/link pyGTKtalog/pyGTKtalog shell script to /usr/bin, /usr/local/bin or in
other place, where PATH variable is pointing or you feel like. 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. Then, just run pyGTKtalog script.
@@ -116,9 +122,9 @@ Removed:
NOTES NOTES
===== =====
Catalog file is tared and optionaly compressed sqlite database and directories Catalog file is tared and optionaly gziped sqlite database and directories with
with images and thumbnails. If there are more images, the size of catalog file images and thumbnails. If there are more images, the size of catalog file will
will grow. So be carefull with adding big images in your catalog file! grow. So be carefull with adding big images in your catalog file!
BUGS BUGS
==== ====

View File

@@ -1,11 +1,11 @@
#!/bin/sh #!/bin/sh
# Simple wraper to launch python application from desired place. # Simple shell wraper to launch pyGTKtalog
# adjust to your needs:
data_dir="/home/gryf/Devel/Python/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" python_intrpreter="/usr/bin/python"
# don't change anything below. exec $python_intrpreter -OO ${path_to_gtktalog_directory}/pygtktalog.py "$@"
current_dir="`pwd`"
cd $data_dir
exec $python_intrpreter -OO pygtktalog.py "$current_dir" "$@"
#exec $python_intrpreter pygtktalog.py "$current_dir" "$@"

View File

@@ -22,6 +22,7 @@
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
import sys import sys
import os
try: try:
import gtk import gtk
except ImportError: except ImportError:
@@ -87,26 +88,25 @@ def check_requirements():
print "want to make\nthumbnails!" print "want to make\nthumbnails!"
return 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(): setup_path()
"""Determine application command line options, return db full pathname""" check_requirements()
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
def main(*args):
"""Main function of module pyGTKtalog"""
from models.m_main import MainModel from models.m_main import MainModel
from ctrls.c_main import MainController from ctrls.c_main import MainController
from views.v_main import MainView from views.v_main import MainView
model = MainModel() model = MainModel()
if args and args[0]: if len(sys.argv) > 1:
model.open(args[0]) model.open(os.path.join(execution_dir, sys.argv[1]))
controler = MainController(model) controler = MainController(model)
view = MainView(controler) view = MainView(controler)
@@ -116,11 +116,3 @@ def main(*args):
model.config.save() model.config.save()
model.cleanup() model.cleanup()
gtk.main_quit gtk.main_quit
pass
return
if __name__ == "__main__":
setup_path()
check_requirements()
main(get_parameters())
pass