Exemple #1
0
 def insertFromMimeData(self, source):
     from openalea.vpltk.qt import QtGui
     from openalea.core.service.mimetype import decode
     if source.hasFormat('openalealab/control'):
         # TODO: move outside TextEditor
         data = decode('openalealab/control',
                       source.data('openalealab/control'))
         if data is None:
             return
         varname = '_'.join(data.name.split())
         pycode = '%s = get_control(%r) #%s' % (varname, data.name,
                                                data.interface)
         cursor = self.textCursor()
         cursor.insertText(pycode)
     elif source.hasFormat('openalealab/omero'):
         data = decode('openalealab/omero',
                       source.data('openalealab/omero'))
         if data is None:
             return
         name = data.split('=')[0]
         uri = '='.join(data.split('=')[1:])
         pycode = 'from openalea.core.service import db'
         pycode += '\n%s = db.get(%r)' % (name.strip().replace(
             '.', '_'), uri.strip())
         cursor = self.textCursor()
         cursor.insertText(pycode)
     else:
         return PyCodeEditBase.insertFromMimeData(self, source)
Exemple #2
0
 def insertFromMimeData(self, source):
     from openalea.vpltk.qt import QtGui
     from openalea.core.service.mimetype import decode
     if source.hasFormat('openalealab/control'):
         # TODO: move outside TextEditor
         data = decode('openalealab/control', source.data('openalealab/control'))
         if data is None:
             return
         varname = '_'.join(data.name.split())
         pycode = '%s = get_control(%r) #%s' % (varname, data.name, data.interface)
         cursor = self.textCursor()
         cursor.insertText(pycode)
     elif source.hasFormat('openalealab/omero'):
         data = decode('openalealab/omero', source.data('openalealab/omero'))
         if data is None:
             return
         name = data.split('=')[0]
         uri = '='.join(data.split('=')[1:])
         pycode = 'from openalea.core.service import db'
         pycode += '\n%s = db.get(%r)' % (name.strip().replace('.', '_'), uri.strip())
         cursor = self.textCursor()
         cursor.insertText(pycode)
     else:
         return PyCodeEditBase.insertFromMimeData(self, source)