wiki:ProgramStructure

GUI

A large amount of the GUI code ( gtkgui/nicotine_glade.py and gtkgui/settings_glade.py ) is generated from glade-2 files with the glade2py script.

frame.py loads the glade-generated python files and creates all the main window's widgets and the trayicon.

'Notebooks' and 'Notebook Tabs' are contained in their respective python files, with User Info and User Browse sharing the UserTabs notebook class in userinfo.py.

pynicotine/gtkgui/utils.py contains a bunch of functions that are shared across different files, such as InitialiseColumns, a function for creating listview/treeview columns. AppendLine is used for adding text to all textviews.

The Notebooks are wrapped with the IconNotebook class, which allows for an icon (which changes) and close button on each tab.

Config

config.py contains the config template and save/load functions. It also handles reading the shares databases from disk.

ConfigParser.py is an old version of the Python ConfigParser

Networking

pynicotine/pynicotine.py holds the networking callbacks. They pass through frame.py's callback, networkcallback to OnNetworkEvent where the proper function (that's in pynicotine.py's events dict) is executed.

slskproto.py is the networking thread. lots of undocumented stuff, here. Server and Peer messages get downloaded and get sent off to be parsed in slskmessages.py, unless they are peerinit messages. Outgoing messages are packed and sent from here, as well.

slskmessages.py has classes for unpacking/packing server and peer messages. It uses struct for packing numbers.

Transfers

pynicotine/transfers.py manages transfers and updates the gui after every change.

pynicotine/gtkgui/transferlist.py is a class that gets incorporated in both downloads.py and uploads.py. The update function is probably the most important part of that. Currently, I have transfers in a tree, sorted by username.

Etc

Search, the about dialogs, Interests, and the buddies list have their own classes and functions.

Private Chat, Chatrooms have their own input /commands.

Often you'll see a notebook class that has a function with the same names as the tab class. These will try to run same function in each class.

Last modified 10 months ago Last modified on 31/12/2016 03:52:39