當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。