mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Minor cleanups
This commit is contained in:
parent
439860923c
commit
1a16e40b9e
17
.project
Normal file
17
.project
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>libprs500</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.python.pydev.PyDevBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.python.pydev.pythonNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
9
.pydevproject
Normal file
9
.pydevproject
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse-pydev version="1.0"?>
|
||||
|
||||
<pydev_project>
|
||||
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.5</pydev_property>
|
||||
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
|
||||
<path>/libprs500/src</path>
|
||||
</pydev_pathproperty>
|
||||
</pydev_project>
|
11
setup.py
11
setup.py
@ -12,7 +12,7 @@
|
||||
## 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.
|
||||
#!/usr/bin/env python2.5
|
||||
#!/usr/bin/env python
|
||||
import sys
|
||||
|
||||
import ez_setup
|
||||
@ -33,8 +33,9 @@ except Exception, e:
|
||||
"WARNING: Could not install the Python Imaging Library.", \
|
||||
"Some functionality will be unavailable"
|
||||
|
||||
import sys
|
||||
|
||||
from setuptools import setup, find_packages
|
||||
sys.path.append('src')
|
||||
from libprs500 import __version__ as VERSION
|
||||
|
||||
if sys.hexversion < 0x2050000:
|
||||
@ -45,7 +46,8 @@ if sys.hexversion < 0x2050000:
|
||||
|
||||
setup(
|
||||
name='libprs500',
|
||||
packages = find_packages(),
|
||||
packages = find_packages('src'),
|
||||
package_dir = { '' : 'src' },
|
||||
version=VERSION,
|
||||
author='Kovid Goyal',
|
||||
author_email='kovid@kovidgoyal.net',
|
||||
@ -111,7 +113,8 @@ setup(
|
||||
try:
|
||||
import PyQt4
|
||||
except ImportError:
|
||||
print "You do not have PyQt4 installed. The GUI will not work. You can obtain PyQt4 from http://www.riverbankcomputing.co.uk/pyqt/download.php"
|
||||
print "You do not have PyQt4 installed. The GUI will not work.", \
|
||||
"You can obtain PyQt4 from http://www.riverbankcomputing.co.uk/pyqt/download.php"
|
||||
else:
|
||||
import PyQt4.Qt
|
||||
if PyQt4.Qt.PYQT_VERSION < 0x40101:
|
||||
|
@ -59,7 +59,7 @@ class FileFormatter(object):
|
||||
if self.is_readonly: mode += "r-"+x+"r-"+x+"r-"+x
|
||||
else: mode += "rw"+x+"rw"+x+"rw"+x
|
||||
return mode
|
||||
return property(**locals())
|
||||
return property(doc=doc, fget=fget)
|
||||
|
||||
@apply
|
||||
def name_in_color():
|
||||
@ -73,28 +73,28 @@ class FileFormatter(object):
|
||||
ext = self.name[self.name.rfind("."):]
|
||||
if ext in (".pdf", ".rtf", ".lrf", ".lrx", ".txt"): cname = green + self.name + normal
|
||||
return cname
|
||||
return property(**locals())
|
||||
return property(doc=doc, fget=fget)
|
||||
|
||||
@apply
|
||||
def human_readable_size():
|
||||
doc=""" File size in human readable form """
|
||||
def fget(self):
|
||||
human_readable(self.size)
|
||||
return property(**locals())
|
||||
return property(doc=doc, fget=fget)
|
||||
|
||||
@apply
|
||||
def modification_time():
|
||||
doc=""" Last modified time in the Linux ls -l format """
|
||||
def fget(self):
|
||||
return time.strftime("%Y-%m-%d %H:%M", time.localtime(self.wtime))
|
||||
return property(**locals())
|
||||
return property(doc=doc, fget=fget)
|
||||
|
||||
@apply
|
||||
def creation_time():
|
||||
doc=""" Last modified time in the Linux ls -l format """
|
||||
def fget(self):
|
||||
return time.strftime("%Y-%m-%d %H:%M", time.localtime(self.ctime))
|
||||
return property(**locals())
|
||||
return property(doc=doc, fget=fget)
|
||||
|
||||
def info(dev):
|
||||
info = dev.get_device_information()
|
||||
|
@ -122,7 +122,7 @@ class Main(QObject, Ui_MainWindow):
|
||||
for c in range(topleft.column(), bottomright.column()+1):
|
||||
self.current_view.resizeColumnToContents(c)
|
||||
for r in range(topleft.row(), bottomright.row()+1):
|
||||
self.current_view.resizeRowToContents(c)
|
||||
self.current_view.resizeRowToContents(r)
|
||||
|
||||
def show_book(self, current, previous):
|
||||
if not len(self.current_view.selectedIndexes()):
|
||||
@ -240,13 +240,11 @@ class Main(QObject, Ui_MainWindow):
|
||||
def edit(self, action):
|
||||
if self.library_view.isVisible():
|
||||
rows = self.library_view.selectionModel().selectedRows()
|
||||
accepted = False
|
||||
for row in rows:
|
||||
_id = self.library_model.id_from_index(row)
|
||||
dialog = QDialog(self.window)
|
||||
ebd = EditBookDialog(dialog, _id, self.library_model.db)
|
||||
if dialog.exec_() == QDialog.Accepted:
|
||||
accepted = True
|
||||
title = unicode(ebd.title.text().toUtf8(), 'utf-8').strip()
|
||||
authors = unicode(ebd.authors.text().toUtf8(), 'utf-8').strip()
|
||||
rating = ebd.rating.value()
|
||||
|
@ -17,7 +17,6 @@ import os
|
||||
import textwrap
|
||||
import time
|
||||
import traceback
|
||||
import sys
|
||||
from operator import itemgetter, attrgetter
|
||||
from socket import gethostname
|
||||
from urlparse import urlparse, urlunparse
|
||||
@ -32,11 +31,9 @@ from PyQt4.QtCore import Qt, SIGNAL
|
||||
from PyQt4.Qt import QApplication, QString, QFont, QAbstractListModel, \
|
||||
QVariant, QAbstractTableModel, QTableView, QListView, \
|
||||
QLabel, QAbstractItemView, QPixmap, QIcon, QSize, \
|
||||
QMessageBox, QSettings, QFileDialog, QErrorMessage, \
|
||||
QSpinBox, QPoint, \
|
||||
QIODevice, QPainterPath, QItemDelegate, QPainter, QPen, \
|
||||
QColor, QLinearGradient, QBrush, QStyle, QStringList, \
|
||||
QByteArray, QBuffer, QMimeData, QTextStream, QIODevice, \
|
||||
QSpinBox, QPoint, QPainterPath, QItemDelegate, QPainter, QPen, \
|
||||
QColor, QLinearGradient, QBrush, QStyle, \
|
||||
QByteArray, QBuffer, QMimeData, \
|
||||
QDrag, QRect
|
||||
|
||||
NONE = QVariant() #: Null value to return from the data function of item models
|
||||
@ -674,8 +671,11 @@ class DeviceBooksModel(QAbstractTableModel):
|
||||
self._orig_data = book_list
|
||||
self.reset()
|
||||
|
||||
def rowCount(self, parent): return len(self._data)
|
||||
def columnCount(self, parent): return 4
|
||||
def rowCount(self, parent):
|
||||
return len(self._data)
|
||||
|
||||
def columnCount(self, parent):
|
||||
return 4
|
||||
|
||||
def headerData(self, section, orientation, role):
|
||||
if role != Qt.DisplayRole:
|
||||
|
@ -25,7 +25,6 @@ to get and set meta information. For example:
|
||||
"""
|
||||
|
||||
import struct
|
||||
import array
|
||||
import zlib
|
||||
import xml.dom.minidom as dom
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user