예제 #1
0
    def start(self, applicationModel):
        self.logger = applicationModel.getEngine().getService(IZAppServiceIDs.LOGGER_SERVICE_ID)
        self.logger.debug(u"Auto-Update Service started.") #$NON-NLS-1$
        self.stopped = False

        runner = ZAutoUpdateRunnable(self, True)
        thread = ZThread(runner, u"AutoUpdate", True) #$NON-NLS-1$
        thread.start()
예제 #2
0
    def _startListening(self):
        sysProfile = self.applicationModel.getSystemProfile()

        port = sysProfile.getProperties().getPropertyInt(u"/system-properties/singleton/port", 84113) #$NON-NLS-1$
        self.server = SimpleXMLRPCServer.SimpleXMLRPCServer( (u"localhost", port), logRequests = False ) #$NON-NLS-1$
        self.server.register_instance(ZRavenRPCServer(self))
        
        self.logger.debug(u"Singleton server created on port %d." % port) #$NON-NLS-1$

        thread = ZThread(self, u"ZSingletonService", True) #$NON-NLS-1$
        thread.start()
예제 #3
0
    def onBeginBackroundTask(self, event): #@UnusedVariable
        self._cancelTask()
        # save button states
        self.bgTaskPreviousButtonState = self._isButtonEnabledById(ZID_PREVIOUS)
        self.bgTaskNextButtonState =  self._isButtonEnabledById(ZID_NEXT)
        # disable buttons
        self._enableNextButton(False)
        self._enablePreviousButton(False)

        self.bgTask = event.getTask()
#        wizardTask.run()
        thread = ZThread(self.bgTask, u"ZWizardTaskThread", True) #$NON-NLS-1$
        thread.start()
        event.Skip()
예제 #4
0
    def _startListening(self):
        sysProfile = self.applicationModel.getSystemProfile()

        port = sysProfile.getProperties().getPropertyInt(
            u"/system-properties/singleton/port", 84113)  #$NON-NLS-1$
        self.server = SimpleXMLRPCServer.SimpleXMLRPCServer(
            (u"localhost", port), logRequests=False)  #$NON-NLS-1$
        self.server.register_instance(ZRavenRPCServer(self))

        self.logger.debug(u"Singleton server created on port %d." %
                          port)  #$NON-NLS-1$

        thread = ZThread(self, u"ZSingletonService", True)  #$NON-NLS-1$
        thread.start()
예제 #5
0
    def onBeginBackroundTask(self, event):  #@UnusedVariable
        self._cancelTask()
        # save button states
        self.bgTaskPreviousButtonState = self._isButtonEnabledById(
            ZID_PREVIOUS)
        self.bgTaskNextButtonState = self._isButtonEnabledById(ZID_NEXT)
        # disable buttons
        self._enableNextButton(False)
        self._enablePreviousButton(False)

        self.bgTask = event.getTask()
        #        wizardTask.run()
        thread = ZThread(self.bgTask, u"ZWizardTaskThread", True)  #$NON-NLS-1$
        thread.start()
        event.Skip()
예제 #6
0
파일: usage.py 프로젝트: mpm2050/Raven
    def start(self, applicationModel):
        self.queue = Queue(0)
        userProfile = applicationModel.getUserProfile()
        self.usageDir = userProfile.getDirectory(u"usage") #$NON-NLS-1$

        engine = applicationModel.getEngine()
        self.logger = engine.getService(IZBlogAppServiceIDs.LOGGER_SERVICE_ID)
        self.logger.debug(u"Anonymous Usage Statistics Service started.") #$NON-NLS-1$

        accountStore = engine.getService(IZBlogAppServiceIDs.ACCOUNT_STORE_SERVICE_ID)
        dataStore = engine.getService(IZBlogAppServiceIDs.DATA_STORE_SERVICE_ID)
        mediaStoreService = engine.getService(IZBlogAppServiceIDs.MEDIA_STORAGE_SERVICE_ID)

        accountStore.addListener(self)
        dataStore.addListener(self)
        mediaStoreService.addListener(self)

        self.done = False
        self.running = True
        thread = ZThread(self, u"ZUsageStatisticsService", True) #$NON-NLS-1$
        thread.start()
예제 #7
0
 def checkForUpdate(self, onlyPromptWhenNewVersionIsAvailable = True):
     runner = ZAutoUpdateRunnable(self, onlyPromptWhenNewVersionIsAvailable)
     thread = ZThread(runner, u"AutoUpdate", True) #$NON-NLS-1$
     thread.start()
예제 #8
0
파일: tpanel.py 프로젝트: mpm2050/Raven
class ZTestProgressPanel(wx.Panel, IZTestListener):

    def __init__(self, ztest, parent, id = wx.ID_ANY, style = wx.TAB_TRAVERSAL):
        self.ztest = ztest
        self.thread = None
        self.testError = None
        wx.Panel.__init__(self, parent, id = id, style = style)

        self._createWidgets()
        self._bindWidgetEvents()
        self._layoutWidgets()
    # end __init__()

    def _createWidgets(self):
        self.stepListBox = ZHtmlListBox(ZTestProgressPanelContentProvider(self.ztest), self, style = wx.LB_SINGLE | wx.BORDER_SIMPLE)
        self.staticBox = wx.StaticBox(self, wx.ID_ANY, _extstr(u"tpanel.CurrentStatus")) #$NON-NLS-1$
        self.statusCaption1 = wx.StaticText(self, wx.ID_ANY, u"") #$NON-NLS-1$
        self.statusCaption2 = wx.StaticText(self, wx.ID_ANY, u"") #$NON-NLS-1$
    # end _createWidgets()

    def _bindWidgetEvents(self):
        self.Bind(wx.EVT_LISTBOX_DCLICK, self.onDoubleClick, self.stepListBox)
        self.Bind(ZEVT_REFRESH, self.onZoundryRefresh, self)
        self.ztest.addListener(self)
    # end _bindWidgetEvents()

    def _layoutWidgets(self):
        box = wx.BoxSizer(wx.VERTICAL)
        box.Add(self.stepListBox, 1, wx.EXPAND | wx.BOTTOM, 5)
        
        staticSizer = wx.StaticBoxSizer(self.staticBox, wx.VERTICAL)
        staticSizer.Add(self.statusCaption1, 0, wx.EXPAND | wx.ALL, 3)
        staticSizer.Add(self.statusCaption2, 0, wx.EXPAND | wx.ALL, 3)
        
        box.AddSizer(staticSizer, 0, wx.EXPAND | wx.BOTTOM, 5)

        self.SetAutoLayout(True)
        self.SetSizer(box)
    # end _layoutWidgets()

    def getTestError(self):
        return self.testError
    # end getTestError()

    def startTest(self):
        self.thread = ZThread(self.ztest, u"ZTestThread", True) #$NON-NLS-1$
        self.thread.start()
    # end startTest()

    def cancelTest(self):
        self.ztest.removeListener(self)
        self.ztest.cancel()
        self.statusCaption1.SetLabel(_extstr(u"tpanel.TestCancelled")) #$NON-NLS-1$
        self.statusCaption2.SetLabel(u"") #$NON-NLS-1$
    # end cancelTest()
    
    def onDoubleClick(self, event):
        selectedIndex = self.stepListBox.GetSelection()
        step = self.ztest.getSteps()[selectedIndex]
        error = step.getError()
        if error is not None:
            ZShowExceptionMessage(self, error)
        event.Skip()
    # end onDoubleClick()

    def onZoundryRefresh(self, event): #@UnusedVariable
        # Refresh the step ListBox
        self.stepListBox.RefreshAll()
        # Scroll the list box if necessary
        line = self._getCurrentStepLine()
        if not self.stepListBox.IsVisible(line):
            self.stepListBox.ScrollToLine(line)
        # Update the captions
        step = self._getCurrentStep()
        if step:
            self.statusCaption1.SetLabel(_extstr(u"tpanel.RunningTestStepMessage") % (line + 1, len(self.ztest.getSteps()))) #$NON-NLS-1$
            self.statusCaption2.SetLabel(_extstr(u"tpanel.CurrentStep") % step.getDescription()) #$NON-NLS-1$
            pass
        elif self.testError is not None:
            self.statusCaption1.SetLabel(_extstr(u"tpanel.TestFailedMessage")) #$NON-NLS-1$
            self.statusCaption2.SetLabel(u"") #$NON-NLS-1$
        else:
            self.statusCaption1.SetLabel(_extstr(u"tpanel.TestCompletedSuccessfully")) #$NON-NLS-1$
            self.statusCaption2.SetLabel(u"") #$NON-NLS-1$
    # end onZoundryRefresh()

    def onTestStart(self, test): #@UnusedVariable
        fireRefreshEvent(self)
    # end onTestStart()

    def onStepStart(self, test, step): #@UnusedVariable
        fireRefreshEvent(self)
    # end onStepStart()

    def onStepPass(self, test, step): #@UnusedVariable
        fireRefreshEvent(self)
    # end onStepPass()

    def onStepFail(self, test, step, error): #@UnusedVariable
        self.testError = error
        fireRefreshEvent(self)
    # end onStepError()

    def onTestComplete(self, test): #@UnusedVariable
        fireRefreshEvent(self)
        if self.testError is None:
            self._fireTestCompletedEvent()
        else:
            self._fireTestFailedEvent()
    # end onTestComplete()

    def _getCurrentStep(self):
        for step in self.ztest.getSteps():
            if step.isExecuting():
                return step
        return None
    # end _getCurrentStep()

    def _getCurrentStepLine(self):
        counter = 0
        for step in self.ztest.getSteps():
            if step.isExecuting():
                return counter
            counter = counter + 1
        return counter
    # end _getCurrentStepLine()

    def _fireTestCompletedEvent(self):
        event = ZTestCompletedEvent(self.GetId())
        self.GetEventHandler().AddPendingEvent(event)
    # end _fireTestCompletedEvent()

    def _fireTestFailedEvent(self):
        event = ZTestFailedEvent(self.GetId())
        self.GetEventHandler().AddPendingEvent(event)
예제 #9
0
 def _resumeTask(self, task):
     task.attachListener(self)
     name = u"bgtask:id:%s" % str(task.getId())  #$NON-NLS-1$
     thread = ZThread(task, name, True)
     thread.start()
예제 #10
0
 def cancelAsync(self):
     thread = ZThread(ZMethodRunnable(self.cancel), u"CancelTask",
                      True)  #$NON-NLS-1$
     thread.start()
예제 #11
0
 def _resumeTask(self, task):
     task.attachListener(self)
     name = u"bgtask:id:%s" % str(task.getId()) #$NON-NLS-1$
     thread = ZThread(task, name, True)
     thread.start()
예제 #12
0
 def cancelAsync(self):
     thread = ZThread(ZMethodRunnable(self.cancel), u"CancelTask", True) #$NON-NLS-1$
     thread.start()
예제 #13
0
 def onRefreshBlogList(self, event):  #@UnusedVariable
     thread = ZThread(ZListBlogsTasks(self),
                      u"ZSynchronizeAccountBlogsDialog.ZListBlogsTasks",
                      True)  #$NON-NLS-1$
     thread.start()
예제 #14
0
 def onRefreshBlogList(self, event): #@UnusedVariable
     thread = ZThread(ZListBlogsTasks(self), u"ZSynchronizeAccountBlogsDialog.ZListBlogsTasks", True) #$NON-NLS-1$
     thread.start()