This commit is contained in:
Kovid Goyal 2008-05-30 19:43:55 -07:00
parent 2c063eb03a
commit 667804bd9f
2 changed files with 83 additions and 140 deletions

View File

@ -1,8 +1,9 @@
from calibre.gui2.library import SearchBox
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
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, \
QVariant
@ -66,6 +67,14 @@ class Main(MainWindow, Ui_MainWindow):
self.opts = opts
self.document = None
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('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.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.TextAntialiasing, True)

View File

@ -19,20 +19,20 @@
<string>LRF Viewer</string>
</property>
<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>
<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" >
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<property name="margin" >
<number>0</number>
</property>
<item>
@ -41,17 +41,16 @@
<number>0</number>
</property>
<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" >
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<property name="margin" >
<number>0</number>
</property>
<item row="0" column="0" >
@ -61,115 +60,24 @@
</property>
</widget>
</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>
</widget>
<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" >
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>40</height>
@ -218,7 +126,7 @@
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>40</height>
@ -232,9 +140,41 @@
</item>
</layout>
</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" >
<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 name="text" >
<string>Next Page</string>
@ -242,7 +182,8 @@
</action>
<action name="action_previous_page" >
<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 name="text" >
<string>Previous Page</string>
@ -250,7 +191,8 @@
</action>
<action name="action_back" >
<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 name="text" >
<string>Back</string>
@ -258,7 +200,8 @@
</action>
<action name="action_forward" >
<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 name="text" >
<string>Forward</string>
@ -271,7 +214,8 @@
</action>
<action name="action_open_ebook" >
<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 name="text" >
<string>Open ebook</string>
@ -279,7 +223,8 @@
</action>
<action name="action_configure" >
<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 name="text" >
<string>Configure</string>
@ -287,11 +232,6 @@
</action>
</widget>
<customwidgets>
<customwidget>
<class>SearchBox</class>
<extends>QLineEdit</extends>
<header>library.h</header>
</customwidget>
<customwidget>
<class>BookView</class>
<extends>QGraphicsView</extends>