Exemplo n.º 1
0
    def copy(self):
        '''
        Copy the table selection to the clipboard
        At this point, works only for single line selection
        '''
        selection = self.selectionModel()
        indexes = selection.selectedIndexes()
        indexes.sort()

        previous = indexes.pop(0)
        data = self.model().data(previous)
        text = data.toString()
        selected_text = QString(text)
        
        for current in indexes:
            if current.row() != previous.row():
                selected_text.append('\n')
            else:
                selected_text.append('\t')
            data = self.model().data(current)
            text = data.toString()
            selected_text.append(text)
            previous = current
        selected_text.append('\n')
        QApplication.clipboard().setText(selected_text)
Exemplo n.º 2
0
    def copy(self):
        '''
        Copy the table selection to the clipboard
        '''
        selection = self.selectionModel()
        indexes = selection.selectedIndexes()
        indexes.sort()
        previous = indexes.pop(0)
        data = self.model().data(previous)
        try:
            text = data.toString()
        except:
            text = str(data)
        selected_text = QString(text)

        for current in indexes:
            if current.row() != previous.row():
                selected_text.append('\n')
            else:
                selected_text.append('\t')
            data = self.model().data(current)
            try:
                text = data.toString()
            except:
                text = str(data)
            selected_text.append(text)
            previous = current
        selected_text.append('\n')
        QApplication.clipboard().setText(selected_text)
Exemplo n.º 3
0
Arquivo: base.py Projeto: Pyke75/ga
 def paste(self):
     """Reimplement Qt method"""
     if self.has_selected_text():
         self.remove_selected_text()
     self.insert_text(QApplication.clipboard().text())
Exemplo n.º 4
0
Arquivo: base.py Projeto: Pyke75/ga
 def copy(self):
     """
     Reimplement Qt method
     Copy text to clipboard with correct EOL chars
     """
     QApplication.clipboard().setText(self.get_selected_text())
Exemplo n.º 5
0
Arquivo: base.py Projeto: jsantoul/ga
 def paste(self):
     """Reimplement Qt method"""
     if self.has_selected_text():
         self.remove_selected_text()
     self.insert_text(QApplication.clipboard().text())
Exemplo n.º 6
0
Arquivo: base.py Projeto: jsantoul/ga
 def copy(self):
     """
     Reimplement Qt method
     Copy text to clipboard with correct EOL chars
     """
     QApplication.clipboard().setText(self.get_selected_text())