Skip to content

Commit

Permalink
[bug 706] 706-Favorites-Bookmarks-Plugin gnome-terminator#706
Browse files Browse the repository at this point in the history
- the dialog window taking command for bookmark via shortcut keybinding will have focus on OK Button for faster interaction
- fixed a transient window issue for loading pref window via shortcut and context menu
- filed new command text area  was getting filled with last command
- fixed list store init
  • Loading branch information
vssdeo committed Oct 16, 2023
1 parent 86337ad commit a5ddcbe
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions terminatorlib/plugins/custom_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,20 +160,21 @@ def on_keypress(self, widget, event):
if act == PluginActAdd:
dbg("add bookmark")

self.setup_store()
dialog_vars = self.get_last_exe_cmd_dialog_vars()
self.on_new(None, {'dialog_vars' : dialog_vars })
self.update_cmd_list(self.store)
self._save_config()
return True

if act == PluginActBmk:
dbg("open bookmark preferences")
cur_win = Terminator().last_focused_term.get_toplevel()
self.configure(cur_win)
dbg("open custom command preferences")
self.configure(None)
return True


def callback(self, menuitems, menu, terminal):

"""Add our menu items to the menu"""
submenus = {}
item = Gtk.MenuItem.new_with_mnemonic(_('_Custom Commands'))
Expand Down Expand Up @@ -270,7 +271,8 @@ def configure(self, widget, data = None):
_("_OK"), Gtk.ResponseType.ACCEPT
)
)
dbox.set_transient_for(widget.get_toplevel())
if widget:
dbox.set_transient_for(widget.get_toplevel())

icon_theme = Gtk.IconTheme.get_default()
if icon_theme.lookup_icon('terminator-custom-commands', 48, 0):
Expand Down Expand Up @@ -356,8 +358,7 @@ def configure(self, widget, data = None):

button = Gtk.Button(_("Bookmark Last Cmd"))
button_box.pack_start(button, False, True, 0)
ui['dialog_vars'] = self.get_last_exe_cmd_dialog_vars()
button.connect("clicked", self.on_new, ui)
button.connect("clicked", self.on_last_exe_cmd, ui)
ui['button_save_last_cmd'] = button

hbox.pack_start(button_box, False, True, 0)
Expand Down Expand Up @@ -424,8 +425,16 @@ def _create_command_dialog(self, enabled_var = False, name_var = "",
_("_OK"), Gtk.ResponseType.ACCEPT
)
)

#since we call this via shortcut keybinding
#lets focus on OK button
buttonbox = dialog.get_action_area()
buttons = buttonbox.get_children()
dialog.set_focus(buttons[1])

# dbox is init in configure function, in case we want to
# create dialog directly

if self.dbox:
dialog.set_transient_for(self.dbox)

Expand Down Expand Up @@ -463,6 +472,11 @@ def _create_command_dialog(self, enabled_var = False, name_var = "",
dialog.show_all()
return (dialog,enabled,name,name_parse,command)

def on_last_exe_cmd(self, button, data):
new_data = data.copy()
new_data['dialog_vars'] = self.get_last_exe_cmd_dialog_vars()
self.on_new(button, new_data)

def on_new(self, button, data):

#default values can be passed to dialogue window if required
Expand Down

0 comments on commit a5ddcbe

Please sign in to comment.