mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Merge pull request #2286 from koreader/houqp-master
defaults: try parse int from user input
This commit is contained in:
@@ -176,7 +176,8 @@ function SetDefaults:init()
|
||||
callback = function()
|
||||
local new_table = {}
|
||||
for _, field in ipairs(MultiInputDialog:getFields()) do
|
||||
new_table[field:match("^[^= ]+")] = field:match("[^= ]+$")
|
||||
local key, value = field:match("^[^= ]+"), field:match("[^= ]+$")
|
||||
new_table[tonumber(key) or key] = tonumber(value) or value
|
||||
end
|
||||
_G[setting_name] = new_table
|
||||
|
||||
@@ -193,7 +194,6 @@ function SetDefaults:init()
|
||||
},
|
||||
},
|
||||
},
|
||||
input_type = "number",
|
||||
width = Screen:getWidth() * 0.95,
|
||||
height = Screen:getHeight() * 0.2,
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ local ReaderKoboLight = InputContainer:new{
|
||||
|
||||
function ReaderKoboLight:init()
|
||||
self[1] = LeftContainer:new{
|
||||
dimen = Geom:new{w = Screen:getWidth(), h = Screen:getHeight()},
|
||||
dimen = Geom:new{w = nil, h = nil},
|
||||
}
|
||||
self:resetLayout()
|
||||
end
|
||||
|
||||
@@ -243,7 +243,11 @@ logmsg "Starting KOReader . . ."
|
||||
if [ "${FROM_KUAL}" == "yes" ] ; then
|
||||
eips_print_bottom_centered "Starting KOReader . . ." 1
|
||||
fi
|
||||
./reader.lua "$@" > crash.log 2>&1
|
||||
|
||||
# we keep maximum 100K worth of crash log
|
||||
cat crash.log &> /dev/null | tail -c 100000000 > crash.log.new
|
||||
mv -f crash.log.new crash.log
|
||||
./reader.lua "$@" >> crash.log 2>&1
|
||||
|
||||
# clean up our own process tree in case the reader crashed (if needed, to avoid flooding KUAL's log)
|
||||
if pidof reader.lua > /dev/null 2>&1 ; then
|
||||
|
||||
@@ -111,7 +111,10 @@ if awk '$4~/(^|,)ro($|,)/' /proc/mounts | grep ' /mnt/sd ' ; then
|
||||
mount -o remount,rw /mnt/sd
|
||||
fi
|
||||
|
||||
./reader.lua "${args}" > crash.log 2>&1
|
||||
# we keep maximum 100K worth of crash log
|
||||
cat crash.log &> /dev/null | tail -c 100000000 > crash.log.new
|
||||
mv -f crash.log.new crash.log
|
||||
./reader.lua "${args}" >> crash.log 2>&1
|
||||
|
||||
if [ "${FROM_NICKEL}" = "true" ] ; then
|
||||
if [ "${FROM_KFMON}" != "true" ] ; then
|
||||
|
||||
@@ -33,7 +33,10 @@ else
|
||||
args="$@"
|
||||
fi
|
||||
|
||||
./reader.lua "$args" > crash.log 2>&1
|
||||
# we keep maximum 100K worth of crash log
|
||||
cat crash.log &> /dev/null | tail -c 100000000 > crash.log.new
|
||||
mv -f crash.log.new crash.log
|
||||
./reader.lua "$args" >> crash.log 2>&1
|
||||
|
||||
if pidof reader.lua > /dev/null 2>&1 ; then
|
||||
killall -TERM reader.lua
|
||||
|
||||
12
reader.lua
12
reader.lua
@@ -1,4 +1,16 @@
|
||||
#!./luajit
|
||||
print(string.format([[
|
||||
---------------------------------------------
|
||||
launching...
|
||||
_ _____ ____ _
|
||||
| |/ / _ \| _ \ ___ __ _ __| | ___ _ __
|
||||
| ' / | | | |_) / _ \/ _` |/ _` |/ _ \ '__|
|
||||
| . \ |_| | _ < __/ (_| | (_| | __/ |
|
||||
|_|\_\___/|_| \_\___|\__,_|\__,_|\___|_|
|
||||
|
||||
[*] Current time: %s
|
||||
]], os.date("%x-%X")))
|
||||
|
||||
|
||||
-- load default settings
|
||||
require "defaults"
|
||||
|
||||
Reference in New Issue
Block a user