예제 #1
0
 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()
예제 #2
0
 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()
예제 #3
0
 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()
예제 #4
0
파일: indicator.py 프로젝트: XelK/everpad
 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()
예제 #5
0
 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()
예제 #6
0
파일: __init__.py 프로젝트: p0i0/Hazama
def setTranslationLocale():
    global locale
    lang = settings['Main'].get('lang')
    sysLocale = QLocale.system()
    if lang and lang == sysLocale.name():
        locale = sysLocale
    elif lang and lang != sysLocale.name():
        # special case: application language is different from system's
        locale = QLocale(lang)
        QLocale.setDefault(locale)
    else:
        locale = sysLocale
        lang = settings['Main']['lang'] = locale.name()
    langPath = os.path.join(appPath, 'lang')
    logging.info('set translation(%s)', lang)
    global _trans, _transQt  # avoid being collected
    _trans = QTranslator()
    _trans.load(lang, langPath)
    _transQt = QTranslator()
    ret = _transQt.load('qt_' + lang,
                        QLibraryInfo.location(QLibraryInfo.TranslationsPath))
    if not ret:  # frozen
        _transQt.load('qt_' + lang, langPath)
    for i in [_trans, _transQt]:
        QApplication.instance().installTranslator(i)

    global dateFmt, datetimeFmt, fullDatetimeFmt
    timeFmt = settings['Main'].get('timeFormat')
    dateFmt = settings['Main'].get('dateFormat', locale.dateFormat())
    datetimeFmt = (dateFmt + ' ' + timeFmt) if timeFmt else dateFmt
    # use hh:mm because locale.timeFormat will include seconds
    fullDatetimeFmt = dateFmt + ' ' + (timeFmt or 'hh:mm')
예제 #7
0
파일: pad.py 프로젝트: casualuser/everpad
 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()
예제 #8
0
def main():
    """
    """
    from MainWindow import MainWindow

    translator = QTranslator() #Build the translator
    translator.load(":/locales/df_%s" % QLocale.system().name())
    qttranslator = QTranslator()#A translator for Qt standard strings
    qttranslator.load("qt_%s" % (QLocale.system().name()))
    App = QApplication(sys.argv) #Creating the app
    App.setOrganizationName(ORGNAME) #Setting organization and application's
    App.setApplicationName(NAME)#name. It's only useful for QSettings
    App.setApplicationVersion(VERSION)
    App.setOrganizationDomain(URL)
    App.installTranslator(translator)#Install translators into the application.
    App.installTranslator(qttranslator)
    mw = MainWindow(App) #Now it's time to instantiate the main window
    mw.show() #And show it
    sys.exit(App.exec_()) #When the app finishes, exit.
예제 #9
0
def main():
    """
    """
    from MainWindow import MainWindow

    translator = QTranslator()  #Build the translator
    translator.load(":/locales/df_%s" % QLocale.system().name())
    qttranslator = QTranslator()  #A translator for Qt standard strings
    qttranslator.load("qt_%s" % (QLocale.system().name()))
    App = QApplication(sys.argv)  #Creating the app
    App.setOrganizationName(ORGNAME)  #Setting organization and application's
    App.setApplicationName(NAME)  #name. It's only useful for QSettings
    App.setApplicationVersion(VERSION)
    App.setOrganizationDomain(URL)
    App.installTranslator(
        translator)  #Install translators into the application.
    App.installTranslator(qttranslator)
    mw = MainWindow(App)  #Now it's time to instantiate the main window
    mw.show()  #And show it
    sys.exit(App.exec_())  #When the app finishes, exit.
예제 #10
0
 def systemLocale():
   from PySide.QtCore import QLocale
   system = QLocale.system()
   lang, script = system.language(), system.script()
   if lang == QLocale.English: return 'en_US'
   if lang == QLocale.Japanese: return 'ja_JP'
   if lang == QLocale.Korean: return 'ko_KR'
   if lang == QLocale.French: return 'fr_FR'
   if lang == QLocale.German: return 'de_DE'
   if lang == QLocale.Italian: return 'it_IT'
   if lang == QLocale.Spanish: return 'es_ES'
   if lang == QLocale.Portuguese: return 'pt_PT'
   if lang == QLocale.Russian: return 'ru_RU'
   if lang == QLocale.Polish: return 'pl_PL'
   if lang == QLocale.Chinese: return 'zh_CN' if script == QLocale.SimplifiedChineseScript else 'zh_TW'
예제 #11
0
 def __init__(self, *args, **kwargs):
     QApplication.__init__(self, *args, **kwargs)
     self.settings = QSettings('everpad', 'everpad-pad')
     locale = QLocale.system().name()
     self.qtTranslator = QTranslator()
     self.qtTranslator.load("qt_" + locale, QLibraryInfo.location(QLibraryInfo.TranslationsPath))
     self.installTranslator(self.qtTranslator)
     self.appTranslator = QTranslator()
     if not self.appTranslator.load(locale, os.path.join(os.path.dirname(__file__), '../../i18n')):
         self.appTranslator.load(locale, resource_filename('share/everpad/i18n'))
     # 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.appTranslator)
     QNetworkProxyFactory.setUseSystemConfiguration(True)
     self.indicator = Indicator()
     self.update_icon()
     self.indicator.show()
예제 #12
0
파일: app.py 프로젝트: marchon/ifmon
def main(argv=None):
    app = QApplication(argv or sys.argv)
    locale = QLocale.system().name()
    trans = QTranslator()
    locale_path = '%s/locale/ifmon_%s' % (os.path.dirname(
        os.path.dirname(os.path.realpath(__file__))), locale.lower())
    trans.load(locale_path)
    app.installTranslator(trans)
    try:
        setup_db()
    except:
        QMessageBox.critical(
            None, 'Database error', 'Could not find the database.\n'
            'Please install it properly by running install.py on Ubuntu.\n'
            'For other Linux distributions, check the requirements.',
            QMessageBox.Ok)
        sys.exit(app.exit())
    else:
        mw = MainWindow()
        mw.show()
    sys.exit(app.exec_())
예제 #13
0
파일: app.py 프로젝트: marchon/ifmon
def main(argv=None):
    app = QApplication(argv or sys.argv)
    locale = QLocale.system().name()
    trans = QTranslator()
    locale_path = '%s/locale/ifmon_%s' % (os.path.dirname(os.path.dirname(
        os.path.realpath(__file__))), locale.lower())
    trans.load(locale_path)
    app.installTranslator(trans)
    try:
        setup_db()
    except:
        QMessageBox.critical(None, 'Database error',
            'Could not find the database.\n'
            'Please install it properly by running install.py on Ubuntu.\n'
            'For other Linux distributions, check the requirements.',
            QMessageBox.Ok)
        sys.exit(app.exit())
    else:
        mw = MainWindow()
        mw.show()
    sys.exit(app.exec_())
예제 #14
0
 def __init__(self, *args, **kwargs):
     QApplication.__init__(self, *args, **kwargs)
     self.settings = QSettings('everpad', 'everpad-pad')
     locale = QLocale.system().name()
     self.qtTranslator = QTranslator()
     self.qtTranslator.load(
         "qt_" + locale,
         QLibraryInfo.location(QLibraryInfo.TranslationsPath))
     self.installTranslator(self.qtTranslator)
     self.appTranslator = QTranslator()
     if not self.appTranslator.load(
             locale, os.path.join(os.path.dirname(__file__), '../../i18n')):
         self.appTranslator.load(locale,
                                 resource_filename('share/everpad/i18n'))
     # 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.appTranslator)
     QNetworkProxyFactory.setUseSystemConfiguration(True)
     self.indicator = Indicator()
     self.update_icon()
     self.indicator.show()
예제 #15
0
            return self.__settings.value(key)
        else:
            return ""

    def __setitem__(self, key, value):
        """Méthode magique sous-jacent à l'opérateur [] en écriture"""
        self.__settings.setValue(key, value)

    def __delitem__(self, key):
        """Méthode magique sous-jacent à l'opérateur del"""
        self.__settings.remove(key)

if __name__ == "__main__":
    """Main de test"""
    import sys
    from PySide.QtGui import QApplication
    from PySide.QtCore import QLibraryInfo, QLocale, QTranslator

    app = QApplication(sys.argv)

    locale = QLocale.system().name()
    translator = QTranslator()
    translator.load("qt_" + locale,
        QLibraryInfo.location(QLibraryInfo.TranslationsPath))
    app.installTranslator(translator)

    ui = ConfigUI()
    ui.show()
    ret = app.exec_()
    sys.exit(ret)
예제 #16
0
from PySide.QtCore import QTranslator
from PySide.QtCore import QLocale
from PySide.QtCore import QLibraryInfo
from PySide.QtCore import Qt

from qrmainwindow import QtReduceMainWindow

app = QApplication(sys.argv)

app.setOrganizationName("The Reduce Project")
app.setOrganizationDomain("reduce-algebra.sourceforge.net")
app.setApplicationName("QReduce")

qtTranslator = QTranslator(app)
qtTranslator.load("qt_" + QLocale.system().name(),
                  QLibraryInfo.location(QLibraryInfo.TranslationsPath))
app.installTranslator(qtTranslator)

qreduceTranslator = QTranslator(app)
qreduceTranslator.load(sys.path[0] + "/" + "qreducetr." +
                       str(locale.getdefaultlocale()[0]))
#app.installTranslator(qreduceTranslator)

# app.setStyleSheet("QStatusBar::item { border: 0px solid black }");

app.setWindowIcon(QIcon(sys.path[0] + "/" + "Bumblebee.png"))

if os.uname()[0] == "Darwin":
    app.setAttribute(Qt.AA_DontShowIconsInMenus)
예제 #17
0
        else:
            return ""

    def __setitem__(self, key, value):
        """Méthode magique sous-jacent à l'opérateur [] en écriture"""
        self.__settings.setValue(key, value)

    def __delitem__(self, key):
        """Méthode magique sous-jacent à l'opérateur del"""
        self.__settings.remove(key)


if __name__ == "__main__":
    """Main de test"""
    import sys
    from PySide.QtGui import QApplication
    from PySide.QtCore import QLibraryInfo, QLocale, QTranslator

    app = QApplication(sys.argv)

    locale = QLocale.system().name()
    translator = QTranslator()
    translator.load("qt_" + locale,
                    QLibraryInfo.location(QLibraryInfo.TranslationsPath))
    app.installTranslator(translator)

    ui = ConfigUI()
    ui.show()
    ret = app.exec_()
    sys.exit(ret)