Update of /cvsroot/quickrip/quickrip/cli
In directory sc8-pr-cvs1:/tmp/cvs-serv8375/cli
Modified Files:
ncurses.py cli.py
Log Message:
Added threading support to base.py, and removed commandthread.py
This way, you should still be able to use the base.QuickRip.run()
method as before, only it will use a seperate thread :)
Also updates on the CLI... have a look to see how much of a pain curses
can be :)
Index: ncurses.py
===================================================================
RCS file: /cvsroot/quickrip/quickrip/cli/ncurses.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ncurses.py 6 Aug 2003 01:36:06 -0000 1.1
--- ncurses.py 6 Aug 2003 12:22:15 -0000 1.2
***************
*** 18,26 ****
class TitleList:
"""Handle the list of DVD titles in a window"""
! def __init__(self, mainwindow, SCREEN_WIDTH, SCREEN_HEIGHT, numtitles):
height = SCREEN_HEIGHT - 10
width = SCREEN_WIDTH - 4
self.win = curses.newwin(height, width, 2, 2)
self.win.border()
! self.win.addstr(0,2,"".join([numtitles, " DVD titles available"]),curses.A_BOLD)
self.win.refresh()
--- 18,32 ----
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()
+
+
+ def display(self):
+ self.win.clear()
self.win.border()
! self.win.scrollok(1)
! self.win.idlok(1)
self.win.refresh()
Index: cli.py
===================================================================
RCS file: /cvsroot/quickrip/quickrip/cli/cli.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** cli.py 6 Aug 2003 01:36:06 -0000 1.1
--- cli.py 6 Aug 2003 12:22:15 -0000 1.2
***************
*** 52,56 ****
sys.exit(2)
! self.switch(choice)
--- 52,56 ----
sys.exit(2)
! self.handleInput(choice)
***************
*** 62,66 ****
! def switch(self, choice):
if self.mode== 'front':
self.mode = 'titlelist'
--- 62,66 ----
! def handleInput(self, choice):
if self.mode== 'front':
self.mode = 'titlelist'
***************
*** 72,85 ****
def front(self):
self.draw_screen()
! self.stdscr.addstr(2,0,"Hit ENTER to scan the DVD",curses.A_BOLD)
! self.stdscr.refresh()
return 1
def titleList(self):
! self.draw_screen()
self.scanDVD()
- self.draw_screen()
- self.list = ncurses.TitleList(self.stdscr, SCREEN_WIDTH, SCREEN_HEIGHT, self.numtitles)
#i = 2
#for title in self.titles:
--- 72,86 ----
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()
return 1
def titleList(self):
! self.TL.display()
! self.TL.win.addstr(0,2,"Scanning DVD...",curses.A_BOLD)
! self.TL.win.refresh()
self.scanDVD()
#i = 2
#for title in self.titles:
***************
*** 92,113 ****
def int_noTitles(self):
! self.draw_screen()
! self.stdscr.addstr(4, 0, "ERROR: No titles were found!", curses.A_STANDOUT)
def int_dispDVD(self, numtitles):
! self.j = 4
! self.stdscr.addstr(2, 0, "Scanning DVD...", curses.A_BOLD)
! self.stdscr.addstr(4, 0, "".join([numtitles, " titles found on this DVD"]))
! self.stdscr.refresh()
def int_dispTitle(self, title):
! self.j = self.j + 1
! text = "".join(["* Title ", str(title['id']), ", ", title['timelabel']])
! self.stdscr.addstr(self.j, 0, text)
! self.stdscr.refresh()
def main():
! cli = Main()
--- 93,115 ----
def int_noTitles(self):
! self.TL.win.addstr(2, 1, "ERROR: No titles were found!", curses.A_STANDOUT)
! self.TL.win.refresh()
! import time
! time.sleep(2)
! self.mode = ''
def int_dispDVD(self, numtitles):
! self.y = 1
! self.TL.win.addstr(1, 1, "".join([str(numtitles), " titles found on this DVD"]))
! self.TL.win.refresh()
def int_dispTitle(self, title):
! self.y = self.y + 1
! self.TL.win.addstr(self.y, 1, "".join(["[ ] ", title['name'], " ", title['timelabel']]))
! self.TL.win.refresh()
def main():
! cli = Main()
\ No newline at end of file
|