Upload files to "python"

Recreated Shipping tracker in python
This commit is contained in:
2024-06-26 23:42:55 +10:00
parent 91f5f58ee3
commit 3464dd8243
3 changed files with 85 additions and 0 deletions

View File

@@ -0,0 +1,85 @@
import sys
import pyperclip
import urllib.parse
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QHBoxLayout, QLabel, QLineEdit, QPushButton
from PyQt5.QtGui import QIcon
from PyQt5.QtMultimedia import QSound
class URLApp(QWidget):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.setWindowTitle('Shipping Tracker - 1.5')
# Set the dimensions of the window: (x, y, width, height)
self.setGeometry(100, 100, 900, 125)
# Set window icon
self.setWindowIcon(QIcon('sailboat_26f5.png'))
main_layout = QVBoxLayout()
lblRMA = QLabel('RMA or Shipping Number:', self)
main_layout.addWidget(lblRMA)
self.txtRMA = QLineEdit(self)
main_layout.addWidget(self.txtRMA)
# Create a horizontal layout for the buttons
button_layout = QHBoxLayout()
btnBaseURL1 = QPushButton('TNT Customer Refrance', self)
btnBaseURL1.clicked.connect(lambda: self.on_click('https://www.tnt.com/express/en_au/site/shipping-tools/tracking.html?searchType=ref&cons='))
button_layout.addWidget(btnBaseURL1)
btnBaseURL2 = QPushButton('TNT Shipping Number', self)
btnBaseURL2.clicked.connect(lambda: self.on_click('https://www.tnt.com/express/en_au/site/shipping-tools/tracking.html?searchType=con&cons='))
button_layout.addWidget(btnBaseURL2)
btnBaseURL3 = QPushButton('FedEx Shipping Number', self)
btnBaseURL3.clicked.connect(lambda: self.on_click('https://www.fedex.com/fedextrack/?trknbr='))
button_layout.addWidget(btnBaseURL3)
# Add the button layout to the main layout
main_layout.addLayout(button_layout)
self.txtFinalUrl = QLineEdit(self)
main_layout.addWidget(self.txtFinalUrl)
lblCopy = QLabel('Clicking on a button will copy the RMA URL to your clipboard', self)
main_layout.addWidget(lblCopy)
self.setLayout(main_layout)
def on_click(self, baseURL):
rawRMA = self.txtRMA.text()
encodedRMA = urllib.parse.quote(rawRMA)
finalURL = baseURL + encodedRMA
self.txtFinalUrl.setText(finalURL)
pyperclip.copy(finalURL)
# Play sound after copying to clipboard
self.play_notification_sound()
def play_notification_sound(self):
# Load and play notification sound (replace 'notification.wav' with your sound file)
QSound.play('beep.wav')
def main():
app = QApplication(sys.argv)
# Set the application icon
app.setWindowIcon(QIcon('sailboat_26f5.png'))
ex = URLApp()
ex.show()
sys.exit(app.exec_())
if __name__ == '__main__':
main()

BIN
python/beep.wav Normal file

Binary file not shown.

BIN
python/sailboat_26f5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB