update: added copy button for billing code

This commit is contained in:
JOhn 2026-05-12 14:05:44 -04:00
parent f7a2aba9b3
commit 4a1c3b9082

View file

@ -8984,7 +8984,7 @@ class TicketDataLossPopup(QWidget):
self.initUI() self.initUI()
def initUI(self): def initUI(self):
self.setFixedSize(640, 330) self.setFixedSize(640, 380)
self.setWindowFlags(Qt.WindowType.FramelessWindowHint) self.setWindowFlags(Qt.WindowType.FramelessWindowHint)
self.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground) self.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground)
@ -9067,6 +9067,40 @@ class TicketDataLossPopup(QWidget):
message_label.setStyleSheet("border: none; background: transparent;") message_label.setStyleSheet("border: none; background: transparent;")
content.addWidget(message_label, 1) 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 = QHBoxLayout()
button_row.addStretch() button_row.addStretch()
@ -9095,6 +9129,16 @@ class TicketDataLossPopup(QWidget):
self.finished.emit() self.finished.emit()
self.close() 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): def mousePressEvent(self, event):
self.oldPos = event.globalPosition().toPoint() self.oldPos = event.globalPosition().toPoint()