def copy( self ): """ Copies the selected items to the clipboard. """ text = [] for item in self.selectedItems(): text.append(nativestring(item.text())) QApplication.clipboard().setText(','.join(text))
def copy(self): """ Copies the selected items to the clipboard. """ text = [] for item in self.selectedItems(): text.append(nativestring(item.text())) QApplication.clipboard().setText(','.join(text))
def paste(self): """ Pastes text from the clipboard into this edit. """ html = QApplication.clipboard().text() if not self.isRichTextEditEnabled(): self.insertPlainText(projex.text.toAscii(html)) else: super(XTextEdit, self).paste()
def paste( self ): """ Pastes text from the clipboard. """ text = nativestring(QApplication.clipboard().text()) for tag in text.split(','): tag = tag.strip() if ( self.isTagValid(tag) ): self.addTag(tag)
def paste(self): """ Pastes text from the clipboard. """ text = nativestring(QApplication.clipboard().text()) for tag in text.split(','): tag = tag.strip() if (self.isTagValid(tag)): self.addTag(tag)
def showProfileMenu(self, point): """ Prompts the user for profile menu options. Editing needs to be enabled for this to work. """ if not self.isEditingEnabled(): return trigger = self.actionAt(point) if (isinstance(trigger, XViewProfileAction)): prof = trigger.profile() else: prof = None # define the menu menu = QMenu(self) acts = {} text = self.profileText() # user right clicked on a profile if prof: acts['edit'] = menu.addAction('Edit {0}...'.format(text)) acts['save'] = menu.addAction('Save Layout') menu.addSeparator() acts['copy'] = menu.addAction('Copy {0}'.format(text)) acts['export'] = menu.addAction('Export {0}...'.format(text)) menu.addSeparator() acts['remove'] = menu.addAction('Delete {0}'.format(text)) # show toolbar options else: acts['new'] = menu.addAction('New Layout'.format(text)) menu.addSeparator() acts['save_as'] = menu.addAction('Save Layout as...') if QApplication.clipboard().text(): acts['paste'] = menu.addAction('Paste {0}'.format(text)) acts['import'] = menu.addAction('Import {0}...'.format(text)) for key, act in acts.items(): act.setIcon(QIcon(resources.find('img/{0}.png'.format(key)))) # run the menu act = menu.exec_(QCursor.pos()) # create a new profile if act is None: return elif act == acts.get('new'): self.clearActive() # create a new clear profile elif act == acts.get('save_as'): self.saveProfileAs() # edit an existing profile elif act == acts.get('edit'): self.editProfile(prof) # save or create a new profile elif act == acts.get('save'): self.saveProfileLayout(prof) # copy profile elif act == acts.get('copy'): QApplication.clipboard().setText(prof.toString()) # export elif act == acts.get('export'): self.exportProfile(prof) # export elif act == acts.get('import'): self.importProfile() # paste profile elif act == acts.get('paste'): text = QApplication.clipboard().text() try: prof = XViewProfile.fromString(text) except: prof = None QMessageBox.information(self.window(), 'Invalid {0}'.format(text), 'The clipboard text does not contain '\ 'a properly formated {0}'.format(text)) if prof and not prof.isEmpty(): self.createProfile(profile=prof) # paste as profile elif act == acts.get('paste_as'): text = QApplication.clipboard().text() prof = XViewProfile.fromString(text) if not prof.isEmpty(): if XViewProfileDialog.edit(self, prof): self.createProfile(profile=prof) # remove the profile elif act == acts.get('remove'): self.removeProfile(prof)
def copyText(self): """ Copies the selected text to the clipboard. """ view = self.currentWebView() QApplication.clipboard().setText(view.page().selectedText())