![]() |
#1 |
Junior Member
![]() Posts: 4
Karma: 10
Join Date: Aug 2014
Device: none
|
P function?
Sorry if this is a Python newbie question. In my Calibre development environment, I added an html file to the calibre/resources folder as my Calibre modification needed to reference it. To figure out how to do so without hardcoding the full filepath, I searched around Calibre's source files until I found a bit of code that looked like it was referencing a folder in the resources folder. I found this on line 199 of calibre/src/calibre/gui2/viewer/documentview.py:
mjpath = P(u'viewer/mathjax').replace(os.sep, '/') I copied this into my code and modified it to reference the html file that I added. It worked for the most part, but I'm confused as to what this code is actually doing and figured it'd be good to know if I'm using it. What is this 'P' function? Is it specific to Calibre or is it part of the os library? I noticed I had to add that in order for it to work, but I didn't have to add anything else. Searching on Google for 'python P' of course wasn't helpful. ![]() |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 44,263
Karma: 23661992
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
It's calibre specific. Look in utils/resources.py for its definition.
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Junior Member
![]() Posts: 4
Karma: 10
Join Date: Aug 2014
Device: none
|
Ah, okay. That makes sense. Good to know!
|
![]() |
![]() |
![]() |
Tags |
python os resources |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
function re() | myki | Library Management | 6 | 06-23-2014 05:11 PM |
Mini Search function? | AndrewH | Kobo Reader | 4 | 12-21-2013 11:20 AM |
Touch Search function | tkavan | Kobo Reader | 7 | 06-26-2012 09:54 AM |
Request Mute Function | Dr. T | enTourage Archive | 4 | 11-10-2010 11:30 AM |
Find function | doug38 | Ectaco jetBook | 3 | 03-07-2010 10:51 PM |