View Single Post
Old 07-07-2010, 08:31 AM   #5
JvdW
Zealot
JvdW doesn't litterJvdW doesn't litter
 
Posts: 115
Karma: 150
Join Date: Jul 2008
Location: Netherlands Veenendaal
Device: Palm T5, Sony PRS-505, Nook Color
Quote:
Originally Posted by JvdW View Post
I'll check later today and if viable I'll post a simple patch until this is resolved by QT or incorporated into Caliber.
To follow up I did the following:
- install Calibre-0.7.7
- downloaded the source of calibre-0.7.7
- unpack
- rename %INSTALL_DIR%\calibre\Lib\site-packages\calibre\gui2\__init__.pyo to __init__.pyo.orig
- find \calibre-0.77\src\calibre\gui2\__init__.py
- copy that to %INSTALL_DIR%\Lib\site-packages\calibre\gui2\__init__.py
- load __init__.py into an editor
- goto line 582 (def open_url(qurl))
- select from 582 to 596
- delete
- replace with the following
Code:
def open_url(qurl, path):
    paths = os.environ.get('LD_LIBRARY_PATH',
                '').split(os.pathsep)
    paths = [x for x in paths if x]
    if isfrozen and islinux and paths:
        npaths = [x for x in paths if x != sys.frozen_path]
        os.environ['LD_LIBRARY_PATH'] = os.pathsep.join(npaths)
    if iswindows:
        os.startfile(path)
    else:
        QDesktopServices.openUrl(qurl)
    if isfrozen and islinux and paths:
        os.environ['LD_LIBRARY_PATH'] = os.pathsep.join(paths)


def open_local_file(path):
    url = QUrl.fromLocalFile(path)
    open_url(url, path)
- save
- start calibre and hopefully no errors and a working UNC solution.
(error might be that indents don't match, python is sensitive to extra spaces, or tabs instead of spaces. Watch out for editors which auto convert spaces<->tabs!!)
- rinse and repeat if new version come out and Kovid doesn't like my hacking or there is no other solution.

Problem I workaround is QDesktopServices.openUrl(qurl) function which converts qurl back to a localfile but messes up big time on that.
Example
a = '\\server\path\a.pdf'
b = fromLocalFile(a)
c = toLocalFile(b)
c is not equal to a, it should!

It works for me, might not for you, be careful with your data, BACKUP if you don't know what you're doing, Told you, you have been warned!
Regards,

Joop
JvdW is offline   Reply With Quote