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

* Clean up.

* Removed cruft.
This commit is contained in:
2007-10-24 17:34:07 +00:00
parent 8fe3893cdd
commit be20420f74
16 changed files with 389 additions and 100 deletions

View File

@@ -1,18 +1,40 @@
# This Python file uses the following encoding: utf-8
#
# Author: Roman 'gryf' Dobosz gryf@elysium.pl
#
# Copyright (C) 2007 by Roman 'gryf' Dobosz
#
# This file is part of pyGTKtalog.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# -------------------------------------------------------------------------
import gtk
def setup_path():
"""Sets up the python include paths to include src"""
import os.path
import sys
if sys.argv[0]:
top_dir = os.path.dirname(os.path.abspath(sys.argv[0]))
sys.path = [os.path.join(top_dir, "src")] + sys.path
pass
"""Sets up the python include paths to include needed directories"""
import os.path; import sys
from src.utils.globals import TOPDIR
sys.path = [os.path.join(TOPDIR, "src")] + sys.path
return
if __name__ == "__main__":
setup_path()
def check_requirements():
"""Checks versions and other requirements"""
import gtkmvc; gtkmvc.require("1.2.0")
import sys
import os
@@ -20,7 +42,7 @@ if __name__ == "__main__":
try:
from models.m_config import ConfigModel
except:
print "Some fundamental files are missing. try runnig pyGTKtalog in his root directory"
print "Some fundamental files are missing. Try runnig pyGTKtalog in his root directory"
sys.exit(1)
conf = ConfigModel()
@@ -37,10 +59,7 @@ if __name__ == "__main__":
import gtk
import gtk.glade
except:
print "You need to install pyGTK or GTKv2 ",
print "or set your PYTHONPATH correctly."
print "try: export PYTHONPATH=",
print "/usr/local/lib/python2.2/site-packages/"
print "You need to install pyGTK v2.10.x or newer.",
sys.exit(1)
try:
@@ -67,14 +86,25 @@ if __name__ == "__main__":
except:
print "You'll need Python Imaging Library (PIL), if you want to make thumbnails"
sys.exit(1)
return
def get_parameters():
"""Determine application command line options, return db full pathname"""
import sys, os
# if we've got two arguments, shell script passed through command line
# options: current path and probably filename of compressed db
if len(sys.argv) > 2:
return os.path.join(sys.argv[1],sys.argv[2])
return False
def main(*args, **kargs):
from models.m_main import MainModel
from controllers.c_main import MainController
from ctrls.c_main import MainController
from views.v_main import MainView
m = MainModel()
if len(sys.argv) > 2:
m.open(os.path.join(sys.argv[1],sys.argv[2]))
if args and args[0]:
m.open(args[0])
c = MainController(m)
v = MainView(c)
@@ -86,3 +116,10 @@ if __name__ == "__main__":
m.cleanup()
gtk.main_quit
pass
return
if __name__ == "__main__":
setup_path()
check_requirements()
main(get_parameters())
pass