Althought I already got what I want, I want to get some quesitons regarding my current snippet. The one shown on the example has a lot of stuff that I would like to gradually add to the guide I am working on. That means I need to go backwards, and so far I have been succesful but I want to get a better understanding of how the code is builted so I can explain it better without need to get the reader confused.
The current code is the createDialog function on
this snippet.
I stripped to this:
Code: Select all
import uno
import unohelper
def createDialog():
"""Creamos un dialogo y le insertamos los parametros de Posicion, altura y anchura, asi como titulo"""
try:
ctx = uno.getComponentContext()
smgr = ctx.ServiceManager
dialogModel = smgr.createInstanceWithContext(
"com.sun.star.awt.UnoControlDialogModel", ctx)
controlContainer = smgr.createInstanceWithContext(
"com.sun.star.awt.UnoControlDialog", ctx);
controlContainer.setModel(dialogModel);
toolkit = smgr.createInstanceWithContext(
"com.sun.star.awt.ExtToolkit", ctx);
controlContainer.setVisible(False);
controlContainer.createPeer(toolkit, None);
controlContainer.execute()
controlContainer.dispose()
except Exception,e:
print str(e)
g_exportedScripts = createDialog,
My question is what does the UnoControlDialog is necessary for the dialogModel (UnoControlDialogModel) to show up. Basically I am trying to do something similar to this
video, where they start from the very basic, and then build up to a more complex GUI with more services and controls.
I also want to understand better the different methods to start running a GUI on PyUNO, for example, I notice, only uno and unohelper where needed while on a
different script (Paolo Montovani's info dialog) he uses a series of AWT module subcomponents like Rectangle, PosSize, WindowClass and VclWindowPeerAttribute. Althought what I understand he is just calling what he is going to use, I also want to understand what is needed on each step of the way.