Graphical User Interface: Assignment

Added on - 16 Sep 2019

  • 6

    pages

  • 2354

    words

  • 114

    views

  • 0

    downloads

Showing pages 1 to 3 of 6 pages
CP1404/CP5632 2016 SP53 Assignment 2 –Reading List 2.0Task:Create a Graphical User Interface (GUI) version of the program you made in assignment 1, usingPython 3 and the Kivy toolkit, as described in the following information and accompanyingscreencast. This assignment will help you build skills using classes and GUIs as well as giving youmore practice using techniques like selection, repetition, exceptions, lists, file I/O and functions. Somerequirements have in-text references like [0] that refer to the resources list near the bottom. Everythingyou need to know to complete this assignment can be found in the subject materials.Program Overview:Ensure that your program GUI has the following features, as demonstrated in the screenshots:the left side of the screen contains buttons for the user to choose actions from, and text entryfields for inputting information for a new bookthe right side contains buttons for each of the books, colour-coded based on their lengththe status bar at the top of the right side shows the number of pages to read or completedthe status bar at the bottom of the right side shows messages about what to do, or when in listcompleted mode, shows the book's details when a book is clicked on“List Required” is the default (starting) state and shows the books that are required; clicking anitem in this state marks it as completed (the button will immediately disappear)“List Completed” changes the right side view to show books that have been completed (nolength-based colouring); clicking an item in this state shows its details in the bottom status barthe user can add a new book by entering text in the input fields and clicking “Add Book”the exact style (including colours) is up to you, but ensure that all functionality is readilyaccessible with your chosen GUI styleProgram Functionality Details:The main program will be done in a Kivy App subclass in main.py. There will be no main()function, but rather your program will run() the Kivy app in the same way as you've seen inour example programs.[1, 2]The program starts by loading the same CSV (Comma Separated Values) file of items as inyour first assignment. This should be done with a method of your main app class and will besimilar to the code for the first assignment, but will save the books as Book instances in aBookList (see below for more details).The books file is saved when the program ends, updating any changes made with the app bythe user (adding new books or marking them as completed).Adding:CP1404/CP5632 2016 SP53 Assignment 2 © 2016 – Information Technology @ James Cook University1/6
All fields are required. If a field is left blank, the bottom status bar should display “Allfields must be completed” when “Add Book” is clicked.The pages field must be a valid integer. If this is invalid, the status bar should displayPlease enter a valid number”.Pressing the Tab key should move between the text fields. (popup_demo from[1])When the user successfully adds a book, the fields should be cleared and the book shouldappear in the required reading list. (dynamic_widgets from[1])When the user clicks the “Clear” button, all text in the input fields should be cleared.Coding Requirements:Start your work by clicking cloning this repository:https://github.com/yokyen/a2-starterYou should clone this using PyCharm. After cloning, you could create the repository in yourGithub.From PyCharm, Select VCS -> Import Into Version Control -> Share Project on Github.** Ensure the repository is private upon creation.This will give you a new repo containing starter code files and aREADMEfor yourreflection.At the very top of your main.py file, complete the comment containing your details.Make use of named constants where appropriate. E.g. colours could be constants.Use functions/methods appropriately for each significant part of the program. Remember thatfunctions should “do one thing”.Use exception handling where appropriate to deal with input errors.Use app.kv file for your GUI design. Creating the book buttons should be done from Python(main.py), not in the kv file, since it will be dynamic. (dynamic_widgets from[1])Document your classes and methods clearly with docstrings. Include inline/block comments asappropriate. You do not need comments in the kv file (but you can if you wish).You do not need any pseudocode (but you can write some if you wish).ClassesA significant part of this assignment is to learn how to use classes to create reusable data types thatsimplify and modularise your program. In future, you will design your programs by choosing yourown classes, but for now we will tell you what classes to create. It is important that you create theseclasses first, before any code that requires them. This is good coding practice. You should write andthen test each method of each class – one at a time.Note: some incomplete test code (in test_book.py and test_booklist.py) has been provided for you as astarting point.[3]Use a class forBook(in book.py). This should be a simple class with the required attributesfor a book and four methods: __init__, __str__ (used when displaying book details in thestatus bar) and:oa method to mark the book as completedoa method to determine if the book is long (500 or more pages)Use a class forBookList(in booklist.py). It should contain a single attribute, a list of Bookobjects, and at least the following methods:oget book by title – take in a title (string) and return the Book object with that title; thiswill be useful when handling book button clickingoadd book – add a single Book object to the book list attributeoget total pages for required booksoget total pages for completed booksoload books (from csv file into Book objects in the list)osave books (from book list into csv file)osort (by author then number of pages)[4]CP1404/CP5632 2016 SP53 Assignment 2 © 2016 – Information Technology @ James Cook University2/6
The starter code includes two files with incomplete code for testing your classes. You are notmarked on completing these, but it is good practice and very helpful to write tests as youdevelop your Book and BookList classes.GUI Requirements:The functionality can be achieved with a variety of GUI styles and colour schemes. You are welcometo customise the GUI, but it should do everything required and match any constraints specified.Project Reflection:It is important that you start developing good coding and working practices, so you are required tocomplete a short but thoughtful reflection on this project. Complete the template provided in theREADME of your repo reflect on what you learned regarding both coding and your process. Note thatthis is worth significant marks, so allocate significant time to it. We expect answers that show somedetail and thought, not just trivial statements.Git/GitHub:You must use Git version control with your project stored in theprivate repositoryon Github.You are assessed on your use of version control including commits and commit messages, usingimperative voice (like "add X" not "added X").[5]Submission:Submit a zip file containing the entire project directory, including all code (.py, .kv, .csv), your projectreflection README, PyCharm project files and the .git directory (just zip up your project/repodirectory). Please name the file like:FirstnameLastnameA2.zipe.g. if your name were Miles Davis,the filename would be MilesDavisA2.zip. Submit your single zip file by uploading it on LearnJCUunder Assessment (click on the title of the assignment).Due:Submit your assignment bythe date and time specified on LearnJCU.Submissions received after this date will incur late penalties as described in the subject outline.Integrity:The work you submit for this assignment must be your own. You are allowed to discuss theassignment with other students and get assistance from your peers, but you may not do any part ofanyone else’s work for them and you may not get anyone else to do any part of your work. Programsthat are detected to be too similar to another student’s workwill be dealt with promptly according toUniversity procedures for handling plagiarism.If you require assistance with the assignment, please ask usingthe appropriate channels, includingtalking with your lecturer or tutor.Sample Output:Screenshots have been provided above. In addition, you should study the screencast provided with thisassignment to see how the GUI program should work including what the messages should be.References – Resources from Subject Materials:1.KivyDemos.https://github.com/CP1404/KivyDemos2.Kivy Lecture Notes.3.Chapter 15 - Testing.4.attrgetter from Chapter 11 - ClassesCP1404/CP5632 2016 SP53 Assignment 2 © 2016 – Information Technology @ James Cook University3/6