From 0e6ed92c53696f2d0465a7356bbc69629aa959c7 Mon Sep 17 00:00:00 2001 From: gryf Date: Mon, 4 May 2009 15:48:40 +0000 Subject: [PATCH] Added junk stuff, that belongs to 1.x branch. Mostly it is attempt to add i18n support, rest are files with some temporary ideas. --- README | 36 +++++ extract_gettext.sh | 23 ++++ locale/pl.po | 303 ++++++++++++++++++++++++++++++++++++++++++ locale/pygtktalog.pot | 301 +++++++++++++++++++++++++++++++++++++++++ prefs_prefs.py | 69 ++++++++++ 5 files changed, 732 insertions(+) create mode 100755 extract_gettext.sh create mode 100644 locale/pl.po create mode 100644 locale/pygtktalog.pot create mode 100644 prefs_prefs.py diff --git a/README b/README index 2287392..3592c60 100644 --- a/README +++ b/README @@ -121,6 +121,42 @@ design prevent from deleting any file from media directory (placed in ~/.pygtktalog/images). Functionality for exporting images and corresponding db file is planned. +UPDATE +------ +There can be added images for virtually any item in catalog. Therefore there is +some hazard with image filenames. +After long consideration and experiments I've decided, that images for every +item will have file name as follows: + +sha512("filename" + "file size" + "file modification date").hexdigest() + +for thumbnails: +sha512("filename" + "file size" + "file modification date").hexdigest() + "_t" + +Why that way? There is plenty ways to achive goal to keep thumbnails/data with +applications, however I wanted to keep all things in one place, just to prevent +mixing this up with existing, system specific (Gnome, KDE, maybe MacOS, or any +other which is capable to run this application) own solution. Another reason +lays on catalogs update mechanizm. Imagine, that you have large collection of +movie clips and want to frequently add and/or delete somethong from that. +Changing file names of virtually all files is rather rare case. However moving +them between directories will be much more frequent scenario. And now, if you +want to update things in catalog, program will just check if there is such +generated image from movie filename, size and dates, and then it will just +assign that image to file in catalog. No need to wase time again for generating +movie shots all over again. + +Of course there are some limits for such approach. There is relatively small +possibility to generate two filenames that are the same in two cases: + +1. There are two different files (movies or images) with the same name, same +size and same timestamp in different directories. This could happen in case of +images that have fixed size (like BMP) and then due to image/thumbnail creating +policy only the first one will be placed in images directory. + +2. Another possibility........ fuck. + + BUGS ==== diff --git a/extract_gettext.sh b/extract_gettext.sh new file mode 100755 index 0000000..775525b --- /dev/null +++ b/extract_gettext.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# Create new messages.pot file +blacklist="EXIF.py no_thumb.py" +rm locale/pygtktalog.pot +xgettext -L Python --keyword=_ -o locale/pygtktalog.pot pygtktalog.py + +svn ls | grep '.py$'|grep -v 'pygtktalog.py' |while read file; do + xgettext -j -L Python --keyword=_ -o locale/pygtktalog.pot $file +done + +for dir in src/ctrls src/models src/views src/lib; do + svn ls -R $dir| grep '.py$' |grep -v 'EXIF.py'|grep -v 'no_thumb.py'| while read file; do + xgettext -j -L Python --keyword=_ -o locale/pygtktalog.pot $dir/$file + done +done + +cd locale +msginit --input=pygtktalog.pot --locale=pl_PL.UTF-8 + +# now its time to make .mo files: +mkdir -p pl_PL/LC_MESSAGES +#msgfmt --output-file=pl_PL/LC_MESSAGES/pygtktalog.mo pl.po + diff --git a/locale/pl.po b/locale/pl.po new file mode 100644 index 0000000..960ba30 --- /dev/null +++ b/locale/pl.po @@ -0,0 +1,303 @@ +# Polish translations for PACKAGE package +# Polskie tłumaczenia dla pakietu PACKAGE. +# Copyright (C) 2009 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# , 2009. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2009-01-11 13:51+0100\n" +"PO-Revision-Date: 2009-01-11 13:51+0100\n" +"Last-Translator: \n" +"Language-Team: Polish\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " +"|| n%100>=20) ? 1 : 2);\n" + +#: pygtktalog.py:38 +msgid "" +"WARNING: You'll need Python Imaging Library (PIL), if you want to make " +"thumbnails!" +msgstr "" + +#: src/ctrls/c_main.py:284 +msgid "Delete thumbnails" +msgstr "Usunięcie miniaturek" + +#: src/ctrls/c_main.py:284 +msgid "Delete thumbnails?" +msgstr "Usunąć mniniaturki?" + +#: src/ctrls/c_main.py:285 +msgid "Thumbnails for selected items will be permanently removed from catalog." +msgstr "Miniaturki zaznaczonych obiektów zostaną trwale usunięte z katalogu." + +#: src/ctrls/c_main.py:308 src/ctrls/c_main.py:731 src/ctrls/c_main.py:736 +msgid "Delete images" +msgstr "Usnięcie obrazów" + +#: src/ctrls/c_main.py:308 +msgid "Delete all images?" +msgstr "Usunąć wszystkie obrazy?" + +#: src/ctrls/c_main.py:309 +msgid "All images for selected items will be permanently removed from catalog." +msgstr "Wszystkie obrazy zaznaczonych obiektów zostaną trwale usunięte z katalogu." + +#: src/ctrls/c_main.py:342 +msgid "Image view" +msgstr "Przeglądarka obrazów" + +#: src/ctrls/c_main.py:342 +msgid "No Image" +msgstr "Brak obrazu" + +#: src/ctrls/c_main.py:343 +msgid "Image file does not exist." +msgstr "Plik obrazu nie istnieje." + +#: src/ctrls/c_main.py:491 +msgid "Quit application" +msgstr "Zakończ aplikację" + +#: src/ctrls/c_main.py:492 +msgid "Do you really want to quit?" +msgstr "Czy naprawdę chcesz zakończyć?" + +#: src/ctrls/c_main.py:493 src/ctrls/c_main.py:506 +msgid "Current database is not saved, any changes will be lost." +msgstr "Bieżąca baza nie została zachowana, wszystkie zmiany zostaną utracone." + +#: src/ctrls/c_main.py:504 src/ctrls/c_main.py:638 +msgid "Unsaved data" +msgstr "Niezapisane dane" + +#: src/ctrls/c_main.py:505 +msgid "Do you want to abandon changes?" +msgstr "Czy chcesz porzucić zmiany?" + +#: src/ctrls/c_main.py:541 +msgid "Error mounting device" +msgstr "Błąd w trakcie podłączania urzadzenia" + +#: src/ctrls/c_main.py:542 +#, python-format +msgid "Cannot mount device pointed to %s" +msgstr "Nie można podłączyć urządzenia %s" + +#: src/ctrls/c_main.py:544 +#, python-format +msgid "" +"Last mount message:\n" +"%s" +msgstr "Ostatni komunikat polecenia mount:\n%s" + +#: src/ctrls/c_main.py:616 +msgid "Error writing file" +msgstr "Błąd w zapisie pliku" + +#: src/ctrls/c_main.py:617 +#, python-format +msgid "Cannot write file %s." +msgstr "Nie można zapisać pliku %s." + +#: src/ctrls/c_main.py:639 +msgid "There is not saved database" +msgstr "" + +#: src/ctrls/c_main.py:640 +msgid "Pressing Ok will abandon catalog." +msgstr "" + +#: src/ctrls/c_main.py:664 +msgid "Error opening file" +msgstr "" + +#: src/ctrls/c_main.py:665 +#, python-format +msgid "Cannot open file %s." +msgstr "" + +#: src/ctrls/c_main.py:731 +msgid "No images selected" +msgstr "" + +#: src/ctrls/c_main.py:732 +msgid "You have to select at least one image to delete." +msgstr "" + +#: src/ctrls/c_main.py:736 +msgid "Delete selected images?" +msgstr "" + +#: src/ctrls/c_main.py:737 +msgid "Selected images will be permanently removed from catalog." +msgstr "" + +#: src/ctrls/c_main.py:767 +msgid "Choose directory to save images" +msgstr "" + +#: src/ctrls/c_main.py:792 src/ctrls/c_main.py:798 +msgid "Save images" +msgstr "" + +#: src/ctrls/c_main.py:793 +#, python-format +msgid "%d images was succsefully saved." +msgstr "" + +#: src/ctrls/c_main.py:794 +#, python-format +msgid "" +"Images are placed in directory:\n" +"%s." +msgstr "" + +#: src/ctrls/c_main.py:796 +msgid "Images probably don't have real images - only thumbnails." +msgstr "" + +#: src/ctrls/c_main.py:798 +msgid "No images was saved." +msgstr "" + +#: src/ctrls/c_main.py:807 src/ctrls/c_main.py:811 +msgid "Set thumbnail" +msgstr "" + +#: src/ctrls/c_main.py:807 +msgid "No image selected" +msgstr "" + +#: src/ctrls/c_main.py:808 src/ctrls/c_main.py:812 +msgid "You have to select one image to set as thumbnail." +msgstr "" + +#: src/ctrls/c_main.py:811 +msgid "To many images selected" +msgstr "" + +#: src/ctrls/c_main.py:870 +msgid "Choose export file" +msgstr "" + +#: src/ctrls/c_main.py:1016 src/ctrls/c_main.py:1025 +msgid "Remove tags" +msgstr "" + +#: src/ctrls/c_main.py:1016 src/ctrls/c_main.py:1167 +msgid "No files selected" +msgstr "" + +#: src/ctrls/c_main.py:1017 +msgid "You have to select some files first." +msgstr "" + +#: src/ctrls/c_main.py:1025 +msgid "No tags selected" +msgstr "" + +#: src/ctrls/c_main.py:1026 +msgid "You have to select any tag to remove from files." +msgstr "" + +#: src/ctrls/c_main.py:1052 +msgid "Don't copy images. Generate only thumbnails." +msgstr "" + +#: src/ctrls/c_main.py:1116 +msgid "Delete disc" +msgstr "" + +#: src/ctrls/c_main.py:1116 +msgid "No disc selected" +msgstr "" + +#: src/ctrls/c_main.py:1117 +msgid "You have to select disc first before you can delete it" +msgstr "" + +#: src/ctrls/c_main.py:1123 +#, python-format +msgid "Delete %s" +msgstr "" + +#: src/ctrls/c_main.py:1123 +#, python-format +msgid "Delete %s?" +msgstr "" + +#: src/ctrls/c_main.py:1124 +msgid "Object will be permanently removed." +msgstr "" + +#: src/ctrls/c_main.py:1167 src/ctrls/c_main.py:1172 +msgid "Delete files" +msgstr "" + +#: src/ctrls/c_main.py:1168 +msgid "You have to select at least one file to delete." +msgstr "" + +#: src/ctrls/c_main.py:1172 +msgid "Delete files?" +msgstr "" + +#: src/ctrls/c_main.py:1173 +msgid "" +"Selected files and directories will be permanently\n" +" removed from catalog." +msgstr "" + +#: src/ctrls/c_main.py:1215 +msgid "Delete thumbnail" +msgstr "" + +#: src/ctrls/c_main.py:1215 +msgid "Delete thumbnail?" +msgstr "" + +#: src/ctrls/c_main.py:1216 +msgid "Current thumbnail will be permanently removed from catalog." +msgstr "" + +#: src/ctrls/c_main.py:1364 +msgid "Error ejecting device" +msgstr "" + +#: src/ctrls/c_main.py:1366 +#, python-format +msgid "Cannot eject device pointed to %s" +msgstr "" + +#: src/ctrls/c_main.py:1368 +#, python-format +msgid "" +"Last eject message:\n" +"%s" +msgstr "" + +#: src/ctrls/c_main.py:1372 +msgid "Error unmounting device" +msgstr "" + +#: src/ctrls/c_main.py:1374 +#, python-format +msgid "Cannot unmount device pointed to %s" +msgstr "" + +#: src/ctrls/c_main.py:1376 +#, python-format +msgid "" +"Last umount message:\n" +"%s" +msgstr "" + +#: src/lib/device_helper.py:85 +msgid "Eject program not specified" +msgstr "" diff --git a/locale/pygtktalog.pot b/locale/pygtktalog.pot new file mode 100644 index 0000000..f75ff6f --- /dev/null +++ b/locale/pygtktalog.pot @@ -0,0 +1,301 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2009-01-11 13:51+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: pygtktalog.py:38 +msgid "" +"WARNING: You'll need Python Imaging Library (PIL), if you want to make " +"thumbnails!" +msgstr "" + +#: src/ctrls/c_main.py:284 +msgid "Delete thumbnails" +msgstr "" + +#: src/ctrls/c_main.py:284 +msgid "Delete thumbnails?" +msgstr "" + +#: src/ctrls/c_main.py:285 +msgid "Thumbnails for selected items will be permanently removed from catalog." +msgstr "" + +#: src/ctrls/c_main.py:308 src/ctrls/c_main.py:731 src/ctrls/c_main.py:736 +msgid "Delete images" +msgstr "" + +#: src/ctrls/c_main.py:308 +msgid "Delete all images?" +msgstr "" + +#: src/ctrls/c_main.py:309 +msgid "All images for selected items will be permanently removed from catalog." +msgstr "" + +#: src/ctrls/c_main.py:342 +msgid "Image view" +msgstr "" + +#: src/ctrls/c_main.py:342 +msgid "No Image" +msgstr "" + +#: src/ctrls/c_main.py:343 +msgid "Image file does not exist." +msgstr "" + +#: src/ctrls/c_main.py:491 +msgid "Quit application" +msgstr "" + +#: src/ctrls/c_main.py:492 +msgid "Do you really want to quit?" +msgstr "" + +#: src/ctrls/c_main.py:493 src/ctrls/c_main.py:506 +msgid "Current database is not saved, any changes will be lost." +msgstr "" + +#: src/ctrls/c_main.py:504 src/ctrls/c_main.py:638 +msgid "Unsaved data" +msgstr "" + +#: src/ctrls/c_main.py:505 +msgid "Do you want to abandon changes?" +msgstr "" + +#: src/ctrls/c_main.py:541 +msgid "Error mounting device" +msgstr "" + +#: src/ctrls/c_main.py:542 +#, python-format +msgid "Cannot mount device pointed to %s" +msgstr "" + +#: src/ctrls/c_main.py:544 +#, python-format +msgid "" +"Last mount message:\n" +"%s" +msgstr "" + +#: src/ctrls/c_main.py:616 +msgid "Error writing file" +msgstr "" + +#: src/ctrls/c_main.py:617 +#, python-format +msgid "Cannot write file %s." +msgstr "" + +#: src/ctrls/c_main.py:639 +msgid "There is not saved database" +msgstr "" + +#: src/ctrls/c_main.py:640 +msgid "Pressing Ok will abandon catalog." +msgstr "" + +#: src/ctrls/c_main.py:664 +msgid "Error opening file" +msgstr "" + +#: src/ctrls/c_main.py:665 +#, python-format +msgid "Cannot open file %s." +msgstr "" + +#: src/ctrls/c_main.py:731 +msgid "No images selected" +msgstr "" + +#: src/ctrls/c_main.py:732 +msgid "You have to select at least one image to delete." +msgstr "" + +#: src/ctrls/c_main.py:736 +msgid "Delete selected images?" +msgstr "" + +#: src/ctrls/c_main.py:737 +msgid "Selected images will be permanently removed from catalog." +msgstr "" + +#: src/ctrls/c_main.py:767 +msgid "Choose directory to save images" +msgstr "" + +#: src/ctrls/c_main.py:792 src/ctrls/c_main.py:798 +msgid "Save images" +msgstr "" + +#: src/ctrls/c_main.py:793 +#, python-format +msgid "%d images was succsefully saved." +msgstr "" + +#: src/ctrls/c_main.py:794 +#, python-format +msgid "" +"Images are placed in directory:\n" +"%s." +msgstr "" + +#: src/ctrls/c_main.py:796 +msgid "Images probably don't have real images - only thumbnails." +msgstr "" + +#: src/ctrls/c_main.py:798 +msgid "No images was saved." +msgstr "" + +#: src/ctrls/c_main.py:807 src/ctrls/c_main.py:811 +msgid "Set thumbnail" +msgstr "" + +#: src/ctrls/c_main.py:807 +msgid "No image selected" +msgstr "" + +#: src/ctrls/c_main.py:808 src/ctrls/c_main.py:812 +msgid "You have to select one image to set as thumbnail." +msgstr "" + +#: src/ctrls/c_main.py:811 +msgid "To many images selected" +msgstr "" + +#: src/ctrls/c_main.py:870 +msgid "Choose export file" +msgstr "" + +#: src/ctrls/c_main.py:1016 src/ctrls/c_main.py:1025 +msgid "Remove tags" +msgstr "" + +#: src/ctrls/c_main.py:1016 src/ctrls/c_main.py:1167 +msgid "No files selected" +msgstr "" + +#: src/ctrls/c_main.py:1017 +msgid "You have to select some files first." +msgstr "" + +#: src/ctrls/c_main.py:1025 +msgid "No tags selected" +msgstr "" + +#: src/ctrls/c_main.py:1026 +msgid "You have to select any tag to remove from files." +msgstr "" + +#: src/ctrls/c_main.py:1052 +msgid "Don't copy images. Generate only thumbnails." +msgstr "" + +#: src/ctrls/c_main.py:1116 +msgid "Delete disc" +msgstr "" + +#: src/ctrls/c_main.py:1116 +msgid "No disc selected" +msgstr "" + +#: src/ctrls/c_main.py:1117 +msgid "You have to select disc first before you can delete it" +msgstr "" + +#: src/ctrls/c_main.py:1123 +#, python-format +msgid "Delete %s" +msgstr "" + +#: src/ctrls/c_main.py:1123 +#, python-format +msgid "Delete %s?" +msgstr "" + +#: src/ctrls/c_main.py:1124 +msgid "Object will be permanently removed." +msgstr "" + +#: src/ctrls/c_main.py:1167 src/ctrls/c_main.py:1172 +msgid "Delete files" +msgstr "" + +#: src/ctrls/c_main.py:1168 +msgid "You have to select at least one file to delete." +msgstr "" + +#: src/ctrls/c_main.py:1172 +msgid "Delete files?" +msgstr "" + +#: src/ctrls/c_main.py:1173 +msgid "" +"Selected files and directories will be permanently\n" +" removed from catalog." +msgstr "" + +#: src/ctrls/c_main.py:1215 +msgid "Delete thumbnail" +msgstr "" + +#: src/ctrls/c_main.py:1215 +msgid "Delete thumbnail?" +msgstr "" + +#: src/ctrls/c_main.py:1216 +msgid "Current thumbnail will be permanently removed from catalog." +msgstr "" + +#: src/ctrls/c_main.py:1364 +msgid "Error ejecting device" +msgstr "" + +#: src/ctrls/c_main.py:1366 +#, python-format +msgid "Cannot eject device pointed to %s" +msgstr "" + +#: src/ctrls/c_main.py:1368 +#, python-format +msgid "" +"Last eject message:\n" +"%s" +msgstr "" + +#: src/ctrls/c_main.py:1372 +msgid "Error unmounting device" +msgstr "" + +#: src/ctrls/c_main.py:1374 +#, python-format +msgid "Cannot unmount device pointed to %s" +msgstr "" + +#: src/ctrls/c_main.py:1376 +#, python-format +msgid "" +"Last umount message:\n" +"%s" +msgstr "" + +#: src/lib/device_helper.py:85 +msgid "Eject program not specified" +msgstr "" diff --git a/prefs_prefs.py b/prefs_prefs.py new file mode 100644 index 0000000..24e28c4 --- /dev/null +++ b/prefs_prefs.py @@ -0,0 +1,69 @@ +import pygtk +pygtk.require('2.0') +import gtk + +class PreferencesMgr(gtk.Dialog): + def __init__(self): + gtk.Dialog.__init__(self, 'Preferences', None, + gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, + (gtk.STOCK_OK, gtk.RESPONSE_OK, + gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)) + self.current_frame = None + self.create_gui() + + def create_gui(self): + + model = gtk.ListStore(str, gtk.gdk.Pixbuf) + + pixbuf = gtk.gdk.pixbuf_new_from_file('/usr/share/icons/Buuf/128x128/status/stock_weather-night-clear.png') + model.append(['General', pixbuf]) + + pixbuf = gtk.gdk.pixbuf_new_from_file('/usr/share/icons/Buuf/128x128/stock/generic/stock_alarm.png') + model.append(['Security', pixbuf]) + + self.icon_view = gtk.IconView(model) + self.icon_view.set_text_column(0) + self.icon_view.set_pixbuf_column(1) + self.icon_view.set_orientation(gtk.ORIENTATION_VERTICAL) + self.icon_view.set_selection_mode(gtk.SELECTION_SINGLE) + self.icon_view.connect('selection-changed', self.on_select, model) + self.icon_view.set_columns(1) + self.icon_view.set_item_width(-1) + self.icon_view.set_size_request(72, -1) + + self.content_box = gtk.HBox(False) + self.content_box.pack_start(self.icon_view, fill=True, expand=False) + self.icon_view.select_path((0,)) # select a category, will create frame + self.show_all() + self.vbox.pack_start(self.content_box) + self.resize(640, 480) + self.show_all() + + def on_select(self, icon_view, model=None): + selected = icon_view.get_selected_items() + if len(selected) == 0: return + i = selected[0][0] + category = model[i][0] + if self.current_frame is not None: + self.content_box.remove(self.current_frame) + self.current_frame.destroy() + self.current_frame = None + if category == 'General': + self.current_frame = self.create_general_frame() + elif category == 'Security': + self.current_frame = self.create_security_frame() + self.content_box.pack_end(self.current_frame, fill=True, expand=True) + self.show_all() + + def create_general_frame(self): + frame = gtk.Frame('General') + return frame + + def create_security_frame(self): + frame = gtk.Frame('Security') + return frame + +if __name__ == '__main__': + p = PreferencesMgr() + p.run() + p.destroy()