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 Reply Children
  • 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.

Was this helpful?