Ejemplo n.º 1
0
 def onTaskAdded(self, task):
     self.mutex.acquire()
     try:
         task.attachListener(self)
     finally:
         self.mutex.release()
     fireRefreshEvent(self)
Ejemplo n.º 2
0
 def onStop(self, task): #@UnusedVariable
     self.mutex.acquire()
     try:
         self.model.setRunning(False)
     finally:
         self.mutex.release()
         fireRefreshEvent(self)
Ejemplo n.º 3
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()
Ejemplo n.º 4
0
 def onOK(self, event): #@UnusedVariable
     self.mutex.acquire()
     try:
         self.model.setDetaching()
         fireRefreshEvent(self)
     finally:
         self.mutex.release()
Ejemplo n.º 5
0
    def onAccountDeleted(self, account): #@UnusedVariable
        if self._getSelectedAccount().getId() == account.getId():
            selection = ZViewSelection(IZViewSelectionTypes.UNPUBLISHED_ACCOUNT_SELECTION, None)
            fireViewSelectionEvent(selection, self)

        self.accountListProvider.refresh()
        fireRefreshEvent(self)
Ejemplo n.º 6
0
 def onCancel(self, task):
     self.mutex.acquire()
     try:
         self.model.removeTask(task)
     finally:
         self.mutex.release()
     fireRefreshEvent(self)
Ejemplo n.º 7
0
 def onStarted(self, task, workAmount): #@UnusedVariable
     self.mutex.acquire()
     try:
         self.model.addTask(task)
     finally:
         self.mutex.release()
     fireRefreshEvent(self)
Ejemplo n.º 8
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()
Ejemplo n.º 9
0
 def onError(self, task, errorMessage, errorDetails): #@UnusedVariable
     self.mutex.acquire()
     try:
         self.model.removeTask(task)
     finally:
         self.mutex.release()
     fireRefreshEvent(self)
Ejemplo n.º 10
0
 def onOK(self, event):  #@UnusedVariable
     self.mutex.acquire()
     try:
         self.model.setDetaching()
         fireRefreshEvent(self)
     finally:
         self.mutex.release()
Ejemplo n.º 11
0
 def onStarted(self, task, workAmount):  #@UnusedVariable
     self.mutex.acquire()
     try:
         self.model.setRunning(True)
     finally:
         self.mutex.release()
         fireRefreshEvent(self)
Ejemplo n.º 12
0
 def onStarted(self, task, workAmount): #@UnusedVariable
     self.mutex.acquire()
     try:
         self.model.setRunning(True)
     finally:
         self.mutex.release()
         fireRefreshEvent(self)
Ejemplo n.º 13
0
 def onStop(self, task):  #@UnusedVariable
     self.mutex.acquire()
     try:
         self.model.setRunning(False)
     finally:
         self.mutex.release()
         fireRefreshEvent(self)
Ejemplo n.º 14
0
 def onWorkDone(self, task, amount, text): #@UnusedVariable
     self.mutex.acquire()
     try:
         self.model.incrementWorkAmount(amount)
         self.model.setCurrentWorkText(text)
     finally:
         self.mutex.release()
     fireRefreshEvent(self)
Ejemplo n.º 15
0
 def onIndexChange(self, event):
     shouldRefresh = (
         event.getEventType() == IZDocIndexEvent.DOCINDEX_EVENTTYPE_ADD
         or event.getEventType() == IZDocIndexEvent.DOCINDEX_EVENTTYPE_REMOVE
     )
     if shouldRefresh:
         self.indexEventQueue.put(event)
         fireRefreshEvent(self)
Ejemplo n.º 16
0
    def onAccountDeleted(self, account):  #@UnusedVariable
        if self._getSelectedAccount().getId() == account.getId():
            selection = ZViewSelection(
                IZViewSelectionTypes.UNPUBLISHED_ACCOUNT_SELECTION, None)
            fireViewSelectionEvent(selection, self)

        self.accountListProvider.refresh()
        fireRefreshEvent(self)
Ejemplo n.º 17
0
 def onTaskRemoved(self, task):
     self.mutex.acquire()
     try:
         self.model.removeTask(task)
         task.detachListener(self)
     finally:
         self.mutex.release()
     fireRefreshEvent(self)
Ejemplo n.º 18
0
 def onWorkDone(self, task, amount, text):  #@UnusedVariable
     self.mutex.acquire()
     try:
         self.model.incrementWorkAmount(amount)
         self.model.setCurrentWorkText(text)
     finally:
         self.mutex.release()
     fireRefreshEvent(self)
Ejemplo n.º 19
0
 def onAttached(self, task, numCompletedWorkUnits): #@UnusedVariable
     self.mutex.acquire()
     try:
         if task.isRunning():
             self.model.addTask(task)
     finally:
         self.mutex.release()
     fireRefreshEvent(self)
Ejemplo n.º 20
0
 def onError(self, task, errorMessage, errorDetails): #@UnusedVariable
     self.mutex.acquire()
     try:
         self.model.setRunning(False)
         self.model.setDetaching()
     finally:
         self.mutex.release()
         fireRefreshEvent(self)
Ejemplo n.º 21
0
 def onError(self, task, errorMessage, errorDetails):  #@UnusedVariable
     self.mutex.acquire()
     try:
         self.model.setRunning(False)
         self.model.setDetaching()
     finally:
         self.mutex.release()
         fireRefreshEvent(self)
Ejemplo n.º 22
0
 def onAttached(self, task, numCompletedWorkUnits): #@UnusedVariable
     self.mutex.acquire()
     try:
         self.model.setCurrentWorkText(getSafeString(task.getLastLogMessage()))
         self.model.setCurrentWorkAmount(numCompletedWorkUnits)
         self.model.setRunning(task.isRunning())
     finally:
         self.mutex.release()
         fireRefreshEvent(self)
Ejemplo n.º 23
0
 def onWorkDone(self, task, amount, text):  #@UnusedVariable
     self.mutex.acquire()
     try:
         newWorkAmount = self.model.getCurrentWorkAmount() + amount
         self.model.setCurrentWorkAmount(newWorkAmount)
         self.model.setCurrentWorkText(getSafeString(text))
     finally:
         self.mutex.release()
         fireRefreshEvent(self)
Ejemplo n.º 24
0
 def onWorkDone(self, task, amount, text): #@UnusedVariable
     self.mutex.acquire()
     try:
         newWorkAmount = self.model.getCurrentWorkAmount() + amount
         self.model.setCurrentWorkAmount(newWorkAmount)
         self.model.setCurrentWorkText(getSafeString(text))
     finally:
         self.mutex.release()
         fireRefreshEvent(self)
Ejemplo n.º 25
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()
Ejemplo n.º 26
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()
Ejemplo n.º 27
0
 def onComplete(self, task):
     self.mutex.acquire()
     try:
         self.model.setCurrentWorkAmount(task.getNumWorkUnits())
         self.model.setCurrentWorkText(_extstr(u"bgtaskprogressdialog.Done_")) #$NON-NLS-1$
         self.model.setRunning(False)
         self.model.setDetaching()
     finally:
         self.mutex.release()
         fireRefreshEvent(self)
Ejemplo n.º 28
0
 def onAttached(self, task, numCompletedWorkUnits):  #@UnusedVariable
     self.mutex.acquire()
     try:
         self.model.setCurrentWorkText(
             getSafeString(task.getLastLogMessage()))
         self.model.setCurrentWorkAmount(numCompletedWorkUnits)
         self.model.setRunning(task.isRunning())
     finally:
         self.mutex.release()
         fireRefreshEvent(self)
Ejemplo n.º 29
0
 def onComplete(self, task):
     self.mutex.acquire()
     try:
         self.model.setCurrentWorkAmount(task.getNumWorkUnits())
         self.model.setCurrentWorkText(
             _extstr(u"bgtaskprogressdialog.Done_"))  #$NON-NLS-1$
         self.model.setRunning(False)
         self.model.setDetaching()
     finally:
         self.mutex.release()
         fireRefreshEvent(self)
Ejemplo n.º 30
0
 def onTestComplete(self, test): #@UnusedVariable
     fireRefreshEvent(self)
     if self.testError is None:
         self._fireTestCompletedEvent()
     else:
         self._fireTestFailedEvent()
Ejemplo n.º 31
0
 def onTaskRemoved(self, task):  #@UnusedVariable
     fireRefreshEvent(self)
Ejemplo n.º 32
0
 def onTaskRemoved(self, task): #@UnusedVariable
     fireRefreshEvent(self)
Ejemplo n.º 33
0
 def onAccountDeleted(self, account):
     if account.getId() == self.folderListProvider.getAccountId():
         self.folderListProvider.setAccountId(None)
         self.folderListProvider.setBlogId(None)
         self.folderListProvider.refresh()
         fireRefreshEvent(self)
Ejemplo n.º 34
0
 def onAccountAdded(self, account): #@UnusedVariable
     self.accountListProvider.refresh()
     fireRefreshEvent(self)
Ejemplo n.º 35
0
 def onDocumentChanged(self, document, metaDataOnly):
     if not metaDataOnly and self.document is not None and self.document.getId(
     ) == document.getId():
         self.document = document
         fireRefreshEvent(self, None)
Ejemplo n.º 36
0
 def onStepFail(self, test, step, error): #@UnusedVariable
     self.testError = error
     fireRefreshEvent(self)
Ejemplo n.º 37
0
 def onCancel(self, task): #@UnusedVariable
     self.cancelled = True
     fireRefreshEvent(self)
Ejemplo n.º 38
0
 def onComplete(self, task): #@UnusedVariable
     self.complete = True
     fireRefreshEvent(self)
Ejemplo n.º 39
0
 def onAccountDeleted(self, account):
     if account.getId() == self.blogListProvider.getAccountId():
         self.blogListProvider.setAccountId(None)
         self.blogListProvider.refresh()
         fireRefreshEvent(self)
Ejemplo n.º 40
0
 def onAccountChanged(self, account):
     self.accountEventQueue.put((ACCOUNT_EVENT_UPDATE, account))
     self.model.updateAccount(account)
     fireRefreshEvent(self)
Ejemplo n.º 41
0
 def onAccountAdded(self, account):
     self.accountEventQueue.put((ACCOUNT_EVENT_ADD, account))
     self.model.addAccount(account)
     fireRefreshEvent(self)
Ejemplo n.º 42
0
 def _fireRefreshEvent(self, eventType, eventData = None):
     # wrap event type and data in tuple and fire event.
     if not eventType:
         eventType = u"_unknowntype_" #$NON-NLS-1$
     obj = (eventType, eventData)
     fireRefreshEvent(self, obj)
Ejemplo n.º 43
0
 def onWorkDone(self, task, amount, text): #@UnusedVariable
     fireRefreshEvent(self)
Ejemplo n.º 44
0
 def onAccountChanged(self, account):
     self.accountEventQueue.put( (ACCOUNT_EVENT_UPDATE, account) )
     self.model.updateAccount(account)
     fireRefreshEvent(self)
Ejemplo n.º 45
0
 def onAccountDeleted(self, account):
     self.accountEventQueue.put((ACCOUNT_EVENT_DELETE, account))
     self.model.removeAccount(account)
     fireRefreshEvent(self)
Ejemplo n.º 46
0
 def onIndexChange(self, event):
     if event.getDataType() == IZDocIndexEvent.DOCINDEX_DATATYPE_TAG:
         refreshData = (event.getEventType(), event.getTagIDO())
         fireRefreshEvent(self, refreshData)
Ejemplo n.º 47
0
 def onAccountAdded(self, account):
     self.accountEventQueue.put( (ACCOUNT_EVENT_ADD, account) )
     self.model.addAccount(account)
     fireRefreshEvent(self)
Ejemplo n.º 48
0
 def onIndexChange(self, event):
     shouldRefresh = event.getEventType() == IZDocIndexEvent.DOCINDEX_EVENTTYPE_ADD or \
                     event.getEventType() == IZDocIndexEvent.DOCINDEX_EVENTTYPE_REMOVE
     if shouldRefresh:
         self.indexEventQueue.put(event)
         fireRefreshEvent(self)
Ejemplo n.º 49
0
 def onAccountDeleted(self, account):
     self.accountEventQueue.put( (ACCOUNT_EVENT_DELETE, account) )
     self.model.removeAccount(account)
     fireRefreshEvent(self)
Ejemplo n.º 50
0
 def _fireRefreshEvent(self, eventType, eventData=None):
     # wrap event type and data in tuple and fire event.
     if not eventType:
         eventType = u"_unknowntype_"  #$NON-NLS-1$
     obj = (eventType, eventData)
     fireRefreshEvent(self, obj)
Ejemplo n.º 51
0
 def onDocumentDeleted(self, document):
     if self.document is not None and self.document.getId(
     ) == document.getId():
         self.document = None
         fireRefreshEvent(self, None)
Ejemplo n.º 52
0
 def onAccountChanged(self, account):
     if account.getId() == self.blogListProvider.getAccountId():
         self.blogListProvider.refresh()
         fireRefreshEvent(self)