mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Merge pull request #2147 from koreader/houqp-master
move setDirty call from TextWidget:setText to FileManager
This commit is contained in:
@@ -8,4 +8,4 @@ make all
|
||||
retry_cmd 2 make testfront
|
||||
set +o pipefail
|
||||
luajit $(which luacheck) --no-color -q frontend | tee ./luacheck.out
|
||||
test $(grep Total ./luacheck.out | awk '{print $2}') -le 25
|
||||
test $(grep Total ./luacheck.out | awk '{print $2}') -le 19
|
||||
|
||||
@@ -64,16 +64,20 @@ function FileManager:init()
|
||||
text = self.root_path,
|
||||
}
|
||||
|
||||
self.banner = VerticalGroup:new{
|
||||
TextWidget:new{
|
||||
face = Font:getFace("tfont", 24),
|
||||
text = self.title,
|
||||
},
|
||||
CenterContainer:new{
|
||||
dimen = { w = Screen:getWidth(), h = nil },
|
||||
self.path_text,
|
||||
},
|
||||
VerticalSpan:new{ width = Screen:scaleBySize(10) }
|
||||
self.banner = FrameContainer:new{
|
||||
padding = 0,
|
||||
bordersize = 0,
|
||||
VerticalGroup:new{
|
||||
TextWidget:new{
|
||||
face = Font:getFace("tfont", 24),
|
||||
text = self.title,
|
||||
},
|
||||
CenterContainer:new{
|
||||
dimen = { w = Screen:getWidth(), h = nil },
|
||||
self.path_text,
|
||||
},
|
||||
VerticalSpan:new{ width = Screen:scaleBySize(10) }
|
||||
}
|
||||
}
|
||||
|
||||
local g_show_hidden = G_reader_settings:readSetting("show_hidden")
|
||||
@@ -100,6 +104,9 @@ function FileManager:init()
|
||||
|
||||
function file_chooser:onPathChanged(path) -- luacheck: ignore
|
||||
FileManager.instance.path_text:setText(path)
|
||||
UIManager:setDirty(FileManager.instance, function()
|
||||
return "ui", FileManager.instance.banner.dimen
|
||||
end)
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
@@ -363,10 +363,10 @@ function Search:find(option)
|
||||
end
|
||||
end
|
||||
if not self.use_own_metadata_file then
|
||||
f = io.open(self.metafile_1)
|
||||
g = io.open(koreaderfile,"w")
|
||||
local g = io.open(koreaderfile, "w")
|
||||
g:write("#metadata.koreader Version 1.1\n")
|
||||
|
||||
f = io.open(self.metafile_1)
|
||||
line = f:read()
|
||||
while line do
|
||||
if line == " }, " or line == " }" then
|
||||
@@ -546,7 +546,7 @@ function Search:showresults()
|
||||
UIManager:show(menu_container)
|
||||
end
|
||||
|
||||
function Search:browse(option,run,chosen)
|
||||
function Search:browse(option, run, chosen)
|
||||
local ReaderUI = require("apps/reader/readerui")
|
||||
local restart_me = false
|
||||
local menu_container = CenterContainer:new{
|
||||
@@ -648,17 +648,17 @@ function Search:browse(option,run,chosen)
|
||||
i = i + 1
|
||||
end
|
||||
end
|
||||
local dummy = ""
|
||||
|
||||
local menu_title
|
||||
if run == 1 then
|
||||
dummy = _("Browse") .. " " .. option
|
||||
menu_title = _("Browse") .. " " .. option
|
||||
else
|
||||
dummy = chosen
|
||||
menu_title = chosen
|
||||
end
|
||||
|
||||
table.sort(self.results, function(v1,v2) return v1.text < v2.text end)
|
||||
|
||||
self.search_menu:swithItemTable(dummy, self.results)
|
||||
self.search_menu:swithItemTable(menu_title, self.results)
|
||||
UIManager:show(menu_container)
|
||||
end
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
local UIManager = require("ui/uimanager")
|
||||
local Widget = require("ui/widget/widget")
|
||||
local Screen = require("device").screen
|
||||
local RenderText = require("ui/rendertext")
|
||||
@@ -51,9 +50,6 @@ end
|
||||
function TextWidget:setText(text)
|
||||
self.text = text
|
||||
self:updateSize()
|
||||
UIManager:setDirty(self.parent, function()
|
||||
return "partial", self.dimen
|
||||
end)
|
||||
end
|
||||
|
||||
function TextWidget:paintTo(bb, x, y)
|
||||
|
||||
Reference in New Issue
Block a user