Moving code about for packaging

This commit is contained in:
John Ladan 2013-12-18 20:31:27 -05:00
parent 2d95ac5cde
commit 985355d780
13 changed files with 40 additions and 25 deletions

20
error_files/error_search Normal file
View File

@ -0,0 +1,20 @@
Traceback (most recent call last):
File "./librarian.py", line 134, in <module>
curses.wrapper(menutest, m)
File "/usr/lib/python3.2/curses/wrapper.py", line 43, in wrapper
return func(stdscr, *args, **kwds)
File "./librarian.py", line 29, in menutest
menu(w, l)
File "./librarian.py", line 66, in menu
f()
File "./librarian.py", line 115, in browseMenu
b.eventLoop()
File "/users/jladan/src/library/browser.py", line 180, in eventLoop
ch = self.handleInput(ch)
File "/users/jladan/src/library/browser.py", line 366, in handleInput
browserWindow.handleInput(self,ch)
File "/users/jladan/src/library/browser.py", line 203, in handleInput
string = self.hb.getSearch()
File "/users/jladan/src/library/help_bar.py", line 61, in getSearch
string = string + char
TypeError: Can't convert 'bytes' object to str implicitly

View File

@ -1,14 +1,14 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import curses import curses
import db_layer as db import library.database as db
import browser import library.interface.browser as browser
import form import library.interface.form as form
import help_bar as helpBar import library.interface.help_bar as helpBar
import library.interface.checkout as co
import book_data from library import book_data
import checkout as co
stdscr=0 stdscr=0

0
library/__init__.py Normal file
View File

View File

@ -6,7 +6,6 @@ except ImportError:
from urllib2 import urlopen,URLError from urllib2 import urlopen,URLError
from json import loads,dumps from json import loads,dumps
from socket import timeout from socket import timeout
import sys
""" Library Book Type Description: """ Library Book Type Description:
The book is a dictionary of the form { string : a, ... } The book is a dictionary of the form { string : a, ... }

View File

@ -1,7 +1,6 @@
import sys
import sqlite3 import sqlite3
import permissions from library import permissions
_catalogue_db_file = '/users/libcom/catalogue.db' _catalogue_db_file = '/users/libcom/catalogue.db'
_book_table = 'books' _book_table = 'books'

View File

View File

@ -1,7 +1,6 @@
import sys
import curses import curses
import db_layer as db import library.database as db
from form import BookForm,CategoryForm from library.interface.form import BookForm,CategoryForm
class browserWindow: class browserWindow:
# These are actually class variables, not member variables? :< # These are actually class variables, not member variables? :<
@ -26,7 +25,6 @@ class browserWindow:
if not(height and width): if not(height and width):
height = browserWindow._default_height height = browserWindow._default_height
width = browserWindow._default_width width = browserWindow._default_width
sys.stderr.write(str(height)+', '+str(width)+'\n')
self.w = window self.w = window
self.hb = helpbar self.hb = helpbar
self.w.resize(height,width) self.w.resize(height,width)
@ -135,7 +133,6 @@ class browserWindow:
def search(self, string): def search(self, string):
case_sensitive = not(string.islower()) case_sensitive = not(string.islower())
#sys.stderr.write(str(case_sensitive)+'\n')
i = 0 i = 0
found = False found = False
for e in self.entries: for e in self.entries:

View File

@ -1,7 +1,6 @@
import sys
import curses import curses
from form import FormWindow,BookForm from library.interface.form import FormWindow,BookForm
import db_layer as db import library.database as db
class BookIDForm(FormWindow): class BookIDForm(FormWindow):

View File

@ -1,5 +1,4 @@
import curses import curses
import sys
class TextEntry: class TextEntry:
@ -44,7 +43,6 @@ class TextEntry:
self.redraw() self.redraw()
def gain_focus(self): def gain_focus(self):
#sys.stderr.write('I have focus!\n')
self.focus = True self.focus = True
self._mv_cursor(+len(self.value)) self._mv_cursor(+len(self.value))
self.start = max(0,self.cursor-self.width) self.start = max(0,self.cursor-self.width)
@ -150,7 +148,6 @@ class FormWindow:
ch = self.w.getch() ch = self.w.getch()
while ch != 27: while ch != 27:
#sys.stderr.write(curses.keyname(ch).decode('utf-8'))
self.handle_input(ch) self.handle_input(ch)
if ch==10 or ch==curses.KEY_ENTER: if ch==10 or ch==curses.KEY_ENTER:
if self.bt==0: if self.bt==0:
@ -187,12 +184,9 @@ class FormWindow:
def _set_entries(self,book): def _set_entries(self,book):
e = 0 e = 0
for l in self.labels: for l in self.labels:
#sys.stderr.write('updating label: '+l+'\n')
if l.lower() in book: if l.lower() in book:
#sys.stderr.write(' '+l+' found\n')
self.entries[e].value = str(book[l.lower()]) self.entries[e].value = str(book[l.lower()])
else: else:
#sys.stderr.write(' '+l+' notfound\n')
self.entries[e].value = "" self.entries[e].value = ""
e += 1 e += 1
@ -303,7 +297,6 @@ class BookForm(FormWindow):
if self.hl==0: # lookup by isbn if self.hl==0: # lookup by isbn
book = self.lookup_isbn(self.entries[0].value) book = self.lookup_isbn(self.entries[0].value)
if book != {}: if book != {}:
#sys.stderr.write('updating entries\n')
self._set_entries(book) self._set_entries(book)
self.refresh() self.refresh()
self._mv_focus(+7) self._mv_focus(+7)

View File

@ -1,7 +1,7 @@
import grp import grp
import os import os
import exceptions from library import exceptions
class _PermissionLevel: class _PermissionLevel:
def __init__(self, group_name, pretty_name): def __init__(self, group_name, pretty_name):

8
setup.py Normal file
View File

@ -0,0 +1,8 @@
from distutils.core import setup
setup(name="librarian",
description="Library Management Software for CSC",
author="jladan"
version="1.0",
packages=['library','library.interface']
scripts=["librarian"]
)