fix: prevents illegal WPM values and uses default in those cases.
This commit is contained in:
committed by
Julian Murgia
parent
d676e50284
commit
e4414141cb
@@ -18,6 +18,8 @@ const LEFT_CLICK_ACTION_SPEED_UP = "Speed up"
|
|||||||
const LEFT_CLICK_ACTION_INSTANT_FINISH = "Instant finish"
|
const LEFT_CLICK_ACTION_INSTANT_FINISH = "Instant finish"
|
||||||
const LEFT_CLICK_ACTION_NOTHING = "None"
|
const LEFT_CLICK_ACTION_NOTHING = "None"
|
||||||
|
|
||||||
|
const READING_SPEED_IN_WPM_DEFAULT_VALUE = 200
|
||||||
|
|
||||||
|
|
||||||
var leftClickActions: Array = [
|
var leftClickActions: Array = [
|
||||||
LEFT_CLICK_ACTION_SPEED_UP,
|
LEFT_CLICK_ACTION_SPEED_UP,
|
||||||
@@ -113,7 +115,7 @@ func enable_plugin():
|
|||||||
|
|
||||||
ESCProjectSettingsManager.register_setting(
|
ESCProjectSettingsManager.register_setting(
|
||||||
READING_SPEED_IN_WPM,
|
READING_SPEED_IN_WPM,
|
||||||
200,
|
READING_SPEED_IN_WPM_DEFAULT_VALUE,
|
||||||
{
|
{
|
||||||
"type": TYPE_INT
|
"type": TYPE_INT
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,6 +53,18 @@ func _ready():
|
|||||||
SimpleDialogPlugin.READING_SPEED_IN_WPM
|
SimpleDialogPlugin.READING_SPEED_IN_WPM
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if _reading_speed_in_wpm <= 0:
|
||||||
|
escoria.logger.warn(
|
||||||
|
self,
|
||||||
|
"%s setting must be a positive number. Will use default value of %s." %
|
||||||
|
[
|
||||||
|
SimpleDialogPlugin.READING_SPEED_IN_WPM,
|
||||||
|
SimpleDialogPlugin.READING_SPEED_IN_WPM_DEFAULT_VALUE
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
_reading_speed_in_wpm = SimpleDialogPlugin.READING_SPEED_IN_WPM_DEFAULT_VALUE
|
||||||
|
|
||||||
_word_regex.compile("\\S+")
|
_word_regex.compile("\\S+")
|
||||||
|
|
||||||
text_node.bbcode_enabled = true
|
text_node.bbcode_enabled = true
|
||||||
|
|||||||
@@ -52,6 +52,18 @@ func _ready():
|
|||||||
SimpleDialogPlugin.READING_SPEED_IN_WPM
|
SimpleDialogPlugin.READING_SPEED_IN_WPM
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if _reading_speed_in_wpm <= 0:
|
||||||
|
escoria.logger.warn(
|
||||||
|
self,
|
||||||
|
"%s setting must be a positive number. Will use default value of %s." %
|
||||||
|
[
|
||||||
|
SimpleDialogPlugin.READING_SPEED_IN_WPM,
|
||||||
|
SimpleDialogPlugin.READING_SPEED_IN_WPM_DEFAULT_VALUE
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
_reading_speed_in_wpm = SimpleDialogPlugin.READING_SPEED_IN_WPM_DEFAULT_VALUE
|
||||||
|
|
||||||
_word_regex.compile("\\S+")
|
_word_regex.compile("\\S+")
|
||||||
|
|
||||||
bbcode_enabled = true
|
bbcode_enabled = true
|
||||||
|
|||||||
Reference in New Issue
Block a user