~osomon/phatch/pyexiv2-0.3

« back to all changes in this revision

Viewing changes to phatch/core/ct.py

  • Committer: spe.stani.be at gmail
  • Date: 2010-03-13 01:39:24 UTC
  • mfrom: (1542.1.33 context)
  • Revision ID: spe.stani.be@gmail.com-20100313013924-x46mqp2wd5c81dt4
merge with context branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Phatch - Photo Batch Processor
2
 
# Copyright (C) 2007-2008 www.stani.be
3
 
#
4
 
# This program is free software: you can redistribute it and/or modify
5
 
# it under the terms of the GNU General Public License as published by
6
 
# the Free Software Foundation, either version 3 of the License, or
7
 
# (at your option) any later version.
8
 
#
9
 
# This program is distributed in the hope that it will be useful,
10
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 
# GNU General Public License for more details.
13
 
#
14
 
# You should have received a copy of the GNU General Public License
15
 
# along with this program.  If not, see http://www.gnu.org/licenses/
16
 
 
17
 
# Follows PEP8
18
 
 
19
 
try:
20
 
    _
21
 
except NameError:
22
 
    _ = unicode
23
 
 
24
 
import os
25
 
import sys
26
 
from data import license
27
 
from data.info import INFO
28
 
from lib.reverse_translation import _t
29
 
from config import USER_PATH, USER_DATA_PATH, USER_CONFIG_PATH,\
30
 
    USER_CACHE_PATH, USER_ACTIONLISTS_PATH, USER_ACTIONS_PATH,\
31
 
    USER_BIN_PATH, USER_FONTS_PATH, USER_HIGHLIGHTS_PATH, \
32
 
    USER_LOG_PATH, USER_MASKS_PATH, USER_SETTINGS_PATH, \
33
 
    USER_WATERMARKS_PATH
34
 
 
35
 
#---description
36
 
DESKTOP_ENTRY_COMMENT = _('Easily batch process images and edit metadata')
37
 
DESCRIPTION = _('Photo Batch Processor')
38
 
LICENSE = license.GPL
39
 
CONTACT = '%(author)s <%(author_email)s>' % INFO
40
 
 
41
 
TITLE = '%(name)s' % INFO
42
 
COPYRIGHT = '%(copyright)s (%(url)s)' % INFO
43
 
EXTENSION = '%(extension)s' % INFO
44
 
FRAME_TITLE = '%%s%%s - %s' % TITLE
45
 
SEND_MAIL = 'mailto:%(author_email)s?subject=%%s&body=%%s' % INFO
46
 
 
47
 
PLATFORM = sys.platform
48
 
 
49
 
if PLATFORM.startswith('darwin'):
50
 
    LINUX, WINDOWS, MAC = False, False, True
51
 
    PLATFORM = 'mac'
52
 
elif PLATFORM.startswith('win'):
53
 
    LINUX, WINDOWS, MAC = False, True, False
54
 
    PLATFORM = 'windows'
55
 
else:
56
 
    LINUX, WINDOWS, MAC = True, False, False
57
 
    PLATFORM = 'linux'
58
 
 
59
 
#---fields
60
 
ACTION = 'Action'
61
 
 
62
 
#i8n
63
 
BOOLEANS = [_t('True'), _t('False'), _t('true'), _t('false')]
64
 
UNKNOWN = _("Unsaved Action List")
65
 
WILDCARD = "%s (*%s)|*%s|%s|*" \
66
 
                            % (_("Action Lists"), EXTENSION, EXTENSION, \
67
 
                                _("All Files"))
68
 
ACTION_LIST_DESCRIPTION = _("Describe here the action list.")
69
 
SAVE_ACTION_NEEDED = _("There should be a 'Save' action at the end.")
70
 
 
71
 
 
72
 
#---paths
73
 
if hasattr(sys, "frozen"):
74
 
    FILE = sys.argv[0]
75
 
else:
76
 
    FILE = __file__
77
 
PATH = os.path.dirname(os.path.dirname(FILE))
78
 
PHATCH_ACTIONS_PATH = os.path.join(PATH, 'actions')
79
 
 
80
 
PATH_DELIMITER = ';'
81
 
 
82
 
LABEL_PHATCH_ACTIONLIST = '%s %s %%s...' % (INFO['name'], _('with'))
83
 
LABEL_PHATCH_RECENT = _('%s Recent') % INFO['name']
84
 
LABEL_PHATCH_INSPECTOR = _('Image Inspector')
85
 
 
86
 
INTEGRATE_PHATCH_ACTIONLIST = _("Associate Images with Action List in %s...")
87
 
INTEGRATE_PHATCH_RECENT = \
88
 
                    _("Associate Images with Recent Action Lists in %s...")
89
 
INTEGRATE_PHATCH_INSPECTOR = \
90
 
                    _("Associate Images with Image Inspector in %s...")
91
 
INTEGRATE_PHATCH_REMOVE = _("Remove Association from %s...")
92
 
 
93
 
DROPLET_PHATCH_ACTIONLIST = _("&Action List Droplet...")
94
 
DROPLET_PHATCH_RECENT = _("&Recent Droplet...")
95
 
DROPLET_PHATCH_INSPECTOR = _("&Image Inspector Droplet...")
96
 
 
97
 
#---droplets
98
 
if sys.platform.startswith('win'):
99
 
    COMMAND_PATH = 'pythonw.exe'
100
 
    COMMAND_ARGUMENTS_PREFIX = '"%s" ' % os.path.abspath(sys.argv[0])
101
 
    COMMAND_FILE = ''
102
 
else:
103
 
    COMMAND_PATH = 'phatch'
104
 
    COMMAND_ARGUMENTS_PREFIX = ''
105
 
    COMMAND_FILE = '%F'
106
 
 
107
 
#xubuntu doesn't handle %U
108
 
COMMAND_ARGUMENTS = {
109
 
                                'DROP': '-d "%s"',
110
 
                                'RECENT': '-d recent',
111
 
                                'INSPECTOR': '-n',
112
 
}
113
 
for key, value in COMMAND_ARGUMENTS.items():
114
 
    new_value = COMMAND_ARGUMENTS_PREFIX + value
115
 
    if COMMAND_FILE:
116
 
        if '%' in new_value:
117
 
            new_value += ' ' + COMMAND_FILE.replace('%', '%%')
118
 
        else:
119
 
            new_value += ' ' + COMMAND_FILE
120
 
    COMMAND_ARGUMENTS[key] = new_value
121
 
 
122
 
COMMAND = {}
123
 
for key, value in COMMAND_ARGUMENTS.items():
124
 
    COMMAND[key] = COMMAND_PATH + ' ' + COMMAND_ARGUMENTS[key]
125
 
 
126
 
##COMMAND_DROP = 'phatch -d "%s" %%F'
127
 
##COMMAND_RECENT = 'phatch -d recent %F'
128
 
##COMMAND_INSPECTOR = 'phatch -n %F'
129
 
 
130
 
DESCRIPTION_RECENT = _('Batch process with recent action lists')
131
 
DESCRIPTION_INSPECTOR = _('Inspect EXIF &amp; IPTC tags')