Exemplo n.º 1
0
    def onRefresh(self, event):
        showError = False
        isDetached = False
        isDetaching = False
        
        self.mutex.acquire()
        try:
            # Refresh the UI
            self.refresh()
            
            isDetached = self.model.isDetached()
            isDetaching = self.model.isDetaching()
        finally:
            self.mutex.release()

        # If we have successfully detached, close the dialog
        if isDetached:
            showError = self._doEndModal(wx.ID_OK)
        # Should we detach from the listener and start closing down?
        elif isDetaching:
            self.bgTask.detachListener(self)
            self.model.setDetached()
            fireRefreshEvent(self)

        # If there was an error - show it.
        if showError:
            (msg, details) = self.bgTask.getError()
            method = ZShowErrorMessage
            args = [None, msg, details]
            runnable = ZMethodRunnable(method, args)
            fireUIExecEvent(runnable, self.GetParent())

        event.Skip()
Exemplo n.º 2
0
    def __init__(self):
        self.perspectives = self._loadPerspectives()
        self.perspectiveId = self._getStartupPerspective()
        self.perspective = self._createPerspective(self.perspectiveId)
        self.startupActions = self._loadStartupActions()
        self.shutdownActions = self._loadShutdownActions()
        self.iconBundle = getResourceRegistry().getIconBundle(ICON_IMAGES)
        self.trayIconPrefs = ZRavenTrayIconPrefsAccessor()
        self.trayIcon = None

        size = self._getWindowSize()
        pos = self._getWindowPos()
        ZBaseWindow.__init__(self, None, u"Zoundry Raven", size = size, pos = pos) #$NON-NLS-1$

        userPrefs = getApplicationModel().getUserProfile().getPreferences()
        isMax = userPrefs.getUserPreferenceBool(IZBlogAppUserPrefsKeys.APPWIN_MAXIMIZED, False)
        if isMax:
            self.Maximize()

        self.SetIcons(self.iconBundle)
        self.Show(True)

        self._createTrayIcon()
        if self.trayIconPrefs.isAlwaysShowTrayIcon():
            self._showTrayIcon()

        self._registerAsSingletonListener()
        self._doCmdLineBlogThis()

        fireUIExecEvent(ZStartupActionRunner(self), self)
Exemplo n.º 3
0
    def __init__(self, rvalMap, model, systemProfile):
        self.rvalMap = rvalMap
        self.model = model
        self.systemProfile = systemProfile
        self.selectedIndex = -1
        self.importMenuModel = self._createImportMenuModel()
        title = _extstr(u"manager.WindowTitle") #$NON-NLS-1$
        portable = _extstr(u"manager.Portable") #$NON-NLS-1$
        if isPortableEnabled():
            title = u"%s (%s)" % (title, portable) #$NON-NLS-1$

        wx.Frame.__init__(self, None, wx.ID_ANY, title, size=wx.Size(400, 325),
                          style = wx.DEFAULT_FRAME_STYLE)
        self._createWidgets()
        self._populateWidgets()
        self._layoutWidgets()
        self._bindWidgetEvents()
        self.CentreOnScreen()
        self.SetIcons(getResourceRegistry().getIconBundle(ICON_IMAGES))
        self.Show(True)

        # Auto-select the 'default' profile.
        defaultName = self.model.getDefaultProfileName()
        if defaultName:
            self.profilesListView.Select(self._getProfileIndex(defaultName), True)

        # Now set focus on the profileListView
        self.profilesListView.SetFocus()

        # Fire a UI exec event - detect ZBW or WLW on startup
        fireUIExecEvent(ZMethodRunnable(self.onDetectImport), self)
Exemplo n.º 4
0
    def __init__(self):
        self.perspectives = self._loadPerspectives()
        self.perspectiveId = self._getStartupPerspective()
        self.perspective = self._createPerspective(self.perspectiveId)
        self.startupActions = self._loadStartupActions()
        self.shutdownActions = self._loadShutdownActions()
        self.iconBundle = getResourceRegistry().getIconBundle(ICON_IMAGES)
        self.trayIconPrefs = ZRavenTrayIconPrefsAccessor()
        self.trayIcon = None

        size = self._getWindowSize()
        pos = self._getWindowPos()
        ZBaseWindow.__init__(self, None, u"Zoundry Raven", size=size,
                             pos=pos)  #$NON-NLS-1$

        userPrefs = getApplicationModel().getUserProfile().getPreferences()
        isMax = userPrefs.getUserPreferenceBool(
            IZBlogAppUserPrefsKeys.APPWIN_MAXIMIZED, False)
        if isMax:
            self.Maximize()

        self.SetIcons(self.iconBundle)
        self.Show(True)

        self._createTrayIcon()
        if self.trayIconPrefs.isAlwaysShowTrayIcon():
            self._showTrayIcon()

        self._registerAsSingletonListener()
        self._doCmdLineBlogThis()

        fireUIExecEvent(ZStartupActionRunner(self), self)
Exemplo n.º 5
0
 def runAction(self, actionContext):
     class ZActionRunner(IZRunnable):
         def __init__(self, action, context):
             self.action = action
             self.context = context
         def run(self):
             self.action.runAction(self.context)
     runner = ZActionRunner(self.delegateAction, actionContext)
     fireUIExecEvent(runner, actionContext.getParentWindow())
Exemplo n.º 6
0
 def onUiCancel(self, event): #@UnusedVariable
     self.mutex.acquire()
     try:
         self.model.setCanceling(True)
         self.model.setDetaching()
         fireRefreshEvent(self)
         fireUIExecEvent(ZMethodRunnable(self._cancelBackgroundTask), self)
     finally:
         self.mutex.release()
Exemplo n.º 7
0
    def rasEnd(self):
        class ZRASEnd(IZRunnable):
            def __init__(self, ref):
                self.ref = ref
            def run(self):
                self.ref.Close()
                self.ref.Refresh()
        # end ZRASEnd

        # Queue some work to be done on the UI thread.
        fireUIExecEvent(ZRASEnd(self), self)
Exemplo n.º 8
0
    def rasSubTaskStart(self, subTaskName):
        class ZRASSubTaskStart(IZRunnable):
            def __init__(self, ref):
                self.ref = ref
            def run(self):
                self.ref.labelTwo.SetLabel(_extstr(u"splash.CurrentProgress2") % subTaskName) #$NON-NLS-1$
                self.ref.labelTwo.Refresh()
        # end ZRASSubTaskStart

        # Queue some work to be done on the UI thread.
        fireUIExecEvent(ZRASSubTaskStart(self), self)
Exemplo n.º 9
0
    def runAction(self, actionContext):
        class ZActionRunner(IZRunnable):
            def __init__(self, action, context):
                self.action = action
                self.context = context

            def run(self):
                self.action.runAction(self.context)

        runner = ZActionRunner(self.delegateAction, actionContext)
        fireUIExecEvent(runner, actionContext.getParentWindow())
Exemplo n.º 10
0
 def onRemoveInfoWidget(self, event):
     widget = event.getInfoWidget()
     try:
         index = self.infoWidgets.index(widget)
         self.Unbind(ZEVT_DEL_BLOGINFO_WIDGET, widget)
         widget.Show(False)
         self.RemoveChild(widget)
         runnable = ZRemoveBlogInfoRunnable(self, index)
         fireUIExecEvent(runnable, self)
     except:
         pass
Exemplo n.º 11
0
 def onDocumentChanged(self, document, metaDataOnly):
     if document.getId() == self.getDocumentId():
         if metaDataOnly:
             modelDoc = self.getDocument()
             modelDoc.setBlogInfoList(document.getBlogInfoList())
             self._fireUpdateMenu()
         elif not self.isDirty():
             self.model.setDocument(document)
             fireUIExecEvent(ZMethodRunnable(self._refreshContentEditorUI), self)
         else:
             # FIXME (EPW) Editor is dirty, but content changes were made by someone else - prompt the user for what to do
             pass
Exemplo n.º 12
0
    def rasEnd(self):
        class ZRASEnd(IZRunnable):
            def __init__(self, ref):
                self.ref = ref

            def run(self):
                self.ref.Close()
                self.ref.Refresh()

        # end ZRASEnd

        # Queue some work to be done on the UI thread.
        fireUIExecEvent(ZRASEnd(self), self)
Exemplo n.º 13
0
 def onBlogThis(self, blogThisData):
     class ZBlogThisRunner(IZRunnable):
         def __init__(self, blogThisInfo):
             self.blogThisInfo = blogThisInfo
         def run(self):
             blogThisContentHandler= ZBlogThisHandler( blogThisData )
             doc = blogThisContentHandler.createBlogDocument()
             editorWindow = getEditorWindow()
             editorWindow.openDocument(doc)
             editorWindow.Show(True)
             editorWindow.Raise()
     runner = ZBlogThisRunner(blogThisData)
     fireUIExecEvent(runner, self)
Exemplo n.º 14
0
    def rasTaskEnd(self):
        class ZRASTaskEnd(IZRunnable):
            def __init__(self, ref):
                self.ref = ref
            def run(self):
                self.ref.taskNum += 1
                self.ref.labelOne.SetLabel(_extstr(u"splash.Complete")) #$NON-NLS-1$
                self.ref.labelOne.Refresh()
                self.ref.progressOne.SetValue(self.ref.taskNum)
                self.ref.progressOne.Refresh()
        # end ZRASTaskEnd

        # Queue some work to be done on the UI thread.
        fireUIExecEvent(ZRASTaskEnd(self), self)
Exemplo n.º 15
0
    def rasStart(self, totalTasks):
        class ZRASStart(IZRunnable):
            def __init__(self, ref):
                self.ref = ref
            def run(self):
                self.ref.taskNum = 0
                self.ref.progressOne.SetRange(totalTasks)
                self.ref.progressOne.SetValue(0)
                self.ref.progressOne.Refresh()
                self.ref.progressTwo.SetValue(0)
                self.ref.progressTwo.Refresh()
        # end ZRASStart

        # Queue some work to be done on the UI thread.
        fireUIExecEvent(ZRASStart(self), self)
Exemplo n.º 16
0
 def visit(self, node, metaData):
     if node.hashCode() == self.hashValue:
         treeItemId = metaData[u"id"] #$NON-NLS-1$
         self.navView.treeView.SelectItem(treeItemId, True)
         self.navView.treeView.SetFocus()
         selection = self.navView._getCurrentSelection()
         if selection:
             class ZFireViewSelectionDelayed(IZRunnable):
                 def __init__(self, navView, selection):
                     self.navView = navView
                     self.selection = selection
                 def run(self):
                     fireViewSelectionEvent(selection, self.navView)
             runnable = ZFireViewSelectionDelayed(self.navView, selection)
             fireUIExecEvent(runnable, self.navView)
Exemplo n.º 17
0
    def rasSubTaskStart(self, subTaskName):
        class ZRASSubTaskStart(IZRunnable):
            def __init__(self, ref):
                self.ref = ref

            def run(self):
                self.ref.labelTwo.SetLabel(
                    _extstr(u"splash.CurrentProgress2") %
                    subTaskName)  #$NON-NLS-1$
                self.ref.labelTwo.Refresh()

        # end ZRASSubTaskStart

        # Queue some work to be done on the UI thread.
        fireUIExecEvent(ZRASSubTaskStart(self), self)
Exemplo n.º 18
0
    def _doCheckForUpdate(self, onlyPromptWhenNewVersionIsAvailable = True):
        appModel = getApplicationModel()
        appVersion = appModel.getVersion()
        latestVersion = self.getLatestVersionInfo()

        if latestVersion and appVersion.getBuild() < latestVersion.getBuild():
            currVer = appVersion.getFullVersionString()
            latestVer = latestVersion.getFullVersionString()
            msg = _extstr(u"autoupdateimpl.NewVersionMessage") % (currVer, latestVer) #$NON-NLS-1$
            title = _extstr(u"autoupdateimpl.NewVersionAvailable") #$NON-NLS-1$
            fireUIExecEvent(ZAutoUpdateMessageRunner(title, msg, False), appModel.getTopWindow())
        elif not onlyPromptWhenNewVersionIsAvailable:
            msg = _extstr(u"autoupdateimpl.AlreadyUpToDateMsg") #$NON-NLS-1$
            title = _extstr(u"autoupdateimpl.AlreadyUpToDateTitle") #$NON-NLS-1$
            fireUIExecEvent(ZAutoUpdateMessageRunner(title, msg, True), appModel.getTopWindow())
Exemplo n.º 19
0
    def onBlogThis(self, blogThisData):
        class ZBlogThisRunner(IZRunnable):
            def __init__(self, blogThisInfo):
                self.blogThisInfo = blogThisInfo

            def run(self):
                blogThisContentHandler = ZBlogThisHandler(blogThisData)
                doc = blogThisContentHandler.createBlogDocument()
                editorWindow = getEditorWindow()
                editorWindow.openDocument(doc)
                editorWindow.Show(True)
                editorWindow.Raise()

        runner = ZBlogThisRunner(blogThisData)
        fireUIExecEvent(runner, self)
Exemplo n.º 20
0
    def rasTaskStart(self, taskName, totalSubTasks):
        class ZRASTaskStart(IZRunnable):
            def __init__(self, ref):
                self.ref = ref
            def run(self):
                self.ref.subtaskNum = 0
                self.ref.labelOne.SetLabel(_extstr(u"splash.OverallProgress2") % taskName) #$NON-NLS-1$
                self.ref.labelOne.Refresh()
                self.ref.progressTwo.SetRange(totalSubTasks)
                self.ref.progressTwo.SetValue(0)
                self.ref.progressTwo.Refresh()
            # end run()
        # end ZRASTaskStart

        # Queue some work to be done on the UI thread.
        fireUIExecEvent(ZRASTaskStart(self), self)
Exemplo n.º 21
0
    def __init__(self, parent, findReplaceModel):
        self.findReplaceModel = findReplaceModel
        ZBaseDialog.__init__(
            self,
            parent,
            wx.ID_ANY,
            _extstr(u"findreplacedialog.DialogTitle"),
            style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER,
            name=u"ZSpellCheckDialog")  #$NON-NLS-1$ #$NON-NLS-2$
        ZPersistentDialogMixin.__init__(
            self, IZBlogAppUserPrefsKeys.FIND_REPLACE_DIALOG, True, True)

        if getNoneString(self.findReplaceModel.getFindText()) is not None:
            # since there is a search term preselected, initiate the find process.
            runnable = ZMethodRunnable(self._doFindNext)
            fireUIExecEvent(runnable, self)
Exemplo n.º 22
0
    def __init__(self, parent, findReplaceModel):
        self.findReplaceModel = findReplaceModel
        ZBaseDialog.__init__(
            self,
            parent,
            wx.ID_ANY,
            _extstr(u"findreplacedialog.DialogTitle"),
            style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER,
            name=u"ZSpellCheckDialog",
        )  # $NON-NLS-1$ #$NON-NLS-2$
        ZPersistentDialogMixin.__init__(self, IZBlogAppUserPrefsKeys.FIND_REPLACE_DIALOG, True, True)

        if getNoneString(self.findReplaceModel.getFindText()) is not None:
            # since there is a search term preselected, initiate the find process.
            runnable = ZMethodRunnable(self._doFindNext)
            fireUIExecEvent(runnable, self)
Exemplo n.º 23
0
    def rasTaskEnd(self):
        class ZRASTaskEnd(IZRunnable):
            def __init__(self, ref):
                self.ref = ref

            def run(self):
                self.ref.taskNum += 1
                self.ref.labelOne.SetLabel(
                    _extstr(u"splash.Complete"))  #$NON-NLS-1$
                self.ref.labelOne.Refresh()
                self.ref.progressOne.SetValue(self.ref.taskNum)
                self.ref.progressOne.Refresh()

        # end ZRASTaskEnd

        # Queue some work to be done on the UI thread.
        fireUIExecEvent(ZRASTaskEnd(self), self)
Exemplo n.º 24
0
    def rasStart(self, totalTasks):
        class ZRASStart(IZRunnable):
            def __init__(self, ref):
                self.ref = ref

            def run(self):
                self.ref.taskNum = 0
                self.ref.progressOne.SetRange(totalTasks)
                self.ref.progressOne.SetValue(0)
                self.ref.progressOne.Refresh()
                self.ref.progressTwo.SetValue(0)
                self.ref.progressTwo.Refresh()

        # end ZRASStart

        # Queue some work to be done on the UI thread.
        fireUIExecEvent(ZRASStart(self), self)
Exemplo n.º 25
0
    def rasTaskStart(self, taskName, totalSubTasks):
        class ZRASTaskStart(IZRunnable):
            def __init__(self, ref):
                self.ref = ref

            def run(self):
                self.ref.subtaskNum = 0
                self.ref.labelOne.SetLabel(
                    _extstr(u"splash.OverallProgress2") %
                    taskName)  #$NON-NLS-1$
                self.ref.labelOne.Refresh()
                self.ref.progressTwo.SetRange(totalSubTasks)
                self.ref.progressTwo.SetValue(0)
                self.ref.progressTwo.Refresh()

            # end run()

        # end ZRASTaskStart

        # Queue some work to be done on the UI thread.
        fireUIExecEvent(ZRASTaskStart(self), self)
Exemplo n.º 26
0
 def runAction(self, actionContext):  #@UnusedVariable
     if self._backgroundTasksRunning():
         ZShowBackgroundTaskManager()
     fireUIExecEvent(ZMethodRunnable(self._recoverCrashSnapshots),
                     actionContext.getWindow())
     fireUIExecEvent(ZMethodRunnable(self._deleteTempFiles),
                     actionContext.getWindow())
     fireUIExecEvent(ZMethodRunnable(self._createAccountMediaStores),
                     actionContext.getWindow())
Exemplo n.º 27
0
 def onContentDownloadStart(self, fetcher, contentLength):  #@UnusedVariable
     updater = ZInfoImageDetailsPanelUIUpdater(
         self, contentLength,
         ZInfoImageDetailsPanelUIUpdater.MODE_DOWNLOAD_START)
     fireUIExecEvent(updater, self)
Exemplo n.º 28
0
 def onConnectError(self, fetcher, error):  #@UnusedVariable
     updater = ZInfoImageDetailsPanelUIUpdater(
         self, error, ZInfoImageDetailsPanelUIUpdater.MODE_CONNECT_ERROR)
     fireUIExecEvent(updater, self)
Exemplo n.º 29
0
 def onConnect(self, fetcher, connectionRespInfo):  #@UnusedVariable
     updater = ZInfoImageDetailsPanelUIUpdater(
         self, connectionRespInfo,
         ZInfoImageDetailsPanelUIUpdater.MODE_CONNECT)
     fireUIExecEvent(updater, self)
Exemplo n.º 30
0
 def onActivate(self, event):
     if event.GetActive():
         fireUIExecEvent(ZMethodRunnable(self.onActivateStageTwo), self)
     event.Skip()
Exemplo n.º 31
0
 def runTidy(self):
     # IZXHTMLEditControl impl.
     fireUIExecEvent(ZMethodRunnable(self._internalRunTidy), self)
Exemplo n.º 32
0
 def _showViewAndRunValidation(self):
     self._showValidationView()
     fireUIExecEvent(ZMethodRunnable(self._runValidation), self)
Exemplo n.º 33
0
 def schemaValidate(self):
     # IZXHTMLEditControl impl.
     fireUIExecEvent(ZMethodRunnable(self._showViewAndRunValidation), self)
Exemplo n.º 34
0
 def onTemplateModified(self, template): #@UnusedVariable
     fireUIExecEvent(ZMethodRunnable(self.refresh), self)
Exemplo n.º 35
0
 def onConnect(self, fetcher, connectionRespInfo): #@UnusedVariable
     updater = ZInfoImageDetailsPanelUIUpdater(self, connectionRespInfo, ZInfoImageDetailsPanelUIUpdater.MODE_CONNECT)
     fireUIExecEvent(updater, self)
Exemplo n.º 36
0
 def runAction(self, actionContext): #@UnusedVariable
     if self._backgroundTasksRunning():
         ZShowBackgroundTaskManager()
     fireUIExecEvent(ZMethodRunnable(self._recoverCrashSnapshots), actionContext.getWindow())
     fireUIExecEvent(ZMethodRunnable(self._deleteTempFiles), actionContext.getWindow())
     fireUIExecEvent(ZMethodRunnable(self._createAccountMediaStores), actionContext.getWindow())
Exemplo n.º 37
0
 def onAccountTreeItemDeleted(self, event):
     fireUIExecEvent(ZMethodRunnable(self._updateButtonAndPageStates), self)
     event.Skip()
Exemplo n.º 38
0
 def onContentDownloadStart(self, fetcher, contentLength): #@UnusedVariable
     updater = ZInfoImageDetailsPanelUIUpdater(self, contentLength, ZInfoImageDetailsPanelUIUpdater.MODE_DOWNLOAD_START)
     fireUIExecEvent(updater, self)
Exemplo n.º 39
0
 def onContentDownloadComplete(self, fetcher, connectionResp): #@UnusedVariable
     updater = ZInfoImageDetailsPanelUIUpdater(self, connectionResp, ZInfoImageDetailsPanelUIUpdater.MODE_DOWNLOAD_COMPLETE)
     fireUIExecEvent(updater, self)
Exemplo n.º 40
0
 def _firePrefPageChangeEvent(self):
     u"""_firePrefPageChangeEvent() -> None
     Internal convenience method - called when something on
     the pref page changes."""  # $NON-NLS-1$
     if self.prefsDialog:
         fireUIExecEvent(ZMethodRunnable(self.prefsDialog.onPrefPageChange), self.prefsDialog)
Exemplo n.º 41
0
 def onActivate(self, event):
     if event.GetActive():
         fireUIExecEvent(ZMethodRunnable(self.onActivateStageTwo), self)
     event.Skip()
Exemplo n.º 42
0
 def onConnectError(self, fetcher, error): #@UnusedVariable
     updater = ZInfoImageDetailsPanelUIUpdater(self, error, ZInfoImageDetailsPanelUIUpdater.MODE_CONNECT_ERROR)
     fireUIExecEvent(updater, self)
Exemplo n.º 43
0
 def schemaValidate(self):
     # IZXHTMLEditControl impl.
     fireUIExecEvent(ZMethodRunnable(self._showViewAndRunValidation), self)
Exemplo n.º 44
0
 def onContentDownload(self, fetcher, numBytes): #@UnusedVariable
     updater = ZInfoImageDetailsPanelUIUpdater(self, numBytes, ZInfoImageDetailsPanelUIUpdater.MODE_DOWNLOAD)
     fireUIExecEvent(updater, self)
Exemplo n.º 45
0
 def _showViewAndRunValidation(self):
     self._showValidationView()
     fireUIExecEvent(ZMethodRunnable(self._runValidation), self)
Exemplo n.º 46
0
 def onContentDownloadError(self, fetcher, error): #@UnusedVariable
     updater = ZInfoImageDetailsPanelUIUpdater(self, error, ZInfoImageDetailsPanelUIUpdater.MODE_DOWNLOAD_ERROR)
     fireUIExecEvent(updater, self)
Exemplo n.º 47
0
 def runTidy(self):
     # IZXHTMLEditControl impl.
     fireUIExecEvent(ZMethodRunnable(self._internalRunTidy), self)