Skip to content

Commit

Permalink
Fix clipboard bug
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreRochard committed Sep 6, 2021
1 parent dc592c7 commit c8d249a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion node_launcher/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
(
6,
0,
8
9
)
)
)
Expand Down
4 changes: 2 additions & 2 deletions node_launcher/gui/components/copy_button.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from node_launcher.gui.qt import QTimer, QClipboard, QVBoxLayout, QPushButton
from node_launcher.gui.qt import QTimer, QGuiApplication, QVBoxLayout, QPushButton


class CopyButton(QVBoxLayout):
Expand All @@ -13,7 +13,7 @@ def __init__(self, button_text: str, copy_text: str):
self.timer = QTimer(self.parentWidget())

def copy(self):
QClipboard().setText(self.copy_text)
QGuiApplication.clipboard().setText(self.copy_text)
self.button.setText('Copied!')
self.button.repaint()
self.timer.singleShot(1000, self.remove_text)
Expand Down
8 changes: 4 additions & 4 deletions node_launcher/gui/menu.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from node_launcher.gui.qt import QCoreApplication, QKeySequence, QClipboard, QMenu
from node_launcher.gui.qt import QCoreApplication, QKeySequence, QMenu, QGuiApplication

from node_launcher.constants import BITCOIN_CLI_COMMANDS, LNCLI_COMMANDS
from node_launcher.gui.system_tray_widgets import (
Expand All @@ -13,8 +13,8 @@


class Menu(QMenu):
def __init__(self, node_set: NodeSet, system_tray):
super().__init__()
def __init__(self, node_set: NodeSet, system_tray, parent):
super().__init__(parent=parent)
self.node_set = node_set
self.system_tray = system_tray

Expand Down Expand Up @@ -81,7 +81,7 @@ def __init__(self, node_set: NodeSet, system_tray):
self.joule_macaroons_action = self.addAction('Show Macaroons')

self.joule_url_action.triggered.connect(
lambda: QClipboard().setText(self.node_set.lnd.rest_url)
lambda: QGuiApplication.clipboard().setText(self.node_set.lnd.rest_url)
)

self.joule_macaroons_action.triggered.connect(
Expand Down
4 changes: 2 additions & 2 deletions node_launcher/gui/qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@
)
from PyQt5.QtGui import (
QPixmap,
QClipboard,
QFont,
QKeySequence,
QPalette,
QColor,
QIcon
QIcon,
QGuiApplication
)
# # PySide2
# from PySide2 import QtGui, QtWidgets, QtCore
Expand Down
2 changes: 1 addition & 1 deletion node_launcher/gui/system_tray.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def __init__(self, parent: QWidget, node_set: NodeSet):
super(SystemTray, self).__init__(parent=parent)
self.node_set = node_set
self.set_red()
self.menu = Menu(node_set=node_set, system_tray=self)
self.menu = Menu(node_set=node_set, system_tray=self, parent=parent)
self.setContextMenu(self.menu)

def set_icon(self, color: str):
Expand Down

0 comments on commit c8d249a

Please sign in to comment.