Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Development

Notices

Reply
 
Thread Tools Search this Thread
Old 09-10-2014, 09:40 PM   #1
silentfuzzle
Junior Member
silentfuzzle began at the beginning.
 
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.
silentfuzzle is offline   Reply With Quote
Old 09-10-2014, 10:40 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
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.
kovidgoyal is offline   Reply With Quote
Advert
Old 09-10-2014, 11:17 PM   #3
silentfuzzle
Junior Member
silentfuzzle began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Aug 2014
Device: none
Ah, okay. That makes sense. Good to know!
silentfuzzle is offline   Reply With Quote
Reply

Tags
python os resources


Forum Jump

Similar Threads
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


All times are GMT -4. The time now is 04:58 PM.


MobileRead.com is a privately owned, operated and funded community.