mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Use ems not pts for dynammic rescaling
This commit is contained in:
parent
0ba01714d2
commit
e58c5eb50f
@ -222,8 +222,8 @@ class CSSFlattener(object):
|
|||||||
if dyn_rescale is not None:
|
if dyn_rescale is not None:
|
||||||
fsize = self.fmap[_sbase]
|
fsize = self.fmap[_sbase]
|
||||||
fsize *= dyn_rescale
|
fsize *= dyn_rescale
|
||||||
|
cssdict['font-size'] = '%0.5fem'%(fsize/psize)
|
||||||
psize = fsize
|
psize = fsize
|
||||||
cssdict['font-size'] = '%0.5fpt'%(fsize)
|
|
||||||
elif 'font-size' in cssdict or tag == 'body':
|
elif 'font-size' in cssdict or tag == 'body':
|
||||||
fsize = self.fmap[style['font-size']]
|
fsize = self.fmap[style['font-size']]
|
||||||
cssdict['font-size'] = "%0.5fem" % (fsize / psize)
|
cssdict['font-size'] = "%0.5fem" % (fsize / psize)
|
||||||
|
44
src/calibre/gui2/convert/pdf_output.py
Normal file
44
src/calibre/gui2/convert/pdf_output.py
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
__license__ = 'GPL 3'
|
||||||
|
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
|
||||||
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|
||||||
|
from calibre.gui2.convert.pdf_output_ui import Ui_Form
|
||||||
|
from calibre.gui2.convert import Widget
|
||||||
|
from calibre.ebooks.pdf.pageoptions import PAPER_SIZES, ORIENTATIONS
|
||||||
|
from calibre.gui2.widgets import BasicComboModel
|
||||||
|
|
||||||
|
paper_size_model = None
|
||||||
|
orientation_model = None
|
||||||
|
|
||||||
|
class PluginWidget(Widget, Ui_Form):
|
||||||
|
|
||||||
|
TITLE = _('PDF Output')
|
||||||
|
|
||||||
|
def __init__(self, parent, get_option, get_help, db=None, book_id=None):
|
||||||
|
Widget.__init__(self, parent, 'pdf_output', ['paper_size', 'orientation'])
|
||||||
|
self.db, self.book_id = db, book_id
|
||||||
|
self.initialize_options(get_option, get_help, db, book_id)
|
||||||
|
|
||||||
|
default_paper_size = self.opt_paper_size.currentText()
|
||||||
|
default_orientation = self.opt_orientation.currentText()
|
||||||
|
|
||||||
|
global paper_size_model
|
||||||
|
if paper_size_model is None:
|
||||||
|
paper_size_model = BasicComboModel(PAPER_SIZES.keys())
|
||||||
|
self.paper_size_model = paper_size_model
|
||||||
|
self.opt_paper_size.setModel(self.paper_size_model)
|
||||||
|
|
||||||
|
default_index = self.opt_paper_size.findText(default_paper_size)
|
||||||
|
self.opt_paper_size.setCurrentIndex(default_index if default_index != -1 else 0)
|
||||||
|
|
||||||
|
global orientation_model
|
||||||
|
if orientation_model is None:
|
||||||
|
orientation_model = BasicComboModel(ORIENTATIONS.keys())
|
||||||
|
self.orientation_model = orientation_model
|
||||||
|
self.opt_orientation.setModel(self.orientation_model)
|
||||||
|
|
||||||
|
default_index = self.opt_orientation.findText(default_orientation)
|
||||||
|
self.opt_orientation.setCurrentIndex(default_index if default_index != -1 else 0)
|
||||||
|
|
54
src/calibre/gui2/convert/pdf_output.ui
Normal file
54
src/calibre/gui2/convert/pdf_output.ui
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>Form</class>
|
||||||
|
<widget class="QWidget" name="Form">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>300</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Paper Size:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QComboBox" name="opt_paper_size"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Orientation:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QComboBox" name="opt_orientation"/>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>213</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
33
src/calibre/gui2/convert/txt_output.py
Normal file
33
src/calibre/gui2/convert/txt_output.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
__license__ = 'GPL 3'
|
||||||
|
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
|
||||||
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|
||||||
|
from calibre.gui2.convert.txt_output_ui import Ui_Form
|
||||||
|
from calibre.gui2.convert import Widget
|
||||||
|
from calibre.ebooks.txt.writer import TxtNewlines
|
||||||
|
from calibre.gui2.widgets import BasicComboModel
|
||||||
|
|
||||||
|
newline_model = None
|
||||||
|
|
||||||
|
class PluginWidget(Widget, Ui_Form):
|
||||||
|
|
||||||
|
TITLE = _('TXT Output')
|
||||||
|
|
||||||
|
def __init__(self, parent, get_option, get_help, db=None, book_id=None):
|
||||||
|
Widget.__init__(self, parent, 'txt_output', ['newline'])
|
||||||
|
self.db, self.book_id = db, book_id
|
||||||
|
self.initialize_options(get_option, get_help, db, book_id)
|
||||||
|
|
||||||
|
default = self.opt_newline.currentText()
|
||||||
|
|
||||||
|
global newline_model
|
||||||
|
if newline_model is None:
|
||||||
|
newline_model = BasicComboModel(TxtNewlines.NEWLINE_TYPES.keys())
|
||||||
|
self.newline_model = newline_model
|
||||||
|
self.opt_newline.setModel(self.newline_model)
|
||||||
|
|
||||||
|
default_index = self.opt_newline.findText(default)
|
||||||
|
self.opt_newline.setCurrentIndex(default_index if default_index != -1 else 0)
|
||||||
|
|
44
src/calibre/gui2/convert/txt_output.ui
Normal file
44
src/calibre/gui2/convert/txt_output.ui
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>Form</class>
|
||||||
|
<widget class="QWidget" name="Form">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>300</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Newline Type:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QComboBox" name="opt_newline"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>246</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
@ -25,7 +25,7 @@ from calibre.customize.ui import initialized_plugins, is_disabled, enable_plugin
|
|||||||
disable_plugin, customize_plugin, \
|
disable_plugin, customize_plugin, \
|
||||||
plugin_customization, add_plugin, \
|
plugin_customization, add_plugin, \
|
||||||
remove_plugin, input_format_plugins, \
|
remove_plugin, input_format_plugins, \
|
||||||
output_format_plugins
|
output_format_plugins, available_output_formats
|
||||||
from calibre.utils.smtp import config as smtp_prefs
|
from calibre.utils.smtp import config as smtp_prefs
|
||||||
from calibre.gui2.convert.look_and_feel import LookAndFeelWidget
|
from calibre.gui2.convert.look_and_feel import LookAndFeelWidget
|
||||||
from calibre.gui2.convert.page_setup import PageSetupWidget
|
from calibre.gui2.convert.page_setup import PageSetupWidget
|
||||||
@ -391,6 +391,13 @@ class ConfigDialog(QDialog, Ui_Dialog):
|
|||||||
icons = config['toolbar_icon_size']
|
icons = config['toolbar_icon_size']
|
||||||
self.toolbar_button_size.setCurrentIndex(0 if icons == self.ICON_SIZES[0] else 1 if icons == self.ICON_SIZES[1] else 2)
|
self.toolbar_button_size.setCurrentIndex(0 if icons == self.ICON_SIZES[0] else 1 if icons == self.ICON_SIZES[1] else 2)
|
||||||
self.show_toolbar_text.setChecked(config['show_text_in_toolbar'])
|
self.show_toolbar_text.setChecked(config['show_text_in_toolbar'])
|
||||||
|
|
||||||
|
output_formats = sorted(available_output_formats())
|
||||||
|
output_formats.remove('oeb')
|
||||||
|
for f in output_formats:
|
||||||
|
self.output_format.addItem(f)
|
||||||
|
default_index = self.output_format.findText(prefs['output_format'])
|
||||||
|
self.output_format.setCurrentIndex(default_index if default_index != -1 else 0)
|
||||||
|
|
||||||
self.book_exts = sorted(BOOK_EXTENSIONS)
|
self.book_exts = sorted(BOOK_EXTENSIONS)
|
||||||
for ext in self.book_exts:
|
for ext in self.book_exts:
|
||||||
@ -760,6 +767,7 @@ class ConfigDialog(QDialog, Ui_Dialog):
|
|||||||
p = {0:'normal', 1:'high', 2:'low'}[self.priority.currentIndex()]
|
p = {0:'normal', 1:'high', 2:'low'}[self.priority.currentIndex()]
|
||||||
prefs['worker_process_priority'] = p
|
prefs['worker_process_priority'] = p
|
||||||
prefs['read_file_metadata'] = bool(self.pdf_metadata.isChecked())
|
prefs['read_file_metadata'] = bool(self.pdf_metadata.isChecked())
|
||||||
|
prefs['output_format'] = self.output_format.currentText()
|
||||||
config['save_to_disk_single_format'] = self.book_exts[self.single_format.currentIndex()]
|
config['save_to_disk_single_format'] = self.book_exts[self.single_format.currentIndex()]
|
||||||
config['cover_flow_queue_length'] = self.cover_browse.value()
|
config['cover_flow_queue_length'] = self.cover_browse.value()
|
||||||
prefs['language'] = str(self.language.itemData(self.language.currentIndex()).toString())
|
prefs['language'] = str(self.language.itemData(self.language.currentIndex()).toString())
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -136,14 +136,6 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
|||||||
SIGNAL('location_selected(PyQt_PyObject)'),
|
SIGNAL('location_selected(PyQt_PyObject)'),
|
||||||
self.location_selected)
|
self.location_selected)
|
||||||
|
|
||||||
self.output_formats = sorted(['EPUB', 'MOBI', 'LRF'])
|
|
||||||
for f in self.output_formats:
|
|
||||||
self.output_format.addItem(f)
|
|
||||||
self.output_format.setCurrentIndex(self.output_formats.index(
|
|
||||||
prefs['output_format']))
|
|
||||||
self.connect(self.output_format, SIGNAL('currentIndexChanged(QString)'),
|
|
||||||
self.change_output_format, Qt.QueuedConnection)
|
|
||||||
|
|
||||||
####################### Vanity ########################
|
####################### Vanity ########################
|
||||||
self.vanity_template = _('<p>For help visit <a href="http://%s.'
|
self.vanity_template = _('<p>For help visit <a href="http://%s.'
|
||||||
'kovidgoyal.net/user_manual">%s.kovidgoyal.net</a>'
|
'kovidgoyal.net/user_manual">%s.kovidgoyal.net</a>'
|
||||||
@ -266,8 +258,6 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
|||||||
setPopupMode(QToolButton.MenuButtonPopup)
|
setPopupMode(QToolButton.MenuButtonPopup)
|
||||||
self.tool_bar.setContextMenuPolicy(Qt.PreventContextMenu)
|
self.tool_bar.setContextMenuPolicy(Qt.PreventContextMenu)
|
||||||
|
|
||||||
QObject.connect(self.config_button,
|
|
||||||
SIGNAL('clicked(bool)'), self.do_config)
|
|
||||||
self.connect(self.preferences_action, SIGNAL('triggered(bool)'),
|
self.connect(self.preferences_action, SIGNAL('triggered(bool)'),
|
||||||
self.do_config)
|
self.do_config)
|
||||||
self.connect(self.action_preferences, SIGNAL('triggered(bool)'),
|
self.connect(self.action_preferences, SIGNAL('triggered(bool)'),
|
||||||
@ -452,12 +442,6 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
|||||||
window.show()
|
window.show()
|
||||||
setattr(window, '__systray_minimized', False)
|
setattr(window, '__systray_minimized', False)
|
||||||
|
|
||||||
|
|
||||||
def change_output_format(self, x):
|
|
||||||
of = unicode(x).strip()
|
|
||||||
if of != prefs['output_format']:
|
|
||||||
prefs.set('output_format', of)
|
|
||||||
|
|
||||||
def test_server(self, *args):
|
def test_server(self, *args):
|
||||||
if self.content_server.exception is not None:
|
if self.content_server.exception is not None:
|
||||||
error_dialog(self, _('Failed to start content server'),
|
error_dialog(self, _('Failed to start content server'),
|
||||||
@ -1057,7 +1041,7 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
|||||||
rows = [x.row() for x in \
|
rows = [x.row() for x in \
|
||||||
self.library_view.selectionModel().selectedRows()]
|
self.library_view.selectionModel().selectedRows()]
|
||||||
jobs, changed, bad = convert_bulk_ebook(self,
|
jobs, changed, bad = convert_bulk_ebook(self,
|
||||||
self.library_view.model().db, row_ids)
|
self.library_view.model().db, row_ids, out_format=prefs['output_format'])
|
||||||
for func, args, desc, fmt, id, temp_files in jobs:
|
for func, args, desc, fmt, id, temp_files in jobs:
|
||||||
if id not in bad:
|
if id not in bad:
|
||||||
job = self.job_manager.run_job(Dispatcher(self.book_converted),
|
job = self.job_manager.run_job(Dispatcher(self.book_converted),
|
||||||
@ -1076,7 +1060,7 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
|||||||
rows = [x.row() for x in \
|
rows = [x.row() for x in \
|
||||||
self.library_view.selectionModel().selectedRows()]
|
self.library_view.selectionModel().selectedRows()]
|
||||||
jobs, changed, bad = convert_single_ebook(self,
|
jobs, changed, bad = convert_single_ebook(self,
|
||||||
self.library_view.model().db, row_ids)
|
self.library_view.model().db, row_ids, out_format=prefs['output_format'])
|
||||||
for func, args, desc, fmt, id, temp_files in jobs:
|
for func, args, desc, fmt, id, temp_files in jobs:
|
||||||
if id not in bad:
|
if id not in bad:
|
||||||
job = self.job_manager.run_job(Dispatcher(self.book_converted),
|
job = self.job_manager.run_job(Dispatcher(self.book_converted),
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
<ui version="4.0" >
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
<author>Kovid Goyal</author>
|
<author>Kovid Goyal</author>
|
||||||
<class>MainWindow</class>
|
<class>MainWindow</class>
|
||||||
<widget class="QMainWindow" name="MainWindow" >
|
<widget class="QMainWindow" name="MainWindow">
|
||||||
<property name="geometry" >
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
@ -10,331 +11,279 @@
|
|||||||
<height>822</height>
|
<height>822</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy" >
|
<property name="sizePolicy">
|
||||||
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="contextMenuPolicy" >
|
<property name="contextMenuPolicy">
|
||||||
<enum>Qt::NoContextMenu</enum>
|
<enum>Qt::NoContextMenu</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle" >
|
<property name="windowTitle">
|
||||||
<string>__appname__</string>
|
<string>__appname__</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowIcon" >
|
<property name="windowIcon">
|
||||||
<iconset resource="images.qrc" >
|
<iconset resource="images.qrc">
|
||||||
<normaloff>:/library</normaloff>:/library</iconset>
|
<normaloff>:/library</normaloff>:/library</iconset>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="centralwidget" >
|
<widget class="QWidget" name="centralwidget">
|
||||||
<layout class="QGridLayout" name="gridLayout" >
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="0" >
|
<item row="0" column="0">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3" >
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<widget class="LocationView" name="location_view" >
|
<widget class="LocationView" name="location_view">
|
||||||
<property name="sizePolicy" >
|
<property name="sizePolicy">
|
||||||
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize" >
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>16777215</width>
|
<width>16777215</width>
|
||||||
<height>100</height>
|
<height>100</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="verticalScrollBarPolicy" >
|
<property name="verticalScrollBarPolicy">
|
||||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="horizontalScrollBarPolicy" >
|
<property name="horizontalScrollBarPolicy">
|
||||||
<enum>Qt::ScrollBarAsNeeded</enum>
|
<enum>Qt::ScrollBarAsNeeded</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="editTriggers" >
|
<property name="editTriggers">
|
||||||
<set>QAbstractItemView::NoEditTriggers</set>
|
<set>QAbstractItemView::NoEditTriggers</set>
|
||||||
</property>
|
</property>
|
||||||
<property name="tabKeyNavigation" >
|
<property name="tabKeyNavigation">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="showDropIndicator" stdset="0" >
|
<property name="showDropIndicator" stdset="0">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="selectionMode" >
|
<property name="selectionMode">
|
||||||
<enum>QAbstractItemView::NoSelection</enum>
|
<enum>QAbstractItemView::NoSelection</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="selectionBehavior" >
|
<property name="selectionBehavior">
|
||||||
<enum>QAbstractItemView::SelectRows</enum>
|
<enum>QAbstractItemView::SelectRows</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize" >
|
<property name="iconSize">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>40</width>
|
||||||
<height>40</height>
|
<height>40</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="movement" >
|
<property name="movement">
|
||||||
<enum>QListView::Static</enum>
|
<enum>QListView::Static</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="flow" >
|
<property name="flow">
|
||||||
<enum>QListView::LeftToRight</enum>
|
<enum>QListView::LeftToRight</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="gridSize" >
|
<property name="gridSize">
|
||||||
<size>
|
<size>
|
||||||
<width>175</width>
|
<width>175</width>
|
||||||
<height>90</height>
|
<height>90</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="viewMode" >
|
<property name="viewMode">
|
||||||
<enum>QListView::ListMode</enum>
|
<enum>QListView::ListMode</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="wordWrap" >
|
<property name="wordWrap">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="donate_button" >
|
<widget class="QToolButton" name="donate_button">
|
||||||
<property name="cursor" >
|
<property name="cursor">
|
||||||
<cursorShape>PointingHandCursor</cursorShape>
|
<cursorShape>PointingHandCursor</cursorShape>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>...</string>
|
<string>...</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon" >
|
<property name="icon">
|
||||||
<iconset resource="images.qrc" >
|
<iconset resource="images.qrc">
|
||||||
<normaloff>:/images/donate.svg</normaloff>:/images/donate.svg</iconset>
|
<normaloff>:/images/donate.svg</normaloff>:/images/donate.svg</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize" >
|
<property name="iconSize">
|
||||||
<size>
|
<size>
|
||||||
<width>64</width>
|
<width>64</width>
|
||||||
<height>64</height>
|
<height>64</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="autoRaise" >
|
<property name="autoRaise">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3" >
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="vanity" >
|
<widget class="QLabel" name="vanity">
|
||||||
<property name="sizePolicy" >
|
<property name="sizePolicy">
|
||||||
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize" >
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>16777215</width>
|
<width>16777215</width>
|
||||||
<height>90</height>
|
<height>90</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="textFormat" >
|
<property name="textFormat">
|
||||||
<enum>Qt::RichText</enum>
|
<enum>Qt::RichText</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="openExternalLinks" >
|
<property name="openExternalLinks">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2" >
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_2" >
|
|
||||||
<property name="text" >
|
|
||||||
<string>Output:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="output_format" >
|
|
||||||
<property name="toolTip" >
|
|
||||||
<string>Set the output format that is used when converting ebooks and downloading news</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" >
|
<item row="1" column="0">
|
||||||
<layout class="QHBoxLayout" >
|
<layout class="QHBoxLayout">
|
||||||
<property name="spacing" >
|
<property name="spacing">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="margin" >
|
<property name="margin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="advanced_search_button" >
|
<widget class="QToolButton" name="advanced_search_button">
|
||||||
<property name="toolTip" >
|
<property name="toolTip">
|
||||||
<string>Advanced search</string>
|
<string>Advanced search</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>...</string>
|
<string>...</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon" >
|
<property name="icon">
|
||||||
<iconset resource="images.qrc" >
|
<iconset resource="images.qrc">
|
||||||
<normaloff>:/images/search.svg</normaloff>:/images/search.svg</iconset>
|
<normaloff>:/images/search.svg</normaloff>:/images/search.svg</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="shortcut" >
|
<property name="shortcut">
|
||||||
<string>Alt+S</string>
|
<string>Alt+S</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label" >
|
<widget class="QLabel" name="label">
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>&Search:</string>
|
<string>&Search:</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="buddy" >
|
<property name="buddy">
|
||||||
<cstring>search</cstring>
|
<cstring>search</cstring>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="SearchBox" name="search" >
|
<widget class="SearchBox" name="search">
|
||||||
<property name="enabled" >
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy" >
|
<property name="sizePolicy">
|
||||||
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
<horstretch>1</horstretch>
|
<horstretch>1</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="acceptDrops" >
|
<property name="acceptDrops">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip" >
|
<property name="toolTip">
|
||||||
<string>Search the list of books by title or author<br><br>Words separated by spaces are ANDed</string>
|
<string>Search the list of books by title or author<br><br>Words separated by spaces are ANDed</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="whatsThis" >
|
<property name="whatsThis">
|
||||||
<string>Search the list of books by title, author, publisher, tags and comments<br><br>Words separated by spaces are ANDed</string>
|
<string>Search the list of books by title, author, publisher, tags and comments<br><br>Words separated by spaces are ANDed</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="autoFillBackground" >
|
<property name="autoFillBackground">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="frame" >
|
<property name="frame">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="clear_button" >
|
<widget class="QToolButton" name="clear_button">
|
||||||
<property name="toolTip" >
|
<property name="toolTip">
|
||||||
<string>Reset Quick Search</string>
|
<string>Reset Quick Search</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>...</string>
|
<string>...</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon" >
|
<property name="icon">
|
||||||
<iconset resource="images.qrc" >
|
<iconset resource="images.qrc">
|
||||||
<normaloff>:/images/clear_left.svg</normaloff>:/images/clear_left.svg</iconset>
|
<normaloff>:/images/clear_left.svg</normaloff>:/images/clear_left.svg</iconset>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="Line" name="line" >
|
|
||||||
<property name="orientation" >
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer>
|
|
||||||
<property name="orientation" >
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0" >
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="config_button" >
|
|
||||||
<property name="toolTip" >
|
|
||||||
<string>Configuration</string>
|
|
||||||
</property>
|
|
||||||
<property name="text" >
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
<property name="icon" >
|
|
||||||
<iconset resource="images.qrc" >
|
|
||||||
<normaloff>:/images/config.svg</normaloff>:/images/config.svg</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0" >
|
<item row="2" column="0">
|
||||||
<widget class="QStackedWidget" name="stack" >
|
<widget class="QStackedWidget" name="stack">
|
||||||
<property name="sizePolicy" >
|
<property name="sizePolicy">
|
||||||
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
<horstretch>100</horstretch>
|
<horstretch>100</horstretch>
|
||||||
<verstretch>100</verstretch>
|
<verstretch>100</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex" >
|
<property name="currentIndex">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="library" >
|
<widget class="QWidget" name="library">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2" >
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout" >
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout" >
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="match_any" >
|
<widget class="QRadioButton" name="match_any">
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Match any</string>
|
<string>Match any</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="checked" >
|
<property name="checked">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="match_all" >
|
<widget class="QRadioButton" name="match_all">
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Match all</string>
|
<string>Match all</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="checked" >
|
<property name="checked">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="popularity" >
|
<widget class="QCheckBox" name="popularity">
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Sort by &popularity</string>
|
<string>Sort by &popularity</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="TagsView" name="tags_view" >
|
<widget class="TagsView" name="tags_view">
|
||||||
<property name="tabKeyNavigation" >
|
<property name="tabKeyNavigation">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="alternatingRowColors" >
|
<property name="alternatingRowColors">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="animated" >
|
<property name="animated">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="headerHidden" >
|
<property name="headerHidden">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
@ -342,35 +291,35 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="BooksView" name="library_view" >
|
<widget class="BooksView" name="library_view">
|
||||||
<property name="sizePolicy" >
|
<property name="sizePolicy">
|
||||||
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
<horstretch>100</horstretch>
|
<horstretch>100</horstretch>
|
||||||
<verstretch>10</verstretch>
|
<verstretch>10</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="acceptDrops" >
|
<property name="acceptDrops">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="dragEnabled" >
|
<property name="dragEnabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="dragDropOverwriteMode" >
|
<property name="dragDropOverwriteMode">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="dragDropMode" >
|
<property name="dragDropMode">
|
||||||
<enum>QAbstractItemView::DragDrop</enum>
|
<enum>QAbstractItemView::DragDrop</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="alternatingRowColors" >
|
<property name="alternatingRowColors">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="selectionBehavior" >
|
<property name="selectionBehavior">
|
||||||
<enum>QAbstractItemView::SelectRows</enum>
|
<enum>QAbstractItemView::SelectRows</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="showGrid" >
|
<property name="showGrid">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="wordWrap" >
|
<property name="wordWrap">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
@ -379,114 +328,114 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="main_memory" >
|
<widget class="QWidget" name="main_memory">
|
||||||
<layout class="QGridLayout" >
|
<layout class="QGridLayout">
|
||||||
<item row="0" column="0" >
|
<item row="0" column="0">
|
||||||
<widget class="DeviceBooksView" name="memory_view" >
|
<widget class="DeviceBooksView" name="memory_view">
|
||||||
<property name="sizePolicy" >
|
<property name="sizePolicy">
|
||||||
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
<horstretch>100</horstretch>
|
<horstretch>100</horstretch>
|
||||||
<verstretch>10</verstretch>
|
<verstretch>10</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="acceptDrops" >
|
<property name="acceptDrops">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="dragEnabled" >
|
<property name="dragEnabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="dragDropOverwriteMode" >
|
<property name="dragDropOverwriteMode">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="dragDropMode" >
|
<property name="dragDropMode">
|
||||||
<enum>QAbstractItemView::DragDrop</enum>
|
<enum>QAbstractItemView::DragDrop</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="alternatingRowColors" >
|
<property name="alternatingRowColors">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="selectionBehavior" >
|
<property name="selectionBehavior">
|
||||||
<enum>QAbstractItemView::SelectRows</enum>
|
<enum>QAbstractItemView::SelectRows</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="showGrid" >
|
<property name="showGrid">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="wordWrap" >
|
<property name="wordWrap">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="card_a_memory" >
|
<widget class="QWidget" name="card_a_memory">
|
||||||
<layout class="QGridLayout" >
|
<layout class="QGridLayout">
|
||||||
<item row="0" column="0" >
|
<item row="0" column="0">
|
||||||
<widget class="DeviceBooksView" name="card_a_view" >
|
<widget class="DeviceBooksView" name="card_a_view">
|
||||||
<property name="sizePolicy" >
|
<property name="sizePolicy">
|
||||||
<sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
<horstretch>10</horstretch>
|
<horstretch>10</horstretch>
|
||||||
<verstretch>10</verstretch>
|
<verstretch>10</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="acceptDrops" >
|
<property name="acceptDrops">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="dragEnabled" >
|
<property name="dragEnabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="dragDropOverwriteMode" >
|
<property name="dragDropOverwriteMode">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="dragDropMode" >
|
<property name="dragDropMode">
|
||||||
<enum>QAbstractItemView::DragDrop</enum>
|
<enum>QAbstractItemView::DragDrop</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="alternatingRowColors" >
|
<property name="alternatingRowColors">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="selectionBehavior" >
|
<property name="selectionBehavior">
|
||||||
<enum>QAbstractItemView::SelectRows</enum>
|
<enum>QAbstractItemView::SelectRows</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="showGrid" >
|
<property name="showGrid">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="wordWrap" >
|
<property name="wordWrap">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="card_b_memory" >
|
<widget class="QWidget" name="card_b_memory">
|
||||||
<layout class="QGridLayout" >
|
<layout class="QGridLayout">
|
||||||
<item row="0" column="0" >
|
<item row="0" column="0">
|
||||||
<widget class="DeviceBooksView" name="card_b_view" >
|
<widget class="DeviceBooksView" name="card_b_view">
|
||||||
<property name="sizePolicy" >
|
<property name="sizePolicy">
|
||||||
<sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
<horstretch>10</horstretch>
|
<horstretch>10</horstretch>
|
||||||
<verstretch>10</verstretch>
|
<verstretch>10</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="acceptDrops" >
|
<property name="acceptDrops">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="dragEnabled" >
|
<property name="dragEnabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="dragDropOverwriteMode" >
|
<property name="dragDropOverwriteMode">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="dragDropMode" >
|
<property name="dragDropMode">
|
||||||
<enum>QAbstractItemView::DragDrop</enum>
|
<enum>QAbstractItemView::DragDrop</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="alternatingRowColors" >
|
<property name="alternatingRowColors">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="selectionBehavior" >
|
<property name="selectionBehavior">
|
||||||
<enum>QAbstractItemView::SelectRows</enum>
|
<enum>QAbstractItemView::SelectRows</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="showGrid" >
|
<property name="showGrid">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="wordWrap" >
|
<property name="wordWrap">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
@ -497,225 +446,225 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QToolBar" name="tool_bar" >
|
<widget class="QToolBar" name="tool_bar">
|
||||||
<property name="minimumSize" >
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="contextMenuPolicy" >
|
<property name="contextMenuPolicy">
|
||||||
<enum>Qt::PreventContextMenu</enum>
|
<enum>Qt::PreventContextMenu</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="movable" >
|
<property name="movable">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="orientation" >
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize" >
|
<property name="iconSize">
|
||||||
<size>
|
<size>
|
||||||
<width>48</width>
|
<width>48</width>
|
||||||
<height>48</height>
|
<height>48</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolButtonStyle" >
|
<property name="toolButtonStyle">
|
||||||
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="toolBarArea" >
|
<attribute name="toolBarArea">
|
||||||
<enum>TopToolBarArea</enum>
|
<enum>TopToolBarArea</enum>
|
||||||
</attribute>
|
</attribute>
|
||||||
<attribute name="toolBarBreak" >
|
<attribute name="toolBarBreak">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</attribute>
|
</attribute>
|
||||||
<addaction name="action_add" />
|
<addaction name="action_add"/>
|
||||||
<addaction name="action_edit" />
|
<addaction name="action_edit"/>
|
||||||
<addaction name="action_convert" />
|
<addaction name="action_convert"/>
|
||||||
<addaction name="action_view" />
|
<addaction name="action_view"/>
|
||||||
<addaction name="action_news" />
|
<addaction name="action_news"/>
|
||||||
<addaction name="separator" />
|
<addaction name="separator"/>
|
||||||
<addaction name="action_sync" />
|
<addaction name="action_sync"/>
|
||||||
<addaction name="action_save" />
|
<addaction name="action_save"/>
|
||||||
<addaction name="action_del" />
|
<addaction name="action_del"/>
|
||||||
<addaction name="separator" />
|
<addaction name="separator"/>
|
||||||
<addaction name="action_preferences" />
|
<addaction name="action_preferences"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QStatusBar" name="statusBar" >
|
<widget class="QStatusBar" name="statusBar">
|
||||||
<property name="mouseTracking" >
|
<property name="mouseTracking">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<action name="action_add" >
|
<action name="action_add">
|
||||||
<property name="icon" >
|
<property name="icon">
|
||||||
<iconset resource="images.qrc" >
|
<iconset resource="images.qrc">
|
||||||
<normaloff>:/images/add_book.svg</normaloff>:/images/add_book.svg</iconset>
|
<normaloff>:/images/add_book.svg</normaloff>:/images/add_book.svg</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Add books</string>
|
<string>Add books</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="shortcut" >
|
<property name="shortcut">
|
||||||
<string>A</string>
|
<string>A</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="autoRepeat" >
|
<property name="autoRepeat">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_del" >
|
<action name="action_del">
|
||||||
<property name="icon" >
|
<property name="icon">
|
||||||
<iconset resource="images.qrc" >
|
<iconset resource="images.qrc">
|
||||||
<normaloff>:/images/trash.svg</normaloff>:/images/trash.svg</iconset>
|
<normaloff>:/images/trash.svg</normaloff>:/images/trash.svg</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Remove books</string>
|
<string>Remove books</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip" >
|
<property name="toolTip">
|
||||||
<string>Remove books</string>
|
<string>Remove books</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="shortcut" >
|
<property name="shortcut">
|
||||||
<string>Del</string>
|
<string>Del</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_edit" >
|
<action name="action_edit">
|
||||||
<property name="icon" >
|
<property name="icon">
|
||||||
<iconset resource="images.qrc" >
|
<iconset resource="images.qrc">
|
||||||
<normaloff>:/images/edit_input.svg</normaloff>:/images/edit_input.svg</iconset>
|
<normaloff>:/images/edit_input.svg</normaloff>:/images/edit_input.svg</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Edit meta information</string>
|
<string>Edit meta information</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="shortcut" >
|
<property name="shortcut">
|
||||||
<string>E</string>
|
<string>E</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="autoRepeat" >
|
<property name="autoRepeat">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_sync" >
|
<action name="action_sync">
|
||||||
<property name="enabled" >
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon" >
|
<property name="icon">
|
||||||
<iconset resource="images.qrc" >
|
<iconset resource="images.qrc">
|
||||||
<normaloff>:/images/sync.svg</normaloff>:/images/sync.svg</iconset>
|
<normaloff>:/images/sync.svg</normaloff>:/images/sync.svg</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Send to device</string>
|
<string>Send to device</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_save" >
|
<action name="action_save">
|
||||||
<property name="icon" >
|
<property name="icon">
|
||||||
<iconset resource="images.qrc" >
|
<iconset resource="images.qrc">
|
||||||
<normaloff>:/images/save.svg</normaloff>:/images/save.svg</iconset>
|
<normaloff>:/images/save.svg</normaloff>:/images/save.svg</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Save to disk</string>
|
<string>Save to disk</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="shortcut" >
|
<property name="shortcut">
|
||||||
<string>S</string>
|
<string>S</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_news" >
|
<action name="action_news">
|
||||||
<property name="icon" >
|
<property name="icon">
|
||||||
<iconset resource="images.qrc" >
|
<iconset resource="images.qrc">
|
||||||
<normaloff>:/images/news.svg</normaloff>:/images/news.svg</iconset>
|
<normaloff>:/images/news.svg</normaloff>:/images/news.svg</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Fetch news</string>
|
<string>Fetch news</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="shortcut" >
|
<property name="shortcut">
|
||||||
<string>F</string>
|
<string>F</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_convert" >
|
<action name="action_convert">
|
||||||
<property name="icon" >
|
<property name="icon">
|
||||||
<iconset resource="images.qrc" >
|
<iconset resource="images.qrc">
|
||||||
<normaloff>:/images/convert.svg</normaloff>:/images/convert.svg</iconset>
|
<normaloff>:/images/convert.svg</normaloff>:/images/convert.svg</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Convert E-books</string>
|
<string>Convert E-books</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="shortcut" >
|
<property name="shortcut">
|
||||||
<string>C</string>
|
<string>C</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_view" >
|
<action name="action_view">
|
||||||
<property name="icon" >
|
<property name="icon">
|
||||||
<iconset resource="images.qrc" >
|
<iconset resource="images.qrc">
|
||||||
<normaloff>:/images/view.svg</normaloff>:/images/view.svg</iconset>
|
<normaloff>:/images/view.svg</normaloff>:/images/view.svg</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>View</string>
|
<string>View</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="shortcut" >
|
<property name="shortcut">
|
||||||
<string>V</string>
|
<string>V</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_open_containing_folder" >
|
<action name="action_open_containing_folder">
|
||||||
<property name="icon" >
|
<property name="icon">
|
||||||
<iconset resource="images.qrc" >
|
<iconset resource="images.qrc">
|
||||||
<normaloff>:/images/document_open.svg</normaloff>:/images/document_open.svg</iconset>
|
<normaloff>:/images/document_open.svg</normaloff>:/images/document_open.svg</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Open containing folder</string>
|
<string>Open containing folder</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_show_book_details" >
|
<action name="action_show_book_details">
|
||||||
<property name="icon" >
|
<property name="icon">
|
||||||
<iconset resource="images.qrc" >
|
<iconset resource="images.qrc">
|
||||||
<normaloff>:/images/dialog_information.svg</normaloff>:/images/dialog_information.svg</iconset>
|
<normaloff>:/images/dialog_information.svg</normaloff>:/images/dialog_information.svg</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Show book details</string>
|
<string>Show book details</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_books_by_same_author" >
|
<action name="action_books_by_same_author">
|
||||||
<property name="icon" >
|
<property name="icon">
|
||||||
<iconset resource="images.qrc" >
|
<iconset resource="images.qrc">
|
||||||
<normaloff>:/images/user_profile.svg</normaloff>:/images/user_profile.svg</iconset>
|
<normaloff>:/images/user_profile.svg</normaloff>:/images/user_profile.svg</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Books by same author</string>
|
<string>Books by same author</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_books_in_this_series" >
|
<action name="action_books_in_this_series">
|
||||||
<property name="icon" >
|
<property name="icon">
|
||||||
<iconset resource="images.qrc" >
|
<iconset resource="images.qrc">
|
||||||
<normaloff>:/images/books_in_series.svg</normaloff>:/images/books_in_series.svg</iconset>
|
<normaloff>:/images/books_in_series.svg</normaloff>:/images/books_in_series.svg</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Books in this series</string>
|
<string>Books in this series</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_books_by_this_publisher" >
|
<action name="action_books_by_this_publisher">
|
||||||
<property name="icon" >
|
<property name="icon">
|
||||||
<iconset resource="images.qrc" >
|
<iconset resource="images.qrc">
|
||||||
<normaloff>:/images/publisher.png</normaloff>:/images/publisher.png</iconset>
|
<normaloff>:/images/publisher.png</normaloff>:/images/publisher.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Books by this publisher</string>
|
<string>Books by this publisher</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_books_with_the_same_tags" >
|
<action name="action_books_with_the_same_tags">
|
||||||
<property name="icon" >
|
<property name="icon">
|
||||||
<iconset resource="images.qrc" >
|
<iconset resource="images.qrc">
|
||||||
<normaloff>:/images/tags.svg</normaloff>:/images/tags.svg</iconset>
|
<normaloff>:/images/tags.svg</normaloff>:/images/tags.svg</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Books with the same tags</string>
|
<string>Books with the same tags</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_preferences" >
|
<action name="action_preferences">
|
||||||
<property name="icon" >
|
<property name="icon">
|
||||||
<iconset resource="images.qrc" >
|
<iconset resource="images.qrc">
|
||||||
<normaloff>:/images/config.svg</normaloff>:/images/config.svg</iconset>
|
<normaloff>:/images/config.svg</normaloff>:/images/config.svg</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Preferences</string>
|
<string>Preferences</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip" >
|
<property name="toolTip">
|
||||||
<string>Configure calibre</string>
|
<string>Configure calibre</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="shortcut" >
|
<property name="shortcut">
|
||||||
<string>Ctrl+P</string>
|
<string>Ctrl+P</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
@ -748,7 +697,7 @@
|
|||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="images.qrc" />
|
<include location="images.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
@ -757,11 +706,11 @@
|
|||||||
<receiver>search</receiver>
|
<receiver>search</receiver>
|
||||||
<slot>clear()</slot>
|
<slot>clear()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel" >
|
<hint type="sourcelabel">
|
||||||
<x>787</x>
|
<x>787</x>
|
||||||
<y>215</y>
|
<y>215</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel" >
|
<hint type="destinationlabel">
|
||||||
<x>755</x>
|
<x>755</x>
|
||||||
<y>213</y>
|
<y>213</y>
|
||||||
</hint>
|
</hint>
|
||||||
|
@ -72,7 +72,7 @@ def convert_single_ebook(parent, db, book_ids, auto_conversion=False, out_format
|
|||||||
|
|
||||||
return jobs, changed, bad
|
return jobs, changed, bad
|
||||||
|
|
||||||
def convert_bulk_ebook(parent, db, book_ids):
|
def convert_bulk_ebook(parent, db, book_ids, out_format=None):
|
||||||
changed = False
|
changed = False
|
||||||
jobs = []
|
jobs = []
|
||||||
bad = []
|
bad = []
|
||||||
@ -82,7 +82,7 @@ def convert_bulk_ebook(parent, db, book_ids):
|
|||||||
return None, None, None
|
return None, None, None
|
||||||
parent.status_bar.showMessage(_('Starting conversion of %d books') % total, 2000)
|
parent.status_bar.showMessage(_('Starting conversion of %d books') % total, 2000)
|
||||||
|
|
||||||
d = BulkConfig(parent, db)
|
d = BulkConfig(parent, db, out_format)
|
||||||
if d.exec_() != QDialog.Accepted:
|
if d.exec_() != QDialog.Accepted:
|
||||||
return jobs, changed, bad
|
return jobs, changed, bad
|
||||||
|
|
||||||
|
@ -18,9 +18,13 @@ class RecipeInput(InputFormatPlugin):
|
|||||||
file_types = set(['recipe'])
|
file_types = set(['recipe'])
|
||||||
|
|
||||||
recommendations = set([
|
recommendations = set([
|
||||||
('chapter_mark', 'none', OptionRecommendation.HIGH),
|
('chapter', None, OptionRecommendation.HIGH),
|
||||||
('dont_split_on_page_breaks', True, OptionRecommendation.HIGH),
|
('dont_split_on_page_breaks', True, OptionRecommendation.HIGH),
|
||||||
('use_auto_toc', False, OptionRecommendation.HIGH),
|
('use_auto_toc', False, OptionRecommendation.HIGH),
|
||||||
|
('input_encoding', None, OptionRecommendation.HIGH),
|
||||||
|
('input_profile', 'default', OptionRecommendation.HIGH),
|
||||||
|
('page_breaks_before', None, OptionRecommendation.HIGH),
|
||||||
|
('insert_metadata', False, OptionRecommendation.HIGH),
|
||||||
])
|
])
|
||||||
|
|
||||||
options = set([
|
options = set([
|
||||||
|
@ -579,8 +579,9 @@ class BasicNewsRecipe(Recipe):
|
|||||||
|
|
||||||
def feeds2index(self, feeds):
|
def feeds2index(self, feeds):
|
||||||
templ = templates.IndexTemplate()
|
templ = templates.IndexTemplate()
|
||||||
|
css = self.template_css + '\n\n' +(self.extra_css if self.extra_css else '')
|
||||||
return templ.generate(self.title, self.timefmt, feeds,
|
return templ.generate(self.title, self.timefmt, feeds,
|
||||||
extra_css=self.extra_css).render(doctype='xhtml')
|
extra_css=css).render(doctype='xhtml')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def description_limiter(cls, src):
|
def description_limiter(cls, src):
|
||||||
@ -631,8 +632,9 @@ class BasicNewsRecipe(Recipe):
|
|||||||
|
|
||||||
|
|
||||||
templ = templates.FeedTemplate()
|
templ = templates.FeedTemplate()
|
||||||
|
css = self.template_css + '\n\n' +(self.extra_css if self.extra_css else '')
|
||||||
return templ.generate(feed, self.description_limiter,
|
return templ.generate(feed, self.description_limiter,
|
||||||
extra_css=self.extra_css).render(doctype='xhtml')
|
extra_css=css).render(doctype='xhtml')
|
||||||
|
|
||||||
|
|
||||||
def _fetch_article(self, url, dir, f, a, num_of_feeds):
|
def _fetch_article(self, url, dir, f, a, num_of_feeds):
|
||||||
|
@ -5,12 +5,13 @@ import re
|
|||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
class DNAIndia(BasicNewsRecipe):
|
class DNAIndia(BasicNewsRecipe):
|
||||||
|
|
||||||
title = 'DNA India'
|
title = 'DNA India'
|
||||||
description = 'Mumbai news, India news, World news, breaking news'
|
description = 'Mumbai news, India news, World news, breaking news'
|
||||||
__author__ = 'Kovid Goyal'
|
__author__ = 'Kovid Goyal'
|
||||||
language = _('English')
|
language = _('English')
|
||||||
|
encoding = 'cp1252'
|
||||||
|
|
||||||
feeds = [
|
feeds = [
|
||||||
('Top News', 'http://www.dnaindia.com/syndication/rss_topnews.xml'),
|
('Top News', 'http://www.dnaindia.com/syndication/rss_topnews.xml'),
|
||||||
('Popular News', 'http://www.dnaindia.com/syndication/rss_popular.xml'),
|
('Popular News', 'http://www.dnaindia.com/syndication/rss_popular.xml'),
|
||||||
@ -21,21 +22,21 @@ class DNAIndia(BasicNewsRecipe):
|
|||||||
('Money', 'http://www.dnaindia.com/syndication/rss,catid-4.xml'),
|
('Money', 'http://www.dnaindia.com/syndication/rss,catid-4.xml'),
|
||||||
('Sports', 'http://www.dnaindia.com/syndication/rss,catid-6.xml'),
|
('Sports', 'http://www.dnaindia.com/syndication/rss,catid-6.xml'),
|
||||||
('After Hours', 'http://www.dnaindia.com/syndication/rss,catid-7.xml'),
|
('After Hours', 'http://www.dnaindia.com/syndication/rss,catid-7.xml'),
|
||||||
('Digital Life', 'http://www.dnaindia.com/syndication/rss,catid-1089741.xml'),
|
('Digital Life', 'http://www.dnaindia.com/syndication/rss,catid-1089741.xml'),
|
||||||
]
|
]
|
||||||
remove_tags = [{'id':'footer'}, {'class':['bottom', 'categoryHead']}]
|
remove_tags = [{'id':'footer'}, {'class':['bottom', 'categoryHead']}]
|
||||||
|
|
||||||
def print_version(self, url):
|
def print_version(self, url):
|
||||||
match = re.search(r'newsid=(\d+)', url)
|
match = re.search(r'newsid=(\d+)', url)
|
||||||
if not match:
|
if not match:
|
||||||
return url
|
return url
|
||||||
return 'http://www.dnaindia.com/dnaprint.asp?newsid='+match.group(1)
|
return 'http://www.dnaindia.com/dnaprint.asp?newsid='+match.group(1)
|
||||||
|
|
||||||
def postprocess_html(self, soup, first_fetch):
|
def postprocess_html(self, soup, first_fetch):
|
||||||
for t in soup.findAll(['table', 'tr', 'td']):
|
for t in soup.findAll(['table', 'tr', 'td']):
|
||||||
t.name = 'div'
|
t.name = 'div'
|
||||||
|
|
||||||
a = soup.find(href='http://www.3dsyndication.com/')
|
a = soup.find(href='http://www.3dsyndication.com/')
|
||||||
if a is not None:
|
if a is not None:
|
||||||
a.parent.extract()
|
a.parent.extract()
|
||||||
return soup
|
return soup
|
||||||
|
@ -5,7 +5,6 @@ __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
|||||||
import re, string, time
|
import re, string, time
|
||||||
from calibre import strftime
|
from calibre import strftime
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
from calibre.ebooks.BeautifulSoup import BeautifulSoup
|
|
||||||
|
|
||||||
class Newsweek(BasicNewsRecipe):
|
class Newsweek(BasicNewsRecipe):
|
||||||
|
|
||||||
@ -14,15 +13,20 @@ class Newsweek(BasicNewsRecipe):
|
|||||||
description = 'Weekly news and current affairs in the US'
|
description = 'Weekly news and current affairs in the US'
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
language = _('English')
|
language = _('English')
|
||||||
|
|
||||||
extra_css = '#content { font:serif 12pt; }\n.story {font:12pt}\n.HorizontalHeader {font:18pt}\n.deck {font:16pt}'
|
extra_css = '''
|
||||||
|
#content { font-size:normal; font-family: serif }
|
||||||
|
.story { font-size:normal }
|
||||||
|
.HorizontalHeader {font-size:xx-large}
|
||||||
|
.deck {font-size:x-large}
|
||||||
|
'''
|
||||||
keep_only_tags = [dict(name='div', id='content')]
|
keep_only_tags = [dict(name='div', id='content')]
|
||||||
|
|
||||||
remove_tags = [
|
remove_tags = [
|
||||||
dict(name=['script', 'noscript']),
|
dict(name=['script', 'noscript']),
|
||||||
dict(name='div', attrs={'class':['ad', 'SocialLinks', 'SocialLinksDiv',
|
dict(name='div', attrs={'class':['ad', 'SocialLinks', 'SocialLinksDiv',
|
||||||
'channel', 'bot', 'nav', 'top',
|
'channel', 'bot', 'nav', 'top',
|
||||||
'EmailArticleBlock',
|
'EmailArticleBlock',
|
||||||
'comments-and-social-links-wrapper',
|
'comments-and-social-links-wrapper',
|
||||||
'inline-social-links-wrapper',
|
'inline-social-links-wrapper',
|
||||||
'inline-social-links',
|
'inline-social-links',
|
||||||
@ -31,14 +35,14 @@ class Newsweek(BasicNewsRecipe):
|
|||||||
dict(id=['ToolBox', 'EmailMain', 'EmailArticle', 'comment-box',
|
dict(id=['ToolBox', 'EmailMain', 'EmailArticle', 'comment-box',
|
||||||
'nw-comments'])
|
'nw-comments'])
|
||||||
]
|
]
|
||||||
|
|
||||||
recursions = 1
|
recursions = 1
|
||||||
match_regexps = [r'http://www.newsweek.com/id/\S+/page/\d+']
|
match_regexps = [r'http://www.newsweek.com/id/\S+/page/\d+']
|
||||||
|
|
||||||
|
|
||||||
def get_sections(self, soup):
|
def get_sections(self, soup):
|
||||||
sections = []
|
sections = []
|
||||||
|
|
||||||
def process_section(img):
|
def process_section(img):
|
||||||
articles = []
|
articles = []
|
||||||
match = re.search(r'label_([^_.]+)', img['src'])
|
match = re.search(r'label_([^_.]+)', img['src'])
|
||||||
@ -48,25 +52,25 @@ class Newsweek(BasicNewsRecipe):
|
|||||||
if title in ['coverstory', 'more', 'tipsheet']:
|
if title in ['coverstory', 'more', 'tipsheet']:
|
||||||
return
|
return
|
||||||
title = string.capwords(title)
|
title = string.capwords(title)
|
||||||
|
|
||||||
for a in img.parent.findAll('a', href=True):
|
for a in img.parent.findAll('a', href=True):
|
||||||
art, href = a.string, a['href']
|
art, href = a.string, a['href']
|
||||||
if not re.search('\d+$', href) or not art or 'Preview Article' in art:
|
if not re.search('\d+$', href) or not art or 'Preview Article' in art:
|
||||||
continue
|
continue
|
||||||
articles.append({
|
articles.append({
|
||||||
'title':art, 'url':href, 'description':'',
|
'title':art, 'url':href, 'description':'',
|
||||||
'content':'', 'date':''
|
'content':'', 'date':''
|
||||||
})
|
})
|
||||||
sections.append((title, articles))
|
sections.append((title, articles))
|
||||||
|
|
||||||
img.parent.extract()
|
img.parent.extract()
|
||||||
|
|
||||||
for img in soup.findAll(src=re.compile('/label_')):
|
for img in soup.findAll(src=re.compile('/label_')):
|
||||||
process_section(img)
|
process_section(img)
|
||||||
|
|
||||||
return sections
|
return sections
|
||||||
|
|
||||||
|
|
||||||
def parse_index(self):
|
def parse_index(self):
|
||||||
soup = self.get_current_issue()
|
soup = self.get_current_issue()
|
||||||
if not soup:
|
if not soup:
|
||||||
@ -78,10 +82,10 @@ class Newsweek(BasicNewsRecipe):
|
|||||||
if match is not None:
|
if match is not None:
|
||||||
self.timefmt = strftime(' [%d %b, %Y]', time.strptime(match.group(1), '%y%m%d'))
|
self.timefmt = strftime(' [%d %b, %Y]', time.strptime(match.group(1), '%y%m%d'))
|
||||||
self.cover_url = small.replace('coversmall', 'coverlarge')
|
self.cover_url = small.replace('coversmall', 'coverlarge')
|
||||||
|
|
||||||
sections = self.get_sections(soup)
|
sections = self.get_sections(soup)
|
||||||
sections.insert(0, ('Main articles', []))
|
sections.insert(0, ('Main articles', []))
|
||||||
|
|
||||||
for tag in soup.findAll('h5'):
|
for tag in soup.findAll('h5'):
|
||||||
a = tag.find('a', href=True)
|
a = tag.find('a', href=True)
|
||||||
if a is not None:
|
if a is not None:
|
||||||
@ -97,8 +101,8 @@ class Newsweek(BasicNewsRecipe):
|
|||||||
if art['title'] and art['url']:
|
if art['title'] and art['url']:
|
||||||
sections[0][1].append(art)
|
sections[0][1].append(art)
|
||||||
return sections
|
return sections
|
||||||
|
|
||||||
|
|
||||||
def postprocess_html(self, soup, first_fetch):
|
def postprocess_html(self, soup, first_fetch):
|
||||||
divs = list(soup.findAll('div', 'pagination'))
|
divs = list(soup.findAll('div', 'pagination'))
|
||||||
if not divs:
|
if not divs:
|
||||||
@ -106,8 +110,8 @@ class Newsweek(BasicNewsRecipe):
|
|||||||
divs[0].extract()
|
divs[0].extract()
|
||||||
if len(divs) > 1:
|
if len(divs) > 1:
|
||||||
soup.find('body')['style'] = 'page-break-after:avoid'
|
soup.find('body')['style'] = 'page-break-after:avoid'
|
||||||
divs[1].extract()
|
divs[1].extract()
|
||||||
|
|
||||||
h1 = soup.find('h1')
|
h1 = soup.find('h1')
|
||||||
if h1:
|
if h1:
|
||||||
h1.extract()
|
h1.extract()
|
||||||
@ -116,12 +120,12 @@ class Newsweek(BasicNewsRecipe):
|
|||||||
else:
|
else:
|
||||||
soup.find('body')['style'] = 'page-break-before:always; page-break-after:avoid;'
|
soup.find('body')['style'] = 'page-break-before:always; page-break-after:avoid;'
|
||||||
return soup
|
return soup
|
||||||
|
|
||||||
def get_current_issue(self):
|
def get_current_issue(self):
|
||||||
#from urllib2 import urlopen # For some reason mechanize fails
|
#from urllib2 import urlopen # For some reason mechanize fails
|
||||||
#home = urlopen('http://www.newsweek.com').read()
|
#home = urlopen('http://www.newsweek.com').read()
|
||||||
soup = self.index_to_soup('http://www.newsweek.com')#BeautifulSoup(home)
|
soup = self.index_to_soup('http://www.newsweek.com')#BeautifulSoup(home)
|
||||||
img = soup.find('img', alt='Current Magazine')
|
img = soup.find('img', alt='Current Magazine')
|
||||||
if img and img.parent.has_key('href'):
|
if img and img.parent.has_key('href'):
|
||||||
return self.index_to_soup(img.parent['href'])
|
return self.index_to_soup(img.parent['href'])
|
||||||
|
|
||||||
|
@ -53,9 +53,15 @@ def save_soup(soup, target):
|
|||||||
ns = BeautifulSoup('<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />')
|
ns = BeautifulSoup('<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />')
|
||||||
nm = ns.find('meta')
|
nm = ns.find('meta')
|
||||||
metas = soup.findAll('meta', content=True)
|
metas = soup.findAll('meta', content=True)
|
||||||
|
added = False
|
||||||
for meta in metas:
|
for meta in metas:
|
||||||
if 'charset' in meta.get('content', '').lower():
|
if 'charset' in meta.get('content', '').lower():
|
||||||
meta.replaceWith(nm)
|
meta.replaceWith(nm)
|
||||||
|
added = True
|
||||||
|
if not added:
|
||||||
|
head = soup.find('head')
|
||||||
|
if head is not None:
|
||||||
|
head.insert(0, nm)
|
||||||
|
|
||||||
selfdir = os.path.dirname(target)
|
selfdir = os.path.dirname(target)
|
||||||
|
|
||||||
@ -67,6 +73,7 @@ def save_soup(soup, target):
|
|||||||
|
|
||||||
html = unicode(soup)
|
html = unicode(soup)
|
||||||
with open(target, 'wb') as f:
|
with open(target, 'wb') as f:
|
||||||
|
idx = html.find('hoping')
|
||||||
f.write(html.encode('utf-8'))
|
f.write(html.encode('utf-8'))
|
||||||
|
|
||||||
class response(str):
|
class response(str):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user