Initial commit
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# Project exclude paths
|
||||||
|
/venv/
|
||||||
BIN
10.10.10.1.jpg
Normal file
BIN
10.10.10.1.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
BIN
10.10.10.2.jpg
Normal file
BIN
10.10.10.2.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
BIN
10.10.60.22.jpg
Normal file
BIN
10.10.60.22.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 967 B |
BIN
10.10.90.120.jpg
Normal file
BIN
10.10.90.120.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
68
gui_src/mainwindow.ui
Normal file
68
gui_src/mainwindow.ui
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>Form</class>
|
||||||
|
<widget class="QWidget" name="Form">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>537</width>
|
||||||
|
<height>376</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="gridLayoutWidget">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>10</y>
|
||||||
|
<width>521</width>
|
||||||
|
<height>351</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QLineEdit" name="lineEdit_3"/>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Введите имя сервера</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QLineEdit" name="lineEdit_2"/>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLineEdit" name="lineEdit"/>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Введите Ip-адрес</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Выбрерите ОС</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0" colspan="2">
|
||||||
|
<widget class="QPushButton" name="pushButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Сгенерировать QR Code</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
84
mainwindow.py
Normal file
84
mainwindow.py
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from PySide2 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
class QrGenerator(QtWidgets.QWidget):
|
||||||
|
def __init__(self):
|
||||||
|
super(QrGenerator, self).__init__()
|
||||||
|
self.setupUi(self)
|
||||||
|
|
||||||
|
def setupUi(self, Form):
|
||||||
|
Form.setObjectName("Form")
|
||||||
|
Form.resize(537, 376)
|
||||||
|
self.gridLayoutWidget = QtWidgets.QWidget(Form)
|
||||||
|
self.gridLayoutWidget.setGeometry(QtCore.QRect(10, 10, 521, 351))
|
||||||
|
self.gridLayoutWidget.setObjectName("gridLayoutWidget")
|
||||||
|
self.gridLayout = QtWidgets.QGridLayout(self.gridLayoutWidget)
|
||||||
|
self.gridLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.gridLayout.setObjectName("gridLayout")
|
||||||
|
self.lineEdit_3 = QtWidgets.QLineEdit(self.gridLayoutWidget)
|
||||||
|
self.lineEdit_3.setObjectName("lineEdit_3")
|
||||||
|
self.gridLayout.addWidget(self.lineEdit_3, 3, 1, 1, 1)
|
||||||
|
self.label_2 = QtWidgets.QLabel(self.gridLayoutWidget)
|
||||||
|
self.label_2.setObjectName("label_2")
|
||||||
|
self.gridLayout.addWidget(self.label_2, 2, 0, 1, 1)
|
||||||
|
self.lineEdit_2 = QtWidgets.QLineEdit(self.gridLayoutWidget)
|
||||||
|
self.lineEdit_2.setObjectName("lineEdit_2")
|
||||||
|
self.gridLayout.addWidget(self.lineEdit_2, 2, 1, 1, 1)
|
||||||
|
self.lineEdit = QtWidgets.QLineEdit(self.gridLayoutWidget)
|
||||||
|
self.lineEdit.setObjectName("lineEdit")
|
||||||
|
self.gridLayout.addWidget(self.lineEdit, 0, 1, 1, 1)
|
||||||
|
self.label = QtWidgets.QLabel(self.gridLayoutWidget)
|
||||||
|
self.label.setObjectName("label")
|
||||||
|
self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
|
||||||
|
self.label_3 = QtWidgets.QLabel(self.gridLayoutWidget)
|
||||||
|
self.label_3.setObjectName("label_3")
|
||||||
|
self.gridLayout.addWidget(self.label_3, 3, 0, 1, 1)
|
||||||
|
self.pushButton = QtWidgets.QPushButton(self.gridLayoutWidget)
|
||||||
|
self.pushButton.setObjectName("pushButton")
|
||||||
|
self.gridLayout.addWidget(self.pushButton, 4, 0, 1, 2)
|
||||||
|
|
||||||
|
self.retranslateUi(Form)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(Form)
|
||||||
|
self.pushButton.clicked.connect(self.generate)
|
||||||
|
|
||||||
|
def generate(self):
|
||||||
|
import qrcode
|
||||||
|
# Create qr code instance
|
||||||
|
self.qr = qrcode.QRCode(
|
||||||
|
version=1,
|
||||||
|
error_correction=qrcode.constants.ERROR_CORRECT_H,
|
||||||
|
box_size=10,
|
||||||
|
border=4,
|
||||||
|
)
|
||||||
|
|
||||||
|
self.qr.add_data(self.lineEdit.text()+"\n")
|
||||||
|
self.qr.add_data(self.lineEdit_2.text()+"\n")
|
||||||
|
self.qr.add_data(self.lineEdit_3.text()+"\n")
|
||||||
|
self.qr.make(fit=True)
|
||||||
|
|
||||||
|
img = self.qr.make_image()
|
||||||
|
|
||||||
|
# Save it somewhere, change the extension as needed:
|
||||||
|
# img.save("image.png")
|
||||||
|
# img.save("image.bmp")
|
||||||
|
# img.save("image.jpeg")
|
||||||
|
self.name = self.lineEdit.text() + ".jpg"
|
||||||
|
img.save(self.name)
|
||||||
|
|
||||||
|
def retranslateUi(self, Form):
|
||||||
|
Form.setWindowTitle(QtWidgets.QApplication.translate("Form", "Генератор", None, -1))
|
||||||
|
self.label_2.setText(QtWidgets.QApplication.translate("Form", "Введите имя сервера", None, -1))
|
||||||
|
self.label.setText(QtWidgets.QApplication.translate("Form", "Введите Ip-адрес", None, -1))
|
||||||
|
self.label_3.setText(QtWidgets.QApplication.translate("Form", "Выбрерите ОС", None, -1))
|
||||||
|
self.pushButton.setText(QtWidgets.QApplication.translate("Form", "Сгенерировать QR Code", None, -1))
|
||||||
|
|
||||||
|
def runPage():
|
||||||
|
import sys
|
||||||
|
app = QtWidgets.QApplication(sys.argv)
|
||||||
|
nw = QrGenerator()
|
||||||
|
nw.show()
|
||||||
|
sys.exit(app.exec_())
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
runPage()
|
||||||
Reference in New Issue
Block a user