comparison frontends/src/jp/base.py @ 1884:0fe69871b71f

jp: moved KeyboardInterrupt catch one level higher, so it is also catched if the loop is not started
author Goffi <goffi@goffi.org>
date Sat, 05 Mar 2016 18:00:56 +0100
parents df1ca137b0cb
children 01d56efd488b
comparison
equal deleted inserted replaced
1883:abb2f253188e 1884:0fe69871b71f
247 raise ImportError 247 raise ImportError
248 cls(self) 248 cls(self)
249 249
250 def run(self, args=None): 250 def run(self, args=None):
251 self.args = self.parser.parse_args(args) 251 self.args = self.parser.parse_args(args)
252 self.args.func() 252 try:
253 if self._need_loop or self._auto_loop: 253 self.args.func()
254 self._start_loop() 254 if self._need_loop or self._auto_loop:
255 self._start_loop()
256 except KeyboardInterrupt:
257 log.info(_("User interruption: good bye"))
255 258
256 def _start_loop(self): 259 def _start_loop(self):
257 self.loop = GLib.MainLoop() 260 self.loop = GLib.MainLoop()
258 try: 261 self.loop.run()
259 self.loop.run()
260 except KeyboardInterrupt:
261 log.info(_("User interruption: good bye"))
262 262
263 def stop_loop(self): 263 def stop_loop(self):
264 try: 264 try:
265 self.loop.quit() 265 self.loop.quit()
266 except AttributeError: 266 except AttributeError: