Simplify command handler
This commit is contained in:
parent
1e8cb42c00
commit
2d8fd4499d
@ -58,39 +58,31 @@ class QuteBrowser(QApplication):
|
|||||||
cmd = argv[0]
|
cmd = argv[0]
|
||||||
args = argv[1:]
|
args = argv[1:]
|
||||||
|
|
||||||
if cmd == 'open':
|
handlers = {
|
||||||
self.mainwindow.tabs.openurl(*args)
|
'open': self.mainwindow.tabs.openurl,
|
||||||
elif cmd == 'tabopen':
|
'tabopen': self.mainwindow.tabs.tabopen,
|
||||||
self.mainwindow.tabs.tabopen(*args)
|
'quit': QApplication.closeAllWindows, # FIXME
|
||||||
elif cmd == 'quit':
|
'tabclose': self.mainwindow.tabs.close_act,
|
||||||
QApplication.closeAllWindows() # FIXME
|
'tabprev': self.mainwindow.tabs.switch_prev,
|
||||||
elif cmd == 'tabclose':
|
'tabnext': self.mainwindow.tabs.switch_next,
|
||||||
self.mainwindow.tabs.close_act()
|
'reload': self.mainwindow.tabs.reload_act,
|
||||||
elif cmd == 'tabprev':
|
'stop': self.mainwindow.tabs.stop_act,
|
||||||
self.mainwindow.tabs.switch_prev()
|
'back': self.mainwindow.tabs.back_act,
|
||||||
elif cmd == 'tabnext':
|
'forward': self.mainwindow.tabs.forward_act,
|
||||||
self.mainwindow.tabs.switch_next()
|
'print': self.mainwindow.tabs.print_act,
|
||||||
elif cmd == 'reload':
|
'scrolldown': self.mainwindow.tabs.scroll_down_act,
|
||||||
self.mainwindow.tabs.reload_act()
|
'scrollup': self.mainwindow.tabs.scroll_up_act,
|
||||||
elif cmd == 'stop':
|
'scrollleft': self.mainwindow.tabs.scroll_left_act,
|
||||||
self.mainwindow.tabs.stop_act()
|
'scrollright': self.mainwindow.tabs.scroll_right_act,
|
||||||
elif cmd == 'back':
|
'scrollstart': self.mainwindow.tabs.scroll_start_act,
|
||||||
self.mainwindow.tabs.back_act()
|
'scrollend': self.mainwindow.tabs.scroll_end_act,
|
||||||
elif cmd == 'forward':
|
'undo': self.mainwindow.tabs.undo_close,
|
||||||
self.mainwindow.tabs.forward_act()
|
}
|
||||||
elif cmd == 'print':
|
|
||||||
self.mainwindow.tabs.print_act()
|
handler = handlers[cmd]
|
||||||
elif cmd == 'scrolldown':
|
sender = self.sender()
|
||||||
self.mainwindow.tabs.scroll_down_act(count=count)
|
|
||||||
elif cmd == 'scrollup':
|
if sender.count:
|
||||||
self.mainwindow.tabs.scroll_up_act(count=count)
|
handler(*args, count=count)
|
||||||
elif cmd == 'scrollleft':
|
else:
|
||||||
self.mainwindow.tabs.scroll_left_act(count=count)
|
handler(*args)
|
||||||
elif cmd == 'scrollright':
|
|
||||||
self.mainwindow.tabs.scroll_right_act(count=count)
|
|
||||||
elif cmd == 'scrollstart':
|
|
||||||
self.mainwindow.tabs.scroll_start_act()
|
|
||||||
elif cmd == 'scrollend':
|
|
||||||
self.mainwindow.tabs.scroll_end_act()
|
|
||||||
elif cmd == 'undo':
|
|
||||||
self.mainwindow.tabs.undo_close()
|
|
||||||
|
Loading…
Reference in New Issue
Block a user