chore: various minor cleanups

pull/2453/head
Qingping Hou 7 years ago
parent 36763a1ad7
commit dc2746f1d7

@ -83,9 +83,7 @@ end
function ReaderFrontLight:onShowFlDialog()
local FrontLightWidget = require("ui/widget/frontlightwidget")
local fl = FrontLightWidget:new{
}
UIManager:show(fl)
UIManager:show(FrontLightWidget:new{})
end
function ReaderFrontLight:close()

@ -108,10 +108,13 @@ function FileChooser:genItemTableFromPath(path)
local dir_files = {}
local subdir_path = self.path.."/"..dir.name
self.list(subdir_path, sub_dirs, dir_files)
local items = #sub_dirs + #dir_files
local istr = util.template(
items == 1 and _("1 item")
or _("%1 items"), items)
local num_items = #sub_dirs + #dir_files
local istr
if num_items == 1 then
istr = _("1 item")
else
istr = util.template(_("%1 items"), num_items)
end
table.insert(item_table, {
text = dir.name.."/",
mandatory = istr,
@ -148,8 +151,8 @@ function FileChooser:genItemTableFromPath(path)
path = full_path
})
end
-- lfs.dir iterated node string may be encoded with some weird codepage on Windows
-- we need to encode them to utf-8
-- lfs.dir iterated node string may be encoded with some weird codepage on
-- Windows we need to encode them to utf-8
if ffi.os == "Windows" then
for k, v in pairs(item_table) do
if v.text then

@ -42,7 +42,7 @@ function FrontLightWidget:init()
self.fl_cur = self.fl_min
end
local steps_fl = self.fl_max - self.fl_min + 1
self.one_step = math.ceil(steps_fl / 25 )
self.one_step = math.ceil(steps_fl / 25)
self.steps = math.ceil(steps_fl / self.one_step)
if (self.steps - 1) * self.one_step < self.fl_max - self.fl_min then
self.steps = self.steps + 1
@ -91,7 +91,6 @@ function FrontLightWidget:generateProgressGroup(width, height, fl_level, step)
end
function FrontLightWidget:setProgress(num, step)
--clear previous data
self.fl_container:clear()
local padding_span = VerticalSpan:new{ width = self.span }
local button_group_down = HorizontalGroup:new{ align = "center" }

Loading…
Cancel
Save