Example #1
0
 def test10_creation(self):
     gui = mock.MagicMock()
     game_factory = mock.MagicMock()
     c = MainController(gui, game_factory)
     self.assertEqual(c.gui, gui)
     self.assertEqual(c.game_factory, game_factory)
     c.gui.show_select_game.assert_not_called()
     c.start()
     c.gui.show_select_game.assert_called_once_with()
Example #2
0
import sys
from PyQt5.QtWidgets import QApplication
from maincontroller import MainController

if __name__ == '__main__':
    a = QApplication(sys.argv)
    w = MainController()
    w.start()
    sys.exit(a.exec_())
Example #3
0
def make_mock_controller(names='a b'.split()):
    c = MainController(mock.MagicMock(), make_mock_game_factory())
    for i, name in enumerate(sorted(names)):
        c.add_game(name + '_name', name + '_type', dict(x=i + 1))

    return c.start()
Example #4
0
            pickle.dump(MainConfigure.currentUser, fp)
        return
        if QMessageBox.question(self, self.tr('Quit'), 'Sure?',
                                QMessageBox.Yes | QMessageBox.No,
                                QMessageBox.No) == QMessageBox.Yes:
            event.accept()
        else:
            event.ignore()


if __name__ == '__main__':
    from maincontroller import MainController
    import sys
    app = QApplication(sys.argv)
    from fileboxctl import fileBoxCtl
    from garbagectl import garbageCtl
    import cPickle as pickle
    import os
    filepath = MainConfigure.currentUserPath
    if os.path.isfile(filepath):
        with open(filepath, 'r') as fp:
            MainConfigure.currentUser = pickle.load(fp)
    garbageCtl.init()

    fileBoxCtl.init()

    MainController.start()

    MainController.jobCtl()
    sys.exit(app.exec_())