First of all, I am building my first project with Cursor. I have subscribed to Cursor Pro. I am working on a PDF renaming desktop app. I want to rename PDFs based on the information that is contained within them. We have uniform formats that will have the info within the Docs. I had Gemini help me with the Prompt below. I copy and pasted into the Chat window about 16 hours ago and cursor is still spinning to write the code. Did I ask too much in one shot or are my expectations too high?
âPersona and Goal
You are a senior Python developer specializing in building cross-platform desktop applications. Your task is to build a self-contained, executable desktop application for a customer. You will implement the user interface, file handling, PDF text extraction, and file renaming logic exactly as described. You will not make any assumptions or deviate from the provided requirements.
Project Stack & Libraries
-
Primary Language: Python
-
Desktop Framework: [Suggestion: Use
PyQt
orTkinter
for a simpler UI.PyQt
is recommended for a cleaner, more modern look.] -
PDF Library:
PyMuPDF
orpdfplumber
to extract text from the PDF. You will analyze the document to determine which library is most suitable. -
File Handling: Standard Python libraries (
os
,shutil
,re
) for file operations and regular expressions. -
Packaging:
PyInstaller
to create a single-file executable.
Core Functionality
The application will have the following user flow and features:
-
Loading Screen:
-
On startup, clear the screen.
-
Display âWarr Machine-PDF Convertor. Created by RPJ Industries, Inc.â
-
Display the company logo below the text. (You will need to provide the logo file or a placeholder URL for the AI to reference).
-
Show a spinning wheel or progress indicator.
-
This screen will transition to the main menu when the application is ready.
-
-
Main Menu:
-
Display âWarr Machine-PDF Convertor. Created by RPJ Industries, Inc.â and the logo at the top of the screen.
-
Show three buttons centered on the page: âPreview,â âClaim,â and âCredit Memo.â
-
Clicking any of these buttons will clear the screen and proceed to the next step.
-
-
File Input Screen:
-
Display âWarr Machine-PDF Convertor. Created by RPJ Industries, Inc.â and the logo at the top of the screen.
-
Present a box where users can drag and drop a single PDF file.
-
Provide a button labeled âSelect Fileâ to open a file browser for uploading a document.
-
A âRenameâ button will be present but will only become active once a file is loaded.
-
The renaming process will begin when the user clicks âRenameâ or hits the âEnterâ key after a file is loaded.
-
-
Renaming Logic:
-
Based on the userâs initial button selection, the program will perform the following searches within the uploaded PDFâs text:
-
If âPreviewâ was selected:
-
Search for âKey Part #:â and âWork Order #:â
-
Rename format:
key part#_work order#_Preview.pdf
-
-
If âClaimâ was selected:
-
Search for âFailed Part:â and âWork Order 1:â and âClaim Number:â
-
Rename format:
Failed Part_Work Order1_Claim Number_CL.pdf
-
-
If âCredit Memoâ was selected:
-
Search for âFailed Part:â and âDealer Work Order 1:â and âJohn Deere Claim No:â
-
Rename format:
Failed Part_Dealer Work Order1_John Deere Claim No_CM.pdf
-
-
You will use regular expressions to accurately extract the values following these labels, ensuring they are correctly captured for the new filename.
-
The final renamed file will be saved to the userâs desktop
Downloads
directory.
-
-
Completion Screen:
-
Clear the screen and display the same header and logo.
-
Display the message âRenaming is complete.â
-
Show the newly named PDF file on the screen.
-
The user should be able to drag this file directly from the applicationâs UI to a folder on their desktop.
-
Two buttons will be displayed at the bottom of the screen:
-
âNext Documentâ will return the user to the main menu (step 2).
-
âQuitâ will exit the application.
-
-
Implementation Plan
Your first step is to set up the project structure and create the necessary boilerplate for a standalone desktop application using Python. Please create the following:
-
A main Python file (
app.py
). -
A basic
requirements.txt
listing the necessary libraries (PyQt
,PyMuPDF
,PyInstaller
). -
A simple, functional UI for the loading screen (step 1) and the main menu (step 2) to demonstrate the applicationâs basic flow.
-
Include placeholders for the logo and the UI elements for the subsequent steps.
-
Use clear, well-commented code that adheres to standard Python best practices.