SLC S21W6: "Mastering File Handling 2; Managing Data Records with Pickle"

in #dynamicdevs-s21w616 days ago (edited)

Black Gold Elegant Jewelry Logo_20241206_233014_0000.png

edited with canva

Hello friends and welcome to my article in the SLC: S21/W6 in this great dynamics I would be participating immensely into being incorporated in performing these tasks too.


• Task involves creating applications focusing on tracking and managing outdoor exercises like running, walking and cycling

On this precise conquest, activities carried out in simple Pratical application would be implemented for easier presentation. We would be using the QGroupBox This widget would have capacity of holding more than one widget box. It only gets easier as we group input, display widget and button widget in one widget box.


Screenshot_20241206-221731.png
implementation using QGroup Box Widget

We proceed by importing necessary libraries for tas to be duly carried out. New functions would be introduced, which would help arrange in existing hierarchy adding adequate serials while discarding unnecessary python functions from organised file. A file wuld be created to store different traces needed for drop down. The file would be typecourse.txt a function would be needed to open, encode and decode the program or contents of file.

There would be conversion process from string to float It couldn't perform on string interface therefore float would be the perfect alternative, special function (:) was the dissolving catalyst which converted minutes and seconds to hours this adding hours to ascertain total hours received.

The ADD()function would immediately be added to list all required input, needed to get a new record. The parse_durationwould be used to add a new type of the existing drop down. There must be a regular update of necessary data to encode and decode in the exercise data file. Pickle_load() would be used to remove serials on data. Pickle_dump() used to incorporate serials, the record() includes recently added record to list.

The display() function handles output results. Second drop-down will be used to filter our results. We make use of a fresh spreadsheet of empty list filtering records of selected in list,Q standard Item mode 1 ()is used to create a table to incorporate records, creating variables to hold data for different records. The Sum() function computers total of each record making it possible to have a total value through multiplying 85 with total distance.

The history spreadsheet gets populated having summary data to populate the chosen extension table. The default Icon and title would be replaced through importing Q Icon library connect buttons we have functions to populate two drop downs with data from typescourse.txt when application starts off.


Screenshot_20241206-222155_1.png
parent
Screenshot_20241206-222144_1.png
source


• "We aim to develop an application for managing a TV channel database stored in the file list channels data

The use of specially crafted codes from previous class would be duly modified! The QT design has concept of widget boxes in groups making use of Thonny application to create py file for PyQt5 codes.


Screenshot_20241206-222012.pngScreenshot_20241206-222048.png

creating py file for PyQt5 codes


Using the populate_drop down() user to populate drop downs in application, striking change would be incorporating file categories.txtto holding categories, we add the ADD() function which is triggered by adding button() using the pickle_load() and `pickle_dump() function to deserialize anf serialize data before saving on file. All inputs assigned to corresponding variable, checked to validate input making sure inputs are filed and valid using frequency within range 10,000-20,000 and sr fac made up of five digits.

The code gets more interesting and being satisfied save the updated list to list_channels using pickle. The FIND() is almost same with previous application, but especially we search and display channels, that match input, thus adding one more input channel_name

The channel_listis gotten and filtered by looping to find and decode match based on input values. Result is stored in variable history_model which is displayed by filing the tables up. The program runs successfully if connect button has specified details incorporated correctly.


Screenshot_20241206-222827.png
parent
Screenshot_20241206-222911.png
source


• "Application enables user to input, validate, score and display data in a user friendly manner using python and PyQt5"

The widget box would be modified this time to be time consuming we have a template from preceding lessons, therefore moving straight to our ui file using the Thonny application we create py file.


Screenshot_20241206-222945.png
creating py file using Thonny application

We start with necessary libraries, add others as the need might be within scope of project. Importantly, task depends on your language on file or manual type in code. We create an incorporated code. Using the function of previous lessons. Specially one drop down to populate we immediately SAVE() function to collect all input data , validate, load and apprehend information to list. Check boxes are different from radio boxes we select more than one check box. Uphold data, manipulate to your required pleasing. We introduce the programming _layers to store check boxes. We use all valid input to use the pickle_load() function towards existing data on list. We go ahead to encode serial and save most recent `developer_sheetList. Moreso, spreadsheet table is updated to populate and display record. We check and validate inputs.


Screenshot_20241206-223130.png
parent
Screenshot_20241206-223151.png
source

I had a blissful time in the lessons taught, although I resumed quite late though, it's been an interesting ride, i spotted my shortcomings and came back on tract too. I'm more than ready to learn too.

Cc;
@kouba01

I invite @solaymann @enamul17 @simonnwigwe @josepha to join challenge