Sync to trunk.

This commit is contained in:
John Schember 2009-06-05 18:43:36 -04:00
commit 92877f804b
8 changed files with 38 additions and 15 deletions

View File

@ -19,7 +19,7 @@ from modulegraph.find_modules import find_modules
PYTHON = '/Library/Frameworks/Python.framework/Versions/Current/bin/python' PYTHON = '/Library/Frameworks/Python.framework/Versions/Current/bin/python'
class BuildAPP(py2app): class BuildAPP(py2app):
QT_PREFIX = '/Volumes/sw/qt' QT_PREFIX = '/Users/kovid/qt'
LOADER_TEMPLATE = \ LOADER_TEMPLATE = \
r'''#!/usr/bin/env python r'''#!/usr/bin/env python
import os, sys, glob import os, sys, glob
@ -230,7 +230,7 @@ _check_symlinks_prescript()
all_functions = main_functions['console'] + main_functions['gui'] all_functions = main_functions['console'] + main_functions['gui']
print print
print 'Adding PoDoFo' print 'Adding PoDoFo'
pdf = glob.glob(os.path.expanduser('~/podofo/*.dylib'))[0] pdf = glob.glob(os.path.expanduser('/Volumes/sw/podofo/*.dylib'))[0]
shutil.copyfile(pdf, os.path.join(frameworks_dir, os.path.basename(pdf))) shutil.copyfile(pdf, os.path.join(frameworks_dir, os.path.basename(pdf)))

View File

@ -62,16 +62,16 @@ if __name__ == '__main__':
podofo_inc = '/usr/include/podofo' if islinux else \ podofo_inc = '/usr/include/podofo' if islinux else \
'C:\\podofo\\include\\podofo' if iswindows else \ 'C:\\podofo\\include\\podofo' if iswindows else \
'/Users/kovid/podofo/include/podofo' '/Volumes/sw/podofo/include/podofo'
podofo_lib = '/usr/lib' if islinux else r'C:\podofo' if iswindows else \ podofo_lib = '/usr/lib' if islinux else r'C:\podofo' if iswindows else \
'/Users/kovid/podofo/lib' '/Volumes/sw/podofo/lib'
podofo_inc = os.environ.get('PODOFO_INC_DIR', podofo_inc)
if os.path.exists(os.path.join(podofo_inc, 'podofo.h')): if os.path.exists(os.path.join(podofo_inc, 'podofo.h')):
optional.append(Extension('calibre.plugins.podofo', optional.append(Extension('calibre.plugins.podofo',
sources=['src/calibre/utils/podofo/podofo.cpp'], sources=['src/calibre/utils/podofo/podofo.cpp'],
libraries=['podofo'], libraries=['podofo'],
library_dirs=[os.environ.get('PODOFO_LIB_DIR', podofo_lib)], library_dirs=[os.environ.get('PODOFO_LIB_DIR', podofo_lib)],
include_dirs=\ include_dirs=[podofo_inc]))
[os.environ.get('PODOFO_INC_DIR', podofo_inc)]))
else: else:
print 'WARNING: PoDoFo not found on your system. Various PDF related', print 'WARNING: PoDoFo not found on your system. Various PDF related',
print 'functionality will not work.' print 'functionality will not work.'

View File

@ -79,7 +79,7 @@ class DevicePlugin(Plugin):
are pending GUI jobs that need to communicate with the device. are pending GUI jobs that need to communicate with the device.
''' '''
raise NotImplementedError() raise NotImplementedError()
def set_progress_reporter(self, report_progress): def set_progress_reporter(self, report_progress):
''' '''
@param report_progress: Function that is called with a % progress @param report_progress: Function that is called with a % progress

View File

@ -493,9 +493,15 @@ class Device(DeviceConfig, DevicePlugin):
def eject_windows(self): def eject_windows(self):
pass pass
def eject_osx(self): def eject_osx(self):
pass for x in ('_main_prefix', '_card_a_prefix', '_card_b_prefix'):
x = getattr(self, x, None)
if x is not None:
try:
subprocess.Popen(['diskutil', 'eject', x])
except:
pass
def eject_linux(self): def eject_linux(self):
drives = self.find_device_nodes() drives = self.find_device_nodes()

View File

@ -77,7 +77,8 @@ class DeviceManager(Thread):
''' '''
Thread.__init__(self) Thread.__init__(self)
self.setDaemon(True) self.setDaemon(True)
self.devices = [[d, False] for d in device_plugins()] # [Device driver, Showing in GUI, Ejected]
self.devices = [[d, False, False] for d in device_plugins()]
self.device = None self.device = None
self.device_class = None self.device_class = None
self.sleep_time = sleep_time self.sleep_time = sleep_time
@ -93,6 +94,8 @@ class DeviceManager(Thread):
for device in self.devices: for device in self.devices:
connected = self.scanner.is_device_connected(device[0]) connected = self.scanner.is_device_connected(device[0])
if connected and not device[1]: if connected and not device[1]:
if device[2]:
continue
try: try:
dev = device[0] dev = device[0]
dev.reset() dev.reset()
@ -119,13 +122,23 @@ class DeviceManager(Thread):
job.abort(Exception(_('Device no longer connected.'))) job.abort(Exception(_('Device no longer connected.')))
except Queue.Empty: except Queue.Empty:
break break
device[2] = False
self.device = None self.device = None
self.connected_slot(False) self.connected_slot(False)
device[1] ^= True device[1] ^= True
def umount_device(self): def umount_device(self):
self.device.eject() if self.device is not None:
self.device = None self.device.eject()
dev = None
for x in self.devices:
if x[0] is self.device:
dev = x
break
if dev is not None:
dev[2] = True
self.connected_slot(False)
def next(self): def next(self):
if not self.jobs.empty(): if not self.jobs.empty():

View File

@ -185,7 +185,7 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
self.job_manager) self.job_manager)
self.device_manager.start() self.device_manager.start()
####################### Location View ######################## ####################### Location View ########################
QObject.connect(self.location_view, QObject.connect(self.location_view,
SIGNAL('location_selected(PyQt_PyObject)'), SIGNAL('location_selected(PyQt_PyObject)'),
@ -665,6 +665,7 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
########################## Connect to device ############################## ########################## Connect to device ##############################
def device_detected(self, connected): def device_detected(self, connected):
''' '''
Called when a device is connected to the computer. Called when a device is connected to the computer.

View File

@ -278,8 +278,11 @@ class LibraryServer(object):
r = record[FIELD_MAP['formats']] r = record[FIELD_MAP['formats']]
r = r.upper() if r else '' r = r.upper() if r else ''
if 'EPUB' in r or 'PDB' in r: if 'EPUB' in r or 'PDB' in r:
z = record[FIELD_MAP['authors']]
if not z:
z = _('Unknown')
authors = ' & '.join([i.replace('|', ',') for i in authors = ' & '.join([i.replace('|', ',') for i in
record[FIELD_MAP['authors']].split(',')]) z.split(',')])
extra = [] extra = []
rating = record[FIELD_MAP['rating']] rating = record[FIELD_MAP['rating']]
if rating > 0: if rating > 0:

View File

@ -30,7 +30,7 @@ class WashingtonPost(BasicNewsRecipe):
def get_article_url(self, article): def get_article_url(self, article):
return article.get('feedburner_origlink', article.get('link', None)) return article.get('pheedo_origlink', article.get('link', None))
def print_version(self, url): def print_version(self, url):
return url.rpartition('.')[0] + '_pf.html' return url.rpartition('.')[0] + '_pf.html'