Exemplo n.º 1
0
    def __init__(self):
        """Initial user interface and slots

        :returns: none
        """
        super(LottoSimuDialog, self).__init__()

        # Set up the user interface from Designer.
        try:
            self.ui = uic.loadUi(
                os.path.join("pylottosimu", "lottosimu_gui.ui"))
        except FileNotFoundError:
            self.ui = uic.loadUi(
                os.path.abspath(
                    os.path.join(os.path.dirname(sys.argv[0]), "pylottosimu",
                                 "lottosimu_gui.ui")))
        self.ui.setWindowIcon(
            QtGui.QIcon(
                os.path.abspath(
                    os.path.join(os.path.dirname(sys.argv[0]), "misc",
                                 "pyLottoSimu.svg"))))

        self.imageLabel = QSvgWidget()
        self.imageLabel.renderer().load(
            os.path.abspath(
                os.path.join(os.path.dirname(sys.argv[0]), "pylottosimu",
                             "lottokugel.svg")))
        self.ui.scrollArea.setWidget(self.imageLabel)

        self.actionLottoSim()
        self.timer = QtCore.QTimer(self)
        self.sysdat = LottoSystemData()

        # Slots
        self.ui.btn_random_numbers.clicked.connect(self.randomNumbersGenerator)
        self.ui.clean_output_text.clicked.connect(self.cleanOutputText)
        self.ui.btn_start.clicked.connect(self.onBtnStart)
        self.ui.action_quit.triggered.connect(self.onClose)
        self.ui.action_info.triggered.connect(self.onInfo)
        self.ui.action_go_to_the_website.triggered.connect(self.openWebsite)
        self.ui.action_lotto_simulation.changed.connect(self.actionLottoSim)
        self.ui.btn_draw_overview.clicked.connect(self.onDrawOverview)
        self.timer.timeout.connect(self.onTimer)
        self.ui.statusBar().showMessage(self.tr('ready'))
        self.ui.action_lotto_system.triggered.connect(self.onSystem)
        self.ui.action_uniform_distribution.triggered.connect(
            self.draw_distribution)

        self.turn = 0
        self.random_number = 0
        self.delay_of_next_number = self.ui.horizontalSlider.value()
        self.lottodraw = DrawLotto()
        self.ui.label_numbers.setText(self.lottodraw.data['name'])
        self.ui.show()
Exemplo n.º 2
0
 def test_dialog(self):
     """test"""
     lottosystems = LottoSystemData()
     dialog = LottoSettingsDialog(lottosystems, testcase=True)
     self.assertTrue(dialog)
     self.assertTrue(True)
Exemplo n.º 3
0
    def setUp(self):
        """load LottoSystemData

        :return:
        """
        self.lottosystem = LottoSystemData()
Exemplo n.º 4
0
 def test_dialogvalues(self):
     """test"""
     lottosystems = LottoSystemData()
     dialog = LottoSettingsDialog(lottosystems, testcase=True)
     self.assertEqual(dialog.values(),
                      ('Lotto DE', 49, 6, False, 0, False, 0, 'Superzahl'))