Merge pull request #525 from VDuchon/multiline_custom_commands

Allow multiline commands in Custom Commands plugin
This commit is contained in:
Matt Rose 2021-11-02 16:56:46 -04:00 committed by GitHub
commit a9e4fcd2ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -305,8 +305,8 @@ class CustomCommandsMenu(plugin.MenuItem):
label = Gtk.Label(label=_("Command:")) label = Gtk.Label(label=_("Command:"))
table.attach(label, 0, 1, 2, 3) table.attach(label, 0, 1, 2, 3)
command = Gtk.Entry() command = Gtk.TextView()
command.set_text(command_var) command.get_buffer().set_text(command_var)
table.attach(command, 1, 2, 2, 3) table.attach(command, 1, 2, 2, 3)
dialog.vbox.pack_start(table, True, True, 0) dialog.vbox.pack_start(table, True, True, 0)
@ -320,7 +320,7 @@ class CustomCommandsMenu(plugin.MenuItem):
if res == Gtk.ResponseType.ACCEPT: if res == Gtk.ResponseType.ACCEPT:
item['enabled'] = enabled.get_active() item['enabled'] = enabled.get_active()
item['name'] = name.get_text() item['name'] = name.get_text()
item['command'] = command.get_text() item['command'] = command.get_buffer().get_text(command.get_buffer().get_start_iter(), command.get_buffer().get_end_iter(), True)
if item['name'] == '' or item['command'] == '': if item['name'] == '' or item['command'] == '':
err = Gtk.MessageDialog(dialog, err = Gtk.MessageDialog(dialog,
Gtk.DialogFlags.MODAL, Gtk.DialogFlags.MODAL,
@ -430,7 +430,7 @@ class CustomCommandsMenu(plugin.MenuItem):
if res == Gtk.ResponseType.ACCEPT: if res == Gtk.ResponseType.ACCEPT:
item['enabled'] = enabled.get_active() item['enabled'] = enabled.get_active()
item['name'] = name.get_text() item['name'] = name.get_text()
item['command'] = command.get_text() item['command'] = command.get_buffer().get_text(command.get_buffer().get_start_iter(), command.get_buffer().get_end_iter(), True)
if item['name'] == '' or item['command'] == '': if item['name'] == '' or item['command'] == '':
err = Gtk.MessageDialog(dialog, err = Gtk.MessageDialog(dialog,
Gtk.DialogFlags.MODAL, Gtk.DialogFlags.MODAL,