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


Python UpperCaseLineEdit.setMaximumWidth方法代码示例

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


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

示例1: LoginDialog

# 需要导入模块: from openmolar.qt4gui.customwidgets.upper_case_line_edit import UpperCaseLineEdit [as 别名]
# 或者: from openmolar.qt4gui.customwidgets.upper_case_line_edit.UpperCaseLineEdit import setMaximumWidth [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


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