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


Python QtCore.QLocale类代码示例

本文整理汇总了Python中PySide.QtCore.QLocale的典型用法代码示例。如果您正苦于以下问题:Python QLocale类的具体用法?Python QLocale怎么用?Python QLocale使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: setCountryCode

 def setCountryCode(self, idx):
     country = self.ui.countryBox.itemData(idx)
     if country:
         locale = QLocale(Languages[self.ui.languageBox.currentIndex()], QLocale.Country(country))
         name = locale.name()
         codes = name.split('_')
         self.mainWindow.moaiWidget.runString( "MOAIEnvironment.setValue('languageCode', '%s')" % codes[0])
         self.mainWindow.moaiWidget.runString( "MOAIEnvironment.setValue('countryCode', '%s')" % codes[1])
开发者ID:Vavius,项目名称:moai-ide,代码行数:8,代码来源:environmentdock.py

示例2: __init__

 def __init__(self, *args, **kwargs):
     QApplication.__init__(self, *args, **kwargs)
     self.settings = QSettings("everpad", "everpad-pad")
     self.translator = QTranslator()
     if not self.translator.load("../../i18n/%s" % QLocale.system().name()):
         self.translator.load("/usr/share/everpad/i18n/%s" % QLocale.system().name())
     self.installTranslator(self.translator)
     self.icon = QIcon.fromTheme("everpad-mono", QIcon("../../everpad-mono.png"))
     self.indicator = Indicator(self, self.icon)
     self.indicator.show()
开发者ID:fabianofranz,项目名称:everpad,代码行数:10,代码来源:indicator.py

示例3: __init__

 def __init__(self, *args, **kwargs):
     QApplication.__init__(self, *args, **kwargs)
     self.settings = QSettings('everpad', 'everpad-pad')
     self.translator = QTranslator()
     if not self.translator.load('../../i18n/%s' % QLocale.system().name()):
         self.translator.load('/usr/share/everpad/i18n/%s' % QLocale.system().name())
     self.installTranslator(self.translator)
     self.indicator = Indicator(self)
     self.update_icon()
     self.indicator.show()
开发者ID:guofengstc,项目名称:everpad,代码行数:10,代码来源:indicator.py

示例4: __init__

 def __init__(self, *args, **kwargs):
     QApplication.__init__(self, *args, **kwargs)
     self.settings = QSettings("everpad", "everpad-pad")
     self.translator = QTranslator()
     if not self.translator.load("../../i18n/%s" % QLocale.system().name()):
         self.translator.load("/usr/share/everpad/i18n/%s" % QLocale.system().name())
     # This application string can be localized to 'RTL' to switch the application layout
     # direction. See for example i18n/ar_EG.ts
     QT_TRANSLATE_NOOP("QApplication", "QT_LAYOUT_DIRECTION")
     self.installTranslator(self.translator)
     self.indicator = Indicator(self)
     self.update_icon()
     self.indicator.show()
开发者ID:XelK,项目名称:everpad,代码行数:13,代码来源:indicator.py

示例5: __init__

 def __init__(self, *args, **kwargs):
     QApplication.__init__(self, *args, **kwargs)
     self.settings = QSettings('everpad', 'everpad-pad')
     self.translator = QTranslator()
     if not self.translator.load('../../i18n/%s' % QLocale.system().name()):
         self.translator.load('/usr/share/everpad/i18n/%s' % QLocale.system().name())
     # This application string can be localized to 'RTL' to switch the application layout
     # direction. See for example i18n/ar_EG.ts
     QT_TRANSLATE_NOOP('QApplication', 'QT_LAYOUT_DIRECTION')
     self.installTranslator(self.translator)
     QNetworkProxyFactory.setUseSystemConfiguration(True)
     self.indicator = Indicator(self)
     self.update_icon()
     self.indicator.show()
开发者ID:fmoo,项目名称:everpad,代码行数:14,代码来源:indicator.py

示例6: applyEnvironmentSettings

    def applyEnvironmentSettings(self):
        lang = Languages[self.ui.languageBox.currentIndex()]
        country = QLocale.Country(self.ui.countryBox.itemData(self.ui.countryBox.currentIndex()))

        locale = QLocale(lang, country)
        name = locale.name()
        codes = name.split('_')

        relPath = self.ui.documentsBtn.text()
        dpi = float(self.ui.dpiEdit.text())

        self.mainWindow.moaiWidget.runString( "MOAIEnvironment.setValue('languageCode', '%s')" % codes[0])
        self.mainWindow.moaiWidget.runString( "MOAIEnvironment.setValue('countryCode', '%s')" % codes[1])
        self.mainWindow.moaiWidget.runString( "MOAIEnvironment.setValue('screenDpi', %f)" % dpi )
        self.mainWindow.moaiWidget.runString( "MOAIEnvironment.setValue('documentDirectory', '%s')" % relPath )
开发者ID:Vavius,项目名称:moai-ide,代码行数:15,代码来源:environmentdock.py

示例7: __init__

    def __init__(self, parent=None):
        super(BookOrderForm, self).__init__(parent)
        self.setupUi(self)

        self._access = statics.access_level
        # for currency formatting
        self._locale = QLocale()

        # had to hardcode these, wouldn't work otherwise:
        self.contentsLayout.setAlignment(self.groupBox, QtCore.Qt.AlignTop)
        self.contentsLayout.setAlignment(self.groupBox_2, QtCore.Qt.AlignTop)
        self.contentsLayout.setAlignment(self.groupBox_3, QtCore.Qt.AlignTop)
        self.contentsLayout.setAlignment(self.groupBox_4, QtCore.Qt.AlignTop)


        self.log = logging.getLogger('BookOForm')

        self.setup_model()
        self.setup_fields()

        # associate present flag
        self._associate_id = None
        # book internals
        self._book_list = []
        self._total = 0.0

        # flag to indicate whether there were changes to the fields
        self._dirty = False
开发者ID:raulvc,项目名称:seareiros,代码行数:28,代码来源:order_book.py

示例8: formatUptime

 def formatUptime(time):
     s = ''
     loc = QLocale()
     if time.days > 0:
         d = QCoreApplication.translate('ifmon', 'days') if time.days > 1 \
                 else QCoreApplication.translate('ifmon', 'day')
         s = '%s %s, ' % (loc.toString(time.days), d)
     mm, ss = divmod(time.seconds, 60)
     hh, mm = divmod(mm, 60)
     def padded(d):
         if d < 10:
             return loc.toString(0) + loc.toString(d)
         else:
             return loc.toString(d)
     s += '%s:%s:%s' % (padded(hh), padded(mm), padded(ss))
     return s
开发者ID:marchon,项目名称:ifmon,代码行数:16,代码来源:tablemodel.py

示例9: __init__

    def __init__(self, parent=None):
        super(ProductOrderForm, self).__init__(parent)
        self.setupUi(self)
        # had to subclass this spinbox to support return grabbing
        self.edQuantity = ReturnKeySpinBox(self)
        self.edQuantityHolder.addWidget(self.edQuantity)

        self._access = statics.access_level
        # for currency formatting
        self._locale = QLocale()

        # had to hardcode these, wouldn't work otherwise:
        self.contentsLayout.setAlignment(self.groupBox, QtCore.Qt.AlignTop)
        self.contentsLayout.setAlignment(self.groupBox_2, QtCore.Qt.AlignTop)
        self.contentsLayout.setAlignment(self.groupBox_3, QtCore.Qt.AlignTop)
        self.contentsLayout.setAlignment(self.groupBox_4, QtCore.Qt.AlignTop)

        self.log = logging.getLogger("ProductOForm")

        self.setup_model()
        self.setup_fields()

        # associate present flag
        self._associate_id = None
        # product internals
        self._product_list = []
        self._total = 0.0

        # flag to indicate whether there were changes to the fields
        self._dirty = False
开发者ID:raulvc,项目名称:seareiros,代码行数:30,代码来源:order_product.py

示例10: __init__

 def __init__(self, *args, **kwargs):
     """Init app"""
     QApplication.__init__(self, *args, **kwargs)
     self.sync_thread = SyncThread()
     self.sync_thread.start()
     self.translator = QTranslator()
     if not self.translator.load('i18n/%s' % QLocale.system().name()):
         self.translator.load('/usr/share/everpad/lang/%s' % QLocale.system().name())
     self.provider_obj = dbus.SessionBus().get_object("com.everpad.Provider", '/EverpadProvider')
     self.provider = dbus.Interface(self.provider_obj, "com.everpad.Provider")
     self.installTranslator(self.translator)
     self.icon = QIcon.fromTheme('everpad', QIcon('../everpad.png'))
     indicator = Indicator(self, self.icon)
     indicator.show()
     self.opened = {}
     self.setApplicationName('everpad')
     self.settings = gconf.client_get_default()
开发者ID:casualuser,项目名称:everpad,代码行数:17,代码来源:pad.py

示例11: onLoad

	def onLoad( self ):
		QLocale.setDefault(QLocale(QLocale.C))
		locale.setlocale(locale.LC_ALL, 'C')

		QCoreApplication.setOrganizationName("CloudTeam")
		QCoreApplication.setOrganizationDomain("cloudteam.pro")
		QCoreApplication.setApplicationName("juma-moai-editor")

		self.qtApp = QApplication( sys.argv )
		self.qtSetting = QSettings()
		
		self.setupMainWindow()		

		self.initialized = True
		self.running     = False

		return True
开发者ID:cloudteampro,项目名称:juma-editor,代码行数:17,代码来源:QtSupport.py

示例12: __init__

 def __init__(self, parent=None):
     super(BookOrderTableModel, self).__init__(parent)
     self._sql_statement = "SELECT b_o.id, b_o.date, b_o.total, a.fullname as associate, SUBSTR(b_o.obs,0,50) as obs " \
             "FROM order_request b_o " \
             "LEFT JOIN associate a ON b_o.associate_id = a.id " \
             "WHERE b_o.type = 1"
     self._name = "populate_obook"
     self._locale = QLocale()
开发者ID:raulvc,项目名称:seareiros,代码行数:8,代码来源:omodel_book.py

示例13: __init__

 def __init__(self, parent=None):
     super(ProductOrderTableModel, self).__init__(parent)
     self._sql_statement = "SELECT p_o.id, p_o.date, p_o.total, a.fullname as associate, SUBSTR(p_o.obs,0,50) as obs " \
             "FROM order_request p_o " \
             "LEFT JOIN associate a ON p_o.associate_id = a.id " \
             "WHERE p_o.type = 0"
     self._name = "populate_oproduct"
     self._locale = QLocale()
开发者ID:raulvc,项目名称:seareiros,代码行数:8,代码来源:omodel_product.py

示例14: BookOrderTableModel

class BookOrderTableModel(BaseTableModel):
    """ Model for listing book orders """

    ID, DATE, TOTAL, ASSOCIATE, OBS = range(5)

    def __init__(self, parent=None):
        super(BookOrderTableModel, self).__init__(parent)
        self._sql_statement = "SELECT b_o.id, b_o.date, b_o.total, a.fullname as associate, SUBSTR(b_o.obs,0,50) as obs " \
                "FROM order_request b_o " \
                "LEFT JOIN associate a ON b_o.associate_id = a.id " \
                "WHERE b_o.type = 1"
        self._name = "populate_obook"
        self._locale = QLocale()

    def load(self):
        self.set_query_info(self._name, self._sql_statement)
        super(BookOrderTableModel, self).load()

    def data(self, index, role=Qt.DisplayRole):
        if not index.isValid() or not (0<=index.row()<self.rowCount()):
            # invalid index
            return None
        record = self.get_record(index.row())
        column = index.column()
        if role == Qt.DisplayRole:
            if column == self.ID:
                return record.value("id")
            elif column == self.DATE:
                return record.value("date").toString("dd/MMM - HH:mm")
            elif column == self.TOTAL:
                return self._locale.toString(record.value("total"), 'f', 2).replace('.','')
            elif column == self.ASSOCIATE:
                return record.value("associate")
            elif column == self.OBS:
                return record.value("obs")
        return None

    def headerData(self, section, orientation, role=Qt.DisplayRole):
        if role == Qt.TextAlignmentRole:
            if orientation == Qt.Horizontal:
                return int(Qt.AlignLeft|Qt.AlignVCenter)
            return int(Qt.AlignRight|Qt.AlignVCenter)

        if role != Qt.DisplayRole:
            return None

        if orientation == Qt.Horizontal:
            if section == self.ID:
                return "Reg."
            elif section == self.DATE:
                return "Data e Hora"
            elif section == self.TOTAL:
                return "Total (R$)"
            elif section == self.ASSOCIATE:
                return "Associado"
            elif section == self.OBS:
                return unicode("Observações".decode('utf-8'))
        return section + 1
开发者ID:raulvc,项目名称:seareiros,代码行数:58,代码来源:omodel_book.py

示例15: main

def main():

    # application specifics
    app = QApplication(sys.argv)

    # TODO: remove this, hardcoding it for testing
    QLocale.setDefault(QLocale(QLocale.Portuguese, QLocale.Brazil))

    # login dialog
    login_dialog = Login()
    if login_dialog.exec_() == QDialog.Accepted:
        # validation complete, open main interface
        window = MainWindow(login_dialog.get_user_data())
        window.showMaximized()
        # solves mainwindow focusing on windows/xfce
        app.setActiveWindow(window)
        # start main loop
        sys.exit(app.exec_())
开发者ID:raulvc,项目名称:seareiros,代码行数:18,代码来源:seareiros.py


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