From 22c24fbaf78b97aa39141ef87348df1ffbecbbca Mon Sep 17 00:00:00 2001 From: gryf Date: Thu, 6 May 2010 21:14:55 +0200 Subject: [PATCH] - added version for package, - added about signal callback, - use sorting in additional relations in models, - added prototype for about class/function - corrected README for small typos, added links, conformed to be valid reStructuredText --- README | 38 ++++++++++++++++++++++++++-------- pygtktalog/__init__.py | 3 +++ pygtktalog/controllers/main.py | 9 ++++++++ pygtktalog/dbobjects.py | 4 ++-- pygtktalog/dialogs.py | 21 ++++++++++++++++++- 5 files changed, 63 insertions(+), 12 deletions(-) diff --git a/README b/README index dfb773a..3c61030 100644 --- a/README +++ b/README @@ -4,7 +4,7 @@ pyGTKtalog pyGTKtalog is Linux/FreeBSD program for indexing CD/DVD or directories on filesystem. It is similar to `gtktalog `_ or `gwhere `_. There is no coincidence in name of -application, because it's ment to be replacement (in some way) for gtktalog, +application, because it's menat to be replacement (in some way) for gtktalog, which seems to be dead project for years. Current version is 1.9. @@ -24,16 +24,27 @@ FEATURES REQUIREMENTS ------------ -pyGTKtalog was developed using python and following libraries: +pyGTKtalog requires python and following libraries: -* python 2.6 +* `python 2.6 `_ * `pygtk 2.16 `_ -* `pygtkmvc 1.99 `_ +* `pygtkmvc 1.99 `_ * `sqlalchemy 0.6 `_ It may work on other (lower) version of libraries, and it should work with higher versions of libraries. +.. note:: + + Although pygtkmvc is `listed on pypi + `_ it may happen that you + have to download it directly from + `sourceforge `_ page and + install manually. I don't know about pygtk (I've installed it by my + system package manager), but all the others python libraries (sqlalchemy, + paver, nose, coverage) should be installable via `pip + `_ + Optional modules ^^^^^^^^^^^^^^^^ @@ -52,26 +63,30 @@ Programs that are used: * montage, convert from ImageMagick For development process following programs are used: + * `gettext `_ * `intltool `_ * `nose `_ -* `paver `_ +* `coverage `_ +* `paver `__ INSTALATION ----------- You don't have to install it if you don't want to. You can just change current -directory to pyGTKtalog and simply run: +directory to pyGTKtalog and simply run:: -$ paver run + $ paver run 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 bet) + /opt or ~/ is typical bet) + #. copy 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. @@ -86,11 +101,13 @@ function to update DB schema). For version 1.0 there are no features to be done, just bug fixes. There are still minor aims for versions 1.x to be done: + * consolidate popup-menus with edit menu * add popup menu for directly removing tag from tag cloud * implement advanced search For version 2.0: + * Export/Import * Icon grid in files view * command line support: query, adding media to collection etc @@ -101,7 +118,9 @@ For version 2.0: selected * tests * warning about existing image in media directory + Removed: + * filetypes handling (movies, images, archives, documents etc). Now it have common, unified external "plugin" system - simple text output from command line programs. @@ -115,6 +134,7 @@ Removed: * sub lang * release date (from - to) * anidb link/imdb link + Maybe in future versions. Now text file descriptions/notes and tags have to be enough for good and fast information search. diff --git a/pygtktalog/__init__.py b/pygtktalog/__init__.py index 6e94479..450deec 100644 --- a/pygtktalog/__init__.py +++ b/pygtktalog/__init__.py @@ -5,6 +5,9 @@ Author: Roman 'gryf' Dobosz, gryf73@gmail.com Created: 2009-05-05 """ + +__version__ = "1.9.0" + import os import locale import gettext diff --git a/pygtktalog/controllers/main.py b/pygtktalog/controllers/main.py index 88fc3a9..980148c 100644 --- a/pygtktalog/controllers/main.py +++ b/pygtktalog/controllers/main.py @@ -10,12 +10,14 @@ import gtk from gtkmvc import Controller #from pygtktalog.dialogs import yesno +from pygtktalog.dialogs import About from pygtktalog.controllers.discs import DiscsController from pygtktalog.controllers.files import FilesController #from pygtktalog.controllers.details import DetailsController #from pygtktalog.controllers.tags import TagcloudController #from pygtktalog.dialogs import yesno, okcancel, info, warn, error from pygtktalog.logger import get_logger +from pygtktalog import __version__ LOG = get_logger("main controller") @@ -77,3 +79,10 @@ class MainController(Controller): gtk.main_quit() return False + def on_about1_activate(self, widget): + """Show about dialog""" + About("pyGTKtalog", + "%s" % __version__, + "About", + ["Roman 'gryf' Dobosz"], + '') diff --git a/pygtktalog/dbobjects.py b/pygtktalog/dbobjects.py index ccb9b5f..89c3cce 100644 --- a/pygtktalog/dbobjects.py +++ b/pygtktalog/dbobjects.py @@ -31,9 +31,9 @@ class File(Base): children = relation('File', backref=backref('parent', remote_side="File.id"), order_by=[type, filename]) - tags = relation("Tag", secondary=tags_files) + tags = relation("Tag", secondary=tags_files, order_by="Tag.tag") thumbnail = relation("Thumbnail", backref="file") - images = relation("Image", backref="file") + images = relation("Image", backref="file", order_by="Image.filename") def __init__(self, filename=None, path=None, date=None, size=None, ftype=None, src=None): diff --git a/pygtktalog/dialogs.py b/pygtktalog/dialogs.py index fcab0a9..eb08110 100644 --- a/pygtktalog/dialogs.py +++ b/pygtktalog/dialogs.py @@ -15,7 +15,9 @@ class Dialog(object): """ def __init__(self, dialog_type, message, secondary_msg="", title=""): - """Initialize some defaults""" + """ + Initialize some defaults + """ self.dialog = None self.buttons = gtk.BUTTONS_OK self.ok_default = False @@ -54,6 +56,23 @@ class Dialog(object): self.dialog.format_secondary_text(self.secondary_msg) self.dialog.set_title(self.title) +class About(object): + """ + Show About dialog + """ + def __init__(self, name=None, ver="", title="", authors=[],licence=""): + self.dialog = gtk.AboutDialog() + self.dialog.set_title(title) + self.dialog.set_version(ver) + self.dialog.set_license(licence) + self.dialog.set_name(name) + self.dialog.set_authors(authors) + self.dialog.connect('response', + lambda dialog, response: self.dialog.destroy()) + self.dialog.show() + +# TODO: finish this, re-use Dialog class instead of copy/paste of old classes! +# def about(name, version, ) def yesno(message, secondarymsg="", title="", default=False): """Question with yes-no buttons. Returns False on 'no', True on 'yes'"""