示例#1
0
 def dragEnterEvent(self, event):
     """Reimplement Qt method
     Inform Qt about the types of data that the widget accepts"""
     source = event.mimeData()
     if source.hasUrls():
         if mimedata2url(source):
             pathlist = mimedata2url(source)
             shellwidget = self.tabwidget.currentWidget()
             if all([is_python_script(to_text_string(qstr))
                     for qstr in pathlist]):
                 event.acceptProposedAction()
             elif shellwidget is None or not shellwidget.is_running():
                 event.ignore()
             else:
                 event.acceptProposedAction()
         else:
             event.ignore()
     elif source.hasText():
         event.acceptProposedAction()            
示例#2
0
 def dragEnterEvent(self, event):
     """Reimplement Qt method
     Inform Qt about the types of data that the widget accepts"""
     source = event.mimeData()
     if source.hasUrls():
         if mimedata2url(source):
             pathlist = mimedata2url(source)
             shellwidget = self.tabwidget.currentWidget()
             if all([is_python_script(to_text_string(qstr))
                     for qstr in pathlist]):
                 event.acceptProposedAction()
             elif shellwidget is None or not shellwidget.is_running():
                 event.ignore()
             else:
                 event.acceptProposedAction()
         else:
             event.ignore()
     elif source.hasText():
         event.acceptProposedAction()            
示例#3
0
 def dragEnterEvent(self, event):
     """Reimplement Qt method
     Inform Qt about the types of data that the widget accepts"""
     source = event.mimeData()
     if source.hasUrls():
         if mimedata2url(source):
             event.acceptProposedAction()
         else:
             event.ignore()
     elif source.hasText():
         event.acceptProposedAction()
示例#4
0
文件: plugin.py 项目: burrbull/spyder
 def dragEnterEvent(self, event):
     """Reimplement Qt method
     Inform Qt about the types of data that the widget accepts"""
     source = event.mimeData()
     if source.hasUrls():
         if mimedata2url(source):
             event.acceptProposedAction()
         else:
             event.ignore()
     elif source.hasText():
         event.acceptProposedAction()
示例#5
0
 def dropEvent(self, event):
     """Reimplement Qt method
     Unpack dropped data and handle it"""
     source = event.mimeData()
     if source.hasUrls():
         pathlist = mimedata2url(source)
         self.shell.drop_pathlist(pathlist)
     elif source.hasText():
         lines = to_text_string(source.text())
         self.shell.set_cursor_position('eof')
         self.shell.execute_lines(lines)
     event.acceptProposedAction()
示例#6
0
文件: plugin.py 项目: burrbull/spyder
 def dropEvent(self, event):
     """Reimplement Qt method
     Unpack dropped data and handle it"""
     source = event.mimeData()
     if source.hasUrls():
         pathlist = mimedata2url(source)
         self.shell.drop_pathlist(pathlist)
     elif source.hasText():
         lines = to_text_string(source.text())
         self.shell.set_cursor_position('eof')
         self.shell.execute_lines(lines)
     event.acceptProposedAction()
示例#7
0
 def dropEvent(self, event):
     """Reimplement Qt method
     Unpack dropped data and handle it"""
     source = event.mimeData()
     shellwidget = self.tabwidget.currentWidget()
     if source.hasText():
         qstr = source.text()
         if is_python_script(to_text_string(qstr)):
             self.start(qstr)
         elif shellwidget:
             shellwidget.shell.insert_text(qstr)
     elif source.hasUrls():
         pathlist = mimedata2url(source)
         if all(
             [is_python_script(to_text_string(qstr)) for qstr in pathlist]):
             for fname in pathlist:
                 self.start(fname)
         elif shellwidget:
             shellwidget.shell.drop_pathlist(pathlist)
     event.acceptProposedAction()
示例#8
0
 def dropEvent(self, event):
     """Reimplement Qt method
     Unpack dropped data and handle it"""
     source = event.mimeData()
     shellwidget = self.tabwidget.currentWidget()
     if source.hasText():
         qstr = source.text()
         if is_python_script(to_text_string(qstr)):
             self.start(qstr)
         elif shellwidget:
             shellwidget.shell.insert_text(qstr)
     elif source.hasUrls():
         pathlist = mimedata2url(source)
         if all([is_python_script(to_text_string(qstr)) 
                 for qstr in pathlist]):
             for fname in pathlist:
                 self.start(fname)
         elif shellwidget:
             shellwidget.shell.drop_pathlist(pathlist)
     event.acceptProposedAction()