Commit 587d0a25 authored by SVN-Git Migration's avatar SVN-Git Migration

Imported Upstream version 0.2.16

parent 9de10320
include COPYING
include MANIFEST.in
include djvusmooth edit-text
include djvusmooth.py
include doc/*.1
include doc/*.txt
include doc/*.xml
include doc/COPYING
include doc/changelog
include extra/*
include po/*.po
......
Metadata-Version: 1.1
Name: djvusmooth
Version: 0.2.15
Version: 0.2.16
Summary: graphical editor for DjVu
Home-page: http://jwilk.net/software/djvusmooth
Author: Jakub Wilk
......@@ -15,5 +15,7 @@ Classifier: License :: OSI Approved :: GNU General Public License (GPL)
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Topic :: Text Processing
Classifier: Topic :: Multimedia :: Graphics
......@@ -3,14 +3,16 @@
# Copyright © 2008 Jakub Wilk <jwilk@jwilk.net>
#
# This package 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; version 2 dated June, 1991.
# This file is part of djvusmooth.
#
# This package 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.
# djvusmooth is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as published
# by the Free Software Foundation.
#
# djvusmooth 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.
if __name__ != '__main__':
raise ImportError('This module is not intended for import')
......@@ -21,4 +23,4 @@ from djvusmooth.gui.main import Application
application = Application()
application.start(sys.argv[1:])
# vim:ts=4 sw=4 et
# vim:ts=4 sts=4 sw=4 et
......@@ -5,4 +5,4 @@ import lib
sys.modules['djvusmooth'] = lib
# vim:ts=4 sw=4 et
# vim:ts=4 sts=4 sw=4 et
djvusmooth (0.2.16) unstable; urgency=low
* Drop support for Python 2.5.
* Improve error handling.
* Improve the manual page:
+ Use minus sign instead of hyphen in dates.
* Remove python-djvulibre version checks.
This fixes compatiblity with python-djvulibre ≥ 0.5.
Thanks to Daniel Stender for the bug report.
https://bitbucket.org/jwilk/djvusmooth/issues/17
-- Jakub Wilk <jwilk@jwilk.net> Tue, 15 Sep 2015 11:12:06 +0200
djvusmooth (0.2.15) unstable; urgency=low
[ Jakub Wilk ]
......@@ -163,7 +176,7 @@ djvusmooth (0.2.4) unstable; urgency=low
djvusmooth (0.2.3) unstable; urgency=low
* Fix issues with “Overprinted annotation properties” dialog:
+ Allow to turn off the “allow visible” property.
+ Allow turning off the “allow visible” property.
Thanks to Janusz S. Bień for the bug report.
https://bugs.debian.org/574362
+ Disable the “allow visible” checkbox if a hyperlink has no border.
......
......@@ -3,12 +3,12 @@
.\" Title: djvusmooth
.\" Author: Jakub Wilk <jwilk@jwilk.net>
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\" Date: 10/07/2014
.\" Date: 09/15/2015
.\" Manual: djvusmooth manual
.\" Source: djvusmooth 0.2.15
.\" Source: djvusmooth 0.2.16
.\" Language: English
.\"
.TH "DJVUSMOOTH" "1" 2014-10-07 "djvusmooth 0\&.2\&.15" "djvusmooth manual"
.TH "DJVUSMOOTH" "1" 2015\-09\-15 "djvusmooth 0\&.2\&.16" "djvusmooth manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
......
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE refentry PUBLIC '-//OASIS//DTD DocBook XML V4.5//EN' 'http://www.docbook.org/xml/4.5/docbookx.dtd'
<!DOCTYPE refentry PUBLIC '-//OASIS//DTD DocBook XML V4.5//EN' 'http://www.docbook.org/xml/4.5/docbookx.dtd'
[
<!ENTITY p 'djvusmooth'>
<!ENTITY version '0.2.15'>
<!ENTITY version '0.2.16'>
]>
<refentry>
......@@ -110,4 +110,4 @@
</refentry>
<!-- vim:set ts=4 sw=4 tw=120 et: -->
<!-- vim:set ts=4 sts=4 sw=4 tw=120 et: -->
#!/usr/bin/python
# encoding=UTF-8
# Copyright © 2008 Jakub Wilk <jwilk@jwilk.net>
# Copyright © 2008-2015 Jakub Wilk <jwilk@jwilk.net>
#
# This package 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; version 2 dated June, 1991.
# This file is part of djvusmooth.
#
# This package 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.
# djvusmooth is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as published
# by the Free Software Foundation.
#
# djvusmooth 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.
from __future__ import print_function
if __name__ != '__main__':
raise ImportError('This module is not intended for import')
import argparse
import sys
import djvu.decode
import djvu.sexpr
try:
import djvusmooth_importer
except ImportError:
pass
from djvusmooth.text.mangle import import_, export
def do_export(djvu_file_name, page_no):
context = djvu.decode.Context()
document = context.new_document(djvu.decode.FileURI(djvu_file_name))
text = djvu.decode.PageText(document.pages[page_no], details = djvu.decode.TEXT_DETAILS_WORD)
text = djvu.decode.PageText(document.pages[page_no], details=djvu.decode.TEXT_DETAILS_WORD)
text.wait()
export(text.sexpr, sys.stdout)
def do_import(djvu_file_name, page_no):
context = djvu.decode.Context()
document = context.new_document(djvu.decode.FileURI(djvu_file_name))
text = djvu.decode.PageText(document.pages[page_no], details = djvu.decode.TEXT_DETAILS_WORD)
text = djvu.decode.PageText(document.pages[page_no], details=djvu.decode.TEXT_DETAILS_WORD)
text.wait()
print import_(text.sexpr, sys.stdin)
print(import_(text.sexpr, sys.stdin))
def main():
from optparse import OptionParser
oparser = OptionParser(usage = '%prog {--import | --export} --page N')
oparser.add_option('-p', '--page', dest='page_no', action='store', type='int')
oparser.add_option('-x', '--export', dest='action', action='store_const', const=do_export)
oparser.add_option('-i', '--import', dest='action', action='store_const', const=do_import)
options, [djvu_file_name] = oparser.parse_args()
if options.action is None:
oparser.error('No action specified')
if options.page_no is None:
oparser.error('No page specified')
options.action(djvu_file_name, options.page_no - 1)
ap = argparse.ArgumentParser()
ap.add_argument('-p', '--page', dest='page_no', metavar='N', action='store', type=int, required=True)
ag = ap.add_mutually_exclusive_group(required=True)
ag.add_argument('-x', '--export', dest='action', action='store_const', const=do_export)
ag.add_argument('-i', '--import', dest='action', action='store_const', const=do_import)
ap.add_argument('file', metavar='FILE')
options = ap.parse_args()
options.action(options.file, options.page_no - 1)
if __name__ == '__main__':
main()
# vim:ts=4 sw=4 et
# vim:ts=4 sts=4 sw=4 et
__version__ = '0.2.15'
__version__ = '0.2.16'
__author__ = 'Jakub Wilk <jwilk@jwilk.net>'
import sys
if sys.version_info < (2, 5):
raise RuntimeError('Python >= 2.5 is required')
if sys.version_info < (2, 6):
raise RuntimeError('Python >= 2.6 is required')
if sys.version_info >= (3, 0):
raise RuntimeError('Python 2.X is required')
# vim:ts=4 sw=4 et
# vim:ts=4 sts=4 sw=4 et
# encoding=UTF-8
# Copyright © 2009-2012 Jakub Wilk <jwilk@jwilk.net>
# Copyright © 2009-2015 Jakub Wilk <jwilk@jwilk.net>
#
# This package 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; version 2 dated June, 1991.
# This file is part of djvusmooth.
#
# This package 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.
# djvusmooth is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as published
# by the Free Software Foundation.
#
# djvusmooth 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.
import errno
import os
......@@ -38,7 +40,7 @@ class xdg(object):
def save_config_path(xdg, resource):
path = os.path.join(xdg.xdg_config_home, resource)
try:
os.makedirs(path, 0700)
os.makedirs(path, 0o700)
except OSError:
if not os.path.isdir(path):
raise
......@@ -58,7 +60,9 @@ class Config(object):
self._data = {}
self._resource = resource
for directory in xdg.load_config_paths(resource):
self._load(os.path.join(directory, '%s.conf' % resource))
self._load(
os.path.join(directory, '{res}.conf'.format(res=resource))
)
self._legacy_path = legacy_path
if legacy_path is not None:
self._load(legacy_path)
......@@ -88,7 +92,7 @@ class Config(object):
def _load(self, path):
try:
file = open(path, 'r')
except IOError, ex:
except IOError as ex:
if ex.errno == errno.ENOENT:
return
try:
......@@ -107,14 +111,14 @@ class Config(object):
if not self._dirty:
return
directory = xdg.save_config_path(self._resource)
path = os.path.join(directory, '%s.conf' % self._resource)
path = os.path.join(directory, '{res}.conf'.format(res=self._resource))
tmp_path = path + '.tmp'
file = open(tmp_path, 'w')
try:
for key, value in sorted(self._data.iteritems()):
if isinstance(value, unicode):
value = value.encode('UTF-8')
file.write('%s=%s\n' % (key, value))
file.write('{key}={val}\n'.format(key=key, val=value))
file.flush()
os.fsync(file.fileno())
finally:
......@@ -130,9 +134,9 @@ class Config(object):
if self._legacy_path is not None:
try:
os.remove(self._legacy_path)
except OSError, ex:
except OSError as ex:
if ex.errno != errno.ENOENT:
raise
self._dirty = False
# vim:ts=4 sw=4 et
# vim:ts=4 sts=4 sw=4 et
# encoding=UTF-8
# Copyright © 2008-2014 Jakub Wilk <jwilk@jwilk.net>
# Copyright © 2008-2015 Jakub Wilk <jwilk@jwilk.net>
#
# This package 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; version 2 dated June, 1991.
# This file is part of djvusmooth.
#
# This package 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.
# djvusmooth is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as published
# by the Free Software Foundation.
#
# djvusmooth 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.
'''
Checks for djvusmooth dependencies.
'''
DDJVU_API_MIN_VERSION = 26
PYTHON_DJVULIBRE_MIN_VERSION = (0, 1, 4)
djvulibre_path = None
def _check_signals():
......@@ -39,21 +38,16 @@ def _check_djvu():
else:
djvulibre_path = set_dll_search_path()
try:
from djvu.decode import __version__ as djvu_decode_version
except ImportError, ex:
raise ImportError('%s; perhaps python-djvulibre is not installed' % (ex,))
python_djvu_decode_version, ddjvu_api_version = djvu_decode_version.split('/')
if int(ddjvu_api_version) < DDJVU_API_MIN_VERSION:
raise ImportError('DjVuLibre with DDJVU API >= %d is required' % DDJVU_API_MIN_VERSION)
python_djvu_decode_version = map(int, python_djvu_decode_version.split('.'))
if tuple(python_djvu_decode_version) < PYTHON_DJVULIBRE_MIN_VERSION:
raise ImportError('python-djvulibre >= %s is required' % ('.'.join(map(str, PYTHON_DJVULIBRE_MIN_VERSION))))
import djvu.decode
except ImportError as exc:
raise ImportError('{exc}; perhaps python-djvulibre is not installed'.format(exc=exc))
del djvu # quieten pyflakes
def _check_wx():
try:
import wxversion
except ImportError, ex:
raise ImportError('%s; perhaps wxPython is not installed' % (ex,))
except ImportError as exc:
raise ImportError('{exc}; perhaps wxPython is not installed'.format(exc=exc))
for ver in ['2.8-unicode', '3.0']:
try:
wxversion.select(ver, optionsRequired=True)
......@@ -65,14 +59,7 @@ def _check_wx():
raise ImportError('wxPython 3.0 or 2.8 in Unicode mode is required')
_check_signals()
del _check_signals
try:
_check_djvu()
finally:
del _check_djvu
try:
_check_wx()
finally:
del _check_wx
_check_djvu()
_check_wx()
# vim:ts=4 sw=4 et
# vim:ts=4 sts=4 sw=4 et
# encoding=UTF-8
# Copyright © 2008-2011 Jakub Wilk <jwilk@jwilk.net>
# Copyright © 2008-2015 Jakub Wilk <jwilk@jwilk.net>
#
# This package 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; version 2 dated June, 1991.
# This file is part of djvusmooth.
#
# This package 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.
# djvusmooth is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as published
# by the Free Software Foundation.
#
# djvusmooth 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.
import pkgconfig
import os.path
import subprocess
import threading
......@@ -19,10 +20,11 @@ import threading
from djvu.sexpr import Expression, Symbol
djvused_path = None
if os.name =='nt':
if os.name == 'nt':
from . import dependencies
djvused_path = os.path.join(dependencies.djvulibre_path, 'djvused.exe')
else:
from . import pkgconfig
try:
djvulibre_bin_path = os.path.join(pkgconfig.Package('ddjvuapi').variable('exec_prefix'), 'bin')
except (IOError, OSError):
......@@ -33,17 +35,19 @@ if djvused_path is None or not os.path.isfile(djvused_path):
# Let's hope it's within $PATH...
djvused_path = 'djvused'
DJVUSED_PATH = djvused_path
def _djvused_usability_check():
try:
djvused = subprocess.Popen([DJVUSED_PATH], stdout = subprocess.PIPE, stderr = subprocess.PIPE)
djvused = subprocess.Popen(
[djvused_path],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
)
djvused.communicate()
if djvused.returncode == 10:
return
except (IOError, OSError):
pass
raise IOError('%r does not seem to be usable' % DJVUSED_PATH)
raise IOError('{path!r} does not seem to be usable'.format(path=djvused_path))
_djvused_usability_check()
......@@ -52,7 +56,7 @@ class IOError(IOError):
class StreamEditor(object):
def __init__(self, file_name, autosave = False):
def __init__(self, file_name, autosave=False):
self._file_name = file_name
self._commands = []
self._autosave = autosave
......@@ -123,7 +127,7 @@ class StreamEditor(object):
def set_page_title(self, title):
self._add('set-page-title %s' % Expression(title))
def save_page(self, file_name, include = False):
def save_page(self, file_name, include=False):
command = 'save-page'
if include:
command += '-with'
......@@ -139,16 +143,23 @@ class StreamEditor(object):
self._add('save')
def _reader_thread(self, fo, result):
result[0] = fo.read(),
result[0] = fo.read()
def _execute(self, commands, save = False):
args = [DJVUSED_PATH]
def _execute(self, commands, save=False):
args = [djvused_path]
if save:
args += '-s',
args += self._file_name,
djvused = subprocess.Popen(args, stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE)
djvused = subprocess.Popen(args,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
)
result = [None]
reader_thread = threading.Thread(target = self._reader_thread, args = (djvused.stdout, result))
reader_thread = threading.Thread(
target=self._reader_thread,
args=(djvused.stdout, result)
)
reader_thread.setDaemon(True)
reader_thread.start()
stdin = djvused.stdin
......@@ -163,8 +174,8 @@ class StreamEditor(object):
def commit(self):
try:
return self._execute(self._commands, save = self._autosave)
return self._execute(self._commands, save=self._autosave)
finally:
self._commands = []
# vim:ts=4 sw=4 et
# vim:ts=4 sts=4 sw=4 et
# encoding=UTF-8
# Copyright © 2008-2013 Jakub Wilk <jwilk@jwilk.net>
# Copyright © 2008-2015 Jakub Wilk <jwilk@jwilk.net>
#
# This package 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; version 2 dated June, 1991.
# This file is part of djvusmooth.
#
# This package 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.
# djvusmooth is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as published
# by the Free Software Foundation.
#
# djvusmooth 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.
import os.path
import subprocess
......@@ -63,17 +65,17 @@ class temporary_file(object):
class Editor(object):
def __call__(self, file_name):
def __call__(self, path):
raise NotImplementedError
class RunMailcapEditor(object):
def __call__(self, file_name):
file_name = os.path.abspath(file_name)
def __call__(self, path):
path = os.path.abspath(path)
edit = subprocess.Popen(
['edit', 'text/plain:%s' % file_name],
stdin = subprocess.PIPE,
stdout = subprocess.PIPE,
['edit', 'text/plain:{path}'.format(path=path)],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
)
edit.stdin.close()
edit.stdout.close()
......@@ -85,15 +87,15 @@ class CustomEditor(object):
self._command = [command]
self._command += extra_args
def __call__(self, file_name):
file_name = os.path.abspath(file_name)
def __call__(self, path):
path = os.path.abspath(path)
edit = subprocess.Popen(
self._command + [file_name],
stdin = subprocess.PIPE,
stdout = subprocess.PIPE,
self._command + [path],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
)
edit.stdin.close()
edit.stdout.close()
edit.wait()
# vim:ts=4 sw=4 et
# vim:ts=4 sts=4 sw=4 et
......@@ -2,20 +2,22 @@
# Copyright © 2008-2014 Jakub Wilk <jwilk@jwilk.net>
#
# This package 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; version 2 dated June, 1991.
# This file is part of djvusmooth.
#
# This package 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.
# djvusmooth is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as published
# by the Free Software Foundation.
#
# djvusmooth 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.
import wx
class ProgressDialog(wx.ProgressDialog):
def __init__(self, title, message, maximum = 100, parent = None, style = wx.PD_AUTO_HIDE | wx.PD_APP_MODAL):
def __init__(self, title, message, maximum=100, parent=None, style=(wx.PD_AUTO_HIDE | wx.PD_APP_MODAL)):
wx.ProgressDialog.__init__(self, title, message, maximum, parent, style)
self.__max = maximum
self.__n = 0
......@@ -31,8 +33,8 @@ try:
NumberEntryDialog = wx.NumberEntryDialog
except AttributeError:
class NumberEntryDialog(wx.SingleChoiceDialog):
def __init__(self, parent, message, prompt, caption, value, min, max, pos = wx.DefaultPosition):
wx.SingleChoiceDialog.__init__(self, parent = parent, message = message, caption = caption, choices = map(str, xrange(min, max + 1)), pos = pos)
def __init__(self, parent, message, prompt, caption, value, min, max, pos=wx.DefaultPosition):
wx.SingleChoiceDialog.__init__(self, parent=parent, message=message, caption=caption, choices=map(str, xrange(min, max + 1)), pos=pos)
self.SetSelection(value - min)
def GetValue(self):
......@@ -40,4 +42,4 @@ except AttributeError:
__all__ = ['ProgressDialog', 'NumberEntryDialog']
# vim:ts=4 sw=4 et
# vim:ts=4 sts=4 sw=4 et
......@@ -3,14 +3,16 @@
# Copyright © 2008-2014 Jakub Wilk <jwilk@jwilk.net>
# Copyright © 2009 Mateusz Turcza <mturcza@mimuw.edu.pl>
#
# This package 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; version 2 dated June, 1991.
# This file is part of djvusmooth.
#
# This package 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.
# djvusmooth is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as published
# by the Free Software Foundation.
#
# djvusmooth 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.
import wx
......@@ -19,36 +21,35 @@ import djvu.const
from djvusmooth.i18n import _
ZONES_MAP = \
(
(_('all'), djvu.const.TEXT_ZONE_PAGE),
(_('columns'), djvu.const.TEXT_ZONE_COLUMN),
(_('regions'), djvu.const.TEXT_ZONE_REGION),
ZONES_MAP = (
(_('all'), djvu.const.TEXT_ZONE_PAGE),
(_('columns'), djvu.const.TEXT_ZONE_COLUMN),
(_('regions'), djvu.const.TEXT_ZONE_REGION),
(_('paragraphs'), djvu.const.TEXT_ZONE_PARAGRAPH),
(_('lines'), djvu.const.TEXT_ZONE_LINE),
(_('words'), djvu.const.TEXT_ZONE_WORD),
(_('lines'), djvu.const.TEXT_ZONE_LINE),
(_('words'), djvu.const.TEXT_ZONE_WORD),
(_('characters'), djvu.const.TEXT_ZONE_CHARACTER)
)
class FlattenTextDialog(wx.Dialog):
def __init__(self, parent):
wx.Dialog.__init__(self, parent, title = _('Flatten text'))
wx.Dialog.__init__(self, parent, title=_('Flatten text'))
sizer = wx.BoxSizer(wx.VERTICAL)
self._scope_box = wx.RadioBox(self,
label = _('Scope') + ':',
choices = (_('current page'), _('all pages')),
label=(_('Scope') + ':'),
choices=(_('current page'), _('all pages')),
style = wx.RA_HORIZONTAL
)
self._zone_box = wx.RadioBox(self,
label = _('Remove details') + ':',
choices = [label for label, type in ZONES_MAP],
style = wx.RA_SPECIFY_COLS, majorDimension = 2
label=(_('Remove details') + ':'),
choices=[label for label, type in ZONES_MAP],
style=wx.RA_SPECIFY_COLS, majorDimension=2
)
self._zone_box.SetSelection(len(ZONES_MAP) - 1)
for box in self._scope_box, self._zone_box:
sizer.Add(box, 0, wx.EXPAND | wx.ALL, 5)
line = wx.StaticLine(self, -1, style = wx.LI_HORIZONTAL)
line = wx.StaticLine(self, -1, style=wx.LI_HORIZONTAL)
sizer.Add(line, 0, wx.EXPAND | wx.BOTTOM | wx.TOP, 5)
button_sizer = wx.StdDialogButtonSizer()
button = wx.Button(self, wx.ID_OK)
......@@ -69,4 +70,4 @@ class FlattenTextDialog(wx.Dialog):
__all__ = ['FlattenTextDialog']
# vim:ts=4 sw=4 et
# vim:ts=4 sts=4 sw=4 et
......@@ -2,14 +2,16 @@
# Copyright © 2012 Jakub Wilk <jwilk@jwilk.net>
#
# This package 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; version 2 dated June, 1991.
# This file is part of djvusmooth.
#
# This package 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.
# djvusmooth is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as published
# by the Free Software Foundation.
#
# djvusmooth 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