mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Basic status bar functionality in place
This commit is contained in:
parent
3526d3d28c
commit
6c63fc0ec7
@ -6,12 +6,13 @@
|
|||||||
<file>images/delfile.png</file>
|
<file>images/delfile.png</file>
|
||||||
<file>images/edit.png</file>
|
<file>images/edit.png</file>
|
||||||
<file>images/fileopen.png</file>
|
<file>images/fileopen.png</file>
|
||||||
|
<file>images/jobs-animated.mng</file>
|
||||||
|
<file>images/jobs.svg</file>
|
||||||
<file alias="library" >images/library.png</file>
|
<file alias="library" >images/library.png</file>
|
||||||
<file alias="card" >images/memory_stick_unmount.png</file>
|
<file alias="card" >images/memory_stick_unmount.png</file>
|
||||||
<file>images/minus.png</file>
|
<file>images/minus.png</file>
|
||||||
<file>images/plus.png</file>
|
<file>images/plus.png</file>
|
||||||
<file alias="reader" >images/reader.png</file>
|
<file alias="reader" >images/reader.png</file>
|
||||||
<file>images/upload.png</file>
|
<file>images/upload.png</file>
|
||||||
<file>images/jobs.svg</file>
|
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -24,6 +24,7 @@ from PyQt4.Qt import qDebug, qFatal, qWarning, qCritical
|
|||||||
from libprs500.gui2 import APP_TITLE, installErrorHandler
|
from libprs500.gui2 import APP_TITLE, installErrorHandler
|
||||||
from libprs500.gui2.main_ui import Ui_MainWindow
|
from libprs500.gui2.main_ui import Ui_MainWindow
|
||||||
from libprs500.gui2.device import DeviceDetector
|
from libprs500.gui2.device import DeviceDetector
|
||||||
|
from libprs500.gui2.status import StatusBar
|
||||||
|
|
||||||
class Main(QObject, Ui_MainWindow):
|
class Main(QObject, Ui_MainWindow):
|
||||||
|
|
||||||
@ -34,10 +35,9 @@ class Main(QObject, Ui_MainWindow):
|
|||||||
self.setupUi(window)
|
self.setupUi(window)
|
||||||
self.read_settings()
|
self.read_settings()
|
||||||
|
|
||||||
####################### Tabs setup #####################
|
####################### Status Bar #####################
|
||||||
self.tabs.setup()
|
self.status_bar = StatusBar()
|
||||||
self.tabs.animate()
|
self.window.setStatusBar(self.status_bar)
|
||||||
|
|
||||||
|
|
||||||
####################### Setup books view ########################
|
####################### Setup books view ########################
|
||||||
self.library_view.set_database(self.database_path)
|
self.library_view.set_database(self.database_path)
|
||||||
|
@ -170,168 +170,88 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0" >
|
<item row="2" column="0" >
|
||||||
<widget class="AnimatedTabWidget" name="tabs" >
|
<widget class="QStackedWidget" name="stacks" >
|
||||||
<property name="tabPosition" >
|
<property name="sizePolicy" >
|
||||||
<enum>QTabWidget::West</enum>
|
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
||||||
|
<horstretch>100</horstretch>
|
||||||
|
<verstretch>100</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex" >
|
<property name="currentIndex" >
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="usesScrollButtons" >
|
<widget class="QWidget" name="library" >
|
||||||
<bool>false</bool>
|
<layout class="QVBoxLayout" >
|
||||||
</property>
|
<item>
|
||||||
<widget class="QWidget" name="books_tab" >
|
<widget class="BooksView" name="library_view" >
|
||||||
<attribute name="title" >
|
|
||||||
<string>Books</string>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="icon" >
|
|
||||||
<iconset resource="images.qrc" >:/library</iconset>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QGridLayout" >
|
|
||||||
<item row="0" column="0" >
|
|
||||||
<widget class="QStackedWidget" name="stacks" >
|
|
||||||
<property name="sizePolicy" >
|
<property name="sizePolicy" >
|
||||||
<sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
|
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
||||||
<horstretch>100</horstretch>
|
<horstretch>100</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>10</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex" >
|
<property name="acceptDrops" >
|
||||||
<number>0</number>
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="dragEnabled" >
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="dragDropOverwriteMode" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="dragDropMode" >
|
||||||
|
<enum>QAbstractItemView::DragDrop</enum>
|
||||||
|
</property>
|
||||||
|
<property name="alternatingRowColors" >
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="selectionBehavior" >
|
||||||
|
<enum>QAbstractItemView::SelectRows</enum>
|
||||||
|
</property>
|
||||||
|
<property name="showGrid" >
|
||||||
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="library" >
|
|
||||||
<layout class="QGridLayout" >
|
|
||||||
<item row="0" column="0" >
|
|
||||||
<widget class="BooksView" name="library_view" >
|
|
||||||
<property name="sizePolicy" >
|
|
||||||
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
|
||||||
<horstretch>100</horstretch>
|
|
||||||
<verstretch>10</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="acceptDrops" >
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="dragEnabled" >
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="dragDropOverwriteMode" >
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="dragDropMode" >
|
|
||||||
<enum>QAbstractItemView::DragDrop</enum>
|
|
||||||
</property>
|
|
||||||
<property name="alternatingRowColors" >
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="selectionBehavior" >
|
|
||||||
<enum>QAbstractItemView::SelectRows</enum>
|
|
||||||
</property>
|
|
||||||
<property name="showGrid" >
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="main_memory" >
|
|
||||||
<layout class="QGridLayout" >
|
|
||||||
<item row="0" column="0" >
|
|
||||||
<widget class="BooksView" name="main_memory_view" >
|
|
||||||
<property name="sizePolicy" >
|
|
||||||
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
|
||||||
<horstretch>100</horstretch>
|
|
||||||
<verstretch>10</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="acceptDrops" >
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="dragEnabled" >
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="dragDropOverwriteMode" >
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="dragDropMode" >
|
|
||||||
<enum>QAbstractItemView::DragDrop</enum>
|
|
||||||
</property>
|
|
||||||
<property name="alternatingRowColors" >
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="selectionBehavior" >
|
|
||||||
<enum>QAbstractItemView::SelectRows</enum>
|
|
||||||
</property>
|
|
||||||
<property name="showGrid" >
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="jobs_tab" >
|
<widget class="QWidget" name="main_memory" >
|
||||||
<attribute name="title" >
|
<layout class="QGridLayout" >
|
||||||
<string>Jobs</string>
|
<item row="0" column="0" >
|
||||||
</attribute>
|
<widget class="BooksView" name="main_memory_view" >
|
||||||
<attribute name="toolTip" >
|
<property name="sizePolicy" >
|
||||||
<string>Show jobs being currently processed</string>
|
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
||||||
</attribute>
|
<horstretch>100</horstretch>
|
||||||
<layout class="QGridLayout" />
|
<verstretch>10</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="acceptDrops" >
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="dragEnabled" >
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="dragDropOverwriteMode" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="dragDropMode" >
|
||||||
|
<enum>QAbstractItemView::DragDrop</enum>
|
||||||
|
</property>
|
||||||
|
<property name="alternatingRowColors" >
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="selectionBehavior" >
|
||||||
|
<enum>QAbstractItemView::SelectRows</enum>
|
||||||
|
</property>
|
||||||
|
<property name="showGrid" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0" >
|
|
||||||
<layout class="QHBoxLayout" >
|
|
||||||
<property name="spacing" >
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<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="CoverDisplay" name="book_cover" >
|
|
||||||
<property name="maximumSize" >
|
|
||||||
<size>
|
|
||||||
<width>60</width>
|
|
||||||
<height>80</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="acceptDrops" >
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="pixmap" >
|
|
||||||
<pixmap/>
|
|
||||||
</property>
|
|
||||||
<property name="scaledContents" >
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="book_info" >
|
|
||||||
<property name="text" >
|
|
||||||
<string><table><tr><td><b>Title: </b>%1</td><td><b>&nbsp;Size:</b> %2</td></tr><tr><td><b>Author: </b>%3</td><td><b>&nbsp;Type: </b>%4</td></tr></table></string>
|
|
||||||
</property>
|
|
||||||
<property name="textFormat" >
|
|
||||||
<enum>Qt::RichText</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QToolBar" name="tool_bar" >
|
<widget class="QToolBar" name="tool_bar" >
|
||||||
@ -366,6 +286,11 @@
|
|||||||
<addaction name="action_del" />
|
<addaction name="action_del" />
|
||||||
<addaction name="action_edit" />
|
<addaction name="action_edit" />
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QStatusBar" name="statusBar" >
|
||||||
|
<property name="mouseTracking" >
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
<action name="action_add" >
|
<action name="action_add" >
|
||||||
<property name="icon" >
|
<property name="icon" >
|
||||||
<iconset resource="images.qrc" >:/images/addfile.png</iconset>
|
<iconset resource="images.qrc" >:/images/addfile.png</iconset>
|
||||||
@ -407,11 +332,6 @@
|
|||||||
</action>
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
|
||||||
<class>CoverDisplay</class>
|
|
||||||
<extends>QLabel</extends>
|
|
||||||
<header>widgets.h</header>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>DeviceView</class>
|
<class>DeviceView</class>
|
||||||
<extends>QListView</extends>
|
<extends>QListView</extends>
|
||||||
@ -427,12 +347,6 @@
|
|||||||
<extends>QLineEdit</extends>
|
<extends>QLineEdit</extends>
|
||||||
<header>library.h</header>
|
<header>library.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
|
||||||
<class>AnimatedTabWidget</class>
|
|
||||||
<extends>QTabWidget</extends>
|
|
||||||
<header>progress.h</header>
|
|
||||||
<container>1</container>
|
|
||||||
</customwidget>
|
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="images.qrc" />
|
<include location="images.qrc" />
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Form implementation generated from reading ui file 'main.ui'
|
# Form implementation generated from reading ui file 'main.ui'
|
||||||
#
|
#
|
||||||
# Created: Thu Jun 7 08:58:03 2007
|
# Created: Tue Jun 19 11:07:30 2007
|
||||||
# by: PyQt4 UI code generator 4-snapshot-20070606
|
# by: PyQt4 UI code generator 4-snapshot-20070606
|
||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
@ -86,22 +86,11 @@ class Ui_MainWindow(object):
|
|||||||
self.hboxlayout1.addWidget(self.clear_button)
|
self.hboxlayout1.addWidget(self.clear_button)
|
||||||
self.gridlayout.addLayout(self.hboxlayout1,1,0,1,1)
|
self.gridlayout.addLayout(self.hboxlayout1,1,0,1,1)
|
||||||
|
|
||||||
self.tabs = AnimatedTabWidget(self.centralwidget)
|
self.stacks = QtGui.QStackedWidget(self.centralwidget)
|
||||||
self.tabs.setTabPosition(QtGui.QTabWidget.West)
|
|
||||||
self.tabs.setUsesScrollButtons(False)
|
|
||||||
self.tabs.setObjectName("tabs")
|
|
||||||
|
|
||||||
self.books_tab = QtGui.QWidget()
|
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding)
|
||||||
self.books_tab.setObjectName("books_tab")
|
|
||||||
|
|
||||||
self.gridlayout1 = QtGui.QGridLayout(self.books_tab)
|
|
||||||
self.gridlayout1.setObjectName("gridlayout1")
|
|
||||||
|
|
||||||
self.stacks = QtGui.QStackedWidget(self.books_tab)
|
|
||||||
|
|
||||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Preferred)
|
|
||||||
sizePolicy.setHorizontalStretch(100)
|
sizePolicy.setHorizontalStretch(100)
|
||||||
sizePolicy.setVerticalStretch(0)
|
sizePolicy.setVerticalStretch(100)
|
||||||
sizePolicy.setHeightForWidth(self.stacks.sizePolicy().hasHeightForWidth())
|
sizePolicy.setHeightForWidth(self.stacks.sizePolicy().hasHeightForWidth())
|
||||||
self.stacks.setSizePolicy(sizePolicy)
|
self.stacks.setSizePolicy(sizePolicy)
|
||||||
self.stacks.setObjectName("stacks")
|
self.stacks.setObjectName("stacks")
|
||||||
@ -109,8 +98,8 @@ class Ui_MainWindow(object):
|
|||||||
self.library = QtGui.QWidget()
|
self.library = QtGui.QWidget()
|
||||||
self.library.setObjectName("library")
|
self.library.setObjectName("library")
|
||||||
|
|
||||||
self.gridlayout2 = QtGui.QGridLayout(self.library)
|
self.vboxlayout = QtGui.QVBoxLayout(self.library)
|
||||||
self.gridlayout2.setObjectName("gridlayout2")
|
self.vboxlayout.setObjectName("vboxlayout")
|
||||||
|
|
||||||
self.library_view = BooksView(self.library)
|
self.library_view = BooksView(self.library)
|
||||||
|
|
||||||
@ -127,14 +116,14 @@ class Ui_MainWindow(object):
|
|||||||
self.library_view.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
|
self.library_view.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
|
||||||
self.library_view.setShowGrid(False)
|
self.library_view.setShowGrid(False)
|
||||||
self.library_view.setObjectName("library_view")
|
self.library_view.setObjectName("library_view")
|
||||||
self.gridlayout2.addWidget(self.library_view,0,0,1,1)
|
self.vboxlayout.addWidget(self.library_view)
|
||||||
self.stacks.addWidget(self.library)
|
self.stacks.addWidget(self.library)
|
||||||
|
|
||||||
self.main_memory = QtGui.QWidget()
|
self.main_memory = QtGui.QWidget()
|
||||||
self.main_memory.setObjectName("main_memory")
|
self.main_memory.setObjectName("main_memory")
|
||||||
|
|
||||||
self.gridlayout3 = QtGui.QGridLayout(self.main_memory)
|
self.gridlayout1 = QtGui.QGridLayout(self.main_memory)
|
||||||
self.gridlayout3.setObjectName("gridlayout3")
|
self.gridlayout1.setObjectName("gridlayout1")
|
||||||
|
|
||||||
self.main_memory_view = BooksView(self.main_memory)
|
self.main_memory_view = BooksView(self.main_memory)
|
||||||
|
|
||||||
@ -151,36 +140,9 @@ class Ui_MainWindow(object):
|
|||||||
self.main_memory_view.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
|
self.main_memory_view.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
|
||||||
self.main_memory_view.setShowGrid(False)
|
self.main_memory_view.setShowGrid(False)
|
||||||
self.main_memory_view.setObjectName("main_memory_view")
|
self.main_memory_view.setObjectName("main_memory_view")
|
||||||
self.gridlayout3.addWidget(self.main_memory_view,0,0,1,1)
|
self.gridlayout1.addWidget(self.main_memory_view,0,0,1,1)
|
||||||
self.stacks.addWidget(self.main_memory)
|
self.stacks.addWidget(self.main_memory)
|
||||||
self.gridlayout1.addWidget(self.stacks,0,0,1,1)
|
self.gridlayout.addWidget(self.stacks,2,0,1,1)
|
||||||
self.tabs.addTab(self.books_tab,QtGui.QIcon(":/library"),"")
|
|
||||||
|
|
||||||
self.jobs_tab = QtGui.QWidget()
|
|
||||||
self.jobs_tab.setObjectName("jobs_tab")
|
|
||||||
|
|
||||||
self.gridlayout4 = QtGui.QGridLayout(self.jobs_tab)
|
|
||||||
self.gridlayout4.setObjectName("gridlayout4")
|
|
||||||
self.tabs.addTab(self.jobs_tab,"")
|
|
||||||
self.gridlayout.addWidget(self.tabs,2,0,1,1)
|
|
||||||
|
|
||||||
self.hboxlayout2 = QtGui.QHBoxLayout()
|
|
||||||
self.hboxlayout2.setSpacing(6)
|
|
||||||
self.hboxlayout2.setMargin(0)
|
|
||||||
self.hboxlayout2.setObjectName("hboxlayout2")
|
|
||||||
|
|
||||||
self.book_cover = CoverDisplay(self.centralwidget)
|
|
||||||
self.book_cover.setMaximumSize(QtCore.QSize(60,80))
|
|
||||||
self.book_cover.setAcceptDrops(True)
|
|
||||||
self.book_cover.setScaledContents(True)
|
|
||||||
self.book_cover.setObjectName("book_cover")
|
|
||||||
self.hboxlayout2.addWidget(self.book_cover)
|
|
||||||
|
|
||||||
self.book_info = QtGui.QLabel(self.centralwidget)
|
|
||||||
self.book_info.setTextFormat(QtCore.Qt.RichText)
|
|
||||||
self.book_info.setObjectName("book_info")
|
|
||||||
self.hboxlayout2.addWidget(self.book_info)
|
|
||||||
self.gridlayout.addLayout(self.hboxlayout2,3,0,1,1)
|
|
||||||
MainWindow.setCentralWidget(self.centralwidget)
|
MainWindow.setCentralWidget(self.centralwidget)
|
||||||
|
|
||||||
self.tool_bar = QtGui.QToolBar(MainWindow)
|
self.tool_bar = QtGui.QToolBar(MainWindow)
|
||||||
@ -192,6 +154,11 @@ class Ui_MainWindow(object):
|
|||||||
self.tool_bar.setObjectName("tool_bar")
|
self.tool_bar.setObjectName("tool_bar")
|
||||||
MainWindow.addToolBar(self.tool_bar)
|
MainWindow.addToolBar(self.tool_bar)
|
||||||
|
|
||||||
|
self.statusBar = QtGui.QStatusBar(MainWindow)
|
||||||
|
self.statusBar.setMouseTracking(True)
|
||||||
|
self.statusBar.setObjectName("statusBar")
|
||||||
|
MainWindow.setStatusBar(self.statusBar)
|
||||||
|
|
||||||
self.action_add = QtGui.QAction(MainWindow)
|
self.action_add = QtGui.QAction(MainWindow)
|
||||||
self.action_add.setIcon(QtGui.QIcon(":/images/addfile.png"))
|
self.action_add.setIcon(QtGui.QIcon(":/images/addfile.png"))
|
||||||
self.action_add.setAutoRepeat(False)
|
self.action_add.setAutoRepeat(False)
|
||||||
@ -211,7 +178,6 @@ class Ui_MainWindow(object):
|
|||||||
self.label.setBuddy(self.search)
|
self.label.setBuddy(self.search)
|
||||||
|
|
||||||
self.retranslateUi(MainWindow)
|
self.retranslateUi(MainWindow)
|
||||||
self.tabs.setCurrentIndex(0)
|
|
||||||
self.stacks.setCurrentIndex(0)
|
self.stacks.setCurrentIndex(0)
|
||||||
QtCore.QObject.connect(self.clear_button,QtCore.SIGNAL("clicked()"),self.search.clear)
|
QtCore.QObject.connect(self.clear_button,QtCore.SIGNAL("clicked()"),self.search.clear)
|
||||||
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||||
@ -224,10 +190,6 @@ class Ui_MainWindow(object):
|
|||||||
self.search.setWhatsThis(QtGui.QApplication.translate("MainWindow", "Search the list of books by title, author, publisher, tags and comments<br><br>Words separated by spaces are ANDed", None, QtGui.QApplication.UnicodeUTF8))
|
self.search.setWhatsThis(QtGui.QApplication.translate("MainWindow", "Search the list of books by title, author, publisher, tags and comments<br><br>Words separated by spaces are ANDed", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.clear_button.setToolTip(QtGui.QApplication.translate("MainWindow", "Reset Quick Search", None, QtGui.QApplication.UnicodeUTF8))
|
self.clear_button.setToolTip(QtGui.QApplication.translate("MainWindow", "Reset Quick Search", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.clear_button.setText(QtGui.QApplication.translate("MainWindow", "...", None, QtGui.QApplication.UnicodeUTF8))
|
self.clear_button.setText(QtGui.QApplication.translate("MainWindow", "...", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.tabs.setTabText(self.tabs.indexOf(self.books_tab), QtGui.QApplication.translate("MainWindow", "Books", None, QtGui.QApplication.UnicodeUTF8))
|
|
||||||
self.tabs.setTabText(self.tabs.indexOf(self.jobs_tab), QtGui.QApplication.translate("MainWindow", "Jobs", None, QtGui.QApplication.UnicodeUTF8))
|
|
||||||
self.tabs.setTabToolTip(self.tabs.indexOf(self.jobs_tab),QtGui.QApplication.translate("MainWindow", "Show jobs being currently processed", None, QtGui.QApplication.UnicodeUTF8))
|
|
||||||
self.book_info.setText(QtGui.QApplication.translate("MainWindow", "<table><tr><td><b>Title: </b>%1</td><td><b> Size:</b> %2</td></tr><tr><td><b>Author: </b>%3</td><td><b> Type: </b>%4</td></tr></table>", None, QtGui.QApplication.UnicodeUTF8))
|
|
||||||
self.action_add.setText(QtGui.QApplication.translate("MainWindow", "Add books to Library", None, QtGui.QApplication.UnicodeUTF8))
|
self.action_add.setText(QtGui.QApplication.translate("MainWindow", "Add books to Library", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.action_add.setShortcut(QtGui.QApplication.translate("MainWindow", "A", None, QtGui.QApplication.UnicodeUTF8))
|
self.action_add.setShortcut(QtGui.QApplication.translate("MainWindow", "A", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.action_del.setText(QtGui.QApplication.translate("MainWindow", "Delete books", None, QtGui.QApplication.UnicodeUTF8))
|
self.action_del.setText(QtGui.QApplication.translate("MainWindow", "Delete books", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
@ -235,7 +197,6 @@ class Ui_MainWindow(object):
|
|||||||
self.action_edit.setText(QtGui.QApplication.translate("MainWindow", "Edit meta-information", None, QtGui.QApplication.UnicodeUTF8))
|
self.action_edit.setText(QtGui.QApplication.translate("MainWindow", "Edit meta-information", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.action_edit.setShortcut(QtGui.QApplication.translate("MainWindow", "E", None, QtGui.QApplication.UnicodeUTF8))
|
self.action_edit.setShortcut(QtGui.QApplication.translate("MainWindow", "E", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
|
|
||||||
from widgets import DeviceView, CoverDisplay
|
from widgets import DeviceView
|
||||||
from progress import AnimatedTabWidget
|
|
||||||
from library import BooksView, SearchBox
|
from library import BooksView, SearchBox
|
||||||
import images_rc
|
import images_rc
|
||||||
|
108
src/libprs500/gui2/status.py
Normal file
108
src/libprs500/gui2/status.py
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
## Copyright (C) 2007 Kovid Goyal kovid@kovidgoyal.net
|
||||||
|
## This program is free software; you can redistribute it and/or modify
|
||||||
|
## it under the terms of the GNU General Public License as published by
|
||||||
|
## the Free Software Foundation; either version 2 of the License, or
|
||||||
|
## (at your option) any later version.
|
||||||
|
##
|
||||||
|
## This program is distributed in the hope that it will be useful,
|
||||||
|
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
## GNU General Public License for more details.
|
||||||
|
##
|
||||||
|
## You should have received a copy of the GNU General Public License along
|
||||||
|
## with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
|
from PyQt4.QtGui import QStatusBar, QMovie, QLabel, QFrame, QHBoxLayout, QPixmap, \
|
||||||
|
QSizePolicy
|
||||||
|
from PyQt4.QtCore import Qt, QSize
|
||||||
|
|
||||||
|
class BookInfoDisplay(QFrame):
|
||||||
|
class BookCoverDisplay(QLabel):
|
||||||
|
WIDTH = 60
|
||||||
|
HEIGHT = 80
|
||||||
|
def __init__(self, coverpath=':default_cover'):
|
||||||
|
QLabel.__init__(self)
|
||||||
|
self.default_pixmap = QPixmap(coverpath).scaled(self.__class__.WIDTH,
|
||||||
|
self.__class__.HEIGHT,
|
||||||
|
Qt.IgnoreAspectRatio,
|
||||||
|
Qt.SmoothTransformation)
|
||||||
|
self.setPixmap(self.default_pixmap)
|
||||||
|
self.setSizePolicy(QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed))
|
||||||
|
|
||||||
|
def sizeHint(self):
|
||||||
|
return QSize(self.__class__.WIDTH, self.__class__.HEIGHT)
|
||||||
|
|
||||||
|
|
||||||
|
class BookDataDisplay(QLabel):
|
||||||
|
def __init__(self):
|
||||||
|
QLabel.__init__(self)
|
||||||
|
self.setTextInteractionFlags(Qt.TextSelectableByMouse)
|
||||||
|
self.setText('TODO')
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
QFrame.__init__(self)
|
||||||
|
self.layout = QHBoxLayout()
|
||||||
|
self.setLayout(self.layout)
|
||||||
|
self.cover_display = BookInfoDisplay.BookCoverDisplay()
|
||||||
|
self.layout.addWidget(self.cover_display)
|
||||||
|
self.book_data = BookInfoDisplay.BookDataDisplay()
|
||||||
|
self.layout.addWidget(self.book_data)
|
||||||
|
|
||||||
|
|
||||||
|
class MovieButton(QLabel):
|
||||||
|
def __init__(self, movie):
|
||||||
|
QLabel.__init__(self)
|
||||||
|
self.movie = movie
|
||||||
|
self.setMovie(movie)
|
||||||
|
self.movie.start()
|
||||||
|
self.movie.stop()
|
||||||
|
|
||||||
|
class StatusBar(QStatusBar):
|
||||||
|
def __init__(self):
|
||||||
|
QStatusBar.__init__(self)
|
||||||
|
self.movie_button = MovieButton(QMovie(':/images/jobs-animated.mng'))
|
||||||
|
self.addPermanentWidget(self.movie_button)
|
||||||
|
self.book_info = BookInfoDisplay()
|
||||||
|
self.addWidget(self.book_info)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
# Used to create the animated status icon
|
||||||
|
from PyQt4.Qt import QApplication, QPainter, QSvgRenderer, QPixmap, QColor
|
||||||
|
from subprocess import check_call
|
||||||
|
import os
|
||||||
|
app = QApplication([])
|
||||||
|
|
||||||
|
def create_pixmaps(path, size=16, delta=20):
|
||||||
|
r = QSvgRenderer(path)
|
||||||
|
if not r.isValid():
|
||||||
|
raise Exception(path + ' not valid svg')
|
||||||
|
pixmaps = []
|
||||||
|
for angle in range(0, 360+delta, delta):
|
||||||
|
pm = QPixmap(size, size)
|
||||||
|
pm.fill(QColor(0,0,0,0))
|
||||||
|
p = QPainter(pm)
|
||||||
|
p.translate(size/2., size/2.)
|
||||||
|
p.rotate(angle)
|
||||||
|
p.translate(-size/2., -size/2.)
|
||||||
|
r.render(p)
|
||||||
|
p.end()
|
||||||
|
pixmaps.append(pm)
|
||||||
|
return pixmaps
|
||||||
|
|
||||||
|
def create_mng(path='/home/kovid/work/libprs500/src/libprs500/gui2/images/jobs.svg', size=64, angle=5, delay=5):
|
||||||
|
pixmaps = create_pixmaps(path, size, angle)
|
||||||
|
filesl = []
|
||||||
|
for i in range(len(pixmaps)):
|
||||||
|
name = 'a%s.png'%(i,)
|
||||||
|
filesl.append(name)
|
||||||
|
pixmaps[i].save(name, 'PNG')
|
||||||
|
filesc = ' '.join(filesl)
|
||||||
|
cmd = 'convert -dispose Background -delay '+str(delay)+ ' ' + filesc + ' -loop 0 animated.mng'
|
||||||
|
print cmd
|
||||||
|
try:
|
||||||
|
check_call(cmd, shell=True)
|
||||||
|
finally:
|
||||||
|
for file in filesl:
|
||||||
|
os.remove(file)
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user