Print

Print


Rasmus Fogh wrote:

>Dear Gary,
>
>I hate multiple dialog boxes myself, but we have to provide some kind of
>error handling. Both data model and code are very complex and it is easy
>to go wrong. If, as you say, people call e.g. makeIntermediatePeak with
>inappropriate parameters we have to let them know, otherwise they might be
>getting and using an incorrect result.
>
>What kind of behaviour do you think would be appropriate for the situation
>where people call a function with inappropriate parameters?
>
>Yours,
>
>Rasmus
>  
>

Exceptions, If you are writing python code I guess you should know about 
exceptions ;-)

regards
gary

>---------------------------------------------------------------------------
>Dr. Rasmus H. Fogh                  Email: [log in to unmask]
>Dept. of Biochemistry, University of Cambridge,
>80 Tennis Court Road, Cambridge CB2 1GA, UK.     FAX (01223)766002
>
>On Tue, 4 Apr 2006, Gary S. Thompson wrote:
>
>  
>
>>Tim Stevens wrote:
>>
>>    
>>
>>>>def test(argServer=None):
>>>>   if (argServer != None):
>>>>       print(argServer.getCurrentPeaks())
>>>>
>>>>if I call the macro with no peaks selected I get a popup window telling
>>>>me the fact. This which may not always  be the desired effect...
>>>>
>>>>Can I  be presumptious enough to suggest that all the ArgumentServer
>>>>functions at least should be 'quiet', i.e. without gui side effects?
>>>>
>>>>
>>>>        
>>>>
>>>One of the primary roles of the Argument Server is to provide an interface
>>>with graphical interaction, so I'm not going to remove the dialogs.
>>>
>>>A quiet mode is possible, but I would do it at the object attribute level,
>>>rather than for every function.
>>>
>>>For the moment you can always get at the current peaks directly, in the
>>>way that the argument server does, i.e. argServer.parent.currentPeaks
>>>
>>>
>>>      
>>>
>>What I guess the problem is is that I assumed argument server and
>>[Peak|Window...]Basic are a set of convenience function for digging into
>>the data model quickly, rather than a set of prepackaged functions to do
>>certain things in the gui.... for example in PeakBasic
>>makeIntermediatePeak(peaks): if you call this with a set of
>>inappropriatley selected peaks
>>1. you could produce and awful lot of dialogs
>>2. have no way to stop the process and
>>3. if you were using it as part of another script would have say ok I
>>will have to copy the ccpn code without the warnings and maintain it myself
>>
>>our idea would be to divide it into a set of non gui convenience
>>functions that either returned results or threw errors and then use
>>these within the basic functions....
>>
>>regards
>>gary
>>
>>    
>>
>>>
>>>      
>>>
>>>>Obviously you may feel its to late in the day for this as people are
>>>>already using the ArgumnetServer.
>>>>
>>>>
>>>>        
>>>>
>>>I'm not opposed to extensions where the default leaves things the way they
>>>were.
>>>
>>>T.
>>>
>>>
>>>      
>>>
>>It would be nice to extend things so there are convenience apis as well
>>as the Analysis Functions. I still think that people will tend to assume
>>that these are utility functions without side effects until they get a
>>shock and it certainly diminishes there  usefulness.
>>
>>Our best suggestion would be to have for example
>>
>>
>>
>>
>>    
>>
>>>-------------------------------------------------------------------------------
>>>Dr Tim Stevens			Email: [log in to unmask]
>>>Department of Biochemistry            [log in to unmask]
>>>University of Cambridge        Phone: +44 1223 766022 (office)
>>>80 Tennis Court Road	               +44 7816 338275 (mobile)
>>>Old Addenbrooke's Site 	       +44 1223 364613 (home)
>>>Cambridge  CB2 1GA	   	WWWeb: http://www.bio.cam.ac.uk/~tjs23
>>>United Kingdom 		       http://www.pantonia.co.uk
>>>-------------------------------------------------------------------------------
>>>------ +NH3CH(CH(CH3)OH)C(O)NHCH(CH(CH3)CH2CH3)C(O)NHCH(CH2CH2SCH3)CO2- -------
>>>-------------------------------------------------------------------------------
>>>
>>>.
>>>
>>>
>>>
>>>      
>>>
>>--
>>-------------------------------------------------------------------
>>Dr Gary Thompson
>>Astbury Centre for Structural Molecular Biology,
>>University of Leeds, Astbury Building,
>>Leeds, LS2 9JT, West-Yorkshire, UK             Tel. +44-113-3433024
>>email: [log in to unmask]                   Fax  +44-113-2331407
>>-------------------------------------------------------------------
>>
>>    
>>
>
>.
>
>  
>


-- 
-------------------------------------------------------------------
Dr Gary Thompson
Astbury Centre for Structural Molecular Biology,
University of Leeds, Astbury Building,
Leeds, LS2 9JT, West-Yorkshire, UK             Tel. +44-113-3433024
email: [log in to unmask]                   Fax  +44-113-2331407
-------------------------------------------------------------------