Skip to content

Commit 7048947

Browse files
authored
add QRCodeGenerator
1 parent 2759d4c commit 7048947

12 files changed

+4116
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
{
2+
"chain": [
3+
{
4+
"phase": "DemandAnalysis",
5+
"phaseType": "SimplePhase",
6+
"max_turn_step": -1,
7+
"need_reflect": "True"
8+
},
9+
{
10+
"phase": "LanguageChoose",
11+
"phaseType": "SimplePhase",
12+
"max_turn_step": -1,
13+
"need_reflect": "True"
14+
},
15+
{
16+
"phase": "Coding",
17+
"phaseType": "SimplePhase",
18+
"max_turn_step": 1,
19+
"need_reflect": "False"
20+
},
21+
{
22+
"phase": "CodeCompleteAll",
23+
"phaseType": "ComposedPhase",
24+
"cycleNum": 10,
25+
"Composition": [
26+
{
27+
"phase": "CodeComplete",
28+
"phaseType": "SimplePhase",
29+
"max_turn_step": 1,
30+
"need_reflect": "False"
31+
}
32+
]
33+
},
34+
{
35+
"phase": "CodeReview",
36+
"phaseType": "ComposedPhase",
37+
"cycleNum": 3,
38+
"Composition": [
39+
{
40+
"phase": "CodeReviewComment",
41+
"phaseType": "SimplePhase",
42+
"max_turn_step": 1,
43+
"need_reflect": "False"
44+
},
45+
{
46+
"phase": "CodeReviewModification",
47+
"phaseType": "SimplePhase",
48+
"max_turn_step": 1,
49+
"need_reflect": "False"
50+
}
51+
]
52+
},
53+
{
54+
"phase": "Test",
55+
"phaseType": "ComposedPhase",
56+
"cycleNum": 3,
57+
"Composition": [
58+
{
59+
"phase": "TestErrorSummary",
60+
"phaseType": "SimplePhase",
61+
"max_turn_step": 1,
62+
"need_reflect": "False"
63+
},
64+
{
65+
"phase": "TestModification",
66+
"phaseType": "SimplePhase",
67+
"max_turn_step": 1,
68+
"need_reflect": "False"
69+
}
70+
]
71+
},
72+
{
73+
"phase": "EnvironmentDoc",
74+
"phaseType": "SimplePhase",
75+
"max_turn_step": 1,
76+
"need_reflect": "True"
77+
},
78+
{
79+
"phase": "Manual",
80+
"phaseType": "SimplePhase",
81+
"max_turn_step": 1,
82+
"need_reflect": "False"
83+
}
84+
],
85+
"recruitments": [
86+
"Chief Executive Officer",
87+
"Counselor",
88+
"Chief Human Resource Officer",
89+
"Chief Product Officer",
90+
"Chief Technology Officer",
91+
"Programmer",
92+
"Code Reviewer",
93+
"Software Test Engineer",
94+
"Chief Creative Officer"
95+
],
96+
"clear_structure": "True",
97+
"brainstorming": "False",
98+
"gui_design": "True",
99+
"git_management": "False",
100+
"self_improve": "False"
101+
}

Diff for: WareHouse/QRCodeGenerator_THUNLP_20231015214731/PhaseConfig.json

+277
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Write a Python program that generates QR codes. Your program should take user input for the data or text that needs to be encoded in the QR code. It should then use a suitable library or package to generate a QR code image from the input data. Finally, the program should save the QR code image to a file, allowing the user to specify the file name and format (e.g., PNG, JPG).Make sure to provide a user-friendly interface that guides the user through the process of inputting the data and specifying the file name and format for the QR code image. Test your program with various inputs to ensure it generates valid QR codes and handles different data types gracefully.

Diff for: WareHouse/QRCodeGenerator_THUNLP_20231015214731/QRCodeGenerator_THUNLP_20231015214731.log

+3,530
Large diffs are not rendered by default.
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"Chief Executive Officer": [
3+
"{chatdev_prompt}",
4+
"You are Chief Executive Officer. Now, we are both working at ChatDev and we share a common interest in collaborating to successfully complete a task assigned by a new customer.",
5+
"Your main responsibilities include being an active decision-maker on users' demands and other key policy issues, leader, manager, and executor. Your decision-making role involves high-level decisions about policy and strategy; and your communicator role can involve speaking to the organization's management and employees.",
6+
"Here is a new customer's task: {task}.",
7+
"To complete the task, I will give you one or more instructions, and you must help me to write a specific solution that appropriately solves the requested instruction based on your expertise and my needs."
8+
],
9+
"Chief Product Officer": [
10+
"{chatdev_prompt}",
11+
"You are Chief Product Officer. we are both working at ChatDev. We share a common interest in collaborating to successfully complete a task assigned by a new customer.",
12+
"You are responsible for all product-related matters in ChatDev. Usually includes product design, product strategy, product vision, product innovation, project management and product marketing.",
13+
"Here is a new customer's task: {task}.",
14+
"To complete the task, you must write a response that appropriately solves the requested instruction based on your expertise and customer's needs."
15+
],
16+
"Counselor": [
17+
"{chatdev_prompt}",
18+
"You are Counselor. Now, we share a common interest in collaborating to successfully complete a task assigned by a new customer.",
19+
"Your main responsibilities include asking what user and customer think and provide your valuable suggestions. ",
20+
"Here is a new customer's task: {task}.",
21+
"To complete the task, I will give you one or more instructions, and you must help me to write a specific solution that appropriately solves the requested instruction based on your expertise and my needs."
22+
],
23+
"Chief Technology Officer": [
24+
"{chatdev_prompt}",
25+
"You are Chief Technology Officer. we are both working at ChatDev. We share a common interest in collaborating to successfully complete a task assigned by a new customer.",
26+
"You are very familiar to information technology. You will make high-level decisions for the overarching technology infrastructure that closely align with the organization's goals, while you work alongside the organization's information technology (\"IT\") staff members to perform everyday operations.",
27+
"Here is a new customer's task: {task}.",
28+
"To complete the task, You must write a response that appropriately solves the requested instruction based on your expertise and customer's needs."
29+
],
30+
"Chief Human Resource Officer": [
31+
"{chatdev_prompt}",
32+
"You are Chief Human Resource Officer. Now, we are both working at ChatDev and we share a common interest in collaborating to successfully complete a task assigned by a new customer.",
33+
"You are a corporate officer who oversees all aspects of human resource management and industrial relations policies, practices and operations for an organization. You will be involved in board staff recruitment, member selection, executive compensation, and succession planning. Besides, You report directly to the chief executive officer (CEO) and am a member of the most senior-level committees of a company (e.g., executive committee or office of CEO).",
34+
"Here is a new customer's task: {task}.",
35+
"To complete the task, you must write a response that appropriately solves the requested instruction based on your expertise and customer's needs."
36+
],
37+
"Programmer": [
38+
"{chatdev_prompt}",
39+
"You are Programmer. we are both working at ChatDev. We share a common interest in collaborating to successfully complete a task assigned by a new customer.",
40+
"You can write/create computer software or applications by providing a specific programming language to the computer. You have extensive computing and coding experience in many varieties of programming languages and platforms, such as Python, Java, C, C++, HTML, CSS, JavaScript, XML, SQL, PHP, etc,.",
41+
"Here is a new customer's task: {task}.",
42+
"To complete the task, you must write a response that appropriately solves the requested instruction based on your expertise and customer's needs."
43+
],
44+
"Code Reviewer": [
45+
"{chatdev_prompt}",
46+
"You are Code Reviewer. we are both working at ChatDev. We share a common interest in collaborating to successfully complete a task assigned by a new customer.",
47+
"You can help programmers to assess source codes for software troubleshooting, fix bugs to increase code quality and robustness, and offer proposals to improve the source codes.",
48+
"Here is a new customer's task: {task}.",
49+
"To complete the task, you must write a response that appropriately solves the requested instruction based on your expertise and customer's needs."
50+
],
51+
"Software Test Engineer": [
52+
"{chatdev_prompt}",
53+
"You are Software Test Engineer. we are both working at ChatDev. We share a common interest in collaborating to successfully complete a task assigned by a new customer.",
54+
"You can use the software as intended to analyze its functional properties, design manual and automated test procedures to evaluate each software product, build and implement software evaluation test programs, and run test programs to ensure that testing protocols evaluate the software correctly.",
55+
"Here is a new customer's task: {task}.",
56+
"To complete the task, you must write a response that appropriately solves the requested instruction based on your expertise and customer's needs."
57+
],
58+
"Chief Creative Officer": [
59+
"{chatdev_prompt}",
60+
"You are Chief Creative Officer. we are both working at ChatDev. We share a common interest in collaborating to successfully complete a task assigned by a new customer.",
61+
"You direct ChatDev's creative software's and develop the artistic design strategy that defines the company's brand. You create the unique image or music of our produced software's and deliver this distinctive design to consumers to create a clear brand image which is a fundamental and essential work throughout the company.",
62+
"Here is a new customer's task: {task}.",
63+
"To complete the task, you must write a response that appropriately solves the requested instruction based on your expertise and customer's needs."
64+
]
65+
}
635 Bytes
Loading
+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
'''
2+
This is the main file that contains the user interface and orchestrates the generation of QR codes.
3+
'''
4+
import tkinter as tk
5+
from tkinter import filedialog, messagebox
6+
import qrcode
7+
class QRCodeGenerator:
8+
def __init__(self, root):
9+
self.root = root
10+
self.root.title("QR Code Generator")
11+
self.data_label = tk.Label(root, text="Enter data or text:")
12+
self.data_label.pack()
13+
self.data_entry = tk.Entry(root)
14+
self.data_entry.pack()
15+
self.file_label = tk.Label(root, text="Choose file name and format:")
16+
self.file_label.pack()
17+
self.file_entry = tk.Entry(root)
18+
self.file_entry.pack()
19+
self.file_button = tk.Button(root, text="Choose File", command=self.choose_file)
20+
self.file_button.pack()
21+
self.generate_button = tk.Button(root, text="Generate QR Code", command=self.generate_qr_code)
22+
self.generate_button.pack()
23+
def choose_file(self):
24+
file_path = filedialog.asksaveasfilename(defaultextension=".png")
25+
self.file_entry.delete(0, tk.END)
26+
self.file_entry.insert(0, file_path)
27+
def generate_qr_code(self):
28+
data = self.data_entry.get()
29+
file_path = self.file_entry.get()
30+
if data and file_path:
31+
qr = qrcode.QRCode(version=1, box_size=10, border=5)
32+
qr.add_data(data)
33+
qr.make(fit=True)
34+
qr_img = qr.make_image(fill="black", back_color="white")
35+
qr_img.save(file_path)
36+
messagebox.showinfo("Success", "QR Code generated and saved successfully!")
37+
else:
38+
messagebox.showerror("Error", "Please enter data and choose a file name.")
39+
root = tk.Tk()
40+
app = QRCodeGenerator(root)
41+
root.mainloop()
+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# QR Code Generator User Manual
2+
3+
## Introduction
4+
5+
The QR Code Generator is a Python program that allows users to generate QR codes from text or data input. The program provides a user-friendly interface that guides the user through the process of inputting the data and specifying the file name and format for the QR code image. The generated QR code image can be saved to a file in various formats such as PNG or JPG.
6+
7+
## Installation
8+
9+
To use the QR Code Generator, you need to have Python installed on your system. You can download Python from the official website: https://www.python.org/downloads/
10+
11+
Once Python is installed, you can install the required dependencies by running the following command in your terminal or command prompt:
12+
13+
```
14+
pip install -r requirements.txt
15+
```
16+
17+
## Usage
18+
19+
To use the QR Code Generator, follow these steps:
20+
21+
1. Open a terminal or command prompt.
22+
2. Navigate to the directory where the program files are located.
23+
3. Run the following command to start the program:
24+
25+
```
26+
python main.py
27+
```
28+
29+
4. The program will open a window with a user interface.
30+
5. Enter the text or data that you want to encode in the QR code in the "Enter data or text" field.
31+
6. Choose a file name and format for the QR code image by clicking the "Choose File" button. By default, the file format is set to PNG.
32+
7. Click the "Generate QR Code" button to generate the QR code image.
33+
8. The program will save the QR code image to the specified file.
34+
9. A message box will appear indicating whether the QR code was generated and saved successfully.
35+
36+
## Examples
37+
38+
Here are some examples of how to use the QR Code Generator:
39+
40+
### Example 1: Generating a QR code from text input
41+
42+
1. Open the QR Code Generator program.
43+
2. Enter the text "Hello, World!" in the "Enter data or text" field.
44+
3. Choose a file name and format for the QR code image.
45+
4. Click the "Generate QR Code" button.
46+
5. The program will save the QR code image to the specified file.
47+
48+
### Example 2: Generating a QR code from data input
49+
50+
1. Open the QR Code Generator program.
51+
2. Enter the data "1234567890" in the "Enter data or text" field.
52+
3. Choose a file name and format for the QR code image.
53+
4. Click the "Generate QR Code" button.
54+
5. The program will save the QR code image to the specified file.
55+
56+
## Conclusion
57+
58+
The QR Code Generator is a user-friendly Python program that allows users to generate QR codes from text or data input. It provides a simple and intuitive interface for generating QR codes and saving them to files. With the QR Code Generator, you can easily create QR codes for various purposes such as sharing information or promoting your business.
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
Task:
2+
Write a Python program that generates QR codes. Your program should take user input for the data or text that needs to be encoded in the QR code. It should then use a suitable library or package to generate a QR code image from the input data. Finally, the program should save the QR code image to a file, allowing the user to specify the file name and format (e.g., PNG, JPG).Make sure to provide a user-friendly interface that guides the user through the process of inputting the data and specifying the file name and format for the QR code image. Test your program with various inputs to ensure it generates valid QR codes and handles different data types gracefully.
3+
4+
Config:
5+
ChatEnvConfig.clear_structure: True
6+
ChatEnvConfig.brainstorming: False
7+
8+
9+
Roster:
10+
Chief Executive Officer, Counselor, Chief Human Resource Officer, Chief Product Officer, Chief Technology Officer, Programmer, Code Reviewer, Software Test Engineer, Chief Creative Officer
11+
12+
Modality:
13+
command line interface
14+
15+
Ideas:
16+
17+
18+
Language:
19+
Python
20+
21+
Code_Version:
22+
5.0
23+
24+
Proposed_images:
25+
0
26+
27+
Incorporated_images:
28+
0
29+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
'''
2+
This file contains the QRCodeGenerator class responsible for generating QR codes.
3+
'''
4+
import qrcode
5+
class QRCodeGenerator:
6+
def __init__(self, data):
7+
self.data = data
8+
def generate_qr_code(self, file_path):
9+
qr = qrcode.QRCode(version=1, box_size=10, border=5)
10+
qr.add_data(self.data)
11+
qr.make(fit=True)
12+
qr_img = qr.make_image(fill="black", back_color="white")
13+
qr_img.save(file_path)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
qrcode==7.3

0 commit comments

Comments
 (0)