ui: add keyboard accelerators
This commit is contained in:
parent
90fe6b862e
commit
89f34d8621
28
main.go
28
main.go
@ -346,15 +346,15 @@ func (self *DockerGUI) update_visible_tabs(index int) {
|
|||||||
func (self *DockerGUI) create_menu_bar() {
|
func (self *DockerGUI) create_menu_bar() {
|
||||||
menubar := self.MenuBar()
|
menubar := self.MenuBar()
|
||||||
|
|
||||||
file_menu := menubar.AddMenuWithTitle("File")
|
file_menu := menubar.AddMenuWithTitle("&File")
|
||||||
exit_action := qt.NewQAction5("Exit", self.QObject)
|
exit_action := qt.NewQAction5("E&xit", self.QObject)
|
||||||
exit_action.OnTriggered(func() {
|
exit_action.OnTriggered(func() {
|
||||||
self.Close()
|
self.Close()
|
||||||
})
|
})
|
||||||
file_menu.AddAction(exit_action)
|
file_menu.AddAction(exit_action)
|
||||||
|
|
||||||
docker_menu := menubar.AddMenuWithTitle("Docker")
|
docker_menu := menubar.AddMenuWithTitle("&Docker")
|
||||||
refresh_action := qt.NewQAction5("Refresh", self.QObject)
|
refresh_action := qt.NewQAction5("&Refresh", self.QObject)
|
||||||
refresh_action.OnTriggered(self.refresh_data)
|
refresh_action.OnTriggered(self.refresh_data)
|
||||||
docker_menu.AddAction(refresh_action)
|
docker_menu.AddAction(refresh_action)
|
||||||
}
|
}
|
||||||
@ -364,53 +364,53 @@ func (self *DockerGUI) show_context_menu(position *qt.QPoint) {
|
|||||||
current_tab := self.tab_widget.CurrentWidget()
|
current_tab := self.tab_widget.CurrentWidget()
|
||||||
|
|
||||||
// Add refresh action to context menu
|
// Add refresh action to context menu
|
||||||
refresh_action := qt.NewQAction5("Refresh", self.QObject)
|
refresh_action := qt.NewQAction5("&Refresh", self.QObject)
|
||||||
refresh_action.OnTriggered(self.refresh_data)
|
refresh_action.OnTriggered(self.refresh_data)
|
||||||
context_menu.AddAction(refresh_action)
|
context_menu.AddAction(refresh_action)
|
||||||
|
|
||||||
context_menu.AddSeparator()
|
context_menu.AddSeparator()
|
||||||
|
|
||||||
if current_tab == self.containers_tab {
|
if current_tab == self.containers_tab {
|
||||||
terminal_action := qt.NewQAction5("Terminal", self.QObject)
|
terminal_action := qt.NewQAction5("&Terminal", self.QObject)
|
||||||
terminal_action.OnTriggered(func() { self.handle_action("Terminal") })
|
terminal_action.OnTriggered(func() { self.handle_action("Terminal") })
|
||||||
context_menu.AddAction(terminal_action)
|
context_menu.AddAction(terminal_action)
|
||||||
|
|
||||||
logs_action := qt.NewQAction5("Logs", self.QObject)
|
logs_action := qt.NewQAction5("&Logs", self.QObject)
|
||||||
logs_action.OnTriggered(func() { self.open_logs() })
|
logs_action.OnTriggered(func() { self.open_logs() })
|
||||||
context_menu.AddAction(logs_action)
|
context_menu.AddAction(logs_action)
|
||||||
|
|
||||||
context_menu.AddSeparator()
|
context_menu.AddSeparator()
|
||||||
|
|
||||||
start_action := qt.NewQAction5("Start", self.QObject)
|
start_action := qt.NewQAction5("&Start", self.QObject)
|
||||||
start_action.OnTriggered(func() { self.handle_action("Start") })
|
start_action.OnTriggered(func() { self.handle_action("Start") })
|
||||||
context_menu.AddAction(start_action)
|
context_menu.AddAction(start_action)
|
||||||
|
|
||||||
stop_action := qt.NewQAction5("Stop", self.QObject)
|
stop_action := qt.NewQAction5("S&top", self.QObject)
|
||||||
stop_action.OnTriggered(func() { self.handle_action("Stop") })
|
stop_action.OnTriggered(func() { self.handle_action("Stop") })
|
||||||
context_menu.AddAction(stop_action)
|
context_menu.AddAction(stop_action)
|
||||||
|
|
||||||
remove_action := qt.NewQAction5("Remove", self.QObject)
|
remove_action := qt.NewQAction5("Remo&ve", self.QObject)
|
||||||
remove_action.OnTriggered(func() { self.handle_action("Remove") })
|
remove_action.OnTriggered(func() { self.handle_action("Remove") })
|
||||||
context_menu.AddAction(remove_action)
|
context_menu.AddAction(remove_action)
|
||||||
|
|
||||||
} else if current_tab == self.images_tab {
|
} else if current_tab == self.images_tab {
|
||||||
pull_action := qt.NewQAction5("Pull", self.QObject)
|
pull_action := qt.NewQAction5("&Pull", self.QObject)
|
||||||
pull_action.OnTriggered(self.pull_image)
|
pull_action.OnTriggered(self.pull_image)
|
||||||
context_menu.AddAction(pull_action)
|
context_menu.AddAction(pull_action)
|
||||||
|
|
||||||
context_menu.AddSeparator()
|
context_menu.AddSeparator()
|
||||||
|
|
||||||
remove_action := qt.NewQAction5("Remove", self.QObject)
|
remove_action := qt.NewQAction5("Remo&ve", self.QObject)
|
||||||
remove_action.OnTriggered(self.remove_image)
|
remove_action.OnTriggered(self.remove_image)
|
||||||
context_menu.AddAction(remove_action)
|
context_menu.AddAction(remove_action)
|
||||||
|
|
||||||
} else if current_tab == self.networks_tab {
|
} else if current_tab == self.networks_tab {
|
||||||
remove_action := qt.NewQAction5("Remove", self.QObject)
|
remove_action := qt.NewQAction5("Remo&ve", self.QObject)
|
||||||
remove_action.OnTriggered(func() { self.handle_action("Remove") })
|
remove_action.OnTriggered(func() { self.handle_action("Remove") })
|
||||||
context_menu.AddAction(remove_action)
|
context_menu.AddAction(remove_action)
|
||||||
|
|
||||||
} else if current_tab == self.volumes_tab {
|
} else if current_tab == self.volumes_tab {
|
||||||
remove_action := qt.NewQAction5("Remove", self.QObject)
|
remove_action := qt.NewQAction5("Remo&ve", self.QObject)
|
||||||
remove_action.OnTriggered(func() { self.handle_action("Remove") })
|
remove_action.OnTriggered(func() { self.handle_action("Remove") })
|
||||||
context_menu.AddAction(remove_action)
|
context_menu.AddAction(remove_action)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user