Willkommen bei der Dokumentation von pyLottoSimu!

Lotto Generator und Simulator

Eine Simulation des Lotto Deutschland (6 aus 49), Lotto Österreich (6 aus 45), Euromillionen, Powerball-Lotterie der USA, Mega Millions Lotterie und Hot Lotto Sizzler.

Das pyLottoSimu Programm generiert zufällige Lottozahlen und kann eine Ziehung simulieren. In der Simulationsansicht ist eine Lottokugel sichtbar, auf der die Zahlen immer schneller rotieren, Und schließlich stehen bleibt, dazu kommt der Text, die erste Zahl der heutigen Ziehung war die … Vielleicht waren es ja tatsächlich die Zahlen der nächsten Ziehung, natürlich sind auch hier, alle Zahlen ohne Gewähr.

pyLottoSimu kann in diesen Sprachen gestartet werden:

Englisch, Deutsch, Französisch, Spanisch, Italienisch, Dänisch, Niederländisch, Polnisch und Russisch

Start

Das Programm verwendet Python 2.7 oder 3.x und Qt5 for Python.

Start mit:

python lotto.pyw [de|dk|fr|es|it|nl|pl|ru]

Dokumentation

Dokumentation als .html Datei aus den Kommentaren des Quelltextes erstellen lassen:

cd docs
make html

Add new modules with:

cd docs
sphinx-apidoc -f -o . ../pylottosimu
_images/pyLottoSimu_screenshot_en.png

Inhalt

Installation

pyLottoSimu zu starten ist echt einfach, in ein Verzeichniss nach Wunsch den Quelltext entpacken und starten

Abhängigkeiten

Diese Programme brauchst du um pyLottoSimu zu starten:

  • python - Die Python Programmiersprache
  • pyQt5 - Qt5 für Python

Hilfe generieren

Codestyle Test

  • pep8 - Python Codestyle
  • pycodestyle - Python style guide checker
  • isort - import sorting and checking tool
  • nose - start nosetests to run the tests

Versionsverwaltung Git

  • Git - Git - Versionskontrollsystem

Installation bei Debian oder Ubuntu

Zuerst brauchst du auf deinen Rechner diese Programme: Python und pyQt5 und optimal die Versionsverwaltung Git.

# sudo apt-get install python python-pyqt5 python-pyqt5.qtsvg git
# sudo apt-get install python3 python3-pyqt5 python3-pyqt5.qtsvg git

Dann kopiert du den Quellcode des Programmes auf deinem Rechner, entweder das zip File von den Projekt herunterladen oder eleganter mit der Versionsverwaltung Git herunterladen:

# git clone https://github.com/MarkusHackspacher/pyLottoSimu.git

In das Verzeichniss wechseln und starten

cd pyLottoSimu
./lotto.pyw

Alternative:

python lotto.pyw [de|dk|fr|es|it|nl|pl|ru]
python3 lotto.pyw [de|dk|fr|es|it|nl|pl|ru]

Contribute

Feel free and send a pull request to https://github.com/MarkusHackspacher/pyLottoSimu . If you have an idea, tell it at https://gitter.im/MarkusHackspacher/pyLottoSimu . Thank you in advance.

Übersetzen

Benutzeroberfläche übersetzen

Um das Programm zu Übersetzen oder eine Übersetzung in Ihrer Sprache hinzuzufügen, legen Sie in der complete.pro eine Zeile mit ihren Sprachcode an.

cd pylottosimu
pylupdate5 complete.pro

Übersetzen der Sprachdatei: lotto1_xx.ts:

lrelease complete.pro

Bei Linux muss zuvor das pyqt5-dev-tools Paket für den pylupdate5 Befehl und qttools5-dev-tools für lrelease installiert werden:

apt-get install pyqt5-dev-tools qttools5-dev-tools

Dokumentation übersetzen

Die Kommentare des Quelltextes sind in englisch und werden über Sprachdateien ins deutsche übersetzt, und diese Seiten werden durch Sphinx generiert

Die vorkommenden Textstellen werden in pot Dateien kopiert. Mit dem Befehl werden viele pot Dateien unter _build/locale generiert. Mit dem sphinx-intl Befehl wird das docs/locale/de Verzeichnis aktualisiert:

cd docs
make gettext
sphinx-intl update -p _build/locale -l de

Übersetzen der .po Dateien im ./locale/de/LC_MESSAGES/ Verzeichnis und danach die mo Dateien generieren:

sphinx-intl build

Generieren der Dokumentation in Deutsch:

make -e SPHINXOPTS="-D language='de'" html

Historie

Version

The current version is 1.7 from June 3, 2017.

Version 1.6.1

Version 1.6.1 from September 2, 2015.

Version 1.6

Bei der Version 1.6 vom 3. Juni 2015 ist es möglich zwischen vier Lottosysteme zu wählen, das deutsche Lotto 6 aus 49 ist default, das Österreichische 6 aus 45 mit einer Zusatzzahl, die EuroMillionen 5 aus 50 mit zwei Superzahlen zwischen 1 und 11 und sowie die Amerikanische Powerball Lottery 5 aus 59 und eine Zusatzzahl im Bereich 1 bis 35. Unter der Haube ist die Programmlogik von der Oberfläche unabhängiger und es wird in der nächsten Version auch das Programm ohne eine grafische Oberfläche geben. So wird die Programmstruktur übersichtlicher und es lassen sich besser Programmteile in anderen Programmen wiederverwenden. Desweiteren lässt sich mit Pythontools eine .exe Datei erstellen:

python setup.py py2exe

Wenn jemand diese Programm als Gimmick auf seiner Homepage anbieten möchte, dabei den Link zur Homepage anpasst kann es gern tun.

Version 1.5

Die Version 1.5 vom 20. Februar 2014, lässt sich mit Qt4 oder mit Qt5 starten.

Version 1.4

Die Erneuerungen in der Version 1.4 von 3.Oktober 2013 vom pyLottoSimu ist die Mehrsprachigkeit mittlerweile sind es neun Sprachen. Und im Programmfenster gibt es auch einen größere Änderung, es lässt sich jetzt Auswählen ob das Zahlenübersichtsfenster automatisch nach der Ziehung angezeigt werden soll.

Vorschau

das Programm startet mit dem zuletzt gewählen Lotosystem.

pylottosimu

pylottosimu Sammlung

Unterpakete
pylottosimu.dialog
Untermodule
pylottosimu.dialog.lottosettingdialog module
Klasse LottoSettingsDialog

Manage the GUI of setting dialog. Use lottosystem.ui.

class pylottosimu.dialog.lottosettingdialog.LottoSettingsDialog(sysdat, parent=None, testcase=None)[Quellcode]

Bases: PyQt5.QtWidgets.QDialog

The GUI of Settings.

Parameter:
  • sysdat (string) – Lotto setting
  • parent (string) – parent window
static get_values(sysdat, parent=None)[Quellcode]

static method to create the dialog and return (dialog.values, accepted)

Parameter:sysdat (string) – Lotto setting
Rückgabe:dialog.values, accepted
Rückgabetyp:array of int, bool
sep_addit_numbers()[Quellcode]

if the checkbox with separate additional numbers is active then enable to set the number

Rückgabe:
set_values()[Quellcode]

Set Values

Rückgabe:
values()[Quellcode]

Values

Rückgabe:
with_addit()[Quellcode]

if the checkbox with additional numbers is active then enable to set the number

Rückgabe:
pylottosimu.dialog.lottosettingdialog.qt_loadui(uifile)[Quellcode]
pylottosimu.dialog.show_drawing
Klasse DlgShowDrawing

show a Dialog with all the ball numbers from the draw and the bonus numbers.

class pylottosimu.dialog.show_drawing.DlgShowDrawing(ballnumbers, highestnumber, bonusnumbers=False, highestbonus=False)[Quellcode]

Bases: PyQt5.QtWidgets.QDialog

Anzeige der numern in der Dialogbox

Parameter:
  • ballnumbers (tuple of int) – the number of draw
  • highestnumber (int) – the number of the PushButtons
  • bonusnumbers (int) – the bonus numbers
  • highestbonus (int) – the highest bonus number (separate numbers)
Rückgabe:

None

initbuttons()[Quellcode]

Array of buttons from 1 to the highest number and buttons for the additional numbers

Rückgabe:None
Modulinhalte

additional dialogs

Untermodule
pylottosimu.lottosystem Modul
class pylottosimu.lottosystem.LottoSystemData[Quellcode]

Bases: object

loads predefined lottery systems. And read and write a json file of the data set.

Datensatz

  • name: name of the lottery system,
  • max_draw: highest number of draw
  • draw_numbers: number to pick
  • with_addit: with additional number
  • sep_addit_numbers: with separate additional number, the additional number are not in the same pot
  • addit_numbers: additional number to pick
  • max_addit: highest additional number in the separate pot
static fixdata()[Quellcode]

Data of predefined lottery system.

The following are predefined: Lotto Germany (pick 6 out of 49), Lotto Austria (pick 6 out of 45), EuroMillionen, Powerball Lottery US, Mega Millions, Hot Lotto Sizzler

If you miss your favorite lottery system than could you add here.

Rückgabe:Daten
projectpath()[Quellcode]

open in the home path and create a direction.

Rückgabe:path of the project
readfile()[Quellcode]

read lottosystems.json

Rückgabe:Daten
writetofile()[Quellcode]

write lottosystems.json

Rückgabe:keine
pylottosimu.pylotto Modul
class LottoSimuDialog

Load the GUI and manage the signals for the program of the pyLottoSimu. Use the lottosimu_gui.ui

class drawlotto

simulate a lotto draw. draw the lotto numbers and give the draw text back

class pylottosimu.pylotto.DrawLotto(name='Lotto DE', max_draw=49, draw_numbers=6, with_addit=True, addit_numbers=1, sep_addit_numbers=True, max_addit=9, name_addition='Superzahl')[Quellcode]

Bases: PyQt5.QtCore.QObject

Simuliere eine Lottoziehung

Parameter:
  • name (string) – Name des Spiels
  • max_draw (int) – Anzahl der Nummern
  • draw_numbers (int) – Die Losnumern
  • with_addit (bool) – mit Zusatzzahlen
  • addit_numbers (int) – Die Zusatzzahlen
  • sep_addit_numbers (bool) – seperate Zusatzzahlen
  • max_addit (int) – Maximale Anzahl der Zusatzzahlen
draw()[Quellcode]

draw of the lotto numbers

Rückgabe:keine
picknumber(turn)[Quellcode]

pick of a lotto number

Rückgabe:pick
class pylottosimu.pylotto.LottoSimuDialog[Quellcode]

Bases: PyQt5.QtWidgets.QMainWindow

The GUI and program of the pyLottoSimu.

action_lottosim()[Quellcode]

Changing the layout for simulation or generation and change the visible of the buttons.

Rückgabe:keine
onbtn_draw_overview()[Quellcode]

show dialog of the draw

Rückgabe:keine
onbtn_start()[Quellcode]

Start simulation with the first drawing init timer with the valve from the Scrollbar the next drawing starts with the timer event.

Rückgabe:keine
onclean_output_text()[Quellcode]

Clean the output text

Rückgabe:keine
onclose()[Quellcode]

GUI beenden

Rückgabe:keine
oninfo()[Quellcode]

Set the text for the info message box in html format

Rückgabe:keine
onrandom_numbers_generator()[Quellcode]

Show the output from the random number generator.

Rückgabe:keine
onsystem()[Quellcode]

show dialog of the draw

Rückgabe:keine
ontimer()[Quellcode]

Start time to show a number.

Rückgabe:keine
static onwebsite()[Quellcode]

webseite öffnen

Rückgabe:keine
show_next_number()[Quellcode]

Simulation of the draw and show the next Number on the Screen.

Rückgabe:keine
pylottosimu.pylotto.qt_loadui(uifile)[Quellcode]

load Qt ui file

Parameter:uifile
Rückgabe:
Modulinhalte

Manage a Lotto simulation draw.

tests package

Submodules
tests.test_drawlotto module
class tests.test_drawlotto.DrawLottoTestCase(methodName='runTest')[Quellcode]

Bases: unittest.case.TestCase

Test the lotto draw with some input numbers

setUp()[Quellcode]

Init class pylotto.drawlotto

Rückgabe:none
test_draw()[Quellcode]

test draw without a additional number

Rückgabe:none
test_draw_addit()[Quellcode]

test draw with a additional number

Rückgabe:none
test_draw_addit_sep()[Quellcode]

test draw with a separate additional number

Rückgabe:none
test_drawone()[Quellcode]

test draw one number without a additional number

Rückgabe:none
test_drawthree()[Quellcode]

test draw three number without a additional number

Rückgabe:none
test_drawtwo()[Quellcode]

test draw two number without a additional number

Rückgabe:none
test_drawzero()[Quellcode]

test set draw to no number and make sure to set to one number

Rückgabe:none
test_setting()[Quellcode]

Test lotto.data

Rückgabe:none
tests.test_lottosettingdialog module

Test the dialog module

lottosettingdialog

Setup for testing, create the UI_lottosystem.py file:

cd dialog/ pyuic4 –output UI_lottosystem.py lottosystem.ui
class tests.test_lottosettingdialog.LottoSystemDataTestCase(methodName='runTest')[Quellcode]

Bases: unittest.case.TestCase

Test of drawing

setUp()[Quellcode]

Creates the QApplication instance

Rückgabe:none
tearDown()[Quellcode]

Deletes the reference owned by self

Rückgabe:none
test_dialog()[Quellcode]

test

tests.test_lottosystemdata module

Testcase for module pylottosimu.lottosystemdata

class tests.test_lottosystemdata.TestCodeFormat(methodName='runTest')[Quellcode]

Bases: unittest.case.TestCase

Test the code format of the file

setUp()[Quellcode]

load LottoSystemData

Rückgabe:
test_readfile()[Quellcode]

read the lottosystems.json file

tests.test_show_drawing module

Test the dialog module show_drawing

class tests.test_show_drawing.ShowDrawingTestCase(methodName='runTest')[Quellcode]

Bases: unittest.case.TestCase

Test of drawing

setUp()[Quellcode]

Creates the QApplication instance

tearDown()[Quellcode]

Deletes the reference owned by self

test_ballnumber()[Quellcode]

test with one ball numbers

test_bonusnumbers()[Quellcode]

test ball numbers and bonus numbers in a maximal draw of 5 numbers

test_bonusnumbersseparate()[Quellcode]

test separate bonus numbers

Rückgabe:none
test_highernumbers()[Quellcode]

test with higher draw numbers as the highest number in the draw in the ball numbers and in the bonus numbers

Rückgabe:none
test_samenumbers()[Quellcode]

test the same ball numbers and bonus numbers in a maximal draw of 5 numbers

Rückgabe:none
test_twoballnumber()[Quellcode]

test with two ball numbers

Module contents

test case

Indizes und Tabellen