diff --git a/python/ShippingTracker-1.5.py b/python/ShippingTracker-1.5.py new file mode 100644 index 0000000..9123adf --- /dev/null +++ b/python/ShippingTracker-1.5.py @@ -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() diff --git a/python/beep.wav b/python/beep.wav new file mode 100644 index 0000000..c0e5a35 Binary files /dev/null and b/python/beep.wav differ diff --git a/python/sailboat_26f5.png b/python/sailboat_26f5.png new file mode 100644 index 0000000..f95bd71 Binary files /dev/null and b/python/sailboat_26f5.png differ