Ejemplo n.º 1
0
def mainProgram():
    print("- Welcome to version 0.6 of Filofax")
    print(
        "- Type the first letter of the alternative in the menu to execute it."
    )
    try:
        filofax = Catalog(FILENAME)
    except UnboundLocalError:
        print('File ' + FILENAME + ' not found!')
    printCurrent(filofax)
    printMenu()
    choice = choose()
    while choice != 'Q':
        if choice == 'N':
            filofax.changeDate(1)
        if choice == 'P':
            filofax.changeDate(-1)
        if choice == 'D':
            addNote(filofax)
        if choice == 'E':
            removeNote(filofax)
        if choice == 'A':
            addPage(filofax)
        if choice == 'R':
            removePage(filofax)
        if choice == 'S':
            showPages(filofax)
        if choice == 'M':
            showMonth(filofax)
        if choice == 'J':
            date = chooseDate()
            filofax.setDate(date)
        if choice == 'C':
            date = chooseDate()
            showPage(filofax, date)
        printCurrent(filofax)
        printMenu()
        choice = choose()
    filofax.save(FILENAME)
Ejemplo n.º 2
0
 def __init__(self):
      
     self.catalog = Catalog("Catalog.json", "Buyers.json", "configCatalog.json", "devices.json")
Ejemplo n.º 3
0
                self.catalog.remove_inactive_ws()

                # remove inactive fridges
                self.catalog.remove_inactive_fridge()
                
                print("Inactive fridges and web services removed.")

                time.sleep(5*60)


########################################## MAIN FUNCTION ############################################

if __name__ == '__main__':
    conf = {
        '/': {
            'request.dispatch': cherrypy.dispatch.MethodDispatcher(),
            'tools.sessions.on': True,
        }
    }

    catalog = Catalog("Catalog.json")

    inactiveThread = RemoveInactiveThread(catalog)
    inactiveThread.start()

    cherrypy.tree.mount(Catalog_REST(catalog), '/', conf)
    cherrypy.config.update({'server.socket_host': '0.0.0.0'})
    cherrypy.config.update({'server.socket_port': 8080})
    cherrypy.engine.start()
    cherrypy.engine.block()
Ejemplo n.º 4
0
from Catalog import *
from Dialog import Dialog
from Controller import Controller
from View import View

question = Question(
    1, 'Привет',
    [Answer(1, 'Привет', 2), Answer(2, 'Пока', 0)])
question2 = Question(
    2, 'Как дела?',
    [Answer(1, 'Хорошо', 3), Answer(3, 'Нормально', 3)])
question3 = Question(3, 'Пока', [Answer(1, 'Пока', 0)])

catalog = Catalog([question, question2, question3])

dialog = Dialog(catalog)
view = View()
controller = Controller(dialog, view)
view.set_controller(controller)

controller.start()
Ejemplo n.º 5
0
 def setup_method(self, method):
     print "Entered setup"
     print method
     self.location = "location"
     self.webserver = "webserver"
     self.dut = Catalog(self.location, self.webserver)
Ejemplo n.º 6
0
from Catalog import *
from User import *
from pdb import set_trace

catalog = Catalog()
# catalog.displayAllBooks()
# set_trace()
librarian = Librarian("Awantik", "Bangalore", 34, 'asljlkj22', 'zeke101')
librarian.catalogAccess(catalog)

book = librarian.addBook('Shoe Dog', 'Phil Knight', '2015', 312)
librarian.addBookItem(book, '123hg', 'H1B2')
librarian.addBookItem(book, '123hg', 'H1B4')
librarian.addBookItem(book, '123hg', 'H1B5')

book = catalog.addBook('Moonwalking with Einstien', 'J Foer', '2017', 318)
librarian.addBookItem(book, '463hg', 'K1B2')
librarian.addBookItem(book, '463hg', 'K1B3')
librarian.addBookItem(book, '463hg', 'K1B4')

# catalog.displayAllBooks()

m1 = Member("Vishal", "Bangalore", 23, 'asljlkj22', 'std1233')
# m1.availableBooks(catalog)
m1.issueBook(catalog, 'Moonwalking with Einstien', '463hg', 5)
# m1.availableBooks(catalog)
#
# m1.issued_books_details()
# m1.availableBooks(catalog)
# m1.returnBook(catalog,"Moonwalking with Einstien",'463hg','K1B4')
# m1.availableBooks(catalog)
Ejemplo n.º 7
0
 def __init__(self):
     self.catalog = Catalog("Catalog.txt")