16 |
# write to the Free Software Foundation, Inc., 59 Temple Place |
# write to the Free Software Foundation, Inc., 59 Temple Place |
17 |
# - Suite 330, Boston, MA 02111-1307, USA. |
# - Suite 330, Boston, MA 02111-1307, USA. |
18 |
# |
# |
19 |
# Copyright 2001-2002 Free Software Foundation |
# Copyright 2001-2003 Free Software Foundation |
20 |
# |
# |
21 |
# FILE: |
# FILE: |
22 |
# DisplayDropTarget.py |
# DisplayDropTarget.py |
29 |
import sys, string |
import sys, string |
30 |
from Utils import * |
from Utils import * |
31 |
from gnue.common import GDebug |
from gnue.common import GDebug |
|
from gnue.designer.forms import Incubator |
|
32 |
|
|
33 |
import cPickle |
import cPickle |
34 |
|
|
60 |
# do something with it. |
# do something with it. |
61 |
def OnData(self, x, y, d): |
def OnData(self, x, y, d): |
62 |
|
|
63 |
|
instance = self.editor.instance |
64 |
|
|
65 |
# copy the data from the drag source to our data object |
# copy the data from the drag source to our data object |
66 |
if self.GetData(): |
if self.GetData(): |
67 |
# convert it back to our format |
# convert it back to our format |
111 |
return d # TODO: This should actually return a failure |
return d # TODO: This should actually return a failure |
112 |
|
|
113 |
# Create a parent block |
# Create a parent block |
114 |
parent = Incubator.createObject( |
parent = instance.incubator.createObject( |
115 |
self.editor._instance, |
instance.rootObject, |
|
self.editor._instance.rootObject, |
|
116 |
'block', |
'block', |
117 |
parent=self.editor.page, |
self.editor.page, |
118 |
attributes={'datasource':datasource}) |
attributes={'datasource':datasource}) |
119 |
else: |
else: |
120 |
for child in self.editor.page._children: |
for child in self.editor.page._children: |
161 |
y += 1 |
y += 1 |
162 |
|
|
163 |
# Create a label |
# Create a label |
164 |
Incubator.createObject( |
instance.incubator.createObject( |
165 |
self.editor._instance, |
instance.rootObject, |
|
self.editor._instance.rootObject, |
|
166 |
'label', |
'label', |
167 |
parent=self.editor.page, |
self.editor.page, |
168 |
attributes={'x': lx, |
attributes={'x': lx, |
169 |
'y': ly, |
'y': ly, |
170 |
'width': len(label), |
'width': len(label), |
193 |
# Create our new object |
# Create our new object |
194 |
# |
# |
195 |
if not params['Type'] in ('selectedWidgets',): |
if not params['Type'] in ('selectedWidgets',): |
196 |
object = Incubator.createObject( |
object = instance.incubator.createObject( |
197 |
self.editor._instance, |
instance.rootObject, |
|
self.editor._instance.rootObject, |
|
198 |
params['Type'], |
params['Type'], |
199 |
parent=parent, |
parent, |
200 |
attributes=attributes) |
attributes=attributes) |
201 |
|
|
202 |
if params['Type'] in ('entry',): |
if params['Type'] in ('entry',): |
216 |
|
|
217 |
|
|
218 |
if triggertext: |
if triggertext: |
219 |
Incubator.createObject( |
instance.incubator.createObject( |
220 |
self.editor._instance, |
instance.rootObject, |
|
self.editor._instance.rootObject, |
|
221 |
'trigger', |
'trigger', |
222 |
parent = object, |
object, |
223 |
attributes = { |
attributes = { |
224 |
'_content_': triggertext, |
'_content_': triggertext, |
225 |
'type': 'PRE-INSERT', |
'type': 'PRE-INSERT', |