(mpv) Add config option to allow/block direct chat input
This commit is contained in:
parent
cc8723babd
commit
8415c93b04
@ -100,7 +100,7 @@ function chat_update()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if use_alpha_rows_for_chat == false then
|
if use_alpha_rows_for_chat == false and opts['chatDirectInput'] == true then
|
||||||
local alphawarning_ass = assdraw.ass_new()
|
local alphawarning_ass = assdraw.ass_new()
|
||||||
alphawarning_ass = "{\\a6}You can temporarily use old mpv bindings with a-z keys.\n{\\a6}Press [TAB] to return to Syncplay chat mode." -- TODO: Move message to messages.py
|
alphawarning_ass = "{\\a6}You can temporarily use old mpv bindings with a-z keys.\n{\\a6}Press [TAB] to return to Syncplay chat mode." -- TODO: Move message to messages.py
|
||||||
ass:append(alphawarning_ass)
|
ass:append(alphawarning_ass)
|
||||||
@ -250,7 +250,8 @@ opts = {
|
|||||||
['chatMaxLines'] = 7,
|
['chatMaxLines'] = 7,
|
||||||
['chatTopMargin'] = 25,
|
['chatTopMargin'] = 25,
|
||||||
['chatLeftMargin'] = 20,
|
['chatLeftMargin'] = 20,
|
||||||
['chatBottomMargin'] = 30
|
['chatBottomMargin'] = 30,
|
||||||
|
['chatDirectInput'] = true
|
||||||
}
|
}
|
||||||
|
|
||||||
function detect_platform()
|
function detect_platform()
|
||||||
@ -297,7 +298,7 @@ local repl_active = false
|
|||||||
local insert_mode = false
|
local insert_mode = false
|
||||||
local line = ''
|
local line = ''
|
||||||
local cursor = 1
|
local cursor = 1
|
||||||
local key_hints_enabled = true
|
local key_hints_enabled = false
|
||||||
|
|
||||||
function input_ass()
|
function input_ass()
|
||||||
if not repl_active then
|
if not repl_active then
|
||||||
@ -731,8 +732,6 @@ add_alpharowbinding('#','#')
|
|||||||
add_alpharowbinding('~','~')
|
add_alpharowbinding('~','~')
|
||||||
add_alpharowbinding('\'','\'')
|
add_alpharowbinding('\'','\'')
|
||||||
add_alpharowbinding('@','@')
|
add_alpharowbinding('@','@')
|
||||||
add_repl_alpharow_bindings(alpharowbindings)
|
|
||||||
mp.add_forced_key_binding('tab', handle_tab)
|
|
||||||
|
|
||||||
add_repl_bindings(bindings)
|
add_repl_bindings(bindings)
|
||||||
|
|
||||||
@ -764,4 +763,10 @@ function set_syncplayintf_options(input)
|
|||||||
chat_format = get_output_style()
|
chat_format = get_output_style()
|
||||||
local vertical_output_area = CANVAS_HEIGHT-(opts['chatTopMargin']+opts['chatBottomMargin'])
|
local vertical_output_area = CANVAS_HEIGHT-(opts['chatTopMargin']+opts['chatBottomMargin'])
|
||||||
max_scrolling_rows = math.floor(vertical_output_area/opts['chatOutputFontSize'])
|
max_scrolling_rows = math.floor(vertical_output_area/opts['chatOutputFontSize'])
|
||||||
|
if opts['chatDirectInput'] == true then
|
||||||
|
add_repl_alpharow_bindings(alpharowbindings)
|
||||||
|
mp.add_forced_key_binding('tab', handle_tab)
|
||||||
|
key_hints_enabled = true
|
||||||
|
else
|
||||||
|
end
|
||||||
end
|
end
|
||||||
@ -176,7 +176,7 @@ MPV_ARGS = ['--force-window', '--idle', '--hr-seek=always', '--keep-open']
|
|||||||
MPV_SLAVE_ARGS = ['--msg-level=all=error,cplayer=info,term-msg=info', '--input-terminal=no', '--input-file=/dev/stdin']
|
MPV_SLAVE_ARGS = ['--msg-level=all=error,cplayer=info,term-msg=info', '--input-terminal=no', '--input-file=/dev/stdin']
|
||||||
MPV_SLAVE_ARGS_NEW = ['--term-playing-msg=<SyncplayUpdateFile>\nANS_filename=${filename}\nANS_length=${=length:${=duration:0}}\nANS_path=${path}\n</SyncplayUpdateFile>', '--terminal=yes']
|
MPV_SLAVE_ARGS_NEW = ['--term-playing-msg=<SyncplayUpdateFile>\nANS_filename=${filename}\nANS_length=${=length:${=duration:0}}\nANS_path=${path}\n</SyncplayUpdateFile>', '--terminal=yes']
|
||||||
MPV_NEW_VERSION = False
|
MPV_NEW_VERSION = False
|
||||||
MPV_SYNCPLAYINTF_OPTIONS_TO_SEND = ["chatInputFontFamily", "chatInputFontSize", "chatInputFontWeight", "chatInputFontUnderline", "chatInputFontColor", "chatInputPosition"]
|
MPV_SYNCPLAYINTF_OPTIONS_TO_SEND = ["chatInputFontFamily", "chatInputFontSize", "chatInputFontWeight", "chatInputFontUnderline", "chatInputFontColor", "chatInputPosition","chatDirectInput"]
|
||||||
MPV_SYNCPLAYINTF_CONSTANTS_TO_SEND = ["MaxChatMessageLength={}".format(MAX_CHAT_MESSAGE_LENGTH)]
|
MPV_SYNCPLAYINTF_CONSTANTS_TO_SEND = ["MaxChatMessageLength={}".format(MAX_CHAT_MESSAGE_LENGTH)]
|
||||||
VLC_SLAVE_ARGS = ['--extraintf=luaintf', '--lua-intf=syncplay', '--no-quiet', '--no-input-fast-seek',
|
VLC_SLAVE_ARGS = ['--extraintf=luaintf', '--lua-intf=syncplay', '--no-quiet', '--no-input-fast-seek',
|
||||||
'--play-and-pause', '--start-time=0']
|
'--play-and-pause', '--start-time=0']
|
||||||
|
|||||||
@ -70,7 +70,8 @@ class ConfigurationGetter(object):
|
|||||||
"chatInputFontWeight" : constants.DEFAULT_CHAT_INPUT_FONT_WEIGHT,
|
"chatInputFontWeight" : constants.DEFAULT_CHAT_INPUT_FONT_WEIGHT,
|
||||||
"chatInputFontUnderline": False,
|
"chatInputFontUnderline": False,
|
||||||
"chatInputFontColor": constants.DEFAULT_CHAT_INPUT_FONT_COLOR,
|
"chatInputFontColor": constants.DEFAULT_CHAT_INPUT_FONT_COLOR,
|
||||||
"chatInputPosition": constants.INPUT_POSITION_TOP
|
"chatInputPosition": constants.INPUT_POSITION_TOP,
|
||||||
|
"chatDirectInput": True,
|
||||||
}
|
}
|
||||||
|
|
||||||
self._defaultConfig = self._config.copy()
|
self._defaultConfig = self._config.copy()
|
||||||
@ -115,6 +116,7 @@ class ConfigurationGetter(object):
|
|||||||
"onlySwitchToTrustedDomains",
|
"onlySwitchToTrustedDomains",
|
||||||
"chatInputEnabled",
|
"chatInputEnabled",
|
||||||
"chatInputFontUnderline",
|
"chatInputFontUnderline",
|
||||||
|
"chatDirectInput"
|
||||||
]
|
]
|
||||||
self._tristate = [
|
self._tristate = [
|
||||||
"checkForUpdatesAutomatically",
|
"checkForUpdatesAutomatically",
|
||||||
@ -160,7 +162,7 @@ class ConfigurationGetter(object):
|
|||||||
"chatInputEnabled","chatInputFontUnderline",
|
"chatInputEnabled","chatInputFontUnderline",
|
||||||
"chatInputFontFamily", "chatInputFontSize",
|
"chatInputFontFamily", "chatInputFontSize",
|
||||||
"chatInputFontWeight", "chatInputFontColor",
|
"chatInputFontWeight", "chatInputFontColor",
|
||||||
"chatInputPosition"],
|
"chatInputPosition","chatDirectInput"],
|
||||||
"general": ["language", "checkForUpdatesAutomatically",
|
"general": ["language", "checkForUpdatesAutomatically",
|
||||||
"lastCheckedForUpdates"]
|
"lastCheckedForUpdates"]
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user