diff --git a/gui/__main__.py b/gui/__main__.py index 988113b..f77dbe7 100755 --- a/gui/__main__.py +++ b/gui/__main__.py @@ -8984,7 +8984,7 @@ class TicketDataLossPopup(QWidget): self.initUI() def initUI(self): - self.setFixedSize(640, 330) + self.setFixedSize(640, 380) self.setWindowFlags(Qt.WindowType.FramelessWindowHint) self.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground) @@ -9067,6 +9067,40 @@ class TicketDataLossPopup(QWidget): message_label.setStyleSheet("border: none; background: transparent;") content.addWidget(message_label, 1) + copy_row = QHBoxLayout() + copy_row.addStretch() + + self.copy_button = QPushButton("Copy Billing Code") + self.copy_button.setFixedSize(200, 36) + self.copy_button.setFont(QFont("Arial", 10, QFont.Weight.Bold)) + self.copy_button.setCursor(Qt.CursorShape.PointingHandCursor) + self._copy_button_default_style = """ + QPushButton { + background-color: #ffffff; + border: 2px solid #ff4d4d; + color: #ff4d4d; + border-radius: 6px; + padding: 0 12px; + } + QPushButton:hover { + background-color: #fff0f0; + } + """ + self._copy_button_copied_style = """ + QPushButton { + background-color: #28a745; + border: 2px solid #28a745; + color: white; + border-radius: 6px; + padding: 0 12px; + } + """ + self.copy_button.setStyleSheet(self._copy_button_default_style) + self.copy_button.clicked.connect(self._on_copy_billing_code) + copy_row.addWidget(self.copy_button) + copy_row.addStretch() + content.addLayout(copy_row) + button_row = QHBoxLayout() button_row.addStretch() @@ -9095,6 +9129,16 @@ class TicketDataLossPopup(QWidget): self.finished.emit() self.close() + def _on_copy_billing_code(self): + QApplication.clipboard().setText(self.billing_code) + self.copy_button.setText("Copied!") + self.copy_button.setStyleSheet(self._copy_button_copied_style) + QTimer.singleShot(1500, self._reset_copy_button) + + def _reset_copy_button(self): + self.copy_button.setText("Copy Billing Code") + self.copy_button.setStyleSheet(self._copy_button_default_style) + def mousePressEvent(self, event): self.oldPos = event.globalPosition().toPoint()