Esempio n. 1
0
 def OnClose(self, event):
     if self._allowed_to_exit():
         PUBLISHER.unsubscribe(self._set_label, RideTreeSelection)
         RideClosing().publish()
         self.Destroy()
     else:
         wx.CloseEvent.Veto(event)
Esempio n. 2
0
    def test_notifies_only_after_transaction_complete(self):
        datas_ok = {'steps': False, 'name': False}

        def name_changed_check_that_steps_have_also(data):
            datas_ok['steps'] = self.test_ctrl.step(
                2).keyword == UNUSED_KEYWORD_NAME

        def steps_changed_check_that_name_has_also(data):
            datas_ok['name'] = any(
                True for i in self.test_ctrl.datafile_controller.keywords
                if i.name == UNUSED_KEYWORD_NAME)

        PUBLISHER.subscribe(name_changed_check_that_steps_have_also,
                            RideItemNameChanged)
        PUBLISHER.subscribe(steps_changed_check_that_name_has_also,
                            RideItemStepsChanged)
        try:
            self._rename(USERKEYWORD2_NAME, UNUSED_KEYWORD_NAME, TEST1_NAME,
                         'Steps')
        finally:
            PUBLISHER.unsubscribe(name_changed_check_that_steps_have_also,
                                  RideItemNameChanged)
            PUBLISHER.unsubscribe(steps_changed_check_that_name_has_also,
                                  RideItemStepsChanged)
        assert_true(datas_ok['steps'])
        assert_true(datas_ok['name'])
Esempio n. 3
0
 def OnClose(self, event):
     if self._allowed_to_exit():
         PUBLISHER.unsubscribe(self._set_label, RideTreeSelection)
         RideClosing().publish()
         self.Destroy()
     else:
         wx.CloseEvent.Veto(event)
Esempio n. 4
0
    def test_notifies_only_after_transaction_complete(self):
        datas_ok = {'steps': False, 'name': False}

        def name_changed_check_that_steps_have_also(data):
            datas_ok['steps'] = \
                self.test_ctrl.step(2).keyword == UNUSED_KEYWORD_NAME

        def steps_changed_check_that_name_has_also(data):
            datas_ok['name'] = any(True for i in
                                   self.test_ctrl.datafile_controller.keywords
                                   if i.name == UNUSED_KEYWORD_NAME)
        PUBLISHER.subscribe(name_changed_check_that_steps_have_also,
                            RideItemNameChanged)
        PUBLISHER.subscribe(steps_changed_check_that_name_has_also,
                            RideItemStepsChanged)
        try:
            self._rename(USERKEYWORD2_NAME, UNUSED_KEYWORD_NAME, TEST1_NAME,
                         'Steps')
        finally:
            PUBLISHER.unsubscribe(name_changed_check_that_steps_have_also,
                                  RideItemNameChanged)
            PUBLISHER.unsubscribe(steps_changed_check_that_name_has_also,
                                  RideItemStepsChanged)
        assert_true(datas_ok['steps'])
        assert_true(datas_ok['name'])
Esempio n. 5
0
 def close(self):
     self._colorizer.close()
     self.save()
     PUBLISHER.unsubscribe(self._data_changed, RideItemStepsChanged)
     if self._namespace_updated:
         #Prevent re-entry to unregister method
         self._controller.datafile_controller.unregister_namespace_updates(self._namespace_updated)
     self._namespace_updated = None
Esempio n. 6
0
 def OnClose(self, event):
     self._application.settings['mainframe size'] = self.GetSizeTuple()
     self._application.settings['mainframe position'] = self.GetPositionTuple()
     if self._allowed_to_exit():
         PUBLISHER.unsubscribe(self._set_label, RideTreeSelection)
         RideClosing().publish()
         self.Destroy()
     else:
         wx.CloseEvent.Veto(event)
Esempio n. 7
0
 def OnClose(self, event):
     if self._allowed_to_exit():
         PUBLISHER.unsubscribe(self._set_label, RideTreeSelection)
         RideClosing().publish()
         # deinitialize the frame manager
         self._mgr.UnInit()
         self.Destroy()
     else:
         wx.CloseEvent.Veto(event)
Esempio n. 8
0
 def OnClose(self, event):
     self._application.settings['mainframe size'] = self.GetSizeTuple()
     self._application.settings['mainframe position'] = self.GetPositionTuple()
     if self._allowed_to_exit():
         PUBLISHER.unsubscribe(self._set_label, RideTreeSelection)
         RideClosing().publish()
         self.Destroy()
     else:
         wx.CloseEvent.Veto(event)
Esempio n. 9
0
 def OnClose(self, event):
     if self._allowed_to_exit():
         PUBLISHER.unsubscribe(self._set_label, RideTreeSelection)
         RideClosing().publish()
         # deinitialize the frame manager
         self._mgr.UnInit()
         self.Destroy()
     else:
         wx.CloseEvent.Veto(event)
Esempio n. 10
0
 def close(self):
     self._colorizer.close()
     self.save()
     PUBLISHER.unsubscribe(self._data_changed, RideItemStepsChanged)
     if self._namespace_updated:
         #Prevent re-entry to unregister method
         self._controller.datafile_controller.unregister_namespace_updates(
             self._namespace_updated)
     self._namespace_updated = None
Esempio n. 11
0
    def unsubscribe(self, listener, *topics):
        """Stops listening to messages with the given ``topics``.

        ``listener`` and ``topics`` have the same meaning as in `subscribe`
        and a listener/topic combination is unsubscribed only when both of them
        match.
        """
        for topic in topics:
            PUBLISHER.unsubscribe(listener, topic)
Esempio n. 12
0
    def unsubscribe(self, listener, *topics):
        """Stops listening to messages with the given ``topics``.

        ``listener`` and ``topics`` have the same meaning as in `subscribe`
        and a listener/topic combination is unsubscribed only when both of them
        match.
        """
        for topic in topics:
            PUBLISHER.unsubscribe(listener, topic, key=self)
Esempio n. 13
0
 def OnClose(self, event):
     if self._allowed_to_exit():
         perspective = self._mgr.SavePerspective()
         self._application.settings.set('AUI Perspective', perspective)
         PUBLISHER.unsubscribe(self._set_label, RideTreeSelection)
         RideClosing().publish()
         # deinitialize the frame manager
         self._mgr.UnInit()
         self.Destroy()
     else:
         wx.CloseEvent.Veto(event)
Esempio n. 14
0
 def OnClose(self, event):
     if self._allowed_to_exit():
         perspective = self._mgr.SavePerspective()
         self._application.settings.set('AUI Perspective', perspective)
         PUBLISHER.unsubscribe(self._set_label, RideTreeSelection)
         RideClosing().publish()
         # deinitialize the frame manager
         self._mgr.UnInit()
         self._task_bar_icon.Destroy()
         self.Destroy()
         app = wx.GetApp()
         if app is not self._application:
             # other wx app instance created unexpectedly
             # this will cause RIDE app instance cannot invoke ExitMainLoop properly
             self._application.ExitMainLoop()
     else:
         wx.CloseEvent.Veto(event)
Esempio n. 15
0
 def unsubscribe(self):
     PUBLISHER.unsubscribe(self._listener, self._topic, self)
Esempio n. 16
0
 def close(self):
     self._colorizer.close()
     self.save()
     PUBLISHER.unsubscribe(self._data_changed, RideItemStepsChanged)
 def tearDown(self):
     _DataDependentTest.tearDown(self)
     PUBLISHER.unsubscribe(self._datafile_removed, RideDataFileRemoved)
Esempio n. 18
0
 def tearDown(self):
     PUBLISHER.unsubscribe(self._test_changed, RideItemStepsChanged)
Esempio n. 19
0
 def tearDown(self):
     for listener, topic in self._listeners_and_topics:
         PUBLISHER.unsubscribe(listener, topic)
Esempio n. 20
0
 def tearDown(self):
     PUBLISHER.unsubscribe(self._file_name_changed, RideFileNameChanged)
Esempio n. 21
0
 def tearDown(self):
     for listener, topic in self.messages:
         PUBLISHER.unsubscribe(listener, topic)
     if os.path.exists('path'):
         shutil.rmtree('path')
Esempio n. 22
0
 def tearDown(self):
     PUBLISHER.unsubscribe(self._test_changed, RideItemStepsChanged)
Esempio n. 23
0
 def tearDown(self):
     _DataDependentTest.tearDown(self)
     PUBLISHER.unsubscribe(self._datafile_removed, RideDataFileRemoved)
 def tearDown(self):
     PUBLISHER.unsubscribe(self._modification_prevented,
                           RideModificationPrevented)
Esempio n. 25
0
 def tearDown(self):
     for listener, topic in self._listeners_and_topics:
         PUBLISHER.unsubscribe(listener, topic)
Esempio n. 26
0
File: mocks.py Progetto: tbener/RIDE
 def unsubscribe(self):
     PUBLISHER.unsubscribe(self._listener, self._topic, self)
Esempio n. 27
0
 def tearDown(self):
     if os.path.exists('path'):
         os.removedirs('path')
     PUBLISHER.unsubscribe(self._test_changed, RideItemStepsChanged)
Esempio n. 28
0
 def tearDown(self):
     if os.path.exists('path'):
         os.removedirs('path')
     PUBLISHER.unsubscribe(self._test_changed, RideItemStepsChanged)
Esempio n. 29
0
 def tearDown(self):
     for listener, topic in self.messages:
         PUBLISHER.unsubscribe(listener, topic)
     if os.path.exists('path'):
         shutil.rmtree('path')
Esempio n. 30
0
 def tearDown(self):
     PUBLISHER.unsubscribe(self._test_renamed, RideItemNameChanged)
 def tearDown(self):
     PUBLISHER.unsubscribe(self._modification_prevented, RideModificationPrevented)