file issues with export-diagrams script

3 years 11 months ago #3515 by patrickgeremia
I have some issues with the export diagram scripts that I use with modelio 2.2.2.
For reference, the script can be found here: www.modeliosoft.com/en/modelio-store/scr...export-diagrams.html

I get the following error in the script window:

AttributeError: 'NoneType' object has no attribute 'getBounds' in at line number 281
Traceback (most recent call last):
File "", line 281, in
File "", line 140, in __init__
AttributeError: 'NoneType' object has no attribute 'getBounds'

I already checked that the following lines returns "active shell found"
from org.eclipse.swt.widgets import Display
parent = Display.getDefault().getActiveShell( )
if parent is None:
print "Active shell not found."
else:
print "Active shell found."

Please Log in or Create an account to join the conversation.

3 years 11 months ago #3516 by pan
Hi patrickgeremia,

This is a Hello world script for testing SWT on Modelio:
from org.eclipse.swt import SWT
from org.eclipse.swt.widgets import Display
from org.eclipse.swt.widgets import Shell
from org.eclipse.swt.widgets import Text

class openwindow:
	def __init__(self):
		parent = Display.getDefault().getActiveShell()
		child = Shell(parent, SWT.CLOSE | SWT.RESIZE)
		
		parentW = parent.getBounds().width
		parentH = parent.getBounds().height
		print "Parent width: " + str(parentW)
		print "Parent height: " + str(parentH)
		
		helloWorldTest = Text(child, SWT.NONE)
		helloWorldTest.setText("Hello World SWT")
		helloWorldTest.pack()
		
		child.pack()
		child.open()
		
openwindow()

Can you run it and say us what is the result?

Please Log in or Create an account to join the conversation.

Moderators: chmcma
Time to create page: 0.037 seconds
^ Back to Top