Skip to content

Commit

Permalink
add shortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
outscale-mal committed Sep 25, 2023
1 parent 74574e6 commit bf36db6
Showing 1 changed file with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions osc_tui/mainForm.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,32 +378,42 @@ def reload(self):
self.parentApp.addForm("Cockpit", MainForm, name="osc-tui")
self.parentApp.switchForm("Cockpit")

def quit_key(form, key_val):
def quit_key(self, key_val):
main.kill_threads()
form.parentApp.switchForm("MAIN")
self.parentApp.switchForm("MAIN")

def key_reload(form, _):
form.reload()
def key_reload(self, _):
self.reload()

def switch_to_volumes(form, _):
def switch_to_volumes(self, _):
global MODE
MODE = "Volumes"
form.reload()
self.reload()

def switch_to_instances(form, _):
def switch_to_instances(self, _):
global MODE
MODE = "Vms"
form.reload()
self.reload()

def switch_to_images(form, _):
def switch_to_images(self, _):
global MODE
MODE = "Images"
form.reload()
self.reload()

def switch_to_security_grid(form, _):
def switch_to_security_grid(self, _):
global MODE
MODE = "Security"
form.reload()
self.reload()

def switch_to_nets(self, _):
global MODE
MODE = "Nets"
self.reload()

def switch_to_keypairs(self, _):
global MODE
MODE = "Keypairs"
self.reload()

def set_up_handlers(self):
super().set_up_handlers()
Expand All @@ -416,6 +426,8 @@ def set_up_handlers(self):
self.add_handlers({"I": self.switch_to_instances})
self.add_handlers({"M": self.switch_to_images})
self.add_handlers({"S": self.switch_to_security_grid})
self.add_handlers({"T": self.switch_to_nets})
self.add_handlers({"K": self.switch_to_keypairs})
self.add_handlers({
"r" : self.key_reload,
curses.KEY_F5 : self.key_reload
Expand Down

0 comments on commit bf36db6

Please sign in to comment.