예제 #1
0
 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))
예제 #2
0
    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))
예제 #3
0
 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()
예제 #4
0
 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()
예제 #5
0
 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)
예제 #6
0
 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)
예제 #7
0
 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)
예제 #8
0
 def copyText(self):
     """
     Copies the selected text to the clipboard.
     """
     view = self.currentWebView()
     QApplication.clipboard().setText(view.page().selectedText())
예제 #9
0
    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)