当前位置: 首页>>代码示例>>Python>>正文


Python UpperCaseLineEdit.setText方法代码示例

本文整理汇总了Python中openmolar.qt4gui.customwidgets.upper_case_line_edit.UpperCaseLineEdit.setText方法的典型用法代码示例。如果您正苦于以下问题:Python UpperCaseLineEdit.setText方法的具体用法?Python UpperCaseLineEdit.setText怎么用?Python UpperCaseLineEdit.setText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在openmolar.qt4gui.customwidgets.upper_case_line_edit.UpperCaseLineEdit的用法示例。


在下文中一共展示了UpperCaseLineEdit.setText方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: TxDisplayWidget

# 需要导入模块: from openmolar.qt4gui.customwidgets.upper_case_line_edit import UpperCaseLineEdit [as 别名]
# 或者: from openmolar.qt4gui.customwidgets.upper_case_line_edit.UpperCaseLineEdit import setText [as 别名]
class TxDisplayWidget(QtGui.QWidget):
    text_edited = QtCore.pyqtSignal()

    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)

        self.pl_lineedit = UpperCaseLineEdit()
        self.cmp_lineedit = UpperCaseLineEdit()

        icon = QtGui.QIcon(":forward.png")
        but = QtGui.QPushButton()
        but.setIcon(icon)
        but.setMaximumWidth(30)
        but.clicked.connect(self._complete_treatments)

        layout = QtGui.QHBoxLayout(self)
        layout.setMargin(0)
        layout.addWidget(self.pl_lineedit)
        layout.addWidget(but)
        layout.addWidget(self.cmp_lineedit)

    def set_plan_text(self, text):
        self._initial_pl_text = text
        self.pl_lineedit.setText(text)
        self.pl_lineedit.textChanged.connect(self.text_edited.emit)

    def set_completed_text(self, text):
        self._initial_cmp_text = text
        self.cmp_lineedit.setText(text)
        self.cmp_lineedit.textChanged.connect(self.text_edited.emit)

    def _complete_treatments(self):
        self.cmp_lineedit.setText("%s %s" % (self.cmp_text, self.plan_text))
        self.pl_lineedit.setText("")

    @property
    def plan_text(self):
        txt = str(self.pl_lineedit.text())
        # denture codes are dumb!
        return re.sub("SR\ ", "SR_", txt)

    @property
    def cmp_text(self):
        txt = str(self.cmp_lineedit.text())
        # denture codes are dumb!
        return re.sub("SR\ ", "SR_", txt)

    @property
    def plan_edited(self):
        return self.plan_text != self._initial_pl_text

    @property
    def cmp_edited(self):
        return self.cmp_text != self._initial_cmp_text

    @property
    def has_been_edited(self):
        return not (self.plan_edited or self.cmp_edited)
开发者ID:atarist,项目名称:openmolar1,代码行数:60,代码来源:advanced_tx_planning_dialog.py

示例2: ChildSmileDialog

# 需要导入模块: from openmolar.qt4gui.customwidgets.upper_case_line_edit import UpperCaseLineEdit [as 别名]
# 或者: from openmolar.qt4gui.customwidgets.upper_case_line_edit.UpperCaseLineEdit import setText [as 别名]
class ChildSmileDialog(BaseDialog):
    result = ""
    is_checking_website = False

    def __init__(self, parent):
        BaseDialog.__init__(self, parent)

        self.main_ui = parent
        self.header_label = QtGui.QLabel()
        self.header_label.setAlignment(QtCore.Qt.AlignCenter)
        self.pcde_le = UpperCaseLineEdit()
        self.pcde_le.setText(self.main_ui.pt.pcde)
        self.simd_label = QtGui.QLabel()
        self.simd_label.setAlignment(QtCore.Qt.AlignCenter)

        self.tbi_checkbox = QtGui.QCheckBox(
            _("ToothBrushing Instruction Given"))
        self.tbi_checkbox.setChecked(True)

        self.di_checkbox = QtGui.QCheckBox(_("Dietary Advice Given"))
        self.di_checkbox.setChecked(True)

        self.fl_checkbox = QtGui.QCheckBox(_("Fluoride Varnish Applied"))
        self.fl_checkbox.setToolTip(
            _("Fee claimable for patients betwen 2 and 5"))
        self.fl_checkbox.setChecked(2 <= self.main_ui.pt.ageYears <= 5)

        self.insertWidget(self.header_label)
        self.insertWidget(self.pcde_le)
        self.insertWidget(self.simd_label)
        self.insertWidget(self.tbi_checkbox)
        self.insertWidget(self.di_checkbox)
        self.insertWidget(self.fl_checkbox)

        self.pcde_le.textEdited.connect(self.check_pcde)

        self._simd = None

    @property
    def pcde(self):
        try:
            return str(self.pcde_le.text())
        except:
            return ""

    @property
    def valid_postcode(self):
        return bool(re.match("[A-Z][A-Z](\d+) (\d+)[A-Z][A-Z]", self.pcde))

    def postcode_warning(self):
        if not self.valid_postcode:
            QtGui.QMessageBox.warning(self, "error", "Postcode is not valid")

    def check_pcde(self):
        if self.valid_postcode:
            QtCore.QTimer.singleShot(50, self.simd_lookup)
        else:
            self.header_label.setText(_("Please enter a valid postcode"))
            self.simd_label.setText("")
            self.enableApply(False)

    def simd_lookup(self):
        '''
        poll the server for a simd for a postcode
        '''
        QtGui.QApplication.instance().processEvents()
        global TODAYS_LOOKUPS
        try:
            self.result = TODAYS_LOOKUPS[self.pcde]
            self.simd_label.setText("%s %s" % (_("KNOWN SIMD"), self.result))
            self.enableApply(True)
            LOGGER.debug("simd_lookup unnecessary, value known")
            return
        except KeyError:
            pass

        self.header_label.setText(_("Polling website with Postcode"))

        pcde = self.pcde.replace(" ", "%20")

        url = "%s?pCode=%s" % (LOOKUP_URL, pcde)

        try:
            QtGui.QApplication.instance().setOverrideCursor(
                QtCore.Qt.WaitCursor)
            req = urllib.request.Request(url, headers=HEADERS)
            response = urllib.request.urlopen(req, timeout=20)
            result = response.read()
            self.result = self._parse_result(result)
        except urllib.error.URLError:
            LOGGER.error("url error polling NHS website?")
            self.result = _("Error polling website")
        except socket.timeout:
            LOGGER.error("timeout error polling NHS website?")
            self.result = _("Timeout polling website")
        finally:
            QtGui.QApplication.instance().restoreOverrideCursor()

        self.simd_label.setText("%s = %s" % (_("RESULT"), self.result))
        QtGui.QApplication.instance().processEvents()
#.........这里部分代码省略.........
开发者ID:atarist,项目名称:openmolar1,代码行数:103,代码来源:child_smile_dialog.py

示例3: LoginDialog

# 需要导入模块: from openmolar.qt4gui.customwidgets.upper_case_line_edit import UpperCaseLineEdit [as 别名]
# 或者: from openmolar.qt4gui.customwidgets.upper_case_line_edit.UpperCaseLineEdit import setText [as 别名]
class LoginDialog(ExtendableDialog):

    sys_password = None
    uninitiated = True
    __is_developer_environment = None

    def __init__(self, parent=None):
        ExtendableDialog.__init__(self, parent)
        self.setWindowTitle(_("Login Dialog"))

        header_label = WarningLabel(_('Login Required'))

        self.password_lineEdit = QtGui.QLineEdit()
        self.password_lineEdit.setEchoMode(QtGui.QLineEdit.Password)
        self.user1_lineEdit = UpperCaseLineEdit()
        self.user1_lineEdit.setMaximumWidth(50)
        self.user2_lineEdit = UpperCaseLineEdit()
        self.user2_lineEdit.setMaximumWidth(50)

        self.reception_radioButton = QtGui.QRadioButton(_("Reception Machine"))
        self.surgery_radioButton = QtGui.QRadioButton(_("Surgery Machine"))
        self.surgery_radioButton.setChecked(True)

        frame = QtGui.QFrame()
        form_layout = QtGui.QFormLayout(frame)

        form_layout.addRow(_("System Password"), self.password_lineEdit)

        form_layout.addRow(_("User 1 (Required)"), self.user1_lineEdit)
        form_layout.addRow(_("User 2 (Optional)"), self.user2_lineEdit)

        but_group = QtGui.QButtonGroup(self)
        but_group.addButton(self.surgery_radioButton)
        but_group.addButton(self.reception_radioButton)

        self.insertWidget(header_label)
        self.insertWidget(frame)
        self.insertWidget(self.surgery_radioButton)
        self.insertWidget(self.reception_radioButton)
        self.enableApply()

        # grab any stored information
        PASSWORD, USER1, USER2 = localsettings.autologin()
        self.password_lineEdit.setText(PASSWORD)
        self.user1_lineEdit.setText(USER1)
        self.user2_lineEdit.setText(USER2)
        self.autoreception(QtCore.QString(USER1))
        self.autoreception(QtCore.QString(USER2))

        self.parse_conf_file()

        self.alternate_servers_widget = AlternateServersWidget(self)
        if self.alternate_servers_widget.has_options:
            self.more_but.setText(_("Database choice"))
            self.add_advanced_widget(self.alternate_servers_widget)
        else:
            self.more_but.hide()

        self.user1_lineEdit.textEdited.connect(self.autoreception)
        self.user2_lineEdit.textEdited.connect(self.autoreception)

        self.dirty = True
        self.set_check_on_cancel(True)

        QtCore.QTimer.singleShot(0, self._developer_login)

    def sizeHint(self):
        return QtCore.QSize(350, 300)

    def showEvent(self, event):
        self.password_lineEdit.setFocus(True)

    @property
    def abandon_message(self):
        return _("Are you sure you wish to cancel the login process?")

    def parse_conf_file(self):
        try:
            dom = minidom.parse(localsettings.cflocation)
            self.sys_password = dom.getElementsByTagName(
                "system_password")[0].firstChild.data

            servernames = dom.getElementsByTagName("connection")

            for i, server in enumerate(servernames):
                nameDict = server.attributes
                try:
                    localsettings.server_names.append(nameDict["name"].value)
                except KeyError:
                    localsettings.server_names.append("%d" % i + 1)

        except IOError as e:
            LOGGER.warning("still no settings file. quitting politely")
            QtGui.QMessageBox.information(None, _("Unable to Run OpenMolar"),
                                          _("Good Bye!"))

            QtGui.QApplication.instance().closeAllWindows()
            sys.exit("unable to run - openMolar couldn't find a settings file")

    def autoreception(self, user):
#.........这里部分代码省略.........
开发者ID:Griffin-Ashton,项目名称:openmolar1,代码行数:103,代码来源:login_dialog.py

示例4: FeescaleTestingDialog

# 需要导入模块: from openmolar.qt4gui.customwidgets.upper_case_line_edit import UpperCaseLineEdit [as 别名]
# 或者: from openmolar.qt4gui.customwidgets.upper_case_line_edit.UpperCaseLineEdit import setText [as 别名]
class FeescaleTestingDialog(Ui_codeChecker.Ui_Dialog, QtGui.QDialog):
    def __init__(self, parent=None):
        QtGui.QDialog.__init__(self, parent)
        self.setupUi(self)
        self.table_list = []
        tablenames = []
        self.load_feescales()

        self.model2 = DeciduousAttributeModel(self.current_table)
        self.model3 = AdultAttributeModel(self.current_table)

        self.dec_tableView.setModel(self.model2)
        self.adult_tableView.setModel(self.model3)

        self.dec_tableView.horizontalHeader().setStretchLastSection(True)
        self.adult_tableView.horizontalHeader().setStretchLastSection(True)

        self.setWindowTitle(_("Shortcut tester"))

        self.connect(self.comboBox, QtCore.SIGNAL("currentIndexChanged (int)"),
            self.change_table)

        self.pushButton.clicked.connect(self.check_codes)

        self.quit_pushButton.clicked.connect(self.accept)

        self.line_edits = {}
        form_layout = QtGui.QFormLayout(self.frame)

        for att in CURRTRT_NON_TOOTH_ATTS:
            widg = QtGui.QLineEdit()
            self.line_edits[att] = widg
            form_layout.addRow(att, widg)

        self.lineEdit = UpperCaseLineEdit()
        self.bottom_layout.insertWidget(1, self.lineEdit)

        self.lineEdit.setText("P")

        self.check_codes()

    def load_feescales(self):
        self.table_list = []
        self.tablenames = []
        for table in localsettings.FEETABLES.tables.values():
            self.table_list.append(table)
            self.tablenames.append(table.briefName)
        self.comboBox.clear()
        self.comboBox.addItems(self.tablenames)

    def check_codes(self):
        tx = str(self.lineEdit.text().toAscii()).upper()

        complex_matches = []
        for att in CURRTRT_NON_TOOTH_ATTS:
            for complex_shortcut in self.current_table.complex_shortcuts:
                if complex_shortcut.matches(att, tx):
                    complex_matches.append(att)

            usercode = "%s %s"% (att, tx)
            code = self.current_table.getItemCodeFromUserCode(usercode)
            if code == "-----":
                self.line_edits[att].setText("")
            else:
                description = self.current_table.getItemDescription(
                code, usercode)
                self.line_edits[att].setText("%s %s"%(code, description))
        for model in (self.model2, self.model3):
            model.code = tx
            model.reset()
        for att in DECIDMOUTH + ADULTMOUTH:
            for complex_shortcut in self.current_table.complex_shortcuts:
                if complex_shortcut.matches(att, tx):
                    complex_matches.append(att)

        if complex_matches != []:
            QtGui.QMessageBox.information(self, _("Information"),
            "%s '%s' %s<hr />%s"% (
            _("This feescale handles"), tx,
            _("as a complex code for the following attributes."),
            complex_matches))

    @property
    def current_table(self):
        return self.table_list[self.comboBox.currentIndex()]

    def change_table(self, i):
        self.model2.table = self.current_table
        self.model3.table = self.current_table

        self.check_codes()
开发者ID:jdzla,项目名称:openmolar1,代码行数:93,代码来源:feescale_tester.py

示例5: ChildSmileDialog

# 需要导入模块: from openmolar.qt4gui.customwidgets.upper_case_line_edit import UpperCaseLineEdit [as 别名]
# 或者: from openmolar.qt4gui.customwidgets.upper_case_line_edit.UpperCaseLineEdit import setText [as 别名]
class ChildSmileDialog(BaseDialog):
    result = ""
    is_checking_website = False
    def __init__(self, parent):
        BaseDialog.__init__(self, parent)

        self.main_ui = parent
        self.header_label = QtGui.QLabel()
        self.header_label.setAlignment(QtCore.Qt.AlignCenter)
        self.pcde_le = UpperCaseLineEdit()
        self.pcde_le.setText(self.main_ui.pt.pcde)
        self.simd_label = QtGui.QLabel()
        self.header_label.setAlignment(QtCore.Qt.AlignCenter)

        self.tbi_checkbox = QtGui.QCheckBox(
            _("ToothBrushing Instruction Given"))
        self.tbi_checkbox.setChecked(True)

        self.di_checkbox = QtGui.QCheckBox(_("Dietary Advice Given"))
        self.di_checkbox.setChecked(True)

        self.fl_checkbox = QtGui.QCheckBox(_("Fluoride Varnish Applied"))
        self.fl_checkbox.setToolTip(
            _("Fee claimable for patients betwen 2 and 5"))
        self.fl_checkbox.setChecked(2 <= self.main_ui.pt.ageYears <=5)

        self.insertWidget(self.header_label)
        self.insertWidget(self.pcde_le)
        self.insertWidget(self.simd_label)
        self.insertWidget(self.tbi_checkbox)
        self.insertWidget(self.di_checkbox)
        self.insertWidget(self.fl_checkbox)

        self.pcde_le.textEdited.connect(self.check_pcde)

    @property
    def pcde(self):
        try:
            return str(self.pcde_le.text())
        except:
            return ""

    @property
    def valid_postcode(self):
        return bool(re.match("[A-Z][A-Z](\d+) (\d+)[A-Z][A-Z]", self.pcde))

    def postcode_warning(self):
        if not self.valid_postcode:
            QtGui.QMessageBox.warning(self, "error", "Postcode is not valid")

    def check_pcde(self):
        if self.valid_postcode:
            QtCore.QTimer.singleShot(50, self.simd_lookup)
        else:
            self.header_label.setText(_("Please enter a valid postcode"))
            self.simd_label.setText("")
            self.enableApply(False)

    def check_hung(self):
        '''
        this is called by a timout of the web polling
        '''
        if self.is_checking_website:
            QtGui.QApplication.instance().restoreOverrideCursor()
            QtGui.QMessageBox.warning(self, "error",
                "unable to poll NHS website")
            self.reject()
            return


    def simd_lookup(self):
        '''
        poll the server for a simd for a postcode
        '''
        global TODAYS_LOOKUPS
        try:
            self.result = TODAYS_LOOKUPS[self.pcde]
            self.simd_label.setText(self.result)
            self.enableApply(True)
            LOGGER.debug("simd_lookup unnecessary, value known")
            return
        except KeyError:
            pass
        try:
            self.is_checking_website = True
            QtCore.QTimer.singleShot(15000, self.check_hung)

            self.header_label.setText(_("Polling website with Postcode"))
            QtGui.QApplication.instance().setOverrideCursor(
                QtCore.Qt.WaitCursor)

            pcde = self.pcde.replace(" ", "%20")

            url = "%s?pCode=%s" %(LOOKUP_URL, pcde)

            req = urllib2.Request(url)
            response = urllib2.urlopen(req)
            result = response.read()
            self.result = self._parse_result(result)
            TODAYS_LOOKUPS[self.pcde] = self.result
#.........这里部分代码省略.........
开发者ID:jdzla,项目名称:openmolar1,代码行数:103,代码来源:child_smile_dialog.py


注:本文中的openmolar.qt4gui.customwidgets.upper_case_line_edit.UpperCaseLineEdit.setText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。