PDA

View Full Version : examples/tutorial/Addressbook



twallace51
16th December 2018, 21:07
My question is, how am I doing?
To be more specific, I am learning to use python 3.6 and PyQt5.
For me, the best (only?) way to learn is to read and work with well written code.
I liked the examples provided by Qt, particularly the Addressbook tutorial, see
https://github.com/baoboa/pyqt5/blob/master/examples/tutorials/addressbook
However, there were a lot of things I would have liked to have been included in the tutorial, so I did.
Please review the attached file.
Let me know if this tutorial helpful for other newbies like myself, what could I do better?
Thanks, Tim

d_stranz
18th December 2018, 15:50
Tim,

Thanks for your post. You could make the post much more helpful if you actually listed the "lot of things I would have liked to have been included in the tutorial, so I did."

Right now, the only way anyone can find out what you did is to compare the old and new project files and figure out what you changed. As a result, probably not too many people will have the time or interest in doing that. Posting a list of what you added will also let your changes be indexed by the forum's search engine so that someone who searches for something similar in the future will be able to discover your post.

twallace51
20th December 2018, 19:45
d_stranz
Thanks for your time and the quick response. Your observations are 100% correct.

So let me start again.

I liked the idea of a series of files, one building on the next towards the final app, as a learning aid.
However, in this case, I had to carefully read each one, several times, inorder to figure out what was being done, where and how.
So I rewrote each one to include a simple preamble as to goals, and indicated which code segments were new or changed since the previous file.

I find extended explanations in code to be distracting (in this case there were no comments at all...), so I only added a few key comments, and references to the best online support documents I could find.

I really like being able to collapse an entire file, and then quickly reopen just the code segments I am interested in working with.
So I rewrote the files to make this easier to do, using the IDE geany and a number of if True: # comment statements.

I included a few simple utilities I developed and used to help figure out what the app is actually doing.
For example, colored output to the terminal, depending on its content and origin, can really help deciphering whats going on.

I really like the ability to click on a QlineEdit or QtextEdit widget, and automatically open a custom edit mode for that widget.
Since these widgets apparently dont have have a mouseClick signal, I added a file to this tutorial in which the button signal-slot system,
is replaced with the more versatile eventFIlter function.

I learned a lot working with AddressBook, and would like to share my learning experience with other newbies like my self.
Thanks, twallace51
1299112992129931299412995

Added after 5 minutes:

Limit was 5 files, here are the last 3 ... twallace51

d_stranz
21st December 2018, 15:56
So I rewrote each one to include a simple preamble as to goals, and indicated which code segments were new or changed since the previous file.

Excellent idea.


I added a file to this tutorial in which the button signal-slot system, is replaced with the more versatile eventFilter function.

Also nice. Event filters are often misunderstood, and as you noticed are often a straightforward means to create "signal-like" methods to handle events for which the base widget has no signals.