mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #723
This commit is contained in:
parent
2c063eb03a
commit
667804bd9f
@ -1,8 +1,9 @@
|
|||||||
|
from calibre.gui2.library import SearchBox
|
||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||||
import sys, logging, os, traceback, time, cPickle
|
import sys, logging, os, traceback, time, cPickle
|
||||||
|
|
||||||
from PyQt4.QtGui import QKeySequence, QPainter, QDialog
|
from PyQt4.QtGui import QKeySequence, QPainter, QDialog, QSpinBox, QSlider
|
||||||
from PyQt4.QtCore import Qt, QObject, SIGNAL, QCoreApplication, QThread, \
|
from PyQt4.QtCore import Qt, QObject, SIGNAL, QCoreApplication, QThread, \
|
||||||
QVariant
|
QVariant
|
||||||
|
|
||||||
@ -66,6 +67,14 @@ class Main(MainWindow, Ui_MainWindow):
|
|||||||
self.opts = opts
|
self.opts = opts
|
||||||
self.document = None
|
self.document = None
|
||||||
self.document = Document(self.logger, self.opts)
|
self.document = Document(self.logger, self.opts)
|
||||||
|
self.spin_box_action = self.spin_box = QSpinBox()
|
||||||
|
self.tool_bar.addWidget(self.spin_box)
|
||||||
|
self.tool_bar.addSeparator()
|
||||||
|
self.slider_action = self.slider = QSlider(Qt.Horizontal)
|
||||||
|
self.tool_bar.addWidget(self.slider)
|
||||||
|
self.tool_bar.addSeparator()
|
||||||
|
self.search = SearchBox(self)
|
||||||
|
self.search_action = self.tool_bar.addWidget(self.search)
|
||||||
QObject.connect(self.document, SIGNAL('chapter_rendered(int)'), self.chapter_rendered)
|
QObject.connect(self.document, SIGNAL('chapter_rendered(int)'), self.chapter_rendered)
|
||||||
QObject.connect(self.document, SIGNAL('page_changed(PyQt_PyObject)'), self.page_changed)
|
QObject.connect(self.document, SIGNAL('page_changed(PyQt_PyObject)'), self.page_changed)
|
||||||
|
|
||||||
@ -85,12 +94,6 @@ class Main(MainWindow, Ui_MainWindow):
|
|||||||
QObject.connect(self.spin_box, SIGNAL('valueChanged(int)'), self.go_to_page)
|
QObject.connect(self.spin_box, SIGNAL('valueChanged(int)'), self.go_to_page)
|
||||||
QObject.connect(self.slider, SIGNAL('valueChanged(int)'), self.go_to_page)
|
QObject.connect(self.slider, SIGNAL('valueChanged(int)'), self.go_to_page)
|
||||||
|
|
||||||
self.next_button.setDefaultAction(self.action_next_page)
|
|
||||||
self.previous_button.setDefaultAction(self.action_previous_page)
|
|
||||||
self.back_button.setDefaultAction(self.action_back)
|
|
||||||
self.forward_button.setDefaultAction(self.action_forward)
|
|
||||||
self.open_button.setDefaultAction(self.action_open_ebook)
|
|
||||||
self.configure_button.setDefaultAction(self.action_configure)
|
|
||||||
|
|
||||||
self.graphics_view.setRenderHint(QPainter.Antialiasing, True)
|
self.graphics_view.setRenderHint(QPainter.Antialiasing, True)
|
||||||
self.graphics_view.setRenderHint(QPainter.TextAntialiasing, True)
|
self.graphics_view.setRenderHint(QPainter.TextAntialiasing, True)
|
||||||
|
@ -19,20 +19,20 @@
|
|||||||
<string>LRF Viewer</string>
|
<string>LRF Viewer</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowIcon" >
|
<property name="windowIcon" >
|
||||||
<iconset resource="../images.qrc" >:/images/viewer.svg</iconset>
|
<iconset resource="../images.qrc" >
|
||||||
|
<normaloff>:/images/viewer.svg</normaloff>:/images/viewer.svg</iconset>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="central_widget" >
|
<widget class="QWidget" name="central_widget" >
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>39</y>
|
||||||
|
<width>601</width>
|
||||||
|
<height>662</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout" >
|
||||||
<property name="leftMargin" >
|
<property name="margin" >
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin" >
|
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
@ -41,17 +41,16 @@
|
|||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="viewer_page" >
|
<widget class="QWidget" name="viewer_page" >
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>601</width>
|
||||||
|
<height>662</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
<layout class="QGridLayout" >
|
<layout class="QGridLayout" >
|
||||||
<property name="leftMargin" >
|
<property name="margin" >
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin" >
|
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0" >
|
<item row="0" column="0" >
|
||||||
@ -61,115 +60,24 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" >
|
|
||||||
<widget class="QFrame" name="frame" >
|
|
||||||
<property name="sizePolicy" >
|
|
||||||
<sizepolicy vsizetype="Minimum" hsizetype="Preferred" >
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="frameShape" >
|
|
||||||
<enum>QFrame::StyledPanel</enum>
|
|
||||||
</property>
|
|
||||||
<property name="frameShadow" >
|
|
||||||
<enum>QFrame::Raised</enum>
|
|
||||||
</property>
|
|
||||||
<layout class="QHBoxLayout" >
|
|
||||||
<property name="leftMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="back_button" >
|
|
||||||
<property name="text" >
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="forward_button" >
|
|
||||||
<property name="text" >
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="open_button" >
|
|
||||||
<property name="text" >
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="configure_button" >
|
|
||||||
<property name="text" >
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QSlider" name="slider" >
|
|
||||||
<property name="orientation" >
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="previous_button" >
|
|
||||||
<property name="text" >
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QSpinBox" name="spin_box" >
|
|
||||||
<property name="sizePolicy" >
|
|
||||||
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="next_button" >
|
|
||||||
<property name="text" >
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="SearchBox" name="search" >
|
|
||||||
<property name="sizePolicy" >
|
|
||||||
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="bar_page" >
|
<widget class="QWidget" name="bar_page" >
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>601</width>
|
||||||
|
<height>701</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout" >
|
||||||
<item>
|
<item>
|
||||||
<spacer>
|
<spacer>
|
||||||
<property name="orientation" >
|
<property name="orientation" >
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" >
|
<property name="sizeHint" stdset="0" >
|
||||||
<size>
|
<size>
|
||||||
<width>20</width>
|
<width>20</width>
|
||||||
<height>40</height>
|
<height>40</height>
|
||||||
@ -218,7 +126,7 @@
|
|||||||
<property name="orientation" >
|
<property name="orientation" >
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" >
|
<property name="sizeHint" stdset="0" >
|
||||||
<size>
|
<size>
|
||||||
<width>20</width>
|
<width>20</width>
|
||||||
<height>40</height>
|
<height>40</height>
|
||||||
@ -232,9 +140,41 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QToolBar" name="tool_bar" >
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>601</width>
|
||||||
|
<height>39</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle" >
|
||||||
|
<string>LRF Viewer toolbar</string>
|
||||||
|
</property>
|
||||||
|
<property name="allowedAreas" >
|
||||||
|
<set>Qt::AllToolBarAreas</set>
|
||||||
|
</property>
|
||||||
|
<attribute name="toolBarArea" >
|
||||||
|
<enum>TopToolBarArea</enum>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="toolBarBreak" >
|
||||||
|
<bool>true</bool>
|
||||||
|
</attribute>
|
||||||
|
<addaction name="action_back" />
|
||||||
|
<addaction name="action_forward" />
|
||||||
|
<addaction name="separator" />
|
||||||
|
<addaction name="action_open_ebook" />
|
||||||
|
<addaction name="action_configure" />
|
||||||
|
<addaction name="separator" />
|
||||||
|
<addaction name="action_previous_page" />
|
||||||
|
<addaction name="action_next_page" />
|
||||||
|
<addaction name="separator" />
|
||||||
|
</widget>
|
||||||
<action name="action_next_page" >
|
<action name="action_next_page" >
|
||||||
<property name="icon" >
|
<property name="icon" >
|
||||||
<iconset resource="../images.qrc" >:/images/next.svg</iconset>
|
<iconset resource="../images.qrc" >
|
||||||
|
<normaloff>:/images/next.svg</normaloff>:/images/next.svg</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Next Page</string>
|
<string>Next Page</string>
|
||||||
@ -242,7 +182,8 @@
|
|||||||
</action>
|
</action>
|
||||||
<action name="action_previous_page" >
|
<action name="action_previous_page" >
|
||||||
<property name="icon" >
|
<property name="icon" >
|
||||||
<iconset resource="../images.qrc" >:/images/previous.svg</iconset>
|
<iconset resource="../images.qrc" >
|
||||||
|
<normaloff>:/images/previous.svg</normaloff>:/images/previous.svg</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Previous Page</string>
|
<string>Previous Page</string>
|
||||||
@ -250,7 +191,8 @@
|
|||||||
</action>
|
</action>
|
||||||
<action name="action_back" >
|
<action name="action_back" >
|
||||||
<property name="icon" >
|
<property name="icon" >
|
||||||
<iconset resource="../images.qrc" >:/images/back.svg</iconset>
|
<iconset resource="../images.qrc" >
|
||||||
|
<normaloff>:/images/back.svg</normaloff>:/images/back.svg</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Back</string>
|
<string>Back</string>
|
||||||
@ -258,7 +200,8 @@
|
|||||||
</action>
|
</action>
|
||||||
<action name="action_forward" >
|
<action name="action_forward" >
|
||||||
<property name="icon" >
|
<property name="icon" >
|
||||||
<iconset resource="../images.qrc" >:/images/forward.svg</iconset>
|
<iconset resource="../images.qrc" >
|
||||||
|
<normaloff>:/images/forward.svg</normaloff>:/images/forward.svg</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Forward</string>
|
<string>Forward</string>
|
||||||
@ -271,7 +214,8 @@
|
|||||||
</action>
|
</action>
|
||||||
<action name="action_open_ebook" >
|
<action name="action_open_ebook" >
|
||||||
<property name="icon" >
|
<property name="icon" >
|
||||||
<iconset resource="../images.qrc" >:/images/document_open.svg</iconset>
|
<iconset resource="../images.qrc" >
|
||||||
|
<normaloff>:/images/document_open.svg</normaloff>:/images/document_open.svg</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Open ebook</string>
|
<string>Open ebook</string>
|
||||||
@ -279,7 +223,8 @@
|
|||||||
</action>
|
</action>
|
||||||
<action name="action_configure" >
|
<action name="action_configure" >
|
||||||
<property name="icon" >
|
<property name="icon" >
|
||||||
<iconset resource="../images.qrc" >:/images/config.svg</iconset>
|
<iconset resource="../images.qrc" >
|
||||||
|
<normaloff>:/images/config.svg</normaloff>:/images/config.svg</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Configure</string>
|
<string>Configure</string>
|
||||||
@ -287,11 +232,6 @@
|
|||||||
</action>
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
|
||||||
<class>SearchBox</class>
|
|
||||||
<extends>QLineEdit</extends>
|
|
||||||
<header>library.h</header>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>BookView</class>
|
<class>BookView</class>
|
||||||
<extends>QGraphicsView</extends>
|
<extends>QGraphicsView</extends>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user