mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Merge from trunk
This commit is contained in:
commit
3a6b6bd508
@ -1,10 +1,10 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__author__ = 'iusvar'
|
__copyright__ = 'iusvar'
|
||||||
__description__ = 'Pubblico giornale'
|
__description__ = 'Pubblico giornale'
|
||||||
|
|
||||||
'''
|
'''
|
||||||
http://pubblicogiornale.it/
|
[url]http://pubblicogiornale.it/[/url]
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
@ -16,6 +16,14 @@ class Pubblicogiornale(BasicNewsRecipe):
|
|||||||
publisher = 'PUBBLICO EDIZIONI Srl'
|
publisher = 'PUBBLICO EDIZIONI Srl'
|
||||||
category = 'News'
|
category = 'News'
|
||||||
language = 'it'
|
language = 'it'
|
||||||
__author__ = 'iusvar'
|
__author__ = 'iusvar'
|
||||||
|
|
||||||
feeds = [(u'Pubblico giornale', u'http://pubblicogiornale.it/feed/')]
|
feeds = [
|
||||||
|
(u'Politica', u'http://pubblicogiornale.it/category/politica/feed/'),
|
||||||
|
(u'Mondo', u'http://pubblicogiornale.it/category/mondo/feed/'),
|
||||||
|
(u'Economia', u'http://pubblicogiornale.it/category/economia-2/feed/'),
|
||||||
|
(u'Sport', u'http://pubblicogiornale.it/category/sport-2/feed/'),
|
||||||
|
(u'Cultura', u'http://pubblicogiornale.it/category/cultura-2/feed/'),
|
||||||
|
(u'Rete', u'http://pubblicogiornale.it/category/rete/feed/'),
|
||||||
|
(u'Illustrazioni',u'http://pubblicogiornale.it/category/illustrazioni/feed/')
|
||||||
|
]
|
||||||
|
@ -55,6 +55,10 @@ def config(defaults=None):
|
|||||||
'0 and 1.'))
|
'0 and 1.'))
|
||||||
c.add_opt('fullscreen_clock', default=False, action='store_true',
|
c.add_opt('fullscreen_clock', default=False, action='store_true',
|
||||||
help=_('Show a clock in fullscreen mode.'))
|
help=_('Show a clock in fullscreen mode.'))
|
||||||
|
c.add_opt('fullscreen_pos', default=False, action='store_true',
|
||||||
|
help=_('Show reading position in fullscreen mode.'))
|
||||||
|
c.add_opt('fullscreen_scrollbar', default=True, action='store_false',
|
||||||
|
help=_('Show the scrollbar in fullscreen mode.'))
|
||||||
c.add_opt('cols_per_screen', default=1)
|
c.add_opt('cols_per_screen', default=1)
|
||||||
c.add_opt('use_book_margins', default=False, action='store_true')
|
c.add_opt('use_book_margins', default=False, action='store_true')
|
||||||
c.add_opt('top_margin', default=20)
|
c.add_opt('top_margin', default=20)
|
||||||
@ -201,6 +205,8 @@ class ConfigDialog(QDialog, Ui_Dialog):
|
|||||||
self.hyphenate_default_lang.setEnabled(opts.hyphenate)
|
self.hyphenate_default_lang.setEnabled(opts.hyphenate)
|
||||||
self.opt_fit_images.setChecked(opts.fit_images)
|
self.opt_fit_images.setChecked(opts.fit_images)
|
||||||
self.opt_fullscreen_clock.setChecked(opts.fullscreen_clock)
|
self.opt_fullscreen_clock.setChecked(opts.fullscreen_clock)
|
||||||
|
self.opt_fullscreen_scrollbar.setChecked(opts.fullscreen_scrollbar)
|
||||||
|
self.opt_fullscreen_pos.setChecked(opts.fullscreen_pos)
|
||||||
self.opt_cols_per_screen.setValue(opts.cols_per_screen)
|
self.opt_cols_per_screen.setValue(opts.cols_per_screen)
|
||||||
self.opt_override_book_margins.setChecked(not opts.use_book_margins)
|
self.opt_override_book_margins.setChecked(not opts.use_book_margins)
|
||||||
for x in ('top', 'bottom', 'side'):
|
for x in ('top', 'bottom', 'side'):
|
||||||
@ -271,6 +277,8 @@ class ConfigDialog(QDialog, Ui_Dialog):
|
|||||||
c.set('line_scrolling_stops_on_pagebreaks',
|
c.set('line_scrolling_stops_on_pagebreaks',
|
||||||
self.opt_line_scrolling_stops_on_pagebreaks.isChecked())
|
self.opt_line_scrolling_stops_on_pagebreaks.isChecked())
|
||||||
c.set('fullscreen_clock', self.opt_fullscreen_clock.isChecked())
|
c.set('fullscreen_clock', self.opt_fullscreen_clock.isChecked())
|
||||||
|
c.set('fullscreen_pos', self.opt_fullscreen_pos.isChecked())
|
||||||
|
c.set('fullscreen_scrollbar', self.opt_fullscreen_scrollbar.isChecked())
|
||||||
c.set('cols_per_screen', int(self.opt_cols_per_screen.value()))
|
c.set('cols_per_screen', int(self.opt_cols_per_screen.value()))
|
||||||
c.set('use_book_margins', not
|
c.set('use_book_margins', not
|
||||||
self.opt_override_book_margins.isChecked())
|
self.opt_override_book_margins.isChecked())
|
||||||
|
@ -347,8 +347,8 @@ QToolBox::tab:hover {
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>313</width>
|
<width>811</width>
|
||||||
<height>64</height>
|
<height>352</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="label">
|
<attribute name="label">
|
||||||
@ -388,6 +388,20 @@ QToolBox::tab:hover {
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="3" column="0" colspan="2">
|
||||||
|
<widget class="QCheckBox" name="opt_fullscreen_pos">
|
||||||
|
<property name="text">
|
||||||
|
<string>Show reading &position in full screen mode</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0" colspan="2">
|
||||||
|
<widget class="QCheckBox" name="opt_fullscreen_scrollbar">
|
||||||
|
<property name="text">
|
||||||
|
<string>Show &scrollbar in full screen mode</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="page_6">
|
<widget class="QWidget" name="page_6">
|
||||||
|
@ -143,6 +143,8 @@ class Document(QWebPage): # {{{
|
|||||||
# Leave some space for the scrollbar and some border
|
# Leave some space for the scrollbar and some border
|
||||||
self.max_fs_width = min(opts.max_fs_width, screen_width-50)
|
self.max_fs_width = min(opts.max_fs_width, screen_width-50)
|
||||||
self.fullscreen_clock = opts.fullscreen_clock
|
self.fullscreen_clock = opts.fullscreen_clock
|
||||||
|
self.fullscreen_scrollbar = opts.fullscreen_scrollbar
|
||||||
|
self.fullscreen_pos = opts.fullscreen_pos
|
||||||
self.use_book_margins = opts.use_book_margins
|
self.use_book_margins = opts.use_book_margins
|
||||||
self.cols_per_screen = opts.cols_per_screen
|
self.cols_per_screen = opts.cols_per_screen
|
||||||
self.side_margin = opts.side_margin
|
self.side_margin = opts.side_margin
|
||||||
|
@ -112,6 +112,8 @@ class Metadata(QLabel):
|
|||||||
|
|
||||||
class DoubleSpinBox(QDoubleSpinBox):
|
class DoubleSpinBox(QDoubleSpinBox):
|
||||||
|
|
||||||
|
value_changed = pyqtSignal(object, object)
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
QDoubleSpinBox.__init__(self, *args, **kwargs)
|
QDoubleSpinBox.__init__(self, *args, **kwargs)
|
||||||
self.tt = _('Position in book')
|
self.tt = _('Position in book')
|
||||||
@ -123,6 +125,7 @@ class DoubleSpinBox(QDoubleSpinBox):
|
|||||||
self.setToolTip(self.tt +
|
self.setToolTip(self.tt +
|
||||||
' [{0:.0%}]'.format(float(val)/self.maximum()))
|
' [{0:.0%}]'.format(float(val)/self.maximum()))
|
||||||
self.blockSignals(False)
|
self.blockSignals(False)
|
||||||
|
self.value_changed.emit(self.value(), self.maximum())
|
||||||
|
|
||||||
class Reference(QLineEdit):
|
class Reference(QLineEdit):
|
||||||
|
|
||||||
@ -185,6 +188,7 @@ class EbookViewer(MainWindow, Ui_EbookViewer):
|
|||||||
self.pos.setDecimals(1)
|
self.pos.setDecimals(1)
|
||||||
self.pos.setSuffix('/'+_('Unknown')+' ')
|
self.pos.setSuffix('/'+_('Unknown')+' ')
|
||||||
self.pos.setMinimum(1.)
|
self.pos.setMinimum(1.)
|
||||||
|
self.pos.value_changed.connect(self.update_pos_label)
|
||||||
self.splitter.setCollapsible(0, False)
|
self.splitter.setCollapsible(0, False)
|
||||||
self.splitter.setCollapsible(1, False)
|
self.splitter.setCollapsible(1, False)
|
||||||
self.pos.setMinimumWidth(150)
|
self.pos.setMinimumWidth(150)
|
||||||
@ -302,9 +306,9 @@ class EbookViewer(MainWindow, Ui_EbookViewer):
|
|||||||
self.clock_label = QLabel('99:99', self)
|
self.clock_label = QLabel('99:99', self)
|
||||||
self.clock_label.setVisible(False)
|
self.clock_label.setVisible(False)
|
||||||
self.clock_label.setFocusPolicy(Qt.NoFocus)
|
self.clock_label.setFocusPolicy(Qt.NoFocus)
|
||||||
self.clock_label_style = '''
|
self.info_label_style = '''
|
||||||
QLabel {
|
QLabel {
|
||||||
text-align: right;
|
text-align: center;
|
||||||
border-width: 1px;
|
border-width: 1px;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
@ -314,6 +318,10 @@ class EbookViewer(MainWindow, Ui_EbookViewer):
|
|||||||
font-size: larger;
|
font-size: larger;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
}'''
|
}'''
|
||||||
|
self.original_frame_style = self.frame.frameStyle()
|
||||||
|
self.pos_label = QLabel('2000/4000', self)
|
||||||
|
self.pos_label.setVisible(False)
|
||||||
|
self.pos_label.setFocusPolicy(Qt.NoFocus)
|
||||||
self.clock_timer = QTimer(self)
|
self.clock_timer = QTimer(self)
|
||||||
self.clock_timer.timeout.connect(self.update_clock)
|
self.clock_timer.timeout.connect(self.update_clock)
|
||||||
self.esc_full_screen_action = a = QAction(self)
|
self.esc_full_screen_action = a = QAction(self)
|
||||||
@ -480,11 +488,15 @@ class EbookViewer(MainWindow, Ui_EbookViewer):
|
|||||||
self.window_mode_changed = 'fullscreen'
|
self.window_mode_changed = 'fullscreen'
|
||||||
self.tool_bar.setVisible(False)
|
self.tool_bar.setVisible(False)
|
||||||
self.tool_bar2.setVisible(False)
|
self.tool_bar2.setVisible(False)
|
||||||
|
if not self.view.document.fullscreen_scrollbar:
|
||||||
|
self.vertical_scrollbar.setVisible(False)
|
||||||
|
self.frame.layout().setSpacing(0)
|
||||||
self._original_frame_margins = (
|
self._original_frame_margins = (
|
||||||
self.centralwidget.layout().contentsMargins(),
|
self.centralwidget.layout().contentsMargins(),
|
||||||
self.frame.layout().contentsMargins())
|
self.frame.layout().contentsMargins())
|
||||||
self.frame.layout().setContentsMargins(0, 0, 0, 0)
|
self.frame.layout().setContentsMargins(0, 0, 0, 0)
|
||||||
self.centralwidget.layout().setContentsMargins(0, 0, 0, 0)
|
self.centralwidget.layout().setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.frame.setFrameStyle(self.frame.NoFrame|self.frame.Plain)
|
||||||
|
|
||||||
super(EbookViewer, self).showFullScreen()
|
super(EbookViewer, self).showFullScreen()
|
||||||
|
|
||||||
@ -505,27 +517,54 @@ class EbookViewer(MainWindow, Ui_EbookViewer):
|
|||||||
self.view.document.switch_to_fullscreen_mode()
|
self.view.document.switch_to_fullscreen_mode()
|
||||||
if self.view.document.fullscreen_clock:
|
if self.view.document.fullscreen_clock:
|
||||||
self.show_clock()
|
self.show_clock()
|
||||||
|
if self.view.document.fullscreen_pos:
|
||||||
|
self.show_pos_label()
|
||||||
|
|
||||||
def show_clock(self):
|
def show_clock(self):
|
||||||
self.clock_label.setVisible(True)
|
self.clock_label.setVisible(True)
|
||||||
self.clock_label.setText('99:99 AA')
|
self.clock_label.setText(QTime(22, 33,
|
||||||
|
33).toString(Qt.SystemLocaleShortDate))
|
||||||
self.clock_timer.start(1000)
|
self.clock_timer.start(1000)
|
||||||
self.clock_label.setStyleSheet(self.clock_label_style%(
|
self.clock_label.setStyleSheet(self.info_label_style%(
|
||||||
'rgba(0, 0, 0, 0)', self.view.document.colors()[1]))
|
'rgba(0, 0, 0, 0)', self.view.document.colors()[1]))
|
||||||
self.clock_label.resize(self.clock_label.sizeHint())
|
self.clock_label.resize(self.clock_label.sizeHint())
|
||||||
sw = QApplication.desktop().screenGeometry(self.view)
|
sw = QApplication.desktop().screenGeometry(self.view)
|
||||||
self.clock_label.move(sw.width() - self.vertical_scrollbar.width() - 15
|
vswidth = (self.vertical_scrollbar.width() if
|
||||||
|
self.vertical_scrollbar.isVisible() else 0)
|
||||||
|
self.clock_label.move(sw.width() - vswidth - 15
|
||||||
- self.clock_label.width(), sw.height() -
|
- self.clock_label.width(), sw.height() -
|
||||||
self.clock_label.height()-10)
|
self.clock_label.height()-10)
|
||||||
self.update_clock()
|
self.update_clock()
|
||||||
|
|
||||||
|
def show_pos_label(self):
|
||||||
|
self.pos_label.setVisible(True)
|
||||||
|
self.pos_label.setStyleSheet(self.info_label_style%(
|
||||||
|
'rgba(0, 0, 0, 0)', self.view.document.colors()[1]))
|
||||||
|
sw = QApplication.desktop().screenGeometry(self.view)
|
||||||
|
self.pos_label.move(15, sw.height() - self.pos_label.height()-10)
|
||||||
|
self.update_pos_label()
|
||||||
|
|
||||||
def update_clock(self):
|
def update_clock(self):
|
||||||
self.clock_label.setText(QTime.currentTime().toString('h:mm a'))
|
self.clock_label.setText(QTime.currentTime().toString(Qt.SystemLocaleShortDate))
|
||||||
|
|
||||||
|
def update_pos_label(self, *args):
|
||||||
|
if self.pos_label.isVisible():
|
||||||
|
try:
|
||||||
|
value, maximum = args
|
||||||
|
except:
|
||||||
|
value, maximum = self.pos.value(), self.pos.maximum()
|
||||||
|
text = '%g/%g'%(value, maximum)
|
||||||
|
self.pos_label.setText(text)
|
||||||
|
self.pos_label.resize(self.pos_label.sizeHint())
|
||||||
|
|
||||||
def showNormal(self):
|
def showNormal(self):
|
||||||
self.view.document.page_position.save()
|
self.view.document.page_position.save()
|
||||||
self.clock_label.setVisible(False)
|
self.clock_label.setVisible(False)
|
||||||
|
self.pos_label.setVisible(False)
|
||||||
|
self.frame.setFrameStyle(self.original_frame_style)
|
||||||
|
self.frame.layout().setSpacing(-1)
|
||||||
self.clock_timer.stop()
|
self.clock_timer.stop()
|
||||||
|
self.vertical_scrollbar.setVisible(True)
|
||||||
self.window_mode_changed = 'normal'
|
self.window_mode_changed = 'normal'
|
||||||
self.esc_full_screen_action.setEnabled(False)
|
self.esc_full_screen_action.setEnabled(False)
|
||||||
self.tool_bar.setVisible(True)
|
self.tool_bar.setVisible(True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user