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 # 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(): def setup_path():
"""Sets up the python include paths to include src""" """Sets up the python include paths to include needed directories"""
import os.path import os.path; import sys
import sys from src.utils.globals import TOPDIR
sys.path = [os.path.join(TOPDIR, "src")] + sys.path
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
return return
if __name__ == "__main__":
setup_path() def check_requirements():
"""Checks versions and other requirements"""
import gtkmvc; gtkmvc.require("1.2.0")
import sys import sys
import os import os
@@ -20,7 +42,7 @@ if __name__ == "__main__":
try: try:
from models.m_config import ConfigModel from models.m_config import ConfigModel
except: 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) sys.exit(1)
conf = ConfigModel() conf = ConfigModel()
@@ -37,10 +59,7 @@ if __name__ == "__main__":
import gtk import gtk
import gtk.glade import gtk.glade
except: except:
print "You need to install pyGTK or GTKv2 ", print "You need to install pyGTK v2.10.x or newer.",
print "or set your PYTHONPATH correctly."
print "try: export PYTHONPATH=",
print "/usr/local/lib/python2.2/site-packages/"
sys.exit(1) sys.exit(1)
try: try:
@@ -67,14 +86,25 @@ if __name__ == "__main__":
except: except:
print "You'll need Python Imaging Library (PIL), if you want to make thumbnails" print "You'll need Python Imaging Library (PIL), if you want to make thumbnails"
sys.exit(1) 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 models.m_main import MainModel
from controllers.c_main import MainController from ctrls.c_main import MainController
from views.v_main import MainView from views.v_main import MainView
m = MainModel() m = MainModel()
if len(sys.argv) > 2: if args and args[0]:
m.open(os.path.join(sys.argv[1],sys.argv[2])) m.open(args[0])
c = MainController(m) c = MainController(m)
v = MainView(c) v = MainView(c)
@@ -86,3 +116,10 @@ if __name__ == "__main__":
m.cleanup() m.cleanup()
gtk.main_quit gtk.main_quit
pass pass
return
if __name__ == "__main__":
setup_path()
check_requirements()
main(get_parameters())
pass

View File

@@ -1,3 +1,25 @@
# 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
# -------------------------------------------------------------------------
__all__ = ["models", "views", "controllers", "utils"]

View File

@@ -0,0 +1,25 @@
# 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
# -------------------------------------------------------------------------

View File

@@ -1,6 +1,26 @@
# This Python file uses the following encoding: utf-8 # This Python file uses the following encoding: utf-8
import utils._importer #
import utils.globals # 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
# -------------------------------------------------------------------------
from gtkmvc import Controller from gtkmvc import Controller
import gtk import gtk

View File

@@ -1,4 +1,26 @@
# This Python file uses the following encoding: utf-8 # 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
# -------------------------------------------------------------------------
__version__ = "0.7" __version__ = "0.7"
licence = \ licence = \
@@ -7,8 +29,6 @@ GPL v2
http://www.gnu.org/licenses/gpl.txt http://www.gnu.org/licenses/gpl.txt
""" """
import utils._importer
import utils.globals
import os.path import os.path
from utils import deviceHelper from utils import deviceHelper
from gtkmvc import Controller from gtkmvc import Controller
@@ -62,7 +82,7 @@ class MainController(Controller):
# ustaw domyślne właściwości dla poszczególnych widżetów # ustaw domyślne właściwości dla poszczególnych widżetów
self.view['main'].set_title('pyGTKtalog'); self.view['main'].set_title('pyGTKtalog');
self.view['main'].set_icon_list(gtk.gdk.pixbuf_new_from_file("pixmaps/mainicon.png")) # self.view['main'].set_icon_list(gtk.gdk.pixbuf_new_from_file("pixmaps/mainicon.png"))
#self.view['detailplace'].set_sensitive(False) #self.view['detailplace'].set_sensitive(False)
self.view['details'].hide() self.view['details'].hide()
self.view['exifTab'].hide() self.view['exifTab'].hide()
@@ -310,6 +330,9 @@ class MainController(Controller):
return return
def on_update1_activate(self, menu_item): def on_update1_activate(self, menu_item):
"""Update disc under cursor position"""
# determine origin label and filepath
path = self.view['discs'].get_cursor() path = self.view['discs'].get_cursor()
filepath, label = self.model.get_label_and_filepath(path) filepath, label = self.model.get_label_and_filepath(path)

View File

@@ -0,0 +1,25 @@
# 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
# -------------------------------------------------------------------------

View File

@@ -1,6 +1,27 @@
# This Python file uses the following encoding: utf-8 # This Python file uses the following encoding: utf-8
import utils._importer #
import utils.globals # 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
# -------------------------------------------------------------------------
from gtkmvc import Model from gtkmvc import Model
import sys import sys

View File

@@ -1,7 +1,27 @@
# This Python file uses the following encoding: utf-8 # 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 utils._importer
import utils.globals
from gtkmvc.model_mt import ModelMT from gtkmvc.model_mt import ModelMT
try: try:

View File

@@ -1,3 +1,25 @@
# 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
# -------------------------------------------------------------------------
__all__ = ["globals", "_importer"]

View File

@@ -1,44 +0,0 @@
# Author: Roberto Cavada <cavada@irst.itc.it>
#
# Copyright (c) 2006 by Roberto Cavada
#
# pygtkmvc is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# pygtkmvc 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
#
# For more information on pygtkmvc see <http://pygtkmvc.sourceforge.net>
# or email to the author <cavada@irst.itc.it>.
# Please report bugs to <cavada@irst.itc.it>.
# ======================================================================
# This module is used only as a utility to import gtkmvc when not
# installed.
import utils.globals
if __name__ != "__main__":
try: import gtkmvc
except:
import os.path; import sys
rel_path = os.path.join(utils.globals.TOP_DIR, "..")
top_dir = os.path.dirname(os.path.abspath(rel_path))
sys.path = [top_dir] + sys.path
import gtkmvc
pass
gtkmvc.require("1.0.0")
pass

View File

@@ -1,4 +1,26 @@
# This Python file uses the following encoding: utf-8 # 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
# -------------------------------------------------------------------------
""" """
device (cd, dvd) helper device (cd, dvd) helper
""" """

View File

@@ -1,33 +1,39 @@
# Author: Roberto Cavada <cavada@irst.itc.it> # This Python file uses the following encoding: utf-8
# #
# Copyright (c) 2006 by Roberto Cavada # Author: Roman 'gryf' Dobosz gryf@elysium.pl
# #
# pygtkmvc is free software; you can redistribute it and/or # Copyright (C) 2007 by Roman 'gryf' Dobosz
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
# #
# pygtkmvc is distributed in the hope that it will be useful, # 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 # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# Lesser General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU Lesser General Public # You should have received a copy of the GNU General Public License
# License along with this library; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# For more information on pygtkmvc see <http://pygtkmvc.sourceforge.net>
# or email to the author <cavada@irst.itc.it>.
# Please report bugs to <cavada@irst.itc.it>.
# -------------------------------------------------------------------------
import os.path import os.path
import sys import sys
if sys.argv[0]: top_dir = os.path.dirname(os.path.abspath(sys.argv[0])) if sys.argv[0]: top_dir = os.path.dirname(os.path.abspath(sys.argv[0]))
else: top_dir = "." else: top_dir = "."
# A set of global vars # ----------------------------------------------------------------------
TOP_DIR = top_dir TOPDIR = top_dir
GLADE_DIR = os.path.join(TOP_DIR, "glade") RESOURCES_DIR = os.path.join(TOPDIR, "resources")
GLADE_DIR = os.path.join(RESOURCES_DIR, "glade")
STYLES_DIR = os.path.join(RESOURCES_DIR, "styles")
APPL_SHORT_NAME = "pycolector"
APPL_VERSION = (1, 0, 0)
# ----------------------------------------------------------------------

View File

@@ -0,0 +1,25 @@
# 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
# -------------------------------------------------------------------------

View File

@@ -1,9 +1,30 @@
# This Python file uses the following encoding: utf-8 # 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 utils._importer
import utils.globals
from gtkmvc import View from gtkmvc import View
import os.path import os.path
import utils.globals
class ConfigView(View): class ConfigView(View):
"""Preferences window from glade file """ """Preferences window from glade file """

View File

@@ -1,7 +1,30 @@
# This Python file uses the following encoding: utf-8 # 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 import gtk
import os import os
import utils.globals
class Qst(object): class Qst(object):
"""Show simple dialog for questions """Show simple dialog for questions
@@ -92,7 +115,7 @@ class Abt(object):
class InputDiskLabel(object): class InputDiskLabel(object):
"""Sepcific dialog for quering user for a disc label""" """Sepcific dialog for quering user for a disc label"""
def __init__(self, label=""): def __init__(self, label=""):
self.gladefile = "glade/dialogs.glade" self.gladefile = os.path.join(utils.globals.GLADE_DIR, "dialogs.glade")
self.label = "" self.label = ""
if label!= None: if label!= None:
self.label = label self.label = label
@@ -111,7 +134,7 @@ class InputDiskLabel(object):
class PointDirectoryToAdd(object): class PointDirectoryToAdd(object):
"""Sepcific dialog for quering user for selecting directory to add""" """Sepcific dialog for quering user for selecting directory to add"""
def __init__(self,volname='',dirname=''): def __init__(self,volname='',dirname=''):
self.gladefile = "glade/dialogs.glade" self.gladefile = os.path.join(utils.globals.GLADE_DIR, "dialogs.glade")
self.gladexml = gtk.glade.XML(self.gladefile, "addDirDialog") self.gladexml = gtk.glade.XML(self.gladefile, "addDirDialog")
self.volname = self.gladexml.get_widget("dirvolname") self.volname = self.gladexml.get_widget("dirvolname")
self.volname.set_text(volname) self.volname.set_text(volname)

View File

@@ -1,9 +1,30 @@
# This Python file uses the following encoding: utf-8 # 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 utils._importer
import utils.globals
from gtkmvc import View from gtkmvc import View
import os.path import os.path
import utils.globals
class MainView(View): class MainView(View):
"""This handles only the graphical representation of the """This handles only the graphical representation of the