From: <te...@us...> - 2003-08-06 16:50:33
|
Update of /cvsroot/quickrip/quickrip/cli In directory sc8-pr-cvs1:/tmp/cvs-serv26040/cli Modified Files: cli.py ncurses.py Log Message: More minor CLI changes; Gtk files changed here and there to make them work properly with quickrip, so you can do: ./quickrip.py -g And launch the Gtk UI. Also fixed little bits of code to work with the info scanDVD sends back. Index: cli.py =================================================================== RCS file: /cvsroot/quickrip/quickrip/cli/cli.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** cli.py 6 Aug 2003 12:22:15 -0000 1.2 --- cli.py 6 Aug 2003 16:18:02 -0000 1.3 *************** *** 49,54 **** choice = self.stdscr.getch() ! if chr(choice) in 'qQ': ! sys.exit(2) self.handleInput(choice) --- 49,61 ---- choice = self.stdscr.getch() ! if 0<choice<256: ! if chr(choice) in 'qQ': ! sys.exit(2) ! ! elif self.mode == 'titlelist': ! if choice == curses.KEY_UP: ! self.TL.move_pointer("up") ! elif choice == curses.KEY_DOWN: ! self.TL.move_pointer("down") self.handleInput(choice) *************** *** 72,76 **** def front(self): self.draw_screen() ! self.TL = ncurses.TitleList(self.stdscr, SCREEN_WIDTH, SCREEN_HEIGHT) self.TL.win.addstr(0,2,"Hit ENTER to scan the DVD",curses.A_BOLD) self.TL.win.refresh() --- 79,83 ---- def front(self): self.draw_screen() ! self.TL = ncurses.TitleList(self, SCREEN_WIDTH, SCREEN_HEIGHT) self.TL.win.addstr(0,2,"Hit ENTER to scan the DVD",curses.A_BOLD) self.TL.win.refresh() *************** *** 83,93 **** self.TL.win.refresh() self.scanDVD() ! #i = 2 ! #for title in self.titles: ! # i = i + 1 ! # self.stdscr.addstr(i,0,"".join(["* Title ", str(title['id']), ", ", title['timelabel']])) ! # self.stdscr.refresh() ! #self.stdscr.move(self.pointer['y'], self.pointer['x']) ! --- 90,97 ---- self.TL.win.refresh() self.scanDVD() ! self.TL.win.addstr(0,2,"Select titles to rip",curses.A_BOLD) ! self.TL.win.move(2, 2) ! self.TL.win.refresh() ! return 1 *************** *** 113,115 **** def main(): ! cli = Main() \ No newline at end of file --- 117,119 ---- def main(): ! cli = Main() Index: ncurses.py =================================================================== RCS file: /cvsroot/quickrip/quickrip/cli/ncurses.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ncurses.py 6 Aug 2003 12:22:15 -0000 1.2 --- ncurses.py 6 Aug 2003 16:18:02 -0000 1.3 *************** *** 18,26 **** class TitleList: """Handle the list of DVD titles in a window""" ! def __init__(self, mainwindow, SCREEN_WIDTH, SCREEN_HEIGHT): height = SCREEN_HEIGHT - 10 width = SCREEN_WIDTH - 4 self.win = curses.newwin(height, width, 2, 2) self.display() --- 18,30 ---- class TitleList: """Handle the list of DVD titles in a window""" ! def __init__(self, parent, SCREEN_WIDTH, SCREEN_HEIGHT): height = SCREEN_HEIGHT - 10 width = SCREEN_WIDTH - 4 + self.parent = parent self.win = curses.newwin(height, width, 2, 2) self.display() + self.pointer = {} + self.pointer['x'] = 2 + self.pointer['y'] = 2 *************** *** 31,32 **** --- 35,47 ---- self.win.idlok(1) self.win.refresh() + + + def move_pointer(self, mode): + if mode == 'up': + if (self.pointer['y'] - 1) >= 2: + self.pointer['y'] = self.pointer['y'] - 1 + else: + if (self.pointer['y'] + 1) <= self.parent.y: + self.pointer['y'] = self.pointer['y'] + 1 + self.win.move(self.pointer['y'],self.pointer['x']) + self.win.refresh() \ No newline at end of file |