Changed to Python3 syntax

This commit is contained in:
2013-09-19 00:55:52 +02:00
parent f6ef228c0d
commit 515bc486ce

View File

@ -1,4 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os import os
import curses import curses
import logging import logging
@ -63,7 +65,7 @@ def redraw():
global err global err
global page global page
maxLines = getMaxLines() maxLines = getMaxLines()
page = currentLine / maxLines page = currentLine // maxLines
start = page * maxLines start = page * maxLines
stdscr.erase() stdscr.erase()
for linenumber, fileinfo in enumerate(filelist[start:start + maxLines]): for linenumber, fileinfo in enumerate(filelist[start:start + maxLines]):
@ -73,7 +75,7 @@ def redraw():
fileinfo['checkmark'] = ' ' fileinfo['checkmark'] = ' '
try: try:
stdscr.addstr(linenumber, 0, line_format % fileinfo, curses.A_BOLD) stdscr.addstr(linenumber, 0, line_format % fileinfo, curses.A_BOLD)
except Exception, err: except Exception as err:
logging.error(err) logging.error(err)
if len(filelist) == 0: if len(filelist) == 0:
stdscr.addstr(0, 0, "No files changes - press 'q' to quit", curses.A_BOLD) stdscr.addstr(0, 0, "No files changes - press 'q' to quit", curses.A_BOLD)
@ -165,10 +167,10 @@ def main():
destination = int(chr(c)) - 1 destination = int(chr(c)) - 1
gotoPage(destination) gotoPage(destination)
except Exception, err: except Exception as err:
logging.error(err) logging.error(err)
cleanupCurses() cleanupCurses()
print " ".join(f["file"] for f in filelist if f["checked"]) print(' '.join(f["file"] for f in filelist if f["checked"]))
if __name__ == "__main__": if __name__ == "__main__":
main() main()