- create setup.py file
Eg:
from setuptools import setup
with open("Readme.md", 'r') as f:
long_description = f.read()
setup(| import sys | |
| import os | |
| from PyQt5 import QtWidgets, QtGui | |
| class SampleWidget(QtWidgets.QWidget): | |
| def __init__(self, *args, **kwargs): | |
| super(SampleWidget, self).__init__(*args, **kwargs) | |
| import sys | |
| from PyQt5 import QtWidgets, QtGui, QtCore | |
| class CustomLabel(QtWidgets.QLabel): | |
| def __init__(self, *args, **kwargs): | |
| super(CustomLabel, self).__init__(*args, **kwargs) | |
| self.start_point = QtCore.QPoint(0, 0) # This is x, y point, we will use Qpoint to represent it | |
| self.end_point = QtCore.QPoint(0, 0) # The QPoint will only take two integers, QPointF for floating point |
| import sys | |
| from PyQt5 import QtWidgets, QtCore, QtGui | |
| class ClickableLabel(QtWidgets.QLabel): | |
| # you will have to specify how many arguments and the type of the argument(eg: bool, int, str), in | |
| # our case we will use QPoint to pass mouse position. | |
| # All your signals must be class level, not object level/instance level. | |
| clicked = QtCore.pyqtSignal(QtCore.QPoint) |
| import sys | |
| from PyQt5 import QtWidgets, QtCore | |
| class CustomTimer(QtCore.QThread): | |
| countDownUpdated = QtCore.pyqtSignal(int) # whenever the countdown changes this signal get emitted | |
| def __init__(self, count_down, sleep=1000, *args, **kwargs): | |
| super(CustomTimer, self).__init__(*args, **kwargs) |
| import sys | |
| from PyQt5 import QtGui, QtWidgets | |
| if __name__ == "__main__": | |
| app = QtWidgets.QApplication(sys.argv) | |
| view = QtWidgets.QGraphicsView() | |
| scene = QtWidgets.QGraphicsScene() |
| while True: | |
| for event in event_queue: | |
| if event == "quit": | |
| break | |
| elif event == "button_press": | |
| update_button() | |
| import sys | |
| from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QPushButton, QGridLayout | |
| app = QApplication(sys.argv) | |
| widget = QWidget() | |
| grid_layout = QGridLayout() | |
| label = QLabel("Sample label") | |
| button = QPushButton("Button") # create an instance of QPushbutton |
Eg:
from setuptools import setup
with open("Readme.md", 'r') as f:
long_description = f.read()
setup(| # used to generate file overview | |
| import os | |
| ignore_dirs = ['.git'] | |
| ignore_files = ['.env'] | |
| def path_tree(root, inner=0): | |
| for dir in os.listdir(root): | |
| # print("DIR: ", root, dirs, files) |
This is a gist for data validation for cloud firestore nosql db.
The function takes 2 parameter a datastructure and data, the datastructure that contains all the validation fields such as minlength, default, required etc, it is as show in the Example datastructure. The data is the data passed by user that will be validated
def clean_data(data_structure, data, update=False):
"""