forked from public/pyceo
Merge branch 'master' of /users/git/public/pyceo
This commit is contained in:
commit
e97203c36b
|
@ -6,10 +6,15 @@ from ceo import ldapi, members, library
|
||||||
|
|
||||||
def start():
|
def start():
|
||||||
try:
|
try:
|
||||||
|
print "Reading config file...",
|
||||||
|
#XXX this should really all be done through one big config file
|
||||||
|
members.configure()
|
||||||
|
library.configure()
|
||||||
|
print "read."
|
||||||
|
|
||||||
print "Connecting to LDAP...",
|
print "Connecting to LDAP...",
|
||||||
library.configure()
|
|
||||||
members.connect(AuthCallback())
|
members.connect(AuthCallback())
|
||||||
print "connected"
|
print "connected."
|
||||||
|
|
||||||
if len(sys.argv) == 1:
|
if len(sys.argv) == 1:
|
||||||
ceo.urwid.main.start()
|
ceo.urwid.main.start()
|
||||||
|
|
|
@ -87,7 +87,6 @@ ld = None
|
||||||
def connect(auth_callback):
|
def connect(auth_callback):
|
||||||
"""Connect to LDAP."""
|
"""Connect to LDAP."""
|
||||||
|
|
||||||
configure()
|
|
||||||
|
|
||||||
global ld
|
global ld
|
||||||
password = None
|
password = None
|
||||||
|
|
|
@ -213,30 +213,25 @@ def do_delete(book):
|
||||||
if Confirm("Do you wish to delete %r?" % book):
|
if Confirm("Do you wish to delete %r?" % book):
|
||||||
lib.delete(book)
|
lib.delete(book)
|
||||||
|
|
||||||
class BookPage(urwid.WidgetWrap):
|
class BookPageBase(urwid.WidgetWrap):
|
||||||
def __init__(self, book):
|
def __init__(self):
|
||||||
self._book = book
|
|
||||||
self.author = SingleEdit("Author: ")
|
self.author = SingleEdit("Author: ")
|
||||||
self.title = SingleEdit("Title: ")
|
self.title = SingleEdit("Title: ")
|
||||||
self.year = SingleIntEdit("Year: ")
|
self.year = SingleIntEdit("Year: ")
|
||||||
self.ISBN = urwid.Text("ISBN: ")
|
self.ISBN = urwid.Text("ISBN: ")
|
||||||
self.description = urwid.Edit("Description: ", multiline=True)
|
self.description = urwid.Edit("Description: ", multiline=True)
|
||||||
self.checkout_label = urwid.Text("")
|
|
||||||
|
buttons = urwid.GridFlow(self._init_buttons(), 13, 2, 1, 'center')
|
||||||
save = urwid.Button("Save", self.save)
|
display = urwid.Pile([self.author, self.title, self.year, self.ISBN, self.description,] +
|
||||||
self.checkout_button = urwid.Button("", self.checkout)
|
self._init_widgets() +
|
||||||
back = urwid.Button("Back", raise_back)
|
[urwid.Divider(), buttons])
|
||||||
remove = urwid.Button("Delete", self.delete)
|
|
||||||
|
|
||||||
buttons = urwid.GridFlow([back, self.checkout_button, save, remove], 13, 2, 1, 'center')
|
|
||||||
display = urwid.Pile([self.author, self.title, self.year, self.ISBN,
|
|
||||||
self.description,
|
|
||||||
urwid.Divider(), buttons])
|
|
||||||
urwid.WidgetWrap.__init__(self, display)
|
urwid.WidgetWrap.__init__(self, display)
|
||||||
|
|
||||||
self.refresh()
|
self.refresh()
|
||||||
|
|
||||||
#all these *senders are to allow these to be used as event handlers or just on their own
|
def _init_widgets(self):
|
||||||
|
return []
|
||||||
|
def _init_buttons(self):
|
||||||
|
return []
|
||||||
def refresh(self, *sender):
|
def refresh(self, *sender):
|
||||||
"""update the widgets from the data model"""
|
"""update the widgets from the data model"""
|
||||||
self.author.set_edit_text(self._book.author)
|
self.author.set_edit_text(self._book.author)
|
||||||
|
@ -244,6 +239,25 @@ class BookPage(urwid.WidgetWrap):
|
||||||
self.year.set_edit_text(str(self._book.year))
|
self.year.set_edit_text(str(self._book.year))
|
||||||
self.ISBN.set_text("ISBN: " + self._book.ISBN)
|
self.ISBN.set_text("ISBN: " + self._book.ISBN)
|
||||||
self.description.set_edit_text(self._book.description)
|
self.description.set_edit_text(self._book.description)
|
||||||
|
|
||||||
|
|
||||||
|
class BookPage(BookPageBase):
|
||||||
|
def __init__(self, book):
|
||||||
|
self._book = book
|
||||||
|
BookPageBase.__init__(self)
|
||||||
|
def _init_widgets(self):
|
||||||
|
self.checkout_label = urwid.Text("")
|
||||||
|
return [self.checkout_label]
|
||||||
|
def _init_buttons(self):
|
||||||
|
save = urwid.Button("Save", self.save)
|
||||||
|
self.checkout_button = urwid.Button("", self.checkout)
|
||||||
|
back = urwid.Button("Back", raise_back)
|
||||||
|
remove = urwid.Button("Delete", self.delete)
|
||||||
|
return [back, self.checkout_button, save, remove]
|
||||||
|
|
||||||
|
#all these *senders are to allow these to be used as event handlers or just on their own
|
||||||
|
def refresh(self, *sender):
|
||||||
|
BookPageBase.refresh(self, *sender)
|
||||||
if self._book.signout is None:
|
if self._book.signout is None:
|
||||||
self.checkout_label.set_text("Checked In")
|
self.checkout_label.set_text("Checked In")
|
||||||
self.checkout_button.set_label("Check Out")
|
self.checkout_button.set_label("Check Out")
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Source: ceo
|
Source: ceo
|
||||||
Section: admin
|
Section: admin
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Maintainer: Michael Spang <mspang@uwaterloo.ca>
|
Maintainer: Systems Committee <syscom@csclub.uwaterloo.ca>
|
||||||
Build-Depends: debhelper (>= 5.0.0), python-dev (>= 2.4), python-support (>= 0.3), libkrb5-dev, libldap2-dev, libsasl2-dev
|
Build-Depends: debhelper (>= 5.0.0), python-dev (>= 2.4), python-support (>= 0.3), libkrb5-dev, libldap2-dev, libsasl2-dev
|
||||||
Standards-Version: 3.7.2
|
Standards-Version: 3.7.2
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue