Python PyQt4.QtCore 模块,QLocale() 实例源码

我们从Python开源项目中,提取了以下5个代码示例,用于说明如何使用PyQt4.QtCore.QLocale()

项目:dxf2gcode    作者:cnc-club    | 项目源码 | 文件源码
def __init__(self, parent = None):
        QDoubleSpinBox.__init__(self, parent)
        self.saved_suffix = ''
        #Let's use the locale decimal separator if it is different from the dot ('.')
        local_decimal_separator = QLocale().decimalPoint()
        if local_decimal_separator == '.':
            local_decimal_separator = ''
        self.lineEdit().setValidator(QRegExpValidator(QRegExp("-?[0-9]*[.{0}]?[0-9]*.*".format(local_decimal_separator)), self))
项目:dxf2gcode    作者:cnc-club    | 项目源码 | 文件源码
def valueFromText(self, text):
        if c.PYQT5notPYQT4:
            #print("valueFromText({0})".format(text.encode('utf-8')))
            text = text.encode('utf-8').replace(self.saved_suffix.encode('utf-8'), '').replace(QLocale().decimalPoint(), '.')
        else:
            #print("valueFromText({0})".format(text))
            text = text.replace(self.saved_suffix, '').replace(QLocale().decimalPoint(), '.')
        try:
            #result = float(text.replace('.', QLocale().decimalPoint()))
            result = float(text) #python expect a dot ('.') as decimal separator
        except ValueError:
            result = 0.0
        return result
项目:orquesta    作者:ej-f    | 项目源码 | 文件源码
def setupUi(self, Dialog):
        Dialog.setObjectName(_fromUtf8("Dialog"))
        Dialog.resize(342, 114)
        Dialog.setWindowTitle(_fromUtf8(""))
        self.verticalLayout = QtGui.QVBoxLayout(Dialog)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setSizeConstraint(QtGui.QLayout.SetDefaultConstraint)
        self.horizontalLayout.setMargin(0)
        self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
        self.label_nombre = QtGui.QLabel(Dialog)
        self.label_nombre.setObjectName(_fromUtf8("label_nombre"))
        self.horizontalLayout.addWidget(self.label_nombre)
        self.lineedit_project_name = QtGui.QLineEdit(Dialog)
        self.lineedit_project_name.setObjectName(_fromUtf8("lineedit_project_name"))
        self.horizontalLayout.addWidget(self.lineedit_project_name)
        self.label_group = QtGui.QLabel(Dialog)
        self.label_group.setObjectName(_fromUtf8("label_group"))
        self.horizontalLayout.addWidget(self.label_group)
        self.combobox_term_group = QtGui.QComboBox(Dialog)
        self.combobox_term_group.setObjectName(_fromUtf8("combobox_term_group"))
        self.horizontalLayout.addWidget(self.combobox_term_group)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.horizontalLayout_2 = QtGui.QHBoxLayout()
        self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
        self.label = QtGui.QLabel(Dialog)
        self.label.setObjectName(_fromUtf8("label"))
        self.horizontalLayout_2.addWidget(self.label)
        self.lineedit_log_path = QtGui.QLineEdit(Dialog)
        self.lineedit_log_path.setMouseTracking(True)
        self.lineedit_log_path.setAutoFillBackground(True)
        self.lineedit_log_path.setReadOnly(True)
        self.lineedit_log_path.setObjectName(_fromUtf8("lineedit_log_path"))
        self.horizontalLayout_2.addWidget(self.lineedit_log_path)
        self.button_log_path = QtGui.QPushButton(Dialog)
        self.button_log_path.setObjectName(_fromUtf8("button_log_path"))
        self.horizontalLayout_2.addWidget(self.button_log_path)
        self.verticalLayout.addLayout(self.horizontalLayout_2)
        self.buttonBox = QtGui.QDialogButtonBox(Dialog)
        self.buttonBox.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
        self.verticalLayout.addWidget(self.buttonBox)

        self.retranslateUi(Dialog)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), Dialog.accept)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), Dialog.reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
项目:isogeo-plugin-qgis    作者:isogeo    | 项目源码 | 文件源码
def setupUi(self, dlg_quicksearch_new):
        dlg_quicksearch_new.setObjectName(_fromUtf8("dlg_quicksearch_new"))
        dlg_quicksearch_new.setWindowModality(QtCore.Qt.WindowModal)
        dlg_quicksearch_new.resize(468, 100)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(dlg_quicksearch_new.sizePolicy().hasHeightForWidth())
        dlg_quicksearch_new.setSizePolicy(sizePolicy)
        dlg_quicksearch_new.setMinimumSize(QtCore.QSize(340, 100))
        dlg_quicksearch_new.setMaximumSize(QtCore.QSize(700, 110))
        dlg_quicksearch_new.setContextMenuPolicy(QtCore.Qt.NoContextMenu)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/plugins/Isogeo/resources/bolt.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        dlg_quicksearch_new.setWindowIcon(icon)
        dlg_quicksearch_new.setWindowOpacity(0.9)
        dlg_quicksearch_new.setAutoFillBackground(True)
        dlg_quicksearch_new.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
        dlg_quicksearch_new.setSizeGripEnabled(False)
        dlg_quicksearch_new.setModal(True)
        self.gridLayout = QtGui.QGridLayout(dlg_quicksearch_new)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        spacerItem = QtGui.QSpacerItem(20, 62, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        self.gridLayout.addItem(spacerItem, 1, 0, 1, 3)
        self.lbl_title = QtGui.QLabel(dlg_quicksearch_new)
        self.lbl_title.setMinimumSize(QtCore.QSize(0, 25))
        font = QtGui.QFont()
        font.setPointSize(8)
        font.setBold(True)
        font.setWeight(75)
        self.lbl_title.setFont(font)
        self.lbl_title.setContextMenuPolicy(QtCore.Qt.NoContextMenu)
        self.lbl_title.setAutoFillBackground(True)
        self.lbl_title.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
        self.lbl_title.setObjectName(_fromUtf8("lbl_title"))
        self.gridLayout.addWidget(self.lbl_title, 0, 0, 1, 1)
        self.btn_save_cancel = QtGui.QDialogButtonBox(dlg_quicksearch_new)
        self.btn_save_cancel.setOrientation(QtCore.Qt.Horizontal)
        self.btn_save_cancel.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Save)
        self.btn_save_cancel.setCenterButtons(True)
        self.btn_save_cancel.setObjectName(_fromUtf8("btn_save_cancel"))
        self.gridLayout.addWidget(self.btn_save_cancel, 2, 0, 1, 4)
        self.txt_quicksearch_name = QtGui.QLineEdit(dlg_quicksearch_new)
        self.txt_quicksearch_name.setMinimumSize(QtCore.QSize(50, 25))
        self.txt_quicksearch_name.setObjectName(_fromUtf8("txt_quicksearch_name"))
        self.gridLayout.addWidget(self.txt_quicksearch_name, 0, 1, 1, 3)

        self.retranslateUi(dlg_quicksearch_new)
        QtCore.QObject.connect(self.btn_save_cancel, QtCore.SIGNAL(_fromUtf8("accepted()")), dlg_quicksearch_new.accept)
        QtCore.QObject.connect(self.btn_save_cancel, QtCore.SIGNAL(_fromUtf8("rejected()")), dlg_quicksearch_new.reject)
        QtCore.QMetaObject.connectSlotsByName(dlg_quicksearch_new)
项目:isogeo-plugin-qgis    作者:isogeo    | 项目源码 | 文件源码
def setupUi(self, dlg_quicksearch_rename):
        dlg_quicksearch_rename.setObjectName(_fromUtf8("dlg_quicksearch_rename"))
        dlg_quicksearch_rename.resize(498, 100)
        dlg_quicksearch_rename.setMinimumSize(QtCore.QSize(340, 100))
        dlg_quicksearch_rename.setMaximumSize(QtCore.QSize(700, 116))
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/plugins/Isogeo/resources/bolt.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        dlg_quicksearch_rename.setWindowIcon(icon)
        dlg_quicksearch_rename.setWindowOpacity(0.9)
        dlg_quicksearch_rename.setAutoFillBackground(True)
        dlg_quicksearch_rename.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
        dlg_quicksearch_rename.setModal(True)
        self.gridLayout = QtGui.QGridLayout(dlg_quicksearch_rename)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.lbl_title = QtGui.QLabel(dlg_quicksearch_rename)
        font = QtGui.QFont()
        font.setPointSize(8)
        font.setBold(True)
        font.setWeight(75)
        self.lbl_title.setFont(font)
        self.lbl_title.setContextMenuPolicy(QtCore.Qt.NoContextMenu)
        self.lbl_title.setAutoFillBackground(True)
        self.lbl_title.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
        self.lbl_title.setObjectName(_fromUtf8("lbl_title"))
        self.gridLayout.addWidget(self.lbl_title, 0, 1, 1, 1)
        self.txt_quicksearch_rename = QtGui.QLineEdit(dlg_quicksearch_rename)
        self.txt_quicksearch_rename.setMinimumSize(QtCore.QSize(50, 25))
        self.txt_quicksearch_rename.setObjectName(_fromUtf8("txt_quicksearch_rename"))
        self.gridLayout.addWidget(self.txt_quicksearch_rename, 0, 2, 1, 1)
        spacerItem = QtGui.QSpacerItem(20, 62, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        self.gridLayout.addItem(spacerItem, 2, 0, 1, 2)
        self.btn_save_cancel = QtGui.QDialogButtonBox(dlg_quicksearch_rename)
        self.btn_save_cancel.setOrientation(QtCore.Qt.Horizontal)
        self.btn_save_cancel.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Save)
        self.btn_save_cancel.setCenterButtons(True)
        self.btn_save_cancel.setObjectName(_fromUtf8("btn_save_cancel"))
        self.gridLayout.addWidget(self.btn_save_cancel, 3, 0, 1, 3)

        self.retranslateUi(dlg_quicksearch_rename)
        QtCore.QObject.connect(self.btn_save_cancel, QtCore.SIGNAL(_fromUtf8("accepted()")), dlg_quicksearch_rename.accept)
        QtCore.QObject.connect(self.btn_save_cancel, QtCore.SIGNAL(_fromUtf8("rejected()")), dlg_quicksearch_rename.reject)
        QtCore.QMetaObject.connectSlotsByName(dlg_quicksearch_rename)