Example #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([self.__is_python_script(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()            
Example #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):
             event.acceptProposedAction()
         else:
             event.ignore()
     elif source.hasText():
         event.acceptProposedAction()
Example #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()
Example #4
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()
 def dropEvent(self, event):
     """Reimplement Qt method
     Unpack dropped data and handle it"""
     source = event.mimeData()
     if source.hasText():
         self.start(source.text())
     elif source.hasUrls():
         files = mimedata2url(source)
         for fname in files:
             if self.__is_python_script(fname):
                 self.start(fname)
     event.acceptProposedAction()
Example #6
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()
Example #7
0
 def dropEvent(self, event):
     """Reimplement Qt method
     Unpack dropped data and handle it"""
     source = event.mimeData()
     if source.hasText():
         self.start(source.text())
     elif source.hasUrls():
         files = mimedata2url(source)
         for fname in files:
             if self.__is_python_script(fname):
                 self.start(fname)
     event.acceptProposedAction()
Example #8
0
 def dropEvent(self, event):
     """Reimplement Qt method
     Unpack dropped data and handle it"""
     source = event.mimeData()
     if source.hasUrls():
         files = mimedata2url(source)
         if files:
             files = ["r'%s'" % path for path in files]
             if len(files) == 1:
                 text = files[0]
             else:
                 text = "[" + ", ".join(files) + "]"
             self.shell.insert_text(text)
     elif source.hasText():
         lines = unicode(source.text())
         self.shell.set_cursor_position('eof')
         self.shell.execute_lines(lines)
     event.acceptProposedAction()
Example #9
0
 def dropEvent(self, event):
     """Reimplement Qt method
     Unpack dropped data and handle it"""
     source = event.mimeData()
     if source.hasUrls():
         files = mimedata2url(source)
         if files:
             files = ["r'%s'" % path for path in files]
             if len(files) == 1:
                 text = files[0]
             else:
                 text = "[" + ", ".join(files) + "]"
             self.shell.insert_text(text)
     elif source.hasText():
         lines = unicode(source.text())
         self.shell.set_cursor_position('eof')
         self.shell.execute_lines(lines)
     event.acceptProposedAction()
Example #10
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 self.__is_python_script(qstr):
             self.start(qstr, ask_for_arguments=True)
         elif shellwidget:
             shellwidget.shell.insert_text(qstr)
     elif source.hasUrls():
         pathlist = mimedata2url(source)
         if all([self.__is_python_script(qstr) for qstr in pathlist]):
             for fname in pathlist:
                 self.start(fname, ask_for_arguments=True)
         elif shellwidget:
             shellwidget.shell.drop_pathlist(pathlist)
     event.acceptProposedAction()