How can I call the ICompoundsAtAGlance-Interface in (Iron)Python?

Hello,

I know you can't instantiate an interface in Python. But is there a possilibity of opening the CAG window with the "Show()" method (from the name ICompoundAtAGlance)?

I'm not sure, how I can call a interface...

I tried this one:

class CAG(ICompoundsAtAGlance):
def __init__(self):
def Show(self):
pass

NewCAG = CAG()
NewCAG.Show()

But if I run my code then nothing happens.

Parents
  • Hello  ,

    If this is related to your previous post -

    (20) Mass Hunter SDK - Forum - Mass Spectrometry Software - Agilent Community

    You mention that you only have the SDK loaded and not quant. This is why your code isn't working. Your script must be run from within quant to work. You can execute it from a command line or from the UI Menu.

    I would suggest first making certain you can launch the Quant debugger as outlined in the Scripting Developer's Guide. This will be a good test of your Python setup. From there you can try some of the other examples in the developer's guide. There is also a presentation and a few more examples available on the Quant installation media in this folder -

    Additional\Specials\Software Development Kit Technical Tutorial

  • Hello howard_sanford,

    yes, I did it.

    I'm working with visual studio and the Quant Debugger File...

    And I open my Python-file by "Costum Action..."

    If I create a normal windows form, I can open it with this option.

    But If I want to open CAG by code, nothing happens...

    Kind regards

  • Hello  ,

    There are not many examples in the API section of the manual. You can search for 'ironpython' to see what is available. There is an example in the ICalCurvePane Interface section that shows how to use these calls.

    Though trying to access UIState.CompoundsAtAGlance gives an error that UIState has no such property. 

    Going to the UIState section of the manual shows that the property is actually called CompoudsAtAGlanceView.

    From this it is possible with the following code to open the CAG view.

    import System
    UIState.CompoundsAtAGlanceView.Show()

    Note that a batch must be open for this to work. You will need to do all of your own error checking in your script. There are examples of checking the batch and UI state in the developers guide and in the presentations on the installation media. 

  • Hi howard_sanford,

    thanks for your help.

    I'm a little bit wondering, why has the ICompoundsAtAGlance a .Show()-method too?

    I found out that I can use the following code:

    ICompoundsAtAGlance.Show()

    Before I tried this one:

    CAG = ICompoundsAtAGlance

    CAG.Show()

    But in this two examples I get a script error, because the .Show()-method needs an argument. When I'm looking in the documention of the Quant Scripting, there isn't a hint. There is just the method .Show().

    But the UI State works with the same namespace and the same assembly.

Reply
  • Hi howard_sanford,

    thanks for your help.

    I'm a little bit wondering, why has the ICompoundsAtAGlance a .Show()-method too?

    I found out that I can use the following code:

    ICompoundsAtAGlance.Show()

    Before I tried this one:

    CAG = ICompoundsAtAGlance

    CAG.Show()

    But in this two examples I get a script error, because the .Show()-method needs an argument. When I'm looking in the documention of the Quant Scripting, there isn't a hint. There is just the method .Show().

    But the UI State works with the same namespace and the same assembly.

Children
No Data
Was this helpful?