Exemple #1
0
 def test_mainnet_rest_url_copy_button(self, qtbot: QTest,
                                       launch_widget: LaunchWidget):
     qtbot.mouseClick(launch_widget.mainnet_group_box.rest_url_copy_button,
                      Qt.LeftButton)
     rest_url = launch_widget.node_launcher.command_generator.mainnet_rest_url(
     )
     assert QClipboard().text() == rest_url
Exemple #2
0
    def __init__(self, args):
        super().__init__()

        self.initUI()
        t = QTimer()
        t.singleShot(0, self.onQApplicationStarted)

        self.preferencesGui = PreferencesGUI(self.appctxt,
                                             self.PreferenceWindow)

        self.receiversInst = Receivers(self.ui)
        self.receiversInst.setClipboardInst(QClipboard(self))

        self.connectReceivers()

        self.ui.floatingToolBox.restoreDefaults()

        if not os.path.exists(self.homeDir):
            os.makedirs(self.homeDir)

        if args != '':
            if os.path.isfile(args):
                self.receiversInst.loadPdf(os.path.abspath(args))

            elif args:
                self.receiversInst.newPdf(os.path.abspath(args))
Exemple #3
0
 def copy(self):
     cb = QClipboard()
     try:
         cb.setText(self.ip)
         lable
     except:
         self.fouceEx()
    def __init__(self, config, icon=None):
        super().__init__()
        self.config = config
        if icon:
            self.setWindowIcon(icon)

        # info panel
        about_html = self.generate_about_html(html_template)
        self.about = QTextBrowser()
        self.about.setOpenExternalLinks(True)
        self.about.setMinimumSize(400, 260)
        self.about.setHtml(about_html)

        # widgets
        self.clipboard = QClipboard(self)
        self.status_bar = QLabel()
        copy_button = QPushButton("Copy")
        copy_button.setMaximumWidth(75)
        copy_button.clicked.connect(self.copy_to_clipboard)
        close_button = QPushButton("Close")
        close_button.setMaximumWidth(75)
        close_button.clicked.connect(self.close)

        # layoyut
        clipboard_layout = QHBoxLayout()
        clipboard_layout.addWidget(self.status_bar)
        clipboard_layout.addWidget(copy_button)
        clipboard_layout.addWidget(close_button)

        # Create main layout and add widgets
        main_layout = QVBoxLayout()
        main_layout.addWidget(self.about)
        main_layout.addLayout(clipboard_layout)
        self.setLayout(main_layout)
Exemple #5
0
 def test_grpc_url_copy_button(self, qtbot: QTest,
                               launch_widget: LaunchWidget):
     launch_widget.testnet_group_box.zap_layout.copy_grpc_url.button.setEnabled(
         True)
     qtbot.mouseClick(
         launch_widget.testnet_group_box.zap_layout.copy_grpc_url.button,
         Qt.LeftButton)
     rest_url = launch_widget.testnet_group_box.node_set.lnd.grpc_url
     assert QClipboard().text() == rest_url
Exemple #6
0
 def test_lncli_copy_button(self, qtbot: QTest,
                            launch_widget: LaunchWidget):
     launch_widget.testnet_group_box.cli_layout.copy_lncli.button.setEnabled(
         True)
     qtbot.mouseClick(
         launch_widget.testnet_group_box.cli_layout.copy_lncli.button,
         Qt.LeftButton)
     command = launch_widget.testnet_group_box.node_set.lnd.lncli
     assert QClipboard().text() == ' '.join(command)
Exemple #7
0
    def __init__(self):
        super().__init__()
        self.schedule_object = None
        self.init_ui()
        self.setStyleSheet(WINDOW_STYLE)
        self.setWindowTitle("NRC a iCalendar")
        self.setWindowIcon(QIcon(get_path("assets", "icon.svg")))
        self.clikboard = QClipboard()

        # Dialogo para guardar el archivo
        self.save_dialog = QFileDialog(self)
        self.save_dialog.setFileMode(QFileDialog.AnyFile)
        self.save_dialog.setNameFilter("iCalendar (*.ics)")
        self.save_dialog.setDefaultSuffix("ics")
        self.save_dialog.setAcceptMode(QFileDialog.AcceptSave)
Exemple #8
0
    def paste_nodes(self):
        """
        Pastes nodes from the clipboard.
        """
        clipboard = QClipboard()
        cb_string = clipboard.text()
        if not cb_string:
            return

        self._undo_stack.beginMacro('pasted nodes')
        serial_data = json.loads(cb_string)
        self.clear_selection()
        nodes = self._deserialize(serial_data, True)
        [n.set_selected(True) for n in nodes]
        self._undo_stack.endMacro()
Exemple #9
0
    def copy_nodes(self, nodes=None):
        """
        copy nodes to the clipboard by default this method copies
        the selected nodes from the node graph.

        Args:
            nodes (list[NodeGraphQt.Node]): list of node instances.
        """
        nodes = nodes or self.selected_nodes()
        if not nodes:
            return False
        clipboard = QClipboard()
        serial_data = self._serialize(nodes)
        serial_str = json.dumps(serial_data)
        if serial_str:
            clipboard.setText(serial_str)
            return True
        return False
Exemple #10
0
    def __init__(self, node_set: NodeSet, system_tray):
        super().__init__()
        self.node_set = node_set
        self.system_tray = system_tray

        # Bitcoind
        self.bitcoind_status_action = self.addAction('bitcoind off')
        self.bitcoind_status_action.setEnabled(False)

        self.bitcoind_manager_tabs_dialog = BitcoindManagerTabsDialog(
            bitcoin=self.node_set.bitcoin, system_tray=self.system_tray)
        self.bitcoin_manage_action = self.addAction('Manage Bitcoind')
        self.bitcoin_manage_action.triggered.connect(
            self.bitcoind_manager_tabs_dialog.show)

        QTimer.singleShot(500, self.node_set.bitcoin.process.start)
        self.bitcoind_manager_tabs_dialog.output_tab.bitcoind_synced.connect(
            self.node_set.lnd.process.start)

        self.addSeparator()

        # LND
        self.lnd_status_action = self.addAction('lnd off')
        self.lnd_status_action.setEnabled(False)

        self.lnd_manager_tabs_dialog = LndManagerTabsDialog(
            lnd=self.node_set.lnd, system_tray=self.system_tray)
        self.lnd_manage_action = self.addAction('Manage LND')
        self.lnd_manage_action.triggered.connect(
            self.lnd_manager_tabs_dialog.show)

        self.addSeparator()

        # Joule
        self.joule_status_action = self.addAction('Joule Browser UI')
        self.joule_status_action.setEnabled(False)
        self.joule_url_action = self.addAction('Copy Node URL (REST)')
        self.joule_macaroons_action = self.addAction('Show Macaroons')
        self.joule_url_action.triggered.connect(
            lambda: QClipboard().setText(self.node_set.lnd.rest_url))
        self.joule_macaroons_action.triggered.connect(
            lambda: reveal(self.node_set.lnd.macaroon_path))

        self.addSeparator()

        # Zap
        self.zap_status_action = self.addAction('Zap Desktop UI')
        self.zap_status_action.setEnabled(False)
        self.zap_open_action = self.addAction('Open Zap Desktop')
        self.zap_open_action.triggered.connect(
            lambda: webbrowser.open(self.node_set.lnd.lndconnect_url))
        self.zap_qr_code_label = ZapQrcodeLabel(
            self.node_set.lnd.lndconnect_qrcode)
        self.show_zap_qrcode_action = self.addAction('Pair Zap Mobile')
        self.show_zap_qrcode_action.triggered.connect(
            self.zap_qr_code_label.show)

        self.addSeparator()

        # Quit
        self.quit_action = self.addAction('Quit')
        self.quit_action.triggered.connect(lambda _: QCoreApplication.exit(0))
Exemple #11
0
 def test_joule_url_action(self, reveal_patch: MagicMock,
                           webbrowser_patch: MagicMock, menu: Menu,
                           qtbot: QTest):
     menu.joule_url_action.trigger()
     assert QClipboard().text() == 'test rest'
 def test_copy_rest(self, joule_layout: JouleLayout, qtbot: QTest):
     qtbot.mouseClick(joule_layout.copy_rest.button, Qt.LeftButton)
     assert QClipboard().text() == 'test rest'
Exemple #13
0
 def test_mainnet_lncli_copy_button(self, qtbot: QTest,
                                    launch_widget: LaunchWidget):
     qtbot.mouseClick(launch_widget.mainnet_group_box.lncli_copy_button,
                      Qt.LeftButton)
     command = launch_widget.node_launcher.command_generator.mainnet_lncli()
     assert QClipboard().text() == ' '.join(command)
Exemple #14
0
 def copy_rest_url(self):
     rest_url = getattr(self.node_launcher.command_generator,
                        f'{self.network}_rest_url')()
     QClipboard().setText(rest_url)
Exemple #15
0
def use_clipboard():
    clipboard_text = QClipboard().text()

    return clipboard_text
Exemple #16
0
    def __init__(self, parent: QWidget = None):
        super(ColorWidget, self).__init__(parent)
        self.cp: QClipboard = QClipboard()
        self.pressed: bool = False
        self.timer: QTimer = QTimer()

        self.gridLayout: QGridLayout = QGridLayout(self)
        self.gridLayout.setSpacing(6)
        self.gridLayout.setContentsMargins(11, 11, 11, 11)
        self.verticalLayout: QVBoxLayout = QVBoxLayout()
        self.verticalLayout.setSpacing(0)

        self.labColor: QLabel = QLabel()
        self.labColor.setText('+')
        self.labColor.setStyleSheet("background-color: rgb(255, 107, 107);color: rgb(250, 250, 250);")
        self.labColor.setAlignment(Qt.AlignCenter)
        font: QFont = QFont()
        font.setPixelSize(35)
        font.setBold(True)
        self.labColor.setFont(font)
        sizePolicy: QSizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.labColor.sizePolicy().hasHeightForWidth())
        self.labColor.setSizePolicy(sizePolicy)
        self.labColor.setMinimumSize(QSize(80, 70))
        self.labColor.setMaximumSize(QSize(80, 70))
        self.labColor.setCursor(QCursor(Qt.CrossCursor))
        self.labColor.setFrameShape(QFrame.StyledPanel)
        self.labColor.setFrameShadow(QFrame.Sunken)
        self.verticalLayout.addWidget(self.labColor)

        self.label: QLabel = QLabel(self)
        self.label.setMinimumSize(QSize(0, 18))
        self.label.setStyleSheet("background-color: rgb(0, 0, 0);color: rgb(200, 200, 200);")
        self.label.setAlignment(Qt.AlignCenter)
        self.verticalLayout.addWidget(self.label)
        self.gridLayout.addLayout(self.verticalLayout, 0, 0, 3, 1)

        self.labWeb: QLabel = QLabel(self)
        self.gridLayout.addWidget(self.labWeb, 0, 1, 1, 1)

        self.txtWeb: QLineEdit = QLineEdit(self)
        self.gridLayout.addWidget(self.txtWeb, 0, 2, 1, 1)

        self.labRgb: QLabel = QLabel(self)
        self.gridLayout.addWidget(self.labRgb, 1, 1, 1, 1)

        self.txtRgb: QLineEdit = QLineEdit(self)
        self.gridLayout.addWidget(self.txtRgb, 1, 2, 1, 1)

        self.labPoint: QLabel = QLabel(self)
        self.gridLayout.addWidget(self.labPoint, 2, 1, 1, 1)

        self.txtPoint: QLineEdit = QLineEdit(self)
        self.gridLayout.addWidget(self.txtPoint, 2, 2, 1, 1)

        self.label.setText('当前颜色显示')
        self.labWeb.setText('web值: ')
        self.labRgb.setText('rgb值: ')
        self.labPoint.setText('坐标值: ')

        self.setLayout(self.gridLayout)
        self.setWindowTitle('屏幕拾色器')
        self.setFixedSize(270, 108)

        self.cp = QApplication.clipboard()
        self.pressed = False

        timer = QTimer(self)
        timer.setInterval(100)
        timer.timeout.connect(self.showColorValue)
        timer.start()
Exemple #17
0
 def get_description(self):
     npc_description = f"{self.name_label.text()} est {self.job_label.text()} {self.specie_label.text()} " \
                       f"plutôt {self.appearance_label.text()}, {self.behavior_label.text()}, semble être " \
                       f"{self.personality_label.text()} et a {self.accessories_label.text()}"
     QClipboard().setText(npc_description)
 def copy(self):
     QClipboard().setText(self.copy_text)
     self.button.setText('Copied!')
     self.button.repaint()
     self.timer.singleShot(1000, self.remove_text)
Exemple #19
0
 def copy_lncli_command(self):
     command = getattr(self.node_launcher.command_generator,
                       f'{self.network}_lncli')()
     QClipboard().setText(' '.join(command))
Exemple #20
0
 def __init__(self, parent=None):
     super(ClipboardHelper, self).__init__(parent)
     self._clipboard = QClipboard(parent=self)
Exemple #21
0
    def __init__(self, node_set: NodeSet, system_tray):
        super().__init__()
        self.node_set = node_set
        self.system_tray = system_tray

        self.bitcoind_status_action = self.addAction('bitcoind off')
        self.bitcoind_status_action.setEnabled(False)

        # bitcoin console
        self.bitcoin_cli_widget = ConsoleDialog(
            title='bitcoin-cli',
            program=self.node_set.bitcoin.software.bitcoin_cli,
            args=self.node_set.bitcoin.args,
            commands=BITCOIN_CLI_COMMANDS)
        self.bitcoin_console_action = self.addAction('Open Bitcoin Console')
        self.bitcoin_console_action.triggered.connect(
            self.bitcoin_cli_widget.show)

        # bitcoind output
        self.bitcoind_output_widget = BitcoindOutputWidget(
            node_set=self.node_set, system_tray=self.system_tray)
        self.bitcoind_output_action = self.addAction('See Bitcoin Output')
        self.bitcoind_output_action.triggered.connect(
            self.bitcoind_output_widget.show)

        self.addSeparator()

        self.lnd_status_action = self.addAction('lnd off')
        self.lnd_status_action.setEnabled(False)

        # lnd console

        self.lncli_widget = ConsoleDialog(
            title='lncli',
            program=self.node_set.lnd.software.lncli,
            args=self.node_set.lnd.lncli_arguments(),
            commands=LNCLI_COMMANDS)
        self.lnd_console_action = self.addAction('Open LND Console')
        self.lnd_console_action.triggered.connect(self.lncli_widget.show)

        # lnd output
        self.lnd_output_widget = LndOutputWidget(node_set=self.node_set,
                                                 system_tray=self.system_tray)
        self.lnd_output_action = self.addAction('See LND Output')
        self.lnd_output_action.triggered.connect(self.lnd_output_widget.show)

        self.addSeparator()

        # Joule

        self.joule_status_action = self.addAction('Joule Browser Extension')
        self.joule_status_action.setEnabled(False)
        self.joule_url_action = self.addAction('Copy Node URL (REST)')
        self.joule_macaroons_action = self.addAction('Show Macaroons')

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

        self.joule_macaroons_action.triggered.connect(
            lambda: reveal(self.node_set.lnd.macaroon_path))

        self.addSeparator()

        # settings

        self.settings_action = self.addAction('&Settings')
        self.settings_action.setShortcut(QKeySequence.Preferences)
        self.settings_tab = SettingsTabDialog(node_set=self.node_set)
        self.settings_action.triggered.connect(self.settings_tab.show)

        # advanced

        self.advanced_widget = AdvancedWidget(node_set=self.node_set)
        self.advanced_action = self.addAction('Advanced...')
        self.advanced_action.triggered.connect(self.advanced_widget.show)

        self.addSeparator()

        # quit
        self.quit_action = self.addAction('Quit')

        self.quit_action.triggered.connect(lambda _: QCoreApplication.exit(0))
Exemple #22
0
 def copy_rest_url(self):
     QClipboard().setText(self.node_set.lnd_node.configuration.rest_url)
Exemple #23
0
 def test_copy_button(self, copy_button: CopyButton, qtbot: QTest):
     qtbot.mouseClick(copy_button.button, Qt.LeftButton)
     assert QClipboard().text() == 'copy_this'
Exemple #24
0
 def test_rest_url_copy_button(self, qtbot: QTest,
                               launch_widget: LaunchWidget):
     qtbot.mouseClick(launch_widget.testnet_group_box.joule_layout.copy_rest.button,
                      Qt.LeftButton)
     rest_url = launch_widget.testnet_group_box.node_set.lnd.rest_url
     assert QClipboard().text() == rest_url
 def test_copy_lncli(self, cli_layout: CliLayout, qtbot: QTest):
     qtbot.mouseClick(cli_layout.copy_lncli.button, Qt.LeftButton)
     assert QClipboard().text() == 'test lncli'
 def test_copy_rest(self, menu: Menu, qtbot: QTest):
     menu.joule_url_action.trigger()
     assert QClipboard().text() == 'test rest'