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

  What control mechanisms at your organization

What control mechanisms at your organization are (or should be) the most useful or important for the success of DHL?

  Techniques for executing equijoin

Discuss the different techniques for executing equijoin of two files located at different sites.

  Discuss different types of threats

Review several online newspapers, news sites, and professional magazines and locate examples of three different types of threats

  Write an introspective capstone paper expressing your views

write an introspective capstone paper expressing your views aboutinformation use in todays society. this will be

  Explain why is it so important to test the cabling and

why is it so important to test the cabling and connector terminations on a computer network? envision common cabling

  Describe and explain the types of control procedures that

in this assignment you will apply the knowledge gained about ethics and security to evaluate security risks and control

  What are three costs and benefit associate with each project

What are three costs, benefits, risks, and intangibles associated with each project? Based on your answer to question 1, which project would you choose?

  Define what is the downside of digital medical records

What is the downside of digital medical records. Should all collected data be in a digital form. What type of data should not be in digital form

  Define the nonattacking queens problem

Design and implement a recursive program that solves the NonAttacking Queens problem. That is, write a program to determine all ways in which eight queens.

  Create application that simulates functionality of gas pump

CSC139 Chapter 6 Lab Assignments- Create a windows form application that simulates the functionality of the gas pump. The user enters the number of gallons to purchase in a TextBox.

  Design and implement a fuzzy controller

Design and implement a fuzzy controller (Zero-order Sugeno Fuzzy Inference System) for balancing an inverted pendulum system. A written report detailing your system design and characterisation of its performance must accompany your program submis..

  Compare and contrast different virtual machines

Design and Implementation-  Discuss details of the design and implementation, how it works, challenges you faced, configuration, experimentation, results et - Compare and contrast different virtual machines e.g. JVM, Mono (CLR) and pypy on the ras..

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