Perception expander: minor fixes (#15364)
This commit is contained in:
1 parent
0380d2125a
commit
f51eb40d70
2 files changed
+21
-14
No files matched your search
@@ -460,8 +460,12 @@ function PluginLoader:showPluginDialog(plugin, touchmenu_instance)
|
||||
}})
|
||||
end
|
||||
end
|
||||
local title = plugin.fullname .. "\n\n" .. plugin.description .. "\n"
|
||||
if plugin.enable and not plugin_instance then
|
||||
title = title .. "\n" .. _("This plugin is used in the reader only.\nOpen this dialog while reading a document to view additional options.")
|
||||
end
|
||||
plugin_dialog = ButtonDialog:new{
|
||||
title = plugin.fullname .. "\n\n" .. plugin.description .. "\n",
|
||||
title = title,
|
||||
title_align = "center",
|
||||
buttons = buttons,
|
||||
}
|
||||
|
||||
@@ -14,8 +14,10 @@ local DataStorage = require("datastorage")
|
||||
local Blitbuffer = require("ffi/blitbuffer")
|
||||
|
||||
local PerceptionExpander = Widget:extend{
|
||||
is_enabled = nil,
|
||||
name = "perceptionexpander",
|
||||
is_doc_only = true,
|
||||
settings_file = DataStorage:getSettingsDir() .. "/perception_expander.lua",
|
||||
is_enabled = nil,
|
||||
page_counter = 0,
|
||||
shift_each_pages = 100,
|
||||
margin = 0.1,
|
||||
@@ -24,21 +26,15 @@ local PerceptionExpander = Widget:extend{
|
||||
margin_shift = 0.03,
|
||||
settings = nil,
|
||||
ALMOST_CENTER_OF_THE_SCREEN = 0.37,
|
||||
last_screen_mode = nil
|
||||
last_screen_mode = nil,
|
||||
}
|
||||
|
||||
function PerceptionExpander:init()
|
||||
if not self.settings then self:readSettingsFile() end
|
||||
|
||||
self.is_enabled = self.settings:isTrue("is_enabled")
|
||||
if not self.is_enabled then
|
||||
return
|
||||
self.settings = LuaSettings:open(self.settings_file)
|
||||
if self.settings:isTrue("is_enabled") then
|
||||
self.is_enabled = true
|
||||
self:createUI(true)
|
||||
end
|
||||
self:createUI(true)
|
||||
end
|
||||
|
||||
function PerceptionExpander:readSettingsFile()
|
||||
self.settings = LuaSettings:open(DataStorage:getSettingsDir() .. "/perception_expander.lua")
|
||||
end
|
||||
|
||||
function PerceptionExpander:createUI(readSettings)
|
||||
@@ -230,7 +226,7 @@ function PerceptionExpander:saveSettings(fields)
|
||||
self.settings:saveSetting("line_color_intensity", self.line_color_intensity)
|
||||
self.settings:saveSetting("shift_each_pages", self.shift_each_pages)
|
||||
self.settings:saveSetting("is_enabled", self.is_enabled)
|
||||
self.settings:flush()
|
||||
self.updated = true
|
||||
|
||||
self:createUI()
|
||||
end
|
||||
@@ -241,4 +237,11 @@ function PerceptionExpander:paintTo(bb, x, y)
|
||||
end
|
||||
end
|
||||
|
||||
function PerceptionExpander:onFlushSettings()
|
||||
if self.updated then
|
||||
self.settings:flush()
|
||||
self.updated = nil
|
||||
end
|
||||
end
|
||||
|
||||
return PerceptionExpander
|
||||
Reference in new issue
Block a user