index — aboutMe @ bb2862830ba3cd5525a5f172e1685fd84053c72f

Little GUI that generates small minesweeper fields, ready to be copied in a Discord-syntax

Initial commit
crispy-caesus testobjektc@gmail.com
Fri, 10 Nov 2023 15:18:16 +0100
commit

bb2862830ba3cd5525a5f172e1685fd84053c72f

122 files changed, 156 insertions(+), 0 deletions(-)

jump to
A .gitattributes

@@ -0,0 +1,2 @@

+# Auto detect text files and perform LF normalization +* text=auto
A LICENSE

@@ -0,0 +1,21 @@

+MIT License + +Copyright (c) 2023 crispy-caesus + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE.
A aboutMe.py

@@ -0,0 +1,132 @@

+from PyQt6.QtWidgets import QApplication, QWidget, QPushButton, QTextBrowser, QVBoxLayout +import sys +from PyQt6.QtGui import QIcon +import random +from pyperclip import copy + +class Window(QWidget): + def __init__(self): + super().__init__() + self.setWindowTitle("BANANAAAAAAAAAAAAAA") + self.setWindowIcon(QIcon("banan.jpg")) + self.setGeometry(500,300,400,300) + + stylesheet = ( + 'background-color:rgb(29, 29, 38); color:rgb(179, 179, 212)' + ) + self.setStyleSheet(stylesheet) + + self.create() + + def create(self): + self.tb = QTextBrowser(self) + self.btn = QPushButton('generate new field', self) + self.btn.clicked.connect(self.generate) + vbox = QVBoxLayout(self) + vbox.addWidget(self.tb) + vbox.addWidget(self.btn) + + self.setLayout(vbox) + + self.show() + + self.generate() + + + def generate(self): + field = [[],[],[],[]] + for i in range(0, 4): + for j in range(0, 4): + if random.randint(0,100) < 26: + field[i].append(-1) + + else: + field[i].append(0) + + for i in range(0, 4): + for j in range(0, 4): + if field[i][j] != -1: + if j != 3: + if field[i][j+1] == -1: + field[i][j] = field[i][j] + 1 + if j != 0: + if field[i][j-1] == -1: + field[i][j] = field[i][j] + 1 + if i != 0: + if field[i-1][j] == -1: + field[i][j] = field[i][j] + 1 + if j != 0: + if field[i-1][j-1] == -1: + field[i][j] = field[i][j] + 1 + if j != 3: + if field[i-1][j+1] == -1: + field[i][j] = field[i][j] + 1 + if i != 3: + if field[i+1][j] == -1: + field[i][j] = field[i][j] + 1 + if j != 0: + if field[i+1][j-1] == -1: + field[i][j] = field[i][j] + 1 + if j != 3: + if field[i+1][j+1] == -1: + field[i][j] = field[i][j] + 1 + self.fieldd = field + self.visualize() + + def visualize(self): + self.tb.clear() + field = '' + for i in range(0, len(self.fieldd)): + for j in self.fieldd[i]: + if j == -1: + field = field + '💣' + if j == 0: + field = field + '0 ' + if j == 1: + field = field + '1️ ' + if j == 2: + field = field + '2️ ' + if j == 3: + field = field + '3️ ' + if j == 4: + field = field + '4️ ' + if j == 5: + field = field + '5️ ' + if j == 6: + field = field + '6️ ' + if j == 7: + field = field + '7️ ' + if j == 8: + field = field + '8️ ' + field = field + '\n' + text = '' + for i in range(0, len(self.fieldd)): + for j in self.fieldd[i]: + if j == -1: + text = text + '||:bomb:||' + if j == 0: + text = text + '||:zero:||' + if j == 1: + text = text + '||:one:||' + if j == 2: + text = text + '||:two:||' + if j == 3: + text = text + '||:three:||' + if j == 4: + text = text + '||:four:||' + if j == 5: + text = text + '||:five:||' + if j == 6: + text = text + '||:six:||' + if j == 7: + text = text + '||:seven:||' + if j == 8: + text = text + '||:eight:||' + text = text + '\n' + copy(text) + self.tb.append(field) + +app = QApplication([]) +window = Window() +window.show() +sys.exit(app.exec())
A aboutMe/PyQt6/Qt6/translations/qtbase_en.qm

@@ -0,0 +1,1 @@

+<d!`