Hello,
We don't offer anything specific (at least yet).
There is a Python debugging module called pdb which allows some kind of
debugging, and I think that IPython uses this so that is one way to use
it.
But I just tried it with Analysis and it didn't like operating inside the
Tk event loop. So I suspect the only option now is to follow the code
through by inspection.
To find out where to start, then there are a couple of options. First of
all, the top (main) dialog is set up in
python/ccpnmr/analysis/AnalysisPopup.py and (almost) all the other popups
are in python/ccpnmr/analysis/popups.
Inside AnalysisPopup the main menus are set up, and the associated
functions will call the appropriate popup code. For example, the Window
menu is associated with the WindowMenu string in AnalysisPopup.py and if
you chase that through you find there is a setWindowMenu() function in
AnalysisPopup.py that specifies which functions are associated with which
menu items.
For example, in setWindowMenu() we find the line:
menu.add_command(label='Edit Windows', shortcut='E', command=self.editWindow)
which means that editWindow() is called when the user selects the Windows
--> Edit Windows menu item. The function editWindow() (also in
AnalysisPopup.py) is just:
def editWindow(self, window = None):
popup = self.openPopup('edit_window', EditWindowPopup)
if (window):
popup.setWindow(window)
So the code for this is in EditWindowPopup and at the top of
AnalysisPopup.py we find:
from ccpnmr.analysis.popups.EditWindow import EditWindowPopup
so that tells you to look in popups/EditWindow.py for the class
EditWindowPopup.
Each of these popups has a body() function, and that is where the various
GUI elements are set up, including which functions are called when the
various buttons are clicked. But in general this gets pretty complicated
pretty quickly. For example, there is a lot of boilerplate code which you
have to wade through to find what is really happening.
I hope that helps you get started but do email back with further
questions.
Wayne
On Fri, 24 Jul 2009, Krisztina Feher wrote:
> Hi,
>
> after using now the program for some time finally I would like the get a
> start with writing simple macros. So far I found, that at the begining it is
> better only to modify things in existing modules rather than write them from
> scratch. So I wondered if it is possible to force Analysis to show what
> functions of what modules are executed when I actually click something in
> the GUI. Or anyone have a better idea?
>
> Thanks a lot,
> Krisztina
>
|