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


Python QtCore.QLocale方法代码示例

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


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

示例1: setupUi

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QLocale [as 别名]
def setupUi(self, FmvAbout):
        FmvAbout.setObjectName("FmvAbout")
        FmvAbout.resize(643, 559)
        FmvAbout.setMinimumSize(QtCore.QSize(200, 250))
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/imgFMV/images/Information.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        FmvAbout.setWindowIcon(icon)
        FmvAbout.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
        self.verticalLayout = QtWidgets.QVBoxLayout(FmvAbout)
        self.verticalLayout.setObjectName("verticalLayout")
        self.webView = QtWebKitWidgets.QWebView(FmvAbout)
        self.webView.setProperty("url", QtCore.QUrl("about:blank"))
        self.webView.setObjectName("webView")
        self.verticalLayout.addWidget(self.webView)

        self.retranslateUi(FmvAbout)
        QtCore.QMetaObject.connectSlotsByName(FmvAbout) 
开发者ID:All4Gis,项目名称:QGISFMV,代码行数:19,代码来源:ui_FmvAbout.py

示例2: init_translations

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QLocale [as 别名]
def init_translations(app):
    """
    Loads translations for a given input app. If a scaling factor is defined for testing, we use
    our own subclass of QTranslator.
    """
    global application, translator, locale  # if we don't keep a reference on these, it stops working. pyqt bug?
    application = app
    translator = QTranslator() if trans_scale == 100 else VortaTranslator()

    locale = QLocale(os.environ.get('LANG', None))
    qm_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'qm'))
    ui_langs = locale.uiLanguages()
    succeeded = translator.load(locale, 'vorta', prefix='.', directory=qm_path)  # e.g. vorta/i18n/qm/vorta.de_DE.qm
    if succeeded:
        app.installTranslator(translator)
    logger.debug('Loading translation %s for %r.' % ('succeeded' if succeeded else 'failed', ui_langs)) 
开发者ID:borgbase,项目名称:vorta,代码行数:18,代码来源:__init__.py

示例3: populate_ui

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QLocale [as 别名]
def populate_ui(self):
        """Load settings and populate dialog"""
        settings = QtCore.QSettings()

        self.sendClientActiveCheckBox.setChecked(settings.value("send_client_active", True, type=bool))
        self.sendReadStateCheckBox.setChecked(settings.value("send_read_state", True, type=bool))
        self.enterSendMessageCheckBox.setChecked(settings.value("enter_send_message", False, type=bool))
        self.connectionEventsCheckBox.setChecked(settings.value("connection_events", True, type=bool))
        self.autoConnectCheckBox.setChecked(settings.value("autoconnect", False, type=bool))

        lang_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "languages")

        self.languageComboBox.clear()
        self.languageComboBox.addItem(QtCore.QLocale.languageToString(QtCore.QLocale("en").language()), "en")

        for f in glob.glob(os.path.join(lang_path, "*.qm")):
            file_locale = os.path.splitext(os.path.basename(f))[0].split("_")[-1]
            file_lang = QtCore.QLocale.languageToString(QtCore.QLocale(file_locale).language())
            self.languageComboBox.addItem(file_lang, file_locale)

        language = settings.value("language")
        if not language:
            language = QtCore.QLocale.system().name().split("_")[0]

        i = self.languageComboBox.findData(language)
        if i == -1:
            self.languageComboBox.setCurrentIndex(0)
        else:
            self.languageComboBox.setCurrentIndex(i) 
开发者ID:xmikos,项目名称:qhangups,代码行数:31,代码来源:settings.py

示例4: setupUi

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QLocale [as 别名]
def setupUi(self, Ebeam_Table):
        Ebeam_Table.setObjectName("Ebeam_Table")
        Ebeam_Table.resize(700, 500)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(Ebeam_Table.sizePolicy().hasHeightForWidth())
        Ebeam_Table.setSizePolicy(sizePolicy)
        self.gridLayout_2 = QtWidgets.QGridLayout(Ebeam_Table)
        self.gridLayout_2.setObjectName("gridLayout_2")
        self.table = QtWidgets.QTableWidget(Ebeam_Table)
        self.table.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
        self.table.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
        self.table.setRowCount(0)
        self.table.setColumnCount(2)
        self.table.setObjectName("table")
        item = QtWidgets.QTableWidgetItem()
        item.setTextAlignment(QtCore.Qt.AlignCenter)
        self.table.setHorizontalHeaderItem(0, item)
        item = QtWidgets.QTableWidgetItem()
        item.setTextAlignment(QtCore.Qt.AlignCenter)
        self.table.setHorizontalHeaderItem(1, item)
        self.table.verticalHeader().setVisible(False)
        self.gridLayout_2.addWidget(self.table, 0, 1, 1, 1)

        self.retranslateUi(Ebeam_Table)
        QtCore.QMetaObject.connectSlotsByName(Ebeam_Table) 
开发者ID:ocelot-collab,项目名称:ocelot,代码行数:29,代码来源:ebeam_table_ui.py

示例5: createEditor

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QLocale [as 别名]
def createEditor(self, parent, option, index):
        widget = QtWidgets.QLineEdit(parent)
        widget.setAlignment(QtCore.Qt.AlignRight)
        validator = QtGui.QDoubleValidator(self)
        locale = QtCore.QLocale("en")
        validator.setLocale(locale)
        widget.setValidator(validator)
        return widget 
开发者ID:jjgomera,项目名称:pychemqt,代码行数:10,代码来源:delegate.py

示例6: get_qlocale

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QLocale [as 别名]
def get_qlocale():
    q = QLocale(_current_locale_language)
    return q 
开发者ID:Scille,项目名称:parsec-cloud,代码行数:5,代码来源:lang.py

示例7: setupUi

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QLocale [as 别名]
def setupUi(self, FmvOpenStream):
        FmvOpenStream.setObjectName("FmvOpenStream")
        FmvOpenStream.resize(355, 83)
        FmvOpenStream.setMinimumSize(QtCore.QSize(0, 0))
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/imgFMV/images/stream.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        FmvOpenStream.setWindowIcon(icon)
        FmvOpenStream.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
        self.verticalLayout = QtWidgets.QVBoxLayout(FmvOpenStream)
        self.verticalLayout.setObjectName("verticalLayout")
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.cmb_protocol = QtWidgets.QComboBox(FmvOpenStream)
        self.cmb_protocol.setCursor(QtGui.QCursor(QtCore.Qt.IBeamCursor))
        self.cmb_protocol.setObjectName("cmb_protocol")
        self.cmb_protocol.addItem("")
        self.horizontalLayout_2.addWidget(self.cmb_protocol)
        self.ln_host = QtWidgets.QLineEdit(FmvOpenStream)
        self.ln_host.setText("")
        self.ln_host.setObjectName("ln_host")
        self.horizontalLayout_2.addWidget(self.ln_host)
        self.ln_port = QtWidgets.QLineEdit(FmvOpenStream)
        self.ln_port.setInputMethodHints(QtCore.Qt.ImhNone)
        self.ln_port.setText("")
        self.ln_port.setObjectName("ln_port")
        self.horizontalLayout_2.addWidget(self.ln_port)
        self.verticalLayout.addLayout(self.horizontalLayout_2)
        self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.btn_Open = QtWidgets.QPushButton(FmvOpenStream)
        self.btn_Open.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        self.btn_Open.setObjectName("btn_Open")
        self.horizontalLayout_3.addWidget(self.btn_Open)
        self.verticalLayout.addLayout(self.horizontalLayout_3)

        self.retranslateUi(FmvOpenStream)
        self.btn_Open.clicked['bool'].connect(FmvOpenStream.OpenStream)
        QtCore.QMetaObject.connectSlotsByName(FmvOpenStream) 
开发者ID:All4Gis,项目名称:QGISFMV,代码行数:40,代码来源:ui_FmvOpenStream.py

示例8: valueFromText

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QLocale [as 别名]
def valueFromText(self, text: str):
        if text.endswith("G") or text.endswith("g"):
            return QLocale().toDouble(text[:-1])[0] * 10 ** 9
        elif text.endswith("M") or text.endswith("m"):
            return QLocale().toDouble(text[:-1])[0] * 10 ** 6
        elif text.endswith("K") or text.endswith("k"):
            return QLocale().toDouble(text[:-1])[0] * 10 ** 3
        else:
            return QLocale().toDouble(text.rstrip(self.suffix()))[0] 
开发者ID:jopohl,项目名称:urh,代码行数:11,代码来源:KillerDoubleSpinBox.py

示例9: setupUi

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QLocale [as 别名]
def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(400, 131)
        MainWindow.setLocale(QtCore.QLocale(QtCore.QLocale.German, QtCore.QLocale.Germany))
        self.pb_progress = QtWidgets.QProgressBar(MainWindow)
        self.pb_progress.setGeometry(QtCore.QRect(10, 60, 381, 23))
        self.pb_progress.setProperty("value", 0)
        self.pb_progress.setAlignment(QtCore.Qt.AlignCenter)
        self.pb_progress.setOrientation(QtCore.Qt.Horizontal)
        self.pb_progress.setObjectName("pb_progress")
        self.b_run = QtWidgets.QPushButton(MainWindow)
        self.b_run.setEnabled(False)
        self.b_run.setGeometry(QtCore.QRect(210, 90, 181, 30))
        self.b_run.setCheckable(False)
        self.b_run.setChecked(False)
        self.b_run.setObjectName("b_run")
        self.label = QtWidgets.QLabel(MainWindow)
        self.label.setGeometry(QtCore.QRect(10, 10, 81, 16))
        self.label.setObjectName("label")
        self.label_2 = QtWidgets.QLabel(MainWindow)
        self.label_2.setGeometry(QtCore.QRect(10, 30, 81, 16))
        self.label_2.setObjectName("label_2")
        self.b_check = QtWidgets.QPushButton(MainWindow)
        self.b_check.setGeometry(QtCore.QRect(10, 90, 181, 30))
        self.b_check.setObjectName("b_check")
        self.l_newVersion = QtWidgets.QLabel(MainWindow)
        self.l_newVersion.setGeometry(QtCore.QRect(100, 30, 81, 16))
        self.l_newVersion.setText("")
        self.l_newVersion.setObjectName("l_newVersion")
        self.l_currentVersion = QtWidgets.QLabel(MainWindow)
        self.l_currentVersion.setGeometry(QtCore.QRect(100, 10, 81, 16))
        self.l_currentVersion.setText("")
        self.l_currentVersion.setObjectName("l_currentVersion")

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow) 
开发者ID:BrunoTh,项目名称:ETS2Autopilot,代码行数:38,代码来源:ui_updater.py

示例10: __init__

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QLocale [as 别名]
def __init__(self, parent=None, repository=None, systemtray_icon=None):
        """Init window."""
        super(WorkLogPreviewer, self).__init__(parent)

        saveAct = QAction(QIcon(SAVE_ICON_PATH), '&Save', self)
        saveAct.setShortcut('Ctrl+S')
        saveAct.setStatusTip('Save work log')
        saveAct.triggered.connect(self.save)

        menubar = self.menuBar()
        fileMenu = menubar.addMenu('&File')
        fileMenu.addAction(saveAct)

        self.repository = repository
        self.systemtray_icon = systemtray_icon

        self.statusBar()

        widget = QWidget()
        layout = QVBoxLayout()
        self.te = QPlainTextEdit()
        layout.addWidget(self.te)

        self.lbl = QLabel()
        self.lbl.hide()
        self.movie = QMovie(LOADER_PATH)
        self.lbl.setMovie(self.movie)
        hlayout = QHBoxLayout()
        hlayout.addStretch()
        hlayout.addWidget(self.lbl)
        hlayout.addStretch()
        layout.addLayout(hlayout)

        self.generate_log()

        widget.setLayout(layout)
        widget.setFixedSize(500, 500)
        self.setCentralWidget(widget)

        self.setWindowTitle(f'Work log for {repository.full_name}')
        self.setWindowIcon(QIcon(ICON_PATH))
        self.setLocale(QtCore.QLocale())
        self.adjustSize()

        self.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5()) 
开发者ID:DedSecInside,项目名称:Awesome-Scripts,代码行数:47,代码来源:work_log.py


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