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


Python QLineEdit.setDisabled方法代碼示例

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


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

示例1: __init__

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setDisabled [as 別名]
    def __init__(self, settings):
        super(QWidget, self).__init__()
        self._layout = QBoxLayout(QBoxLayout.TopToBottom)
        self.setLayout(self._layout)
        self.settings = settings

        # eq directory
        widget = QWidget()
        layout = QBoxLayout(QBoxLayout.LeftToRight)
        widget.setLayout(layout)
        label = QLabel("Everquest Directory: ")
        layout.addWidget(label)
        text = QLineEdit()
        text.setText(self.settings.get_value("general", "eq_directory"))
        text.setToolTip(self.settings.get_value("general", "eq_directory"))
        text.setDisabled(True)
        self._text_eq_directory = text
        layout.addWidget(text, 1)
        button = QPushButton("Browse...")
        button.clicked.connect(self._get_eq_directory)
        layout.addWidget(button)
        self._layout.addWidget(widget, 0, Qt.AlignTop)

        # eq directory info
        frame = QFrame()
        frame.setFrameShadow(QFrame.Sunken)
        frame.setFrameShape(QFrame.Box)
        frame_layout = QBoxLayout(QBoxLayout.LeftToRight)
        frame.setLayout(frame_layout)
        widget = QWidget()
        layout = QBoxLayout(QBoxLayout.LeftToRight)
        widget.setLayout(layout)
        self._label_eq_directory = QLabel()
        layout.addWidget(self._label_eq_directory, 1)
        frame_layout.addWidget(widget, 1, Qt.AlignCenter)
        self._layout.addWidget(frame, 1)

        # parse interval
        widget = QWidget()
        layout = QBoxLayout(QBoxLayout.LeftToRight)
        widget.setLayout(layout)
        label = QLabel("Seconds between parse checks: ")
        layout.addWidget(label, 0, Qt.AlignLeft)
        text = QLineEdit()
        text.setText(str(self.settings.get_value("general", "parse_interval")))
        text.editingFinished.connect(self._parse_interval_editing_finished)
        text.setMaxLength(3)
        self._text_parse_interval = text
        metrics = QFontMetrics(QApplication.font())
        text.setFixedWidth(metrics.width("888888"))
        layout.addWidget(text, 0, Qt.AlignLeft)
        self._layout.addWidget(widget, 0, Qt.AlignTop | Qt.AlignLeft)

        # spacing at bottom of window
        widget = QWidget()
        self._layout.addWidget(widget, 1)

        # setup
        if settings.get_value("general", "eq_directory") is not None:
            self._check_directory_stats()
開發者ID:nomns,項目名稱:Parse99,代碼行數:62,代碼來源:generaltab.py

示例2: VisualizationWindow

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setDisabled [as 別名]
class VisualizationWindow(QWidget):

    def __init__(self, application, room, *args, **kwargs):
        '''
        Class defining main window and basic GUI widgets.
        :param application: parent application
        :param room: Room() instance, which is loaded and parsed input file
        '''
        super(VisualizationWindow, self).__init__(*args, **kwargs)

        # initializing error handler in case of exceptions
        self._error_handler = ErrorHandler()

        # assigning application as a class attribute just in case, e.g. for getting screen size
        self._application = application

        # assigning room as a class attribute for easier argument passing
        self.room = room

        # specifying window size
        self._width = 1280
        self._height = 720

        # setting window parameters such as size, position and title
        screen_center = self._application.desktop().screen().rect().center()
        self.setGeometry(screen_center.x() - self._width * .5,
                         screen_center.y() - self._height * .5,
                         self._width,
                         self._height)
        self.setWindowTitle('Ray Tracing Method 4-dimensional visualization')
        self.setFixedSize(self._width, self._height)

        # creating OpenGL widget area
        self._opengl_widget = OpenGLWidget(self)

        # creating source parameters label
        self._source_parameters_lbl = QLabel('Source parameters:', self)
        self._source_parameters_lbl.move(22, 20)

        # creating source coordinates labels and text fields
        self._source_x_lbl = QLabel('X:', self)
        self._source_x_lbl.move(22, 50)
        self._source_x_text = QLineEdit(self)
        self._source_x_text.setFixedWidth(57)
        self._source_x_text.move(40, 46)

        self._source_y_lbl = QLabel('Y:', self)
        self._source_y_lbl.move(112, 50)
        self._source_y_text = QLineEdit(self)
        self._source_y_text.setFixedWidth(57)
        self._source_y_text.move(130, 46)

        self._source_z_lbl = QLabel('Z:', self)
        self._source_z_lbl.move(202, 50)
        self._source_z_text = QLineEdit(self)
        self._source_z_text.setFixedWidth(57)
        self._source_z_text.move(220, 46)

        # creating source SPL label and text field
        self._source_spl_lbl = QLabel('SPL [dB]:', self)
        self._source_spl_lbl.move(22, 80)
        self._source_spl_text = QLineEdit(self)
        self._source_spl_text.setFixedWidth(190)
        self._source_spl_text.move(87, 76)

        # creating source frequency label and dropdown list
        self._source_freq_lbl = QLabel('Frequency [Hz]:', self)
        self._source_freq_lbl.move(22, 110)
        self._source_freq_dropdown = QComboBox(self)
        self._source_freq_dropdown.addItems(['125', '250', '500', '1000', '2000', '4000'])
        self._source_freq_dropdown.setFixedWidth(146)
        self._source_freq_dropdown.move(131, 106)

        # creating simulation button
        self._simulation_button = QPushButton('Start simulation', self)
        self._simulation_button.setFixedSize(257, 60)
        self._simulation_button.move(20, 160)
        self._simulation_button.clicked[bool].connect(self._start_simulation)

        self.show()

    def _start_simulation(self):
        '''
        Method disabling all Qt widgets and starting OpenGL animation.
        '''
        try:   # exception handling in case of wrong input values
            source_pos = (   # source position tuple
                float(self._source_x_text.text()),   # source position x
                float(self._source_z_text.text()),   # source position y
                float(self._source_y_text.text())    # source position z
            )
            source_spl = float(self._source_spl_text.text()),   # source sound pressure level
            source_spl = source_spl[0] if type(source_spl) == type(tuple()) else source_spl
            source_freq = int(self._source_freq_dropdown.currentText())   # source frequency
        except Exception as e:   # in case of exception
            self._error_handler.raise_dialog(str(e))   # raise dialog window with exception description
            return   # and return to prevent function from proceeding

        # disabling all widgets
        self._source_parameters_lbl.setDisabled(True)
#.........這裏部分代碼省略.........
開發者ID:Nhor,項目名稱:4d-ray-tracing-method,代碼行數:103,代碼來源:visualization_window.py

示例3: __init__

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setDisabled [as 別名]
class SeriesAbstract:
    BAR = 'bar'
    LINE = 'line'
    SCATTER = 'scatter'
    CANDLE = 'candle'

    def __init__(
            self, _name: str,
            _x_list: typing.Sequence,
            _y_list: typing.Sequence,
            _color: typing.Any = None,
            _show_value: bool = True
    ):
        assert len(_x_list) == len(_y_list)
        assert len(_x_list) > 0

        self.name = _name
        self.x_list = _x_list
        self.y_list = _y_list
        self.show_value = _show_value
        self.show_group: QGroupBox = None
        self.show_edit: QLineEdit = None

        self.x2y = DataStruct(
            ['x', 'y'], 'x',
            list(zip(self.x_list, self.y_list))
        )
        self.color = None if _color is None else QColor(_color)

    def calcSetX(self) -> typing.Set:
        return set(self.x_list)

    def calcRangeY(
            self, _begin_x=None, _end_x=None
    ) -> typing.Tuple:
        tmp_y = self.x2y.loc[_begin_x:_end_x]['y']
        if len(tmp_y) == 0:
            return None, None
        return min(tmp_y), max(tmp_y)

    def addSeries(
            self, _x2idx: typing.Dict, _idx2x: list, _chart: QChart,
            _axis_x: QValueAxis, _axis_y: QValueAxis
    ):
        raise NotImplementedError('implement addSeries plz')

    def createShow(self):
        self.show_group = QGroupBox()
        self.show_group.setTitle(self.name)
        self.show_edit = QLineEdit()
        self.show_edit.setDisabled(True)
        layout = QFormLayout()
        layout.addWidget(self.show_edit)
        self.show_group.setLayout(layout)

    def updateValue(self, _x):
        value = self.x2y.loc[_x]
        if value is None:
            self.show_edit.setText('')
        else:
            value = value['y'][0]
            self.show_edit.setText('{:.5f}'.format(value))
開發者ID:neosun100,項目名稱:ParadoxTrading,代碼行數:64,代碼來源:SeriesAbstract.py

示例4: CandleSeries

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setDisabled [as 別名]
class CandleSeries(SeriesAbstract):
    def __init__(
            self, _name: str,
            _x_list: typing.Sequence,
            _y_list: typing.Sequence,
            _inc_color: typing.Any = None,
            _dec_color: typing.Any = None,
            _show_value: bool = True,
    ):
        super().__init__(_name, _x_list, _y_list, None, _show_value)

        self.show_open_edit: QLineEdit = None
        self.show_high_edit: QLineEdit = None
        self.show_low_edit: QLineEdit = None
        self.show_close_edit: QLineEdit = None

        self.inc_color = _inc_color
        self.dec_color = _dec_color
        self.type = SeriesAbstract.CANDLE

    def calcRangeY(
            self, _begin_x=None, _end_x=None
    ) -> typing.Tuple:
        tmp_y = self.x2y.loc[_begin_x:_end_x]['y']
        if len(tmp_y) == 0:
            return None, None
        min_value = min([min(d) for d in tmp_y])
        max_value = max([max(d) for d in tmp_y])
        return min_value, max_value

    def addSeries(
            self, _x2idx: typing.Dict, _idx2x: list, _chart: QChart,
            _axis_x: QValueAxis, _axis_y: QValueAxis
    ):
        series = QCandlestickSeries()
        series.setName(self.name)

        for x, y in zip(self.x_list, self.y_list):
            series.append(QCandlestickSet(*y, _x2idx[x]))
        if self.inc_color is not None:
            series.setIncreasingColor(self.inc_color)
        else:
            series.setIncreasingColor(QColor('#c41919'))
        if self.dec_color is not None:
            series.setDecreasingColor(self.dec_color)
        else:
            series.setDecreasingColor(QColor('#009f9f'))

        _chart.addSeries(series)
        _chart.setAxisX(_axis_x, series)
        _chart.setAxisY(_axis_y, series)

        if self.show_value:
            self.createShow()

    def createShow(self):
        self.show_group = QGroupBox()
        self.show_group.setTitle(self.name)

        self.show_open_edit = QLineEdit()
        self.show_open_edit.setDisabled(True)
        self.show_high_edit = QLineEdit()
        self.show_high_edit.setDisabled(True)
        self.show_low_edit = QLineEdit()
        self.show_low_edit.setDisabled(True)
        self.show_close_edit = QLineEdit()
        self.show_close_edit.setDisabled(True)
        layout = QFormLayout()
        layout.addWidget(QLabel('open'))
        layout.addWidget(self.show_open_edit)
        layout.addWidget(QLabel('high'))
        layout.addWidget(self.show_high_edit)
        layout.addWidget(QLabel('low'))
        layout.addWidget(self.show_low_edit)
        layout.addWidget(QLabel('close'))
        layout.addWidget(self.show_close_edit)
        self.show_group.setLayout(layout)

    def updateValue(self, _x):
        value = self.x2y.loc[_x]
        if value is None:
            self.show_open_edit.setText('')
            self.show_high_edit.setText('')
            self.show_low_edit.setText('')
            self.show_close_edit.setText('')
        else:
            value = value['y'][0]
            self.show_open_edit.setText('{:.5f}'.format(value[0]))
            self.show_high_edit.setText('{:.5f}'.format(value[1]))
            self.show_low_edit.setText('{:.5f}'.format(value[2]))
            self.show_close_edit.setText('{:.5f}'.format(value[3]))
開發者ID:neosun100,項目名稱:ParadoxTrading,代碼行數:93,代碼來源:CandleSeries.py

示例5: MainWindow

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

#.........這裏部分代碼省略.........
        return sDate + ' ' + time

    def monthYearLabel(self, date):
        label = monthIntToString[date.month()] + ' '
        label += str(date.year())
        return label

    def createReport(self):
        reportType = self.reportTypeComboBox.currentText()
        fromDate = self.fromDateEdit.date()
        toDate = self.toDateEdit.date()
        entities = []

        if "All entities" in reportType:
            entities = self.selectAllEntities()
        else:
            selected = self.entityList.selectedItems()
            if len(selected) == 1:
                entity = selected[0].text()
                entities = [(self.selectEntityId(entity), entity)]

        if len(entities) > 0:
            if "Opinions" in reportType:
                self.makeMonthlyPolarityChart(entities, fromDate, toDate)
            else:
                print entities
                self.makeMonthlyAppearanceChart(entities, fromDate, toDate)

    def viewArticle(self):
        try:
            articleId = int(self.articleNumberLineEdit.text())
            if articleId > 0 and articleId < self.articleCount:
                self.viewArticleButton.setEnabled(False)
                self.articleNumberLineEdit.setDisabled(True)

                articleList = [i+1 for i in xrange(self.articleCount)]
                articleView = Article(articleId-1, articleList, parentW=self)
                articleView.exec_()

                self.viewArticleButton.setEnabled(True)
                self.articleNumberLineEdit.setDisabled(False)
        except ValueError:
            print "Invalid article id"

    def viewArticleByEntity(self):
        selected = self.entityList.selectedItems()

        if len(selected) == 1:
            articles = self.selectAllArticlesByEntity(selected[0].text())
            articleList = [a[0] for a in articles]
            articleView = Article(0, articleList, shuffle_=True, parentW=self)
            articleView.exec_()

    def addEntity(self):
        newEntity = self.addEntityLineEdit.text().strip()
        newEntity = re.sub(r' +', ' ', newEntity)
        cursor = mysql_conn.cursor()

        if len(newEntity) != 0:
            selectStmt = """SELECT *
                            FROM entities
                            WHERE entity=%s"""
            data = (newEntity,)
            cursor.execute(selectStmt, data)
            rows = cursor.fetchall()
開發者ID:free2tedy,項目名稱:Licenta,代碼行數:69,代碼來源:main.py

示例6: RatukiWidget

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setDisabled [as 別名]
class RatukiWidget(GameWidget):

    def createEngine(self):
        if self.game != 'Ratuki':
            raise Exception("No engine for game {}".format(self.game))
            return
        self.engine = RatukiEngine()

    def initUI(self):
        super(RatukiWidget, self).initUI()

        self.gameInput = RatukiInputWidget(self.engine, self)
        self.gameInput.enterPressed.connect(self.commitRound)
        self.roundLayout.addWidget(self.gameInput)

        self.configLayout = QGridLayout()
        self.matchGroupLayout.addLayout(self.configLayout)
        self.topPointsLineEdit = QLineEdit(self.matchGroup)
        self.topPointsLineEdit.setText(str(self.engine.getTop()))
        self.topPointsLineEdit.setValidator(
            QtGui.QIntValidator(1, 10000, self.topPointsLineEdit))
        self.topPointsLineEdit.setFixedWidth(50)
        sp = QSizePolicy(
            QSizePolicy.Fixed, QSizePolicy.Fixed)
        self.topPointsLineEdit.setSizePolicy(sp)
        self.topPointsLineEdit.textChanged.connect(self.changeTop)
        self.topPointsLineEdit.setDisabled(self.engine.getNumRound() > 1)
        self.configLayout.addWidget(self.topPointsLineEdit, 0, 0)

        self.topPointsLabel = QLabel(self.matchGroup)
        self.topPointsLabel.setStyleSheet("QLabel {font-weight: bold; }")
        self.configLayout.addWidget(self.topPointsLabel, 0, 1)

        self.detailGroup = RatukiRoundsDetail(self.engine, self)
        self.detailGroup.edited.connect(self.updatePanel)
        self.widgetLayout.addWidget(self.detailGroup, 1, 0)

        self.playerGroup = QGroupBox(self)
        self.widgetLayout.addWidget(self.playerGroup, 1, 1)

        self.playerGroup.setStyleSheet(
            "QGroupBox { font-size: 18px; font-weight: bold; }")
        self.playersLayout = QVBoxLayout(self.playerGroup)
        self.playersLayout.addStretch()
        self.playerGroupBox = {}
        for i, player in enumerate(self.players):
            pw = GamePlayerWidget(player, PlayerColours[i], self.playerGroup)
            pw.updateDisplay(self.engine.getScoreFromPlayer(player))
            if player == self.engine.getDealer():
                pw.setDealer()
            self.playersLayout.addWidget(pw)
            self.playerGroupBox[player] = pw

        self.playersLayout.addStretch()

        self.retranslateUI()

    def retranslateUI(self):
        super(RatukiWidget, self).retranslateUI()
        self.topPointsLabel.setText(
            i18n("RatukiWidget", "Score Limit"))
#         self.playerGroup.setTitle(i18n("RatukiWidget","Score"))
        self.detailGroup.retranslateUI()

    def checkPlayerScore(self, player, score): return True

    def unsetDealer(
        self): self.playerGroupBox[self.engine.getDealer()].unsetDealer()

    def setDealer(
        self): self.playerGroupBox[self.engine.getDealer()].setDealer()

    def updatePanel(self):
        self.topPointsLineEdit.setReadOnly(True)
        self.dealerPolicyCheckBox.setEnabled(False)
        for player in self.players:
            score = self.engine.getScoreFromPlayer(player)
            self.playerGroupBox[player].updateDisplay(score)

        if self.engine.getWinner():
            self.detailGroup.updateStats()
        self.detailGroup.updateRound()
        super(RatukiWidget, self).updatePanel()

    def changeTop(self, newtop):
        try:
            newtop = int(newtop)
            self.engine.setTop(newtop)
            self.detailGroup.updatePlot()
        except ValueError:
            pass

    def setWinner(self):
        super(RatukiWidget, self).setWinner()
        winner = self.engine.getWinner()
        if winner in self.players:
            self.playerGroupBox[winner].setWinner()

    def updatePlayerOrder(self):
        GameWidget.updatePlayerOrder(self)
#.........這裏部分代碼省略.........
開發者ID:trawl,項目名稱:gamelog,代碼行數:103,代碼來源:ratuki.py

示例7: VoiceEditor

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setDisabled [as 別名]
class VoiceEditor(QWidget):
    """ This class implements an editor capable to load, edit and save pages.
    """

    # signal emitted when asking to load the next voice
    loadNextVoice = pyqtSignal(name='loadNextVoice')

    def __init__(self, connection, diff):
        """ Object initialization.

        Parameters
        ----------
        self : QWidget
        connection : Connection
            Object managing the connection to the wiki.
        diff : Diff
            Diff widget to be used by this editor.
        """

        super().__init__()

        self.connection = connection
        self.diff = diff
        self.originalContent = ''

        ## ACTIONS

        # save voice
        saveVoiceAction = QAction(
                QIcon('icons/document-save'),
                'Save voice', self)
        saveVoiceAction.setStatusTip('Save the voice content in the wiki')
        saveVoiceAction.triggered.connect(self.savePageContent)
        # save voice and load next one
        saveAndNextAction = QAction(
                QIcon('icons/save-and-next.svg'),
                'Save and next', self)
        saveAndNextAction.setStatusTip('Save the voice and load next one')
        saveAndNextAction.triggered.connect(self.saveAndNextVoice)
        # load next voice discarding changes
        nextVoiceAction = QAction(
                QIcon('icons/arrow-right'),
                'Next', self)
        nextVoiceAction.setStatusTip('Load the next voice discarding changes')
        nextVoiceAction.triggered.connect(self.loadNextVoice.emit)
        # clean editor discarding changes
        clearAction = QAction(
                QIcon('icons/window-close'),
                'Clear', self)
        clearAction.setStatusTip('Clean the editor discarding changes')
        clearAction.triggered.connect(self.clear)
        # show diff
        diffAction = QAction(
                QIcon('icons/sort-presence'),
                'Show changes', self)
        diffAction.setStatusTip('Show changes for the current the edit')
        diffAction.triggered.connect(self.showDiff)

        ## TOOLBARS

        # Actions
        self.actionsToolbar = QToolBar('Actions')
        self.actionsToolbar.addActions([
            diffAction,
            saveVoiceAction,
            saveAndNextAction,
            nextVoiceAction,
            clearAction])
        self.actionsToolbar.setOrientation(Qt.Vertical)

        ## WIDGETS

        self.pageTitle = QLineEdit()
        self.pageTitle.setDisabled(True)
        titleLayout = QHBoxLayout()
        titleLayout.addWidget(QLabel('Title:'))
        titleLayout.addWidget(self.pageTitle)
        titleWidget = QWidget()
        titleWidget.setLayout(titleLayout)

        self.pageContent = QPlainTextEdit()
        self.pageContent.setTabChangesFocus(True)

        summaryLabel = QLabel('Summary:')
        self.summary = QLineEdit()
        summaryHBox = QHBoxLayout()
        summaryHBox.addWidget(summaryLabel)
        summaryHBox.addWidget(self.summary)
        summaryWidget = QWidget()
        summaryWidget.setLayout(summaryHBox)

        self.editToolbar = EditToolbar(self, self.pageContent)

        vbox = QVBoxLayout()
        vbox.addWidget(titleWidget)
        vbox.addWidget(self.editToolbar)
        vbox.addWidget(self.pageContent)
        vbox.addWidget(summaryWidget)

        hbox = QHBoxLayout()
#.........這裏部分代碼省略.........
開發者ID:m-pilia,項目名稱:wikied,代碼行數:103,代碼來源:VoiceEditor.py

示例8: RemigioWidget

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setDisabled [as 別名]
class RemigioWidget(GameWidget):

    bgcolors = [0, 0xCCFF99, 0xFFFF99, 0xFFCC99, 0xFFCCFF]

    def createEngine(self):
        if self.game != 'Remigio':
            raise Exception("No engine for game {}".format(self.game))
            return
        self.engine = RemigioEngine()

    def initUI(self):
        super(RemigioWidget, self).initUI()

        self.gameInput = RemigioInputWidget(
            self.engine, RemigioWidget.bgcolors, self)
        self.gameInput.enterPressed.connect(self.commitRound)
        self.roundLayout.addWidget(self.gameInput)

        self.configLayout = QGridLayout()
        self.matchGroupLayout.addLayout(self.configLayout)
        self.topPointsLineEdit = QLineEdit(self.matchGroup)
        self.topPointsLineEdit.setText(str(self.engine.getTop()))
        self.topPointsLineEdit.setValidator(
            QtGui.QIntValidator(1, 10000, self.topPointsLineEdit))
        self.topPointsLineEdit.setFixedWidth(50)
        sp = QSizePolicy(
            QSizePolicy.Fixed, QSizePolicy.Fixed)
        self.topPointsLineEdit.setSizePolicy(sp)
        self.topPointsLineEdit.textChanged.connect(self.changeTop)
        self.topPointsLineEdit.setDisabled(self.engine.getNumRound() > 1)
        self.configLayout.addWidget(self.topPointsLineEdit, 0, 0)

        self.topPointsLabel = QLabel(self.matchGroup)
        self.topPointsLabel.setStyleSheet("QLabel {font-weight: bold; }")
        self.configLayout.addWidget(self.topPointsLabel, 0, 1)

        self.detailGroup = RemigioRoundsDetail(
            self.engine, RemigioWidget.bgcolors, self)
        self.detailGroup.edited.connect(self.updatePanel)
#         self.detailGroup = GameRoundsDetail(self.engine, self)
        self.widgetLayout.addWidget(self.detailGroup, 1, 0)

        self.playerGroup = QGroupBox(self)
        self.widgetLayout.addWidget(self.playerGroup, 1, 1)

        self.playerGroup.setStyleSheet(
            "QGroupBox { font-size: 18px; font-weight: bold; }")
        self.playersLayout = QVBoxLayout(self.playerGroup)
        self.playersLayout.addStretch()
        self.playerGroupBox = {}
        for i, player in enumerate(self.players):
            pw = RemigioPlayerWidget(
                player, PlayerColours[i % len(PlayerColours)],
                self.playerGroup)
            pw.updateDisplay(self.engine.getScoreFromPlayer(player))
            if player == self.engine.getDealer():
                pw.setDealer()
            if self.engine.isPlayerOff(player):
                print("Should set {} to ko...".format(player))
                pw.koPlayer()
            self.playersLayout.addWidget(pw)
            self.playerGroupBox[player] = pw

        self.playersLayout.addStretch()

        self.retranslateUI()

    def retranslateUI(self):
        super(RemigioWidget, self).retranslateUI()
        self.topPointsLabel.setText(
            i18n("RemigioWidget", "Score Limit"))
#         self.playerGroup.setTitle(i18n("RemigioWidget","Score"))
        self.detailGroup.retranslateUI()

    def updateGameStatusLabel(self):
        super(RemigioWidget, self).updateGameStatusLabel()
        if self.gameStatusLabel.text() == "":
            self.gameStatusLabel.setStyleSheet("QLabel {font-weight:bold;}")
            msg = i18n("RemigioWidget", "Warning: real points are computed \
                        automatically depending on the close type")
            self.gameStatusLabel.setText(msg)

    def getPlayerExtraInfo(self, player):
        c_type = self.gameInput.getCloseType()
        if c_type:
            return {'closeType': c_type}
        else:
            return {}

    def unsetDealer(
        self): self.playerGroupBox[self.engine.getDealer()].unsetDealer()

    def setDealer(
        self): self.playerGroupBox[self.engine.getDealer()].setDealer()

    def updatePanel(self):
        self.topPointsLineEdit.setReadOnly(True)
        self.dealerPolicyCheckBox.setEnabled(False)
        self.updateScores()
        if self.engine.getWinner():
#.........這裏部分代碼省略.........
開發者ID:trawl,項目名稱:gamelog,代碼行數:103,代碼來源:remigio.py

示例9: WindowSR

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

#.........這裏部分代碼省略.........
        row_split.addLayout(column_info)

        # Row of separation 2
        row_sep2  = QHBoxLayout()
        line_sep2 = QFrame()
        line_sep2.setFrameShape(QFrame.HLine)
        row_sep2.addWidget(line_sep2)

        # Add the file location selection row
        row_file       = QHBoxLayout()
        self.but_file  = QPushButton("Save location", self)
        self.but_file.clicked.connect(self.open_f)
        self.text_file = QLineEdit(self.default_path(), self)
        row_file.addWidget(self.but_file)
        row_file.addWidget(self.text_file)

        # Row of separation 3
        row_sep3  = QHBoxLayout()
        line_sep3 = QFrame()
        line_sep3.setFrameShape(QFrame.HLine)
        row_sep3.addWidget(line_sep3)

        # Download button row
        row_dl      = QHBoxLayout()
        self.bar_dl = QProgressBar(self)
        self.bar_dl.setFixedSize(600, 30)
        self.bar_dl.setMaximum(100)
        self.bar_dl.setMinimum(0)
        self.bar_dl.hide()
        self.label_dl = QLabel(self)
        self.label_dl.hide()
        self.but_dl = QPushButton("Download", self)
        self.but_dl.clicked.connect(self.manage_download)
        self.but_dl.setDisabled(True)
        row_dl.addWidget(self.bar_dl)
        row_dl.addWidget(self.label_dl)
        row_dl.addStretch(1)
        row_dl.addWidget(self.but_dl)

        # Add every row to the vertical grid
        self.vertical_grid.addLayout(row_url)
        self.vertical_grid.addLayout(row_sep1)
        self.vertical_grid.addLayout(row_split)
        self.vertical_grid.addLayout(row_sep2)
        self.vertical_grid.addLayout(row_file)
        self.vertical_grid.addLayout(row_sep3)
        self.vertical_grid.addLayout(row_dl)

        # Set layout of the vertical grid to the central widget
        self.central_widget.setLayout(self.vertical_grid)

        self.show()

    def init_client_id(self):
        """Ask for client id if it as never been entered, else load it from
        register with QSettings"""

        self.client_id = None
        self.setting   = QSettings(QSettings.UserScope, "BoBibelo",
                                   "SoundRain", self)
        if not self.setting.value("SR_bool"): # Setting never set
            self.client_id_box()
            self.setting.setValue("SR_bool", True)
            self.setting.setValue("SR_id", self.client_id)
        else:
            self.client_id = self.setting.value("SR_id")
開發者ID:Mougatine,項目名稱:Soundrain,代碼行數:70,代碼來源:soundrain.py


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