markslider shows time
This commit is contained in:
@@ -22,7 +22,7 @@
|
|||||||
__author__ = "Ville Rantanen <ville.q.rantanen@gmail.com>"
|
__author__ = "Ville Rantanen <ville.q.rantanen@gmail.com>"
|
||||||
__version__ = "0.9"
|
__version__ = "0.9"
|
||||||
|
|
||||||
import sys,os,argparse,re
|
import sys,os,argparse,re,datetime
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
import traceback,tty,termios,subprocess,signal
|
import traceback,tty,termios,subprocess,signal
|
||||||
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
|
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
|
||||||
@@ -394,6 +394,11 @@ def print_menu(reader,opts):
|
|||||||
"slideshow" if opts.slideShow else ""),
|
"slideshow" if opts.slideShow else ""),
|
||||||
opts))
|
opts))
|
||||||
|
|
||||||
|
def print_time(opts):
|
||||||
|
now=datetime.datetime.now()
|
||||||
|
bc.posprint( opts.size[0], opts.size[1]-5,
|
||||||
|
colorify("%02d:%02d"%(now.hour,now.minute),opts))
|
||||||
|
|
||||||
def print_help(reader,opts):
|
def print_help(reader,opts):
|
||||||
''' Create a window with help message '''
|
''' Create a window with help message '''
|
||||||
helptext=get_interactive_help_text().split('\n')
|
helptext=get_interactive_help_text().split('\n')
|
||||||
@@ -463,17 +468,26 @@ def browser(opts,files):
|
|||||||
page_print(reader,opts,offset)
|
page_print(reader,opts,offset)
|
||||||
if opts.menu:
|
if opts.menu:
|
||||||
print_menu(reader,opts)
|
print_menu(reader,opts)
|
||||||
|
print_time(opts)
|
||||||
sys.stdout.write(bc.pos(opts.size[0], opts.size[1]))
|
sys.stdout.write(bc.pos(opts.size[0], opts.size[1]))
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
if opts.screenshots:
|
if opts.screenshots:
|
||||||
take_screenshot(reader,opts)
|
take_screenshot(reader,opts)
|
||||||
while 1:
|
while True:
|
||||||
if opts.slideTimer and opts.slideShow:
|
if opts.slideTimer and opts.slideShow:
|
||||||
signal.signal(signal.SIGALRM, timeouthandler)
|
signal.signal(signal.SIGALRM, timeouthandler)
|
||||||
signal.alarm(opts.slideTimer)
|
signal.alarm(opts.slideTimer)
|
||||||
|
elif opts.menu:
|
||||||
|
signal.signal(signal.SIGALRM, timeouthandler)
|
||||||
|
signal.alarm(15)
|
||||||
inkey=getkeypress()
|
inkey=getkeypress()
|
||||||
signal.alarm(0)
|
signal.alarm(0)
|
||||||
|
if not inkey and not opts.slideShow and opts.menu:
|
||||||
|
# normal operation, just update the time
|
||||||
|
print_time(opts)
|
||||||
|
continue
|
||||||
if not inkey and opts.slideShow:
|
if not inkey and opts.slideShow:
|
||||||
|
# slideshow mode
|
||||||
if opts.exit_last:
|
if opts.exit_last:
|
||||||
if reader.page+1==reader.pages:
|
if reader.page+1==reader.pages:
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user