Beispiel #1
0
 def ev_delete_member(self):
     indices = self.member_list.curselection()
     index = int(indices[0]) if indices else 0
     mbr = self.members[index]
     data.delete_member(mbr[0])
     self.members = data.get_members()
     self.populate_member_list()
Beispiel #2
0
 def evNewMember(self):
     dlg = od.OptionsDialog(top,(
                            ["Name",""],
                            ["Email",""]))
     if dlg.changed:
        data.update_member(None,dlg.options[0][1],dlg.options[1][1])
        self.members = data.get_members()
        self.populateMemberList()
Beispiel #3
0
    def ev_edit_member(self, event=None):
        indices = self.member_list.curselection()
        index = int(indices[0]) if indices else 0
        mbr = self.members[index]
        dlg = od.OptionsDialog(top, (["Name", mbr[1]], ["Email", mbr[2]]))

        if dlg.changed:
            data.update_member(mbr[0], dlg.options[0][1], dlg.options[1][1])
            self.members = data.get_members()
            self.populate_member_list()
Beispiel #4
0
    def ev_edit_member(self, event=None):
        indices = self.member_list.curselection()
        index = int(indices[0]) if indices else 0
        mbr = self.members[index]
        dlg = od.OptionsDialog(top, (["Name", mbr[1]], ["Email", mbr[2]]))

        if dlg.changed:
            data.update_member(mbr[0], dlg.options[0][1], dlg.options[1][1])
            self.members = data.get_members()
            self.populate_member_list()
Beispiel #5
0
 def __init__(self, root):
     self.isDirty = False
     self.top = root
     root['menu'] = self.buildMenus(root)
     mainWin = self.buildNoteBook(root)
     mainWin.pack(fill='both', expand=True)
     self.top.protocol('WM_DELETE_WINDOW', self.evClose)
     self.top.title('Lending Library')
     data.initDB()  # use default file
     self.items = data.get_items()
     self.members = data.get_members()
     self.populateItemList()
     self.populateMemberList()
Beispiel #6
0
 def __init__(self, root):
     self.is_dirty = False
     self.top = root
     root["menu"] = self.build_menus(root)
     main_win = self.build_notebook(root)
     main_win.pack(fill="both", expand=True)
     self.top.protocol("WM_DELETE_WINDOW", self.ev_close)
     self.top.title("Lending Libaray")
     data.init_db()  # use default file
     self.items = data.get_items()
     self.members = data.get_members()
     self.populate_item_list()
     self.populate_member_list()
Beispiel #7
0
 def __init__(self, root):
     self.isDirty = False
     self.top = root
     root['menu'] = self.buildMenus(root)
     mainWin = self.buildNoteBook(root)
     mainWin.pack(fill='both', expand=True)
     self.top.protocol('WM_DELETE_WINDOW', self.evClose)
     self.top.title('Lending Library')
     data.initDB()   # use default file
     self.items = data.get_items()
     self.members = data.get_members()
     self.populateItemList()
     self.populateMemberList()
Beispiel #8
0
 def __init__(self, root):
     self.is_dirty = False
     self.top = root
     root["menu"] = self.build_menus(root)
     main_win = self.build_notebook(root)
     main_win.pack(fill="both", expand=True)
     self.top.protocol("WM_DELETE_WINDOW", self.ev_close)
     self.top.title("Lending Libaray")
     data.init_db()  # use default file
     self.items = data.get_items()
     self.members = data.get_members()
     self.populate_item_list()
     self.populate_member_list()
Beispiel #9
0
def add_item():
    if not session.get("logged_in"):
        abort(401)
    get_db()
    owner_id = [row[0] for row in lendydata.get_members() if row[1] == request.form["owner"]]
    try:
        owner_id = owner_id[0]
    except IndexError:
        # implies no owners match name
        # should raise error/create new member
        owner_id = 1  # use default member for now

    lendydata.insert_item(request.form["name"], request.form["description"], owner_id, request.form["price"],
                          request.form["condition"])
    flash("New entry was successfully posted")
    return redirect(url_for("show_inventory"))
Beispiel #10
0
def add_item():
    if not session.get("logged_in"):
        abort(401)
    get_db()
    owner_id = [
        row[0] for row in lendydata.get_members()
        if row[1] == request.form["owner"]
    ]
    try:
        owner_id = owner_id[0]
    except IndexError:
        # implies no owners match name
        # should raise error/create new member
        owner_id = 1  # use default member for now

    lendydata.insert_item(request.form["name"], request.form["description"],
                          owner_id, request.form["price"],
                          request.form["condition"])
    flash("New entry was successfully posted")
    return redirect(url_for("show_inventory"))
Beispiel #11
0
def add_item():
    if not session.get('logged_in'):
        abort(401)
    get_db()
    ownerID = [
        row[0] for row in lendydata.get_members()
        if row[1] == request.form['owner']
    ]
    try:
        ownerID = ownerID[0]
    except IndexError:
        # implies no owners match name
        # should raise error/create new member
        ownerID = 1  # use default member for now.

    lendydata.insert_item(request.form['name'], request.form['description'],
                          ownerID, request.form['price'],
                          request.form['condition'])

    flash('New entry was successfully posted')
    return redirect(url_for('show_inventory'))
Beispiel #12
0
def add_item():
    if not session.get('logged_in'):
        abort(401)

    lendydata.initDB()
    ownerID = [row[0] for row in lendydata.get_members() 
               if row[1] == request.form['owner']]
    try: ownerID = ownerID[0]  
    except IndexError:
        # implies no owners match name
        # should raise eror/create new member
        ownerID = 1      # use default member for now.

    lendydata.insert_item(request.form['name'], 
                          request.form['description'],
                          ownerID,
                          request.form['price'],
                          request.form['condition'])
                         
    lendydata.closeDB()

    flash('New entry was successfully posted')
    return redirect(url_for('show_inventory'))
Beispiel #13
0
 def evNewMember(self):
     dlg = od.OptionsDialog(top, (["Name", ""], ["Email", ""]))
     if dlg.changed:
         data.update_member(None, dlg.options[0][1], dlg.options[1][1])
         self.members = data.get_members()
         self.populateMemberList()
Beispiel #14
0
__author__ = 'Stuart'

"""
any time there is a print, if in console don't print
it would just return normally
"""

import lendydata as ld
ld.initDB()
print(ld.get_members())
print(ld.get_items())

ld.insert_item('Python Projects','Book',6,30,'Excellent')
###
# this should not have worked..... BUT IT DID. WTF PRAGMA?!>!?
###

ld.insert_member('Alan','*****@*****.**')
print(ld.get_members())
ld.insert_item('Python Projects','Book',6,30,'Excellent')
ld.get_items()

ld.update_item(7,Price=25)
ld.get_item_details(7)
ld.get_member_name(6)
ld.update_member(6,Name='Alan Gould')
ld.get_member_details(6)

ld.delete_member(6)  # this also shouldn't work due to referential integrity, but does...
ld.delete_item(7)
ld.delete_member(6)