Mercurial > hg
comparison mercurial/crecord.py @ 31929:bf6b44da1d8e
crecord: extract most of 'main' into a sub function
There are some setup and cleanup necessary around the main code, that
setup/cleanup code needs multiple adjustments so we extract the core code into
its own function first for clarity.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Sun, 26 Mar 2017 15:05:12 +0200 |
parents | 4bc3e55cf386 |
children | 7e7743a01103 |
comparison
equal
deleted
inserted
replaced
31928:277b3e2d711b | 31929:bf6b44da1d8e |
---|---|
1614 method to be wrapped by curses.wrapper() for selecting chunks. | 1614 method to be wrapped by curses.wrapper() for selecting chunks. |
1615 """ | 1615 """ |
1616 | 1616 |
1617 origsigwinchhandler = signal.signal(signal.SIGWINCH, | 1617 origsigwinchhandler = signal.signal(signal.SIGWINCH, |
1618 self.sigwinchhandler) | 1618 self.sigwinchhandler) |
1619 return self._main(stdscr) | |
1620 signal.signal(signal.SIGWINCH, origsigwinchhandler) | |
1621 | |
1622 def _main(self, stdscr): | |
1619 self.stdscr = stdscr | 1623 self.stdscr = stdscr |
1620 # error during initialization, cannot be printed in the curses | 1624 # error during initialization, cannot be printed in the curses |
1621 # interface, it should be printed by the calling code | 1625 # interface, it should be printed by the calling code |
1622 self.initerr = None | 1626 self.initerr = None |
1623 self.yscreensize, self.xscreensize = self.stdscr.getmaxyx() | 1627 self.yscreensize, self.xscreensize = self.stdscr.getmaxyx() |
1665 continue | 1669 continue |
1666 except curses.error: | 1670 except curses.error: |
1667 keypressed = "foobar" | 1671 keypressed = "foobar" |
1668 if self.handlekeypressed(keypressed): | 1672 if self.handlekeypressed(keypressed): |
1669 break | 1673 break |
1670 signal.signal(signal.SIGWINCH, origsigwinchhandler) |