Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 12-16-2011, 10:54 AM   #1
transmitthis
Addict
transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.
 
transmitthis's Avatar
 
Posts: 288
Karma: 1003542
Join Date: May 2011
Device: Google Nexus 7 16GB
Time Column

I'm wondering what the options are when making a custom column for "Time"

Ideally it would be like the Date selector, where a calendar is available to quick select, but I imagine that's not possible for time.

So is there a nice way to display and/or enter time in a column

I have been looking at the python number formatting strings, but its too full of unfamiliar terms for me to understand.

usage will mostly be for small time increments below 4 hours and probably consisting of lots of mins. ie 1h 30min, 45min, 1h 15min, that kind of thing, if it makes a difference.

I did notice that the up/down arrows seem only to change whole integers, wondering if that is set or can be changed... anyway if anyone has any thoughts on time entry please let me know.
transmitthis is offline   Reply With Quote
Old 12-16-2011, 11:19 AM   #2
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,689
Karma: 54369090
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by transmitthis View Post
I'm wondering what the options are when making a custom column for "Time"

Ideally it would be like the Date selector, where a calendar is available to quick select, but I imagine that's not possible for time.

So is there a nice way to display and/or enter time in a column

I have been looking at the python number formatting strings, but its too full of unfamiliar terms for me to understand.

usage will mostly be for small time increments below 4 hours and probably consisting of lots of mins. ie 1h 30min, 45min, 1h 15min, that kind of thing, if it makes a difference.

I did notice that the up/down arrows seem only to change whole integers, wondering if that is set or can be changed... anyway if anyone has any thoughts on time entry please let me know.
I use a custom daytime column that (automatically) gets a 'Set to Today' (Really 'NOW') that updates the value to the second (Sorting order is the clue, even though you can't see the time)

Look in the (save to disk) template editor: format_modtimes for code clues
theducks is online now   Reply With Quote
Advert
Old 12-16-2011, 12:47 PM   #3
transmitthis
Addict
transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.
 
transmitthis's Avatar
 
Posts: 288
Karma: 1003542
Join Date: May 2011
Device: Google Nexus 7 16GB
thanks for helping Ducks,
But really this...
def evaluate(self, formatter, kwargs, mi, locals, fmt):
fmt_data = mi.get('format_metadata', {})
data = sorted(fmt_data.items(), key=lambda x:x[1]['mtime'], reverse=True)
return ','.join(k.upper()+':'+format_date(v['mtime'], fmt)
for k,v in data)
Means nothing to me


I just really want to know what to put in here - see attachment.
Attached Thumbnails
Click image for larger version

Name:	donthavethetime.jpg
Views:	181
Size:	60.1 KB
ID:	80014  
transmitthis is offline   Reply With Quote
Old 12-17-2011, 03:07 PM   #4
transmitthis
Addict
transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.
 
transmitthis's Avatar
 
Posts: 288
Karma: 1003542
Join Date: May 2011
Device: Google Nexus 7 16GB
Still Stuck on this, is anyone able to help me make a simple time column?

Would be very grateful.

PS, I did try and find out answer myself, but then I took an arrow in the knee.
transmitthis is offline   Reply With Quote
Old 12-18-2011, 03:32 AM   #5
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,703
Karma: 6658935
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
It seems that you want a column to express duration in minutes, not a time. I can think of one way to do this, but it isn't particularly pretty.

First: what doesn't work. Using the formatting feature of float and integer doesn't work because you cannot separate the number into the two hours/minutes components. Using a datetime with a format of "hh:mm" doesn't work because it isn't a duration; the rest of the date will be set to something, making the column not sortable.

What does work is to use a custom integer field to enter the number of minutes, and then use a custom composite field and a custom template function to format that number-of-minutes into hours and minutes. One possible template function is
Code:
Function: myHoursMinutes
Arg count: 1
Program code:
def evaluate(self, formatter, kwargs, mi, locals, x):
	if not x:
		return ''
	r = int(x)
	return "%d h %d min"%(r/60, r%60)
Assuming that the number-of-minutes column is named #myint, The template in the composite column would be something like:
Code:
{#myint:myHoursMinutes()}
Personally, I wouldn't bother with any of this. I would use a floating point column and enter the number of hours as the integer part and the number of minutes as the fractional part, and let it display as "1.45" or "2.00", etc.
chaley is offline   Reply With Quote
Advert
Old 12-18-2011, 04:53 PM   #6
transmitthis
Addict
transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.transmitthis ought to be getting tired of karma fortunes by now.
 
transmitthis's Avatar
 
Posts: 288
Karma: 1003542
Join Date: May 2011
Device: Google Nexus 7 16GB
Thanks chaley,
Yep your right, keeping it simple is better, and while I liked your suggestion I decided to forgo some sorting capability's and use a (Oh hang on they do sort in order of duration - weird) text field.

So went with this - and as bonus colour was an option, so longer gets redder.

Thanks all for your help, can get back to skyrim now, er I mean back to finding out if I can use calibre to store and index my recipes
Attached Thumbnails
Click image for larger version

Name:	time.jpg
Views:	197
Size:	17.4 KB
ID:	80120  
transmitthis is offline   Reply With Quote
Reply

Tags
time

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
2 column PDF book to 1 column possible? SeaBookGuy Calibre 19 07-01-2013 02:30 AM
Column copy (one time) wsignal Library Management 6 05-08-2013 04:41 PM
Q: multi-column PDF to single column mobi format converstion auburn1975 Calibre 7 01-28-2012 06:11 PM
anyway to change 2 column lrf to 1 column mobi? lapisjay Amazon Kindle 2 01-12-2011 10:20 PM
pdf to lrf with 2 column and 1 column pages in same file danielwille Sony Reader 3 11-12-2008 10:57 AM


All times are GMT -4. The time now is 04:08 AM.


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