Create two new qlineedits for name and symptoms respectively

Assignment Help Computer Engineering
Reference no: EM131734594

Assignment: Introduction to Computer Science for Life Scientists

Exercise 1 (GUI Programming, 25 Points)

1747_The-main-window-with-the-list-widget.jpg
Figure 1: The main window with the list widget.

In this exercise, you will develop a small GUI application that shows a list of subjects with their personal data, and allows the user to interactively edit it. We provide a scaffold list.py on the course webpage that you may use as a starting point. It defines ListWindow as a class for the main window, containing a member list of type QListWidget to show the list of subjects. Buttons underneath should allow editing. The personal data (name, year of birth, gender and symptoms) is stored in the member variable ListWindow.data.

Implement the function updateList() in the class ListWindow. It should populate list with the subject names currently stored in data. This requires the use of QListWidget.addItem() for each subject. Since updateList() might get called repeatedly, you have to QListWidget.clear() all previous entries from list first.

When the user clicks on the button Edit, we want the function onEditClicked() to be called. In the Qt library you can set a function handling the clicked signal via some_button.clicked.connect(some_function).

Add a new function onDeleteClicked() to ListWindow, that deletes the subject in data that is currently selected by the user in list. Don't forget to also repopulate list.

Now it is time to implement the SubjectDialog. It should present the detailed information of a single subject. For this we need to add GUI elements in the constructor SubjectDia- log. init (). We want to be able to edit the subject's name (text), the year of birth (number), gender (multiple choice) and symptoms (again, text).

1740_The-dialog-box-for-the-subject-data.jpg
Figure 2: The dialog box for the subject data.

- Create two new QLineEdits for the name and symptoms respectively. (only creating them won't make them visible on the dialog box, we will take care of that later with the help of layouts)

- Create a new QSpinBox for the year of birth. Set an appropriate range of allowed values with setRange().

- For the gender, create 3 new QRadioButtons ('m', 'f ' and ' ?' ). Since only one choice should be possible simultaneously, we also need to create a QButtonGroup and add the 3 radio buttons to it.

- Create two buttons for Ok and Cancel. Qt already provides default handlers for both (self.accept and self.reject), but you still need to connect them to the buttons.

- Create a suitable layout. Use a QHBoxLayout to arrange the two buttons in a horizontal row. QFormLayout allows to stack the other widgets vertically and automatically add labels next to them ('Name' etc.). Stack these two layouts vertically using a QVBoxLayout and apply it to the dialog via self.setLayout().

Hint: layouts in Qt have separate functions addWidget() and addLayout() to add child GUI elements directly or another child layout.

- We need to transport our subject's data in and out of the dialog. For this we need two new functions getData() and setData() in SubjectDialog. setData(subject) should receive the data of a single subject (as a list) and fill out the appropriate GUI elements (for example QLineEdit.setText() and QRadioButton.setChecked()). getData() should read out the GUI elements (for example QLineEdit.text()), put the data into a list and return it.

We can now also add a function in ListWindow to handle clicking the Add button. Similarly to onEditClicked() this new function should also show the SubjectDialog but add the result to data instead of replacing an existing element.

Add two new buttons Load and Save to the main window that let the user choose a file (via QFileDialog.getOpenFileName() and QFileDialog.getSaveFileName()) and load/store data to the chosen file.

Hint: to store the subject list into a file, you can use your knowledge from previous assignments, but in this case, it is also permitted to use the pandas library, python's pickle mechanism or other methods you might prefer.

Reference no: EM131734594

Questions Cloud

Each step of the business-to-business buying process : Briefly, explain what would happen at each step of the business-to-business buying process.
Compute the materials price variance : Beary Company produces stuffed bears. Compute the Materials Price variance, Materials Usage variance and the Total Materials Variance
Does the article assign responsibility to persons : Does the article assign responsibility to persons or processes for the problems or achievements it reports?
Calculate net present value of the investment opportunity : Callaghan has an average cost of capital of 10 percent. Calculate the net present value of the investment opportunity
Create two new qlineedits for name and symptoms respectively : Create two new QLineEdits for name and symptoms respectively. Create a new QSpinBox for year of birth. Set appropriate range of allowed values with setRange().
Name the website and describe the features : Now that we have become familiar with technology and web design, can you now identify a website (can be any website, retail, business etc.)
Identify two products or services : Identify two products or services for which you believe reference group appeal would be very strong.
President of lakefront manufacturing : Lillian fok is president of lakefront manufacturing, a producer of bicycle tires. Fok makes 1,000 tires per day with the following resources labor
What should richman company report as a gain on the bonds : Assuming Richman Company has a portfolio of available-for-sale debt investments, what should Richman Company report as a gain (or loss) on the bonds

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd