mirror of
https://github.com/koreader/koreader
synced 2024-11-10 01:10:34 +00:00
[fix] Empty directory path and crash on TextWidget (#5606)
This commit is contained in:
parent
7775233688
commit
03fda96041
@ -32,7 +32,7 @@ function filemanagerutil.abbreviate(path)
|
|||||||
end
|
end
|
||||||
local len = home_dir:len()
|
local len = home_dir:len()
|
||||||
local start = path:sub(1, len)
|
local start = path:sub(1, len)
|
||||||
if start == home_dir then
|
if start == home_dir and path:sub(len+1, len+1) == "/" then
|
||||||
return path:sub(len+2)
|
return path:sub(len+2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -185,7 +185,7 @@ function SkimToWidget:init()
|
|||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
self.current_page_text = Button:new{
|
self.current_page_text = Button:new{
|
||||||
text = self.curr_page,
|
text = tostring(self.curr_page),
|
||||||
bordersize = 0,
|
bordersize = 0,
|
||||||
margin = self.button_margin,
|
margin = self.button_margin,
|
||||||
radius = 0,
|
radius = 0,
|
||||||
@ -365,7 +365,7 @@ function SkimToWidget:update()
|
|||||||
self.curr_page = self.page_count
|
self.curr_page = self.page_count
|
||||||
end
|
end
|
||||||
self.progress_bar.percentage = self.curr_page / self.page_count
|
self.progress_bar.percentage = self.curr_page / self.page_count
|
||||||
self.current_page_text:setText(self.curr_page, self.current_page_text.width)
|
self.current_page_text:setText(tostring(self.curr_page), self.current_page_text.width)
|
||||||
end
|
end
|
||||||
|
|
||||||
function SkimToWidget:addOriginToLocationStack(add_current)
|
function SkimToWidget:addOriginToLocationStack(add_current)
|
||||||
|
@ -137,7 +137,7 @@ end
|
|||||||
|
|
||||||
function BookStatusWidget:getStatDays()
|
function BookStatusWidget:getStatDays()
|
||||||
if stats_book.days then
|
if stats_book.days then
|
||||||
return stats_book.days
|
return tostring(stats_book.days)
|
||||||
else
|
else
|
||||||
return _("N/A")
|
return _("N/A")
|
||||||
end
|
end
|
||||||
|
@ -40,6 +40,8 @@ local dayOfWeekTranslation = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function ReaderProgress:init()
|
function ReaderProgress:init()
|
||||||
|
self.current_pages = tostring(self.current_pages)
|
||||||
|
self.today_pages = tostring(self.today_pages)
|
||||||
self.small_font_face = Font:getFace("smallffont")
|
self.small_font_face = Font:getFace("smallffont")
|
||||||
self.medium_font_face = Font:getFace("ffont")
|
self.medium_font_face = Font:getFace("ffont")
|
||||||
self.large_font_face = Font:getFace("largeffont")
|
self.large_font_face = Font:getFace("largeffont")
|
||||||
@ -456,7 +458,7 @@ function ReaderProgress:genSummaryWeek(width)
|
|||||||
CenterContainer:new{
|
CenterContainer:new{
|
||||||
dimen = Geom:new{ w = tile_width, h = tile_height },
|
dimen = Geom:new{ w = tile_width, h = tile_height },
|
||||||
TextWidget:new{
|
TextWidget:new{
|
||||||
text = total_pages,
|
text = tostring(total_pages),
|
||||||
face = self.medium_font_face,
|
face = self.medium_font_face,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -470,7 +472,7 @@ function ReaderProgress:genSummaryWeek(width)
|
|||||||
CenterContainer:new{
|
CenterContainer:new{
|
||||||
dimen = Geom:new{ w = tile_width, h = tile_height },
|
dimen = Geom:new{ w = tile_width, h = tile_height },
|
||||||
TextWidget:new{
|
TextWidget:new{
|
||||||
text = math.floor(total_pages / 7),
|
text = tostring(math.floor(total_pages / 7)),
|
||||||
face = self.medium_font_face,
|
face = self.medium_font_face,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user