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


Python Translator.get方法代码示例

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


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

示例1: change_systray_icon

# 需要导入模块: from nxdrive.wui.translator import Translator [as 别名]
# 或者: from nxdrive.wui.translator.Translator import get [as 别名]
    def change_systray_icon(self):
        syncing = False
        engines = self.manager.get_engines()
        invalid_credentials = True
        paused = True
        offline = True

        for engine in engines.itervalues():
            syncing |= engine.is_syncing()
            invalid_credentials &= engine.has_invalid_credentials()
            paused &= engine.is_paused()
            offline &= engine.is_offline()

        if offline:
            new_state = 'stopping'
            Action(Translator.get('OFFLINE'))
        elif invalid_credentials:
            new_state = 'stopping'
            Action(Translator.get('INVALID_CREDENTIALS'))
        elif not engines or paused:
            new_state = 'disabled'
            Action.finish_action()
        elif syncing:
            new_state = 'transferring'
        else:
            new_state = 'asleep'
            Action.finish_action()

        self.set_icon_state(new_state)
开发者ID:ssdi-drive,项目名称:nuxeo-drive,代码行数:31,代码来源:application.py

示例2: __init__

# 需要导入模块: from nxdrive.wui.translator import Translator [as 别名]
# 或者: from nxdrive.wui.translator.Translator import get [as 别名]
 def __init__(self, filename):
     values = dict()
     values["name"] = filename
     super(LockNotification, self).__init__("LOCK",
         title=Translator.get("LOCK_NOTIFICATION_TITLE", values),
         description=Translator.get("LOCK_NOTIFICATION_DESCRIPTION", values), level=Notification.LEVEL_INFO,
         flags=Notification.FLAG_VOLATILE|Notification.FLAG_BUBBLE|Notification.FLAG_DISCARD_ON_TRIGGER|Notification.FLAG_REMOVE_ON_DISCARD)
开发者ID:cbsistem,项目名称:nuxeo-drive,代码行数:9,代码来源:notification.py

示例3: _direct_edit_conflict

# 需要导入模块: from nxdrive.wui.translator import Translator [as 别名]
# 或者: from nxdrive.wui.translator.Translator import get [as 别名]
 def _direct_edit_conflict(self, filename, ref, digest):
     log.trace('Entering _direct_edit_conflict for %r / %r', filename, ref)
     try:
         filename = unicode(filename)
         if filename in self._conflicts_modals:
             log.trace('Filename already in _conflicts_modals: %r', filename)
             return
         log.trace('Putting filename in _conflicts_modals: %r', filename)
         self._conflicts_modals[filename] = True
         info = dict(name=filename)
         dlg = WebModal(
             self,
             Translator.get('DIRECT_EDIT_CONFLICT_MESSAGE', info),
         )
         dlg.add_button('OVERWRITE',
                        Translator.get('DIRECT_EDIT_CONFLICT_OVERWRITE'))
         dlg.add_button('CANCEL',
                        Translator.get('DIRECT_EDIT_CONFLICT_CANCEL'))
         res = dlg.exec_()
         if res == 'OVERWRITE':
             self.manager.direct_edit.force_update(unicode(ref),
                                                   unicode(digest))
         del self._conflicts_modals[filename]
     except:
         log.exception('Error while displaying Direct Edit'
                       ' conflict modal dialog for %r', filename)
开发者ID:ssdi-drive,项目名称:nuxeo-drive,代码行数:28,代码来源:application.py

示例4: menu_right

# 需要导入模块: from nxdrive.wui.translator import Translator [as 别名]
# 或者: from nxdrive.wui.translator.Translator import get [as 别名]
    def menu_right(self):
        """
        Create the context menu.
        It shows up on left click.

        Note: icons will not be displayed on every GNU/Linux
        distributions, it depends on the graphical environment.
        """

        if not self.__menu_right:
            style = QApplication.style()
            menu = QMenu()
            menu.addAction(
                style.standardIcon(QStyle.SP_FileDialogInfoView),
                Translator.get('SETTINGS'),
                self.application.show_settings,
            )
            menu.addSeparator()
            menu.addAction(
                style.standardIcon(QStyle.SP_MessageBoxQuestion),
                Translator.get('HELP'),
                self.application.open_help)
            menu.addSeparator()
            menu.addAction(
                style.standardIcon(QStyle.SP_DialogCloseButton),
                Translator.get('QUIT'),
                self.application.quit)
            self.__menu_right = menu

        return self.__menu_right
开发者ID:ssdi-drive,项目名称:nuxeo-drive,代码行数:32,代码来源:systray.py

示例5: testLoadFile

# 需要导入模块: from nxdrive.wui.translator import Translator [as 别名]
# 或者: from nxdrive.wui.translator.Translator import get [as 别名]
 def testLoadFile(self):
     manager = MockManager()
     Translator(manager, self.getFolder('i18n.js'))
     # Verify the call to save
     self.assertTrue(manager.called)
     self.assertEqual("en", Translator.locale())
     manager.called = False
     # Change to an existing language
     Translator.set("fr")
     self.assertTrue(manager.called)
     self.assertEqual("fr", Translator.locale())
     # Test unkown key
     self.assertEqual("BOUZOUF", Translator.get("BOUZOUF"))
     # Test fallback
     self.assertEqual("Fallback", Translator.get("FALLBACK"))
     manager.called = False
     # Try to switch to bad language
     self.assertRaises(Exception, Translator.set, "de")
     self.assertEqual("fr", Translator.locale())
     self.assertFalse(manager.called)
     self.assertRaises(Exception, Translator.set, "es")
     self.assertEqual("fr", Translator.locale())
     # Nothing should be saved
     self.assertFalse(manager.called)
     # Go back to an existing one
     Translator.set("en")
     self.assertTrue(manager.called)
     self.assertEqual("en", Translator.locale())
     self.assertEqual("BOUZOUF", Translator.get("BOUZOUF"))
开发者ID:Bindupriya,项目名称:nuxeo-drive,代码行数:31,代码来源:test_translator.py

示例6: _update_notification

# 需要导入模块: from nxdrive.wui.translator import Translator [as 别名]
# 或者: from nxdrive.wui.translator.Translator import get [as 别名]
 def _update_notification(self):
     replacements = dict()
     replacements["version"] = self.manager.get_updater().get_status()[1]
     notification = Notification(uuid="AutoUpdate",
                                 flags=Notification.FLAG_BUBBLE|Notification.FLAG_VOLATILE|Notification.FLAG_UNIQUE,
                                 title=Translator.get("AUTOUPDATE_NOTIFICATION_TITLE", replacements),
                                 description=Translator.get("AUTOUPDATE_NOTIFICATION_MESSAGE", replacements))
     self.manager.get_notification_service().send_notification(notification)
开发者ID:arameshkumar,项目名称:base-nuxeo-drive,代码行数:10,代码来源:application.py

示例7: __init__

# 需要导入模块: from nxdrive.wui.translator import Translator [as 别名]
# 或者: from nxdrive.wui.translator.Translator import get [as 别名]
 def __init__(self, engine_uid, filename):
     values = dict()
     values["name"] = filename
     title = Translator.get("DELETE_READONLY", values)
     description = Translator.get("DELETE_READONLY_DOCUMENT", values)
     super(DeleteReadOnlyNotification, self).__init__("DELETE_READONLY", title=title, description=description,
                                                      engine_uid=engine_uid, level=Notification.LEVEL_INFO,
                                                      flags=Notification.FLAG_VOLATILE|Notification.FLAG_BUBBLE|Notification.FLAG_DISCARD_ON_TRIGGER|Notification.FLAG_REMOVE_ON_DISCARD)
开发者ID:hendrix513,项目名称:nuxeo-drive,代码行数:10,代码来源:notification.py

示例8: testLoadExistingLanguage

# 需要导入模块: from nxdrive.wui.translator import Translator [as 别名]
# 或者: from nxdrive.wui.translator.Translator import get [as 别名]
 def testLoadExistingLanguage(self):
     Translator(MockManager(),  self.getFolder('i18n.js'), "fr")
     # Should not fallback on en
     self.assertEqual("fr", Translator.locale())
     # Test the key fallback
     self.assertEqual("Fallback", Translator.get("FALLBACK"))
     self.assertEqual(u"Fran\xe7ais", Translator.get("LANGUAGE"))
     self.assertEqual("BOUZOUF", Translator.get("BOUZOUF"))
开发者ID:Bindupriya,项目名称:nuxeo-drive,代码行数:10,代码来源:test_translator.py

示例9: __init__

# 需要导入模块: from nxdrive.wui.translator import Translator [as 别名]
# 或者: from nxdrive.wui.translator.Translator import get [as 别名]
 def __init__(self, engine_uid, doc_pair):
     values = dict()
     values["name"] = doc_pair.local_name
     title = Translator.get("CONFLICT", values)
     description = Translator.get("CONFLICT_ON_FILE", values)
     super(ConflictNotification, self).__init__("CONFLICT_FILE", title=title, description=description,
         engine_uid=engine_uid, level=Notification.LEVEL_WARNING,
         flags=Notification.FLAG_VOLATILE|Notification.FLAG_ACTIONABLE|Notification.FLAG_BUBBLE|Notification.FLAG_PERSISTENT|Notification.FLAG_DISCARD_ON_TRIGGER|Notification.FLAG_REMOVE_ON_DISCARD,
         action="drive.showConflicts();")
开发者ID:jlumsla,项目名称:nuxeo-drive,代码行数:11,代码来源:notification.py

示例10: create_debug_menu

# 需要导入模块: from nxdrive.wui.translator import Translator [as 别名]
# 或者: from nxdrive.wui.translator.Translator import get [as 别名]
 def create_debug_menu(self, parent):
     menuDebug = QtGui.QMenu(parent)
     menuDebug.addAction(Translator.get("DEBUG_WINDOW"), self.show_debug_window)
     menuDebug.addAction(Translator.get("DEBUG_SYSTRAY_MESSAGE"), self._debug_show_message)
     for engine in self.manager.get_engines().values():
         action = QtGui.QAction(engine._name, menuDebug)
         action.setMenu(self._create_debug_engine_menu(engine, menuDebug))
         action.setData(engine)
         menuDebug.addAction(action)
     return menuDebug
开发者ID:Bindupriya,项目名称:nuxeo-drive,代码行数:12,代码来源:application.py

示例11: _update_notification

# 需要导入模块: from nxdrive.wui.translator import Translator [as 别名]
# 或者: from nxdrive.wui.translator.Translator import get [as 别名]
 def _update_notification(self):
     replacements = dict(version=self.manager.get_updater().get_status()[1])
     notification = Notification(
         uuid='AutoUpdate',
         flags=(Notification.FLAG_BUBBLE
                | Notification.FLAG_VOLATILE
                | Notification.FLAG_UNIQUE),
         title=Translator.get('AUTOUPDATE_NOTIFICATION_TITLE', replacements),
         description=Translator.get('AUTOUPDATE_NOTIFICATION_MESSAGE',
                                    replacements),
     )
     self.manager.notification_service.send_notification(notification)
开发者ID:ssdi-drive,项目名称:nuxeo-drive,代码行数:14,代码来源:application.py

示例12: _create_debug_engine_menu

# 需要导入模块: from nxdrive.wui.translator import Translator [as 别名]
# 或者: from nxdrive.wui.translator.Translator import get [as 别名]
 def _create_debug_engine_menu(self, engine, parent):
     menuDebug = QtGui.QMenu(parent)
     action = QtGui.QAction(Translator.get("DEBUG_INVALID_CREDENTIALS"), menuDebug)
     action.setCheckable(True)
     action.setChecked(engine.has_invalid_credentials())
     action.setData(engine)
     action.triggered.connect(self._debug_toggle_invalid_credentials)
     menuDebug.addAction(action)
     action = QtGui.QAction(Translator.get("DEBUG_FILE_STATUS"), menuDebug)
     action.setData(engine)
     action.triggered.connect(self._debug_show_file_status)
     menuDebug.addAction(action)
     return menuDebug
开发者ID:bdineshssdi,项目名称:nuxeo-drive,代码行数:15,代码来源:application.py

示例13: _direct_edit_conflict

# 需要导入模块: from nxdrive.wui.translator import Translator [as 别名]
# 或者: from nxdrive.wui.translator.Translator import get [as 别名]
 def _direct_edit_conflict(self, filename, ref, digest):
     filename = unicode(filename)
     if filename in self._conflicts_modals:
         return
     self._conflicts_modals[filename] = True
     info = dict()
     info["name"] = filename
     dlg = WebModal(self, Translator.get("DIRECT_EDIT_CONFLICT_MESSAGE", info))
     dlg.add_button("OVERWRITE", Translator.get("DIRECT_EDIT_CONFLICT_OVERWRITE"))
     dlg.add_button("CANCEL", Translator.get("DIRECT_EDIT_CONFLICT_CANCEL"))
     res = dlg.exec_()
     if res == "OVERWRITE":
         self.manager.get_drive_edit().force_update(unicode(ref), unicode(digest))
     del self._conflicts_modals
开发者ID:mohgly,项目名称:nuxeo-drive,代码行数:16,代码来源:application.py

示例14: _root_deleted

# 需要导入模块: from nxdrive.wui.translator import Translator [as 别名]
# 或者: from nxdrive.wui.translator.Translator import get [as 别名]
 def _root_deleted(self):
     engine = self.sender()
     info = dict()
     log.debug("Root has been deleted for engine: %s", engine.get_uid())
     info["folder"] = engine.get_local_folder()
     dlg = WebModal(self, Translator.get("DRIVE_ROOT_DELETED", info))
     dlg.add_button("RECREATE", Translator.get("DRIVE_ROOT_RECREATE"), style="primary")
     dlg.add_button("DISCONNECT", Translator.get("DRIVE_ROOT_DISCONNECT"), style="danger")
     res = dlg.exec_()
     if res == "DISCONNECT":
         self.manager.unbind_engine(engine.get_uid())
     elif res == "RECREATE":
         engine.reinit()
         engine.start()
开发者ID:cbsistem,项目名称:nuxeo-drive,代码行数:16,代码来源:application.py

示例15: __init__

# 需要导入模块: from nxdrive.wui.translator import Translator [as 别名]
# 或者: from nxdrive.wui.translator.Translator import get [as 别名]
 def __init__(self, filename):
     values = dict()
     values["name"] = filename
     title = Translator.get("READONLY", values)
     description = Translator.get("DIRECT_EDIT_READONLY_FILE", values)
     super(DirectEditReadOnlyNotification, self).__init__(
         "DIRECT_EDIT_READONLY",
         title=title,
         description=description,
         level=Notification.LEVEL_WARNING,
         flags=Notification.FLAG_VOLATILE
         | Notification.FLAG_BUBBLE
         | Notification.FLAG_DISCARD_ON_TRIGGER
         | Notification.FLAG_REMOVE_ON_DISCARD,
     )
开发者ID:arameshkumar,项目名称:base-nuxeo-drive,代码行数:17,代码来源:notification.py


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