Exemplo n.º 1
0
    def exec_(self, options=None, args=None):
        container = inject.get_injector()
        if container is None: return None

        print(options)

        # if options.console: return None

        # window = container.get_instance('window')
        # if window is None: return None

        # config = container.get_instance('config')
        # if config is None: return None

        # window.show()

        # width = int(config.get('window.width'))
        # height = int(config.get('window.height'))

        # animation = QtCore.QPropertyAnimation(window, b'size')
        # animation.setEndValue(QtCore.QSize(width, height))
        # animation.setStartValue(QtCore.QSize(800, 600))
        # animation.setDuration(200)
        # animation.start()

        return super(Application, self).exec_()
Exemplo n.º 2
0
    def testRegisterUnregister(self):
        injector = Injector()
        injector2 = Injector()

        injector.register()
        self.assertTrue(inject.get_injector() is injector)

        injector2.unregister()
        self.assertTrue(inject.get_injector() is injector)

        injector.unregister()
        self.assertTrue(inject.get_injector() is None)

        injector.register()
        inject.unregister()
        self.assertTrue(inject.get_injector() is None)
Exemplo n.º 3
0
 def testRegisterUnregister(self):
     injector = Injector()
     injector2 = Injector()
     
     injector.register()
     self.assertTrue(inject.get_injector() is injector)
     
     injector2.unregister()
     self.assertTrue(inject.get_injector() is injector)
     
     injector.unregister()
     self.assertTrue(inject.get_injector() is None)
     
     injector.register()
     inject.unregister()
     self.assertTrue(inject.get_injector() is None)
Exemplo n.º 4
0
 def test_configure__should_create_injector(self):
     injector0 = inject.configure()
     injector1 = inject.get_injector()
     assert injector0
     assert injector0 is injector1
Exemplo n.º 5
0
 def test_configure_once__should_create_injector(self):
     injector = inject.configure_once()
     assert inject.get_injector() is injector
Exemplo n.º 6
0
 def test_configure__should_create_injector(self):
     injector0 = inject.configure()
     injector1 = inject.get_injector()
     assert injector0
     assert injector0 is injector1
Exemplo n.º 7
0
 def test_configure_once__should_create_injector(self):
     injector = inject.configure_once()
     assert inject.get_injector() is injector
Exemplo n.º 8
0
def overwrite_binding(key, constructor):
    injector = inject.get_injector()
    injector._bindings[key] = constructor