當前位置: 首頁>>代碼示例>>Python>>正文


Python QLineEdit.isEnabled方法代碼示例

本文整理匯總了Python中PyQt5.QtWidgets.QLineEdit.isEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Python QLineEdit.isEnabled方法的具體用法?Python QLineEdit.isEnabled怎麽用?Python QLineEdit.isEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PyQt5.QtWidgets.QLineEdit的用法示例。


在下文中一共展示了QLineEdit.isEnabled方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: Preferences

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import isEnabled [as 別名]

#.........這裏部分代碼省略.........
    def load_settings(self):
        """Load settings and update graphical widgets with loaded values."""
        settings = QSettings()
        overwrite_existing = settings.value('overwrite_existing', type=bool)
        default_output = settings.value('default_output', type=str)
        prefix = settings.value('prefix', type=str)
        suffix = settings.value('suffix', type=str)
        ffmpeg_path = settings.value('ffmpeg_path', type=str)
        default_command = (settings.value('default_command', type=str) or
                config.default_ffmpeg_cmd)
        videocodecs = (settings.value('videocodecs') or config.video_codecs)
        audiocodecs = (settings.value('audiocodecs') or config.audio_codecs)
        extraformats_video = (settings.value('extraformats_video') or [])
        default_command_image = (settings.value('default_command_image',
                type=str) or
                config.default_imagemagick_cmd
                )
        extraformats_image = (settings.value('extraformats_image') or [])
        extraformats_document = (settings.value('extraformats_document') or [])

        if overwrite_existing:
            self.exst_overwriteQRB.setChecked(True)
        else:
            self.exst_prefixQRB.setChecked(True)

        self.defaultQLE.setText(default_output)
        self.prefixQLE.setText(prefix)
        self.suffixQLE.setText(suffix)
        self.ffmpegpathQLE.setText(ffmpeg_path)
        self.ffmpegcmdQLE.setText(default_command)
        self.set_videocodecs(videocodecs)
        self.set_audiocodecs(audiocodecs)
        self.extraformatsffmpegQPTE.setPlainText("\n".join(extraformats_video))
        self.imagecmdQLE.setText(default_command_image)
        self.extraformatsimageQPTE.setPlainText("\n".join(extraformats_image))
        self.extraformatsdocumentQPTE.setPlainText("\n".join(extraformats_document))

    def set_videocodecs(self, codecs):
        self.vidcodecsQPTE.setPlainText("\n".join(codecs))

    def set_audiocodecs(self, codecs):
        self.audcodecsQPTE.setPlainText("\n".join(codecs))

    def open_dir(self):
        """Get a directory name using a standard Qt dialog and update
        self.defaultQLE with dir's name."""
        if self.defaultQLE.isEnabled():
            _dir = QFileDialog.getExistingDirectory(
                    self, 'FF Multi Converter - ' +
                    self.tr('Choose default output destination'), config.home
                    )
            if _dir:
                self.defaultQLE.setText(_dir)

    @staticmethod
    def plaintext_to_list(widget, formats=[]):
        """
        Parse the text from a QPlainTextEdit widget and return a list.
        The list will consist of every text line that is a single word
        and it's not in the formats list. No duplicates allowed.
        """
        _list = []
        for line in widget.toPlainText().split("\n"):
            line = line.strip()
            if len(line.split()) == 1 and line not in (_list+formats):
                _list.append(line)
        return _list

    def save_settings(self):
        """Set settings values by extracting the appropriate information from
        the graphical widgets."""
        videocodecs = self.plaintext_to_list(self.vidcodecsQPTE)
        audiocodecs = self.plaintext_to_list(self.audcodecsQPTE)
        extraformats_video = self.plaintext_to_list(self.extraformatsffmpegQPTE,
                config.video_formats)
        extraformats_image = self.plaintext_to_list(self.extraformatsimageQPTE,
                config.image_formats)
        extraformats_document = self.plaintext_to_list(
                self.extraformatsdocumentQPTE, config.document_formats)

        settings = QSettings()

        ffmpeg_path = os.path.expanduser(self.ffmpegpathQLE.text())
        if not utils.is_installed(ffmpeg_path):
            ffmpeg_path = utils.is_installed('ffmpeg')

        settings.setValue('overwrite_existing', self.exst_overwriteQRB.isChecked())
        settings.setValue('default_output', self.defaultQLE.text())
        settings.setValue('prefix', self.prefixQLE.text())
        settings.setValue('suffix', self.suffixQLE.text())
        settings.setValue('ffmpeg_path', ffmpeg_path)
        settings.setValue('default_command', self.ffmpegcmdQLE.text())
        settings.setValue('videocodecs', sorted(videocodecs))
        settings.setValue('audiocodecs', sorted(audiocodecs))
        settings.setValue('extraformats_video', sorted(extraformats_video))
        settings.setValue('default_command_image', self.imagecmdQLE.text())
        settings.setValue('extraformats_image', sorted(extraformats_image))
        settings.setValue('extraformats_document', sorted(extraformats_document))

        self.accept()
開發者ID:Ilias95,項目名稱:FF-Multi-Converter,代碼行數:104,代碼來源:preferences_dlg.py

示例2: MainWindow

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import isEnabled [as 別名]

#.........這裏部分代碼省略.........
            for i in fnames:
                if not i in self.fnames:
                    self.fnames.append(i)
            self.filesList_update()

    def filesList_add_dragged(self, links):
        for path in links:
            if os.path.isfile(path) and not path in self.fnames:
                self.fnames.append(path)
        self.filesList_update()

    def filesList_delete(self):
        items = self.filesList.selectedItems()
        if items:
            for i in items:
                self.fnames.remove(i.text())
            self.filesList_update()

    def filesList_clear(self):
        self.fnames = []
        self.filesList_update()

    def clear_all(self):
        """Clears or sets to default the values of all graphical widgets."""
        self.toQLE.clear()
        self.origQCB.setChecked(False)
        self.deleteQCB.setChecked(False)
        self.filesList_clear()

        self.audiovideo_tab.clear()
        self.image_tab.clear()

    def get_output_folder(self):
        if self.toQLE.isEnabled():
            output = QFileDialog.getExistingDirectory(
                    self, 'FF Multi Converter - ' +
                    self.tr('Choose output destination'),
                    config.home)
            if output:
                self.toQLE.setText(output)

    def import_presets(self):
        presets_dlgs.ShowPresets().import_presets()

    def export_presets(self):
        presets_dlgs.ShowPresets().export_presets()

    def reset_presets(self):
        presets_dlgs.ShowPresets().reset()

    def sync_presets(self):
        presets_dlgs.ShowPresets().synchronize()

    def removeold_presets(self):
        presets_dlgs.ShowPresets().remove_old()

    def ok_to_continue(self):
        """
        Check if everything is ok to continue with conversion.

        Check if:
        - At least one file has given for conversion.
        - An output folder has given.
        - Output folder exists.

        Return False if an error arises, else True.
開發者ID:Ilias95,項目名稱:FF-Multi-Converter,代碼行數:70,代碼來源:ffmulticonverter.py

示例3: InspectorWindow

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import isEnabled [as 別名]

#.........這裏部分代碼省略.........
        layerOrder = []
        for _, name in data:
            layerOrder.append(name)
        # defcon has data validity assertion (constant len etc.)
        layerSet.layerOrder = layerOrder

    # transforms

    def hMirror(self):
        glyph = self._glyph
        if None in (glyph, glyph.controlPointBounds):
            return
        xMin, _, xMax, _ = glyph.controlPointBounds
        for contour in glyph:
            for point in contour:
                point.x = xMin + xMax - point.x
        glyph.dirty = True

    def vMirror(self):
        glyph = self._glyph
        if None in (glyph, glyph.controlPointBounds):
            return
        _, yMin, _, yMax = glyph.controlPointBounds
        for contour in glyph:
            for point in contour:
                point.y = yMin + yMax - point.y
        glyph.dirty = True

    def lockMove(self, checked):
        self.moveYEdit.setEnabled(not checked)

    def moveGlyph(self):
        x = self.moveXEdit.text()
        if not self.moveYEdit.isEnabled():
            y = x
        else:
            y = self.moveYEdit.text()
        x, y = int(x) if x != "" else 0, int(y) if y != "" else 0
        self._glyph.move((x, y))

    def lockScale(self, checked):
        self.scaleYEdit.setEnabled(not checked)

    def scaleGlyph(self):
        glyph = self._glyph
        # TODO: consider disabling the buttons in that case?
        if glyph is None:
            return
        sX = self.scaleXEdit.text()
        if not self.scaleYEdit.isEnabled():
            sY = sX
        else:
            sY = self.scaleYEdit.text()
        sX, sY = int(sX) if sX != "" else 100, int(sY) if sY != "" else 100
        sX /= 100
        sY /= 100
        center = self.alignmentWidget.origin()
        glyph.scale((sX, sY), center=center)

    def rotateGlyph(self):
        glyph = self._glyph
        if glyph is None:
            return
        r = self.rotateEdit.text()
        r = int(r) if r != "" else 0
        origin = self.alignmentWidget.origin()
開發者ID:khaledhosny,項目名稱:trufont,代碼行數:70,代碼來源:inspectorWindow.py

示例4: Interface

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import isEnabled [as 別名]

#.........這裏部分代碼省略.........
                #[self.style().standardIcon(QStyle.SP_DialogCloseButton),
                #self.tr('Close Projects')],
            #'undo': [QIcon(resources.IMAGES['undo']), self.tr('Undo')],
            #'redo': [QIcon(resources.IMAGES['redo']), self.tr('Redo')],
            #'cut': [QIcon(resources.IMAGES['cut']), self.tr('Cut')],
            #'copy': [QIcon(resources.IMAGES['copy']), self.tr('Copy')],
            #'paste': [QIcon(resources.IMAGES['paste']), self.tr('Paste')],
            #'find': [QIcon(resources.IMAGES['find']), self.tr('Find')],
            #'find-replace': [QIcon(resources.IMAGES['findReplace']),
                #self.tr('Find/Replace')],
            #'find-files': [QIcon(resources.IMAGES['find']),
                #self.tr('Find In files')],
            #'code-locator': [QIcon(resources.IMAGES['locator']),
                #self.tr('Code Locator')],
            #'splith': [QIcon(resources.IMAGES['splitH']),
                #self.tr('Split Horizontally')],
            #'splitv': [QIcon(resources.IMAGES['splitV']),
                #self.tr('Split Vertically')],
            #'follow-mode': [QIcon(resources.IMAGES['follow']),
                #self.tr('Follow Mode')],
            #'zoom-in': [QIcon(resources.IMAGES['zoom-in']), self.tr('Zoom In')],
            #'zoom-out': [QIcon(resources.IMAGES['zoom-out']),
                #self.tr('Zoom Out')],
            #'indent-more': [QIcon(resources.IMAGES['indent-more']),
                #self.tr('Indent More')],
            #'indent-less': [QIcon(resources.IMAGES['indent-less']),
                #self.tr('Indent Less')],
            #'comment': [QIcon(resources.IMAGES['comment-code']),
                #self.tr('Comment')],
            #'uncomment': [QIcon(resources.IMAGES['uncomment-code']),
                #self.tr('Uncomment')],
            #'go-to-definition': [QIcon(resources.IMAGES['go-to-definition']),
                #self.tr('Go To Definition')],
            #'insert-import': [QIcon(resources.IMAGES['insert-import']),
                #self.tr('Insert Import')],
            #'run-project': [QIcon(resources.IMAGES['play']), 'Run Project'],
            #'run-file': [QIcon(resources.IMAGES['file-run']), 'Run File'],
            #'stop': [QIcon(resources.IMAGES['stop']), 'Stop'],
            #'preview-web': [QIcon(resources.IMAGES['preview-web']),
                #self.tr('Preview Web')]}
        #for item in self.toolbar_items:
            #combo.addItem(self.toolbar_items[item][0],
                #self.toolbar_items[item][1], item)
        #combo.model().sort(0)

##    def _load_toolbar(self):
        #pass
        ##self._toolbar_items.clear()
        ##self.actionGroup = QActionGroup(self)
        ##self.actionGroup.setExclusive(True)
        ##for item in self.toolbar_settings:
            ##if item == 'separator':
                ##self._toolbar_items.addSeparator()
            ##else:
                ##action = self._toolbar_items.addAction(
                    ##self.toolbar_items[item][0], self.toolbar_items[item][1])
                ##action.setData(item)
                ##action.setCheckable(True)
                ##self.actionGroup.addAction(action)

    def _load_langs(self):
        langs = file_manager.get_files_from_folder(
            resources.LANGS, '.qm')
        self._languages = ['English'] + \
            [file_manager.get_module_name(lang) for lang in langs]
        self._comboLang.addItems(self._languages)
        if(self._comboLang.count() > 1):
            self._comboLang.setEnabled(True)
        if settings.LANGUAGE:
            index = self._comboLang.findText(settings.LANGUAGE)
        else:
            index = 0
        self._comboLang.setCurrentIndex(index)

    def save(self):
        qsettings = IDE.ninja_settings()

        qsettings.beginGroup("ide")
        qsettings.beginGroup("interface")

        ninja_theme = self._combobox_themes.currentText()
        settings.NINJA_SKIN = ninja_theme
        qsettings.setValue("skin", settings.NINJA_SKIN)
        settings.SHOW_PROJECT_EXPLORER = self._checkProjectExplorer.isChecked()
        qsettings.setValue("showProjectExplorer",
                           settings.SHOW_PROJECT_EXPLORER)
        settings.SHOW_SYMBOLS_LIST = self._checkSymbols.isChecked()
        qsettings.setValue("showSymbolsList", settings.SHOW_SYMBOLS_LIST)
        if self._line_custom_hdpi.isEnabled():
            screen_resolution = self._line_custom_hdpi.text().strip()
            settings.CUSTOM_SCREEN_RESOLUTION = screen_resolution
        else:
            settings.HDPI = bool(self._combo_resolution.currentIndex())
            qsettings.setValue("autoHdpi", settings.HDPI)
            settings.CUSTOM_SCREEN_RESOLUTION = ""
        qsettings.setValue("customScreenResolution",
                           settings.CUSTOM_SCREEN_RESOLUTION)

        qsettings.endGroup()
        qsettings.endGroup()
開發者ID:ninja-ide,項目名稱:ninja-ide,代碼行數:104,代碼來源:preferences_interface.py

示例5: InspectorWindow

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import isEnabled [as 別名]

#.........這裏部分代碼省略.........
        color = widget.color()
        layer = widget.property("layer")
        if color is not None:
            color = color.getRgbF()
        layer.color = color

    # transforms

    def hMirror(self):
        glyph = self._glyph
        if None in (glyph, glyph.controlPointBounds):
            return
        xMin, _, xMax, _ = glyph.controlPointBounds
        for contour in glyph:
            for point in contour:
                point.x = xMin + xMax - point.x
        glyph.dirty = True

    def vMirror(self):
        glyph = self._glyph
        if None in (glyph, glyph.controlPointBounds):
            return
        _, yMin, _, yMax = glyph.controlPointBounds
        for contour in glyph:
            for point in contour:
                point.y = yMin + yMax - point.y
        glyph.dirty = True

    def lockMove(self, checked):
        self.moveYEdit.setEnabled(not checked)

    def moveGlyph(self):
        x = self.moveXEdit.text()
        if not self.moveYEdit.isEnabled():
            y = x
        else:
            y = self.moveYEdit.text()
        x, y = int(x) if x != "" else 0, int(y) if y != "" else 0
        self._glyph.move((x, y))

    def lockScale(self, checked):
        self.scaleYEdit.setEnabled(not checked)

    def scaleGlyph(self):
        glyph = self._glyph
        # TODO: consider disabling the buttons in that case?
        if glyph is None:
            return
        sX = self.scaleXEdit.text()
        if not self.scaleYEdit.isEnabled():
            sY = sX
        else:
            sY = self.scaleYEdit.text()
        sX, sY = int(sX) if sX != "" else 100, int(sY) if sY != "" else 100
        sX /= 100
        sY /= 100
        center = self.alignmentWidget.origin()
        glyph.scale((sX, sY), center=center)

    def rotateGlyph(self):
        glyph = self._glyph
        if glyph is None:
            return
        r = self.rotateEdit.text()
        r = int(r) if r != "" else 0
        origin = self.alignmentWidget.origin()
開發者ID:madig,項目名稱:trufont,代碼行數:70,代碼來源:inspectorWindow.py


注:本文中的PyQt5.QtWidgets.QLineEdit.isEnabled方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。