本文整理汇总了Python中zoundry.appframework.global_services.getApplicationModel函数的典型用法代码示例。如果您正苦于以下问题:Python getApplicationModel函数的具体用法?Python getApplicationModel怎么用?Python getApplicationModel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getApplicationModel函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, parent, tabInfo, selected = False):
self.parent = parent
self.tabInfo = tabInfo
self.selected = selected
self.firstTab = False
self.wingmanTab = False
self.hovering = False # is the user hovering the mouse over the control
self.clicking = False # is the user clicking the control
self.middleClicking = False # is the user middle-clicking the control
self.borderColor = TAB_BORDER_INNER_COLOR
self.selBGColorStart = wx.Color(157, 185, 235)
self.selBGColorEnd = wx.Color(157, 185, 235)
wx.Panel.__init__(self, parent, wx.ID_ANY)
self.preferredWidth = self._calculatePreferredWidth()
self.SetFont(getDefaultFont())
self.closeButtonBitmap = getApplicationModel().getResourceRegistry().getBitmap(u"images/widgets/tabcontainer/close.png") #$NON-NLS-1$
self.closeHoverButtonBitmap = getApplicationModel().getResourceRegistry().getBitmap(u"images/widgets/tabcontainer/close.png") #$NON-NLS-1$
self.SetSize(wx.Size(self.preferredWidth, -1))
self.Bind(wx.EVT_PAINT, self.onPaint, self)
self.Bind(wx.EVT_ERASE_BACKGROUND, self.onEraseBackground, self)
self.Bind(wx.EVT_ENTER_WINDOW, self.onEnter, self)
self.Bind(wx.EVT_LEAVE_WINDOW, self.onLeave, self)
self.Bind(wx.EVT_LEFT_DOWN, self.onLeftClickDown, self)
self.Bind(wx.EVT_LEFT_UP, self.onLeftClickUp, self)
self.Bind(wx.EVT_MIDDLE_DOWN, self.onMiddleClickDown, self)
self.Bind(wx.EVT_MIDDLE_UP, self.onMiddleClickUp, self)
self.Bind(wx.EVT_RIGHT_UP, self.onRightClick, self)
# FIXME (EPW) show the tooltip string only if the title is truncated
self.SetToolTipString(self.tabInfo.getTitle())
示例2: initializeAspellDirectory
def initializeAspellDirectory(self):
spellingDir = getApplicationModel().getUserProfile().getDirectory(u"spellcheck") #$NON-NLS-1$
aspellDir = os.path.join(spellingDir, u"aspell") #$NON-NLS-1$
keyFilePath = os.path.join(aspellDir, u"data", u"ASCII.dat") #$NON-NLS-2$ #$NON-NLS-1$
if not os.path.isfile(keyFilePath):
aspellBaseZip = getApplicationModel().getResourceRegistry().getResourcePath(u"spellcheck/aspell/aspell-base.zip") #$NON-NLS-1$
unpackZip(aspellBaseZip, aspellDir)
示例3: _loadStringFromFile
def _loadStringFromFile(self, html):
# MSHTML control requires a <head> and <title> element
title = getNoneString( extractTitle(html) )
if not title or html.find(u"<html") == -1: #$NON-NLS-1$
# case where only the body content is given or the content did not have non-empty <head> and <title> elems.
# try and create wrapper around the body. Eg: <html><head><title>ZoundryDocument</title></head><body> CONTENT </body> </html>
html = wrapHtmlBody(html, u"ZoundryDocument") #$NON-NLS-1$
# note: \r\n must be replace with \n. Otherwise, in <pre> blocks, the \r' will show up as an extra line.
html = html.replace(u"\r\n", u"\n") #$NON-NLS-1$ #$NON-NLS-2$
# For the test-harness to work, hard code temp dir
tmpDir = u"c:/temp" #$NON-NLS-1$
if getApplicationModel():
userProfile = getApplicationModel().getUserProfile()
tmpDir = userProfile.getTempDirectory()
d = str(time.time())
fname = os.path.join(tmpDir, u"_z_raven_mshtml_%s_tmp.xhtml" % d) #$NON-NLS-1$
tmpFile = codecs.open(fname, u"w") #$NON-NLS-1$
try:
# write the utf-8 byte order marker for wintel platforms.
tmpFile.write(codecs.BOM_UTF8)
tmpFile.write( convertToUtf8(html) )
tmpFile.close()
self._loadFile(fname)
finally:
tmpFile.close()
示例4: _saveTreeLayout
def _saveTreeLayout(self):
visitor = ZTreeLayoutSaveVisitor()
self.treeView.accept(visitor)
self._saveTreeSelection()
# Save the properties
getApplicationModel().getUserProfile().getProperties().save()
示例5: _run
def _run(self):
publisherService = getApplicationModel().getService(IZBlogAppServiceIDs.PUBLISHING_SERVICE_ID)
dataStoreService = getApplicationModel().getService(IZBlogAppServiceIDs.DATA_STORE_SERVICE_ID)
publisher = None
self.commands = []
if self.blogs:
for blog in self.blogs:
account = blog.getAccount()
publisher = createBlogPublisherFromAccount(account, publisherService)
command = ZDeleteEntryCommand(publisher, dataStoreService, account, blog, self.document, False)
command.addListener( self )
self.commands.append(command)
else:
command = ZDeleteEntryCommand(None, dataStoreService, None, None, self.document, True)
command.addListener( self )
self.commands.append(command)
if self.deleteLocal and self.commands:
self.commands[len(self.commands) - 1].setDeleteLocalEntry(True)
# Now run all of the commands.
for command in self.commands:
self.currentCommand = command
if self.isCancelled():
return
else:
self.currentCommand.doCommand()
示例6: __init__
def __init__(self):
systemProfile = getApplicationModel().getSystemProfile()
self.bundleDirectory = systemProfile.getBundleDirectory()
self.i18nService = getApplicationModel().getService(IZBlogAppServiceIDs.I18N_SERVICE_ID)
self.defaultTranslation = self._loadDefaultTranslation(self.bundleDirectory)
self.defaultTranslation.load()
self.translations = self._loadTranslations(self.bundleDirectory)
示例7: updateCategories
def updateCategories(self, account, blogList, izcommandActivityListener):
accStoreService = getApplicationModel().getService(IZBlogAppServiceIDs.ACCOUNT_STORE_SERVICE_ID)
publisherService = getApplicationModel().getService(IZBlogAppServiceIDs.PUBLISHING_SERVICE_ID)
publisher = createBlogPublisherFromAccount(account, publisherService)
blogList = self._getFilteredAccBlogList(account, blogList)
cmd = ZListCategoriesCommand(publisher, account, blogList)
cmd.addListener(izcommandActivityListener)
cmd.doCommand()
accStoreService.saveAccount(account)
示例8: _registerAsListener
def _registerAsListener(self):
# Register as a data store listener
service = getApplicationModel().getService(IZBlogAppServiceIDs.DATA_STORE_SERVICE_ID)
service.addListener(self)
# Register as a user prefs listener
appModel = getApplicationModel()
userProfile = appModel.getUserProfile()
userPrefs = userProfile.getPreferences()
userPrefs.addListener(self)
示例9: downloadPosts
def downloadPosts(self, account, blogList, maxDocs, izcommandActivityListener):
docIndexService = getApplicationModel().getService(IZBlogAppServiceIDs.DOCUMENT_INDEX_SERVICE_ID)
publisherService = getApplicationModel().getService(IZBlogAppServiceIDs.PUBLISHING_SERVICE_ID)
dataStoreService = getApplicationModel().getService(IZBlogAppServiceIDs.DATA_STORE_SERVICE_ID)
publisher = createBlogPublisherFromAccount(account, publisherService)
blogList = self._getFilteredAccBlogList(account, blogList)
cmd = ZDownloadEntriesCommand(dataStoreService, docIndexService, publisher, account, blogList, maxDocs)
cmd.addListener(izcommandActivityListener)
cmd.doCommand()
示例10: createMediaStorages
def createMediaStorages(self, account, izcommandActivityListener):
accStoreService = getApplicationModel().getService(IZBlogAppServiceIDs.ACCOUNT_STORE_SERVICE_ID)
publisherService = getApplicationModel().getService(IZBlogAppServiceIDs.PUBLISHING_SERVICE_ID)
mediaStoreService = getApplicationModel().getService(IZBlogAppServiceIDs.MEDIA_STORAGE_SERVICE_ID)
# create publisher
publisher = createBlogPublisherFromAccount(account, publisherService)
cmd = ZCreateOrUpdateBlogMediaStoragesCommand(publisher, mediaStoreService, account)
cmd.addListener(izcommandActivityListener)
cmd.doCommand()
accStoreService.saveAccount(account)
示例11: _unregisterAsListener
def _unregisterAsListener(self):
# Unregister from the data store
service = getApplicationModel().getService(IZBlogAppServiceIDs.DATA_STORE_SERVICE_ID)
service.removeListener(self)
# Unregister from the user prefs object
# Register as a user prefs listener
appModel = getApplicationModel()
userProfile = appModel.getUserProfile()
userPrefs = userProfile.getPreferences()
userPrefs.removeListener(self)
示例12: __init__
def __init__(self, parent):
self.indexService = getApplicationModel().getService(IZBlogAppServiceIDs.DOCUMENT_INDEX_SERVICE_ID)
self.accountStore = getApplicationModel().getService(IZBlogAppServiceIDs.ACCOUNT_STORE_SERVICE_ID)
self.model = ZContextInfoTagsModel(ZTagSearchFilter())
self.tagCloudsView = None
self.searchTextBox = None
ZBoxedView.__init__(self, parent)
self._registerAsIndexListener()
示例13: _createCommand
def _createCommand(self, account, blog, pubMetaData):
publisherService = getApplicationModel().getService(IZBlogAppServiceIDs.PUBLISHING_SERVICE_ID)
dataStoreService = getApplicationModel().getService(IZBlogAppServiceIDs.DATA_STORE_SERVICE_ID)
publisher = createBlogPublisherFromAccount(account, publisherService)
# create update or publish command and execute
command = None
if self.document.isPublishedToBlog( blog.getId() ):
command = ZUpdateEntryCommand(publisher, dataStoreService, account, blog, self.document, pubMetaData)
else:
command = ZPublishEntryCommand(publisher, dataStoreService, account, blog, self.document, pubMetaData)
return command
示例14: _recoverCrashSnapshots
def _recoverCrashSnapshots(self):
crashRecoveryService = getApplicationModel().getService(IZBlogAppServiceIDs.CRASH_RECOVERY_SERVICE_ID)
snapshots = crashRecoveryService.getRecoverySnapshots()
if snapshots:
title = _extstr(u"startup.RecoverTitle") #$NON-NLS-1$
msg = _extstr(u"startup.RecoverMessage") % len(snapshots) #$NON-NLS-1$
if ZShowYesNoMessage(getApplicationModel().getTopWindow(), msg, title):
for document in snapshots:
editorWindow = getEditorWindow()
editorWindow.openDocument(document)
editorWindow.Show()
crashRecoveryService.clearRecoverySnapshot()
示例15: updateBlogList
def updateBlogList(self, account, selectedBlogList, izcommandActivityListener): #@UnusedVariable
accStoreService = getApplicationModel().getService(IZBlogAppServiceIDs.ACCOUNT_STORE_SERVICE_ID)
publisherService = getApplicationModel().getService(IZBlogAppServiceIDs.PUBLISHING_SERVICE_ID)
# create publisher
publisher = createBlogPublisherFromAccount(account, publisherService)
# update account's blog list from server
cmd = ZListBlogsCommand(publisher, account, selectedBlogList)
cmd.addListener(izcommandActivityListener)
cmd.listBlogs();
# save account with the new blog lists.
accStoreService.saveAccount(account)