Add a few more default responses for confirmations
This commit is contained in:
parent
8f688fb33b
commit
4af2526f54
@ -1058,13 +1058,14 @@ class FileTransmission:
|
|||||||
'The remote machine wants to read some files from this computer. Do you want to allow the transfer?'
|
'The remote machine wants to read some files from this computer. Do you want to allow the transfer?'
|
||||||
)],
|
)],
|
||||||
window=window, custom_callback=partial(self.handle_receive_confirmation, asd_id),
|
window=window, custom_callback=partial(self.handle_receive_confirmation, asd_id),
|
||||||
|
default_data={'response': 'n'}
|
||||||
)
|
)
|
||||||
|
|
||||||
def handle_receive_confirmation(self, cmd_id: str, data: Dict[str, str], *a: Any) -> None:
|
def handle_receive_confirmation(self, cmd_id: str, data: Dict[str, str], *a: Any) -> None:
|
||||||
asd = self.active_sends.get(cmd_id)
|
asd = self.active_sends.get(cmd_id)
|
||||||
if asd is None:
|
if asd is None:
|
||||||
return
|
return
|
||||||
if data['response'] == 'y':
|
if data.get('response') == 'y':
|
||||||
asd.accepted = True
|
asd.accepted = True
|
||||||
else:
|
else:
|
||||||
self.drop_send(asd.id)
|
self.drop_send(asd.id)
|
||||||
@ -1089,13 +1090,14 @@ class FileTransmission:
|
|||||||
'The remote machine wants to send some files to this computer. Do you want to allow the transfer?'
|
'The remote machine wants to send some files to this computer. Do you want to allow the transfer?'
|
||||||
)],
|
)],
|
||||||
window=window, custom_callback=partial(self.handle_send_confirmation, ar_id),
|
window=window, custom_callback=partial(self.handle_send_confirmation, ar_id),
|
||||||
|
default_data={'response': 'n'}
|
||||||
)
|
)
|
||||||
|
|
||||||
def handle_send_confirmation(self, cmd_id: str, data: Dict[str, str], *a: Any) -> None:
|
def handle_send_confirmation(self, cmd_id: str, data: Dict[str, str], *a: Any) -> None:
|
||||||
ar = self.active_receives.get(cmd_id)
|
ar = self.active_receives.get(cmd_id)
|
||||||
if ar is None:
|
if ar is None:
|
||||||
return
|
return
|
||||||
if data['response'] == 'y':
|
if data.get('response') == 'y':
|
||||||
ar.accepted = True
|
ar.accepted = True
|
||||||
else:
|
else:
|
||||||
self.drop_receive(ar.id)
|
self.drop_receive(ar.id)
|
||||||
|
|||||||
@ -659,13 +659,14 @@ class Window:
|
|||||||
'--choice=o:Open', '--choice=c:Copy to clipboard', '--choice=n;red:Nothing'
|
'--choice=o:Open', '--choice=c:Copy to clipboard', '--choice=n;red:Nothing'
|
||||||
],
|
],
|
||||||
window=self,
|
window=self,
|
||||||
custom_callback=partial(self.hyperlink_open_confirmed, url, cwd)
|
custom_callback=partial(self.hyperlink_open_confirmed, url, cwd),
|
||||||
|
default_data={'response': ''}
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
get_boss().open_url(url, cwd=cwd)
|
get_boss().open_url(url, cwd=cwd)
|
||||||
|
|
||||||
def hyperlink_open_confirmed(self, url: str, cwd: Optional[str], data: Dict[str, Any], *a: Any) -> None:
|
def hyperlink_open_confirmed(self, url: str, cwd: Optional[str], data: Dict[str, Any], *a: Any) -> None:
|
||||||
q = data['response']
|
q = data.get('response', '')
|
||||||
if q == 'o':
|
if q == 'o':
|
||||||
get_boss().open_url(url, cwd=cwd)
|
get_boss().open_url(url, cwd=cwd)
|
||||||
elif q == 'c':
|
elif q == 'c':
|
||||||
@ -912,14 +913,15 @@ class Window:
|
|||||||
'A program running in this window wants to read from the system clipboard.'
|
'A program running in this window wants to read from the system clipboard.'
|
||||||
' Allow it do so, once?')],
|
' Allow it do so, once?')],
|
||||||
window=self,
|
window=self,
|
||||||
custom_callback=self.handle_clipboard_confirmation
|
custom_callback=self.handle_clipboard_confirmation,
|
||||||
|
default_data={'response': 'n'}
|
||||||
)
|
)
|
||||||
|
|
||||||
def handle_clipboard_confirmation(self, data: Dict[str, Any], *a: Any) -> None:
|
def handle_clipboard_confirmation(self, data: Dict[str, Any], *a: Any) -> None:
|
||||||
try:
|
try:
|
||||||
loc = 'p' if self.current_clipboard_read_ask else 'c'
|
loc = 'p' if self.current_clipboard_read_ask else 'c'
|
||||||
response = ''
|
response = ''
|
||||||
if data['response'] == 'y':
|
if data.get('response') == 'y':
|
||||||
response = get_primary_selection() if self.current_clipboard_read_ask else get_clipboard_string()
|
response = get_primary_selection() if self.current_clipboard_read_ask else get_clipboard_string()
|
||||||
self.send_osc52(loc, response)
|
self.send_osc52(loc, response)
|
||||||
finally:
|
finally:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user