Пример #1
0
    def main(self, url):

        storage = WalletStorage(self.config)
        if storage.file_exists:
            wallet = Wallet(storage)
            action = wallet.get_action()
        else:
            action = 'new'

        if action is not None:
            import installwizard
            wizard = installwizard.InstallWizard(self.config, self.network,
                                                 storage)
            wallet = wizard.run(action)
            if not wallet:
                exit()
        else:
            wallet.start_threads(self.network)

        # init tray
        self.dark_icon = self.config.get("dark_icon", False)
        icon = QIcon(
            ":icons/electrum_dark_icon.png") if self.dark_icon else QIcon(
                ':icons/electrum_light_icon.png')
        self.tray = QSystemTrayIcon(icon, None)
        self.tray.setToolTip('Electrum-MYR')
        self.tray.activated.connect(self.tray_activated)
        self.build_tray_menu()
        self.tray.show()

        # main window
        self.main_window = w = ElectrumWindow(self.config, self.network, self)
        self.current_window = self.main_window

        #lite window
        self.init_lite()

        # plugins that need to change the GUI do it here
        run_hook('init')

        w.load_wallet(wallet)

        s = Timer()
        s.start()

        self.windows.append(w)
        if url:
            self.set_url(url)

        w.app = self.app
        w.connect_slots(s)
        w.update_wallet()

        self.app.exec_()

        # clipboard persistence
        # see http://www.mail-archive.com/[email protected]/msg17328.html
        event = QtCore.QEvent(QtCore.QEvent.Clipboard)
        self.app.sendEvent(self.app.clipboard(), event)

        wallet.stop_threads()
Пример #2
0
    def main(self, url):

        storage = WalletStorage(self.config)
        if storage.file_exists:
            wallet = Wallet(storage)
            action = wallet.get_action()
        else:
            action = 'new'

        if action is not None:
            import installwizard
            wizard = installwizard.InstallWizard(self.config, self.network, storage)
            wallet = wizard.run(action)
            if not wallet:
                return
        else:
            wallet.start_threads(self.network)

        # init tray
        if 1:
            self.dark_icon = self.config.get("dark_icon", False)
            icon = QIcon(":icons/electrum_dark_icon.png") if self.dark_icon else QIcon(':icons/electrum_light_icon.png')
            self.tray = QSystemTrayIcon(icon, None)
            self.tray.setToolTip('Reddcoin Electrum')
            self.tray.activated.connect(self.tray_activated)
            self.build_tray_menu()
            self.tray.show()
        else:
            self.tray = None

        # main window
        self.main_window = w = ElectrumWindow(self.config, self.network, self)
        self.current_window = self.main_window

        #lite window
        self.init_lite()

        # initial configuration
        if self.config.get('hide_gui') is True and self.tray.isVisible():
            self.main_window.hide()
            self.lite_window.hide()
        else:
            if self.config.get('lite_mode') is True:
                self.go_lite()
            else:
                self.go_full()

        # plugins that need to change the GUI do it here
        run_hook('init_qt', self)

        w.load_wallet(wallet)

        s = Timer()
        s.start()

        self.windows.append(w)
        if url:
            self.set_url(url)

        w.app = self.app
        w.connect_slots(s)
        w.update_wallet()

        signal.signal(signal.SIGINT, lambda *args: self.app.quit())
        self.app.exec_()
        if self.tray:
            self.tray.hide()

        # clipboard persistence
        # see http://www.mail-archive.com/[email protected]/msg17328.html
        event = QtCore.QEvent(QtCore.QEvent.Clipboard)
        self.app.sendEvent(self.app.clipboard(), event)

        w.close_wallet()
Пример #3
0
    def main(self, url):

        last_wallet = self.config.get('gui_last_wallet')
        if last_wallet is not None and self.config.get('wallet_path') is None:
            if os.path.exists(last_wallet):
                self.config.read_only_options[
                    'default_wallet_path'] = last_wallet
        try:
            storage = WalletStorage(self.config.get_wallet_path())
        except BaseException as e:
            QMessageBox.warning(None, _('Warning'), str(e), _('OK'))
            self.config.set_key('gui_last_wallet', None)
            return

        if storage.file_exists:
            try:
                wallet = Wallet(storage)
            except BaseException as e:
                QMessageBox.warning(None, _('Warning'), str(e), _('OK'))
                return
            action = wallet.get_action()
        else:
            action = 'new'

        if action is not None:
            wallet = self.run_wizard(storage, action)
            if not wallet:
                return
        else:
            wallet.start_threads(self.network)

        # init tray
        self.dark_icon = self.config.get("dark_icon", False)
        icon = QIcon(
            ":icons/electrum_dark_icon.png") if self.dark_icon else QIcon(
                ':icons/electrum_light_icon.png')
        self.tray = QSystemTrayIcon(icon, None)
        self.tray.setToolTip('Electrum-XVG')
        self.tray.activated.connect(self.tray_activated)
        self.build_tray_menu()
        self.tray.show()

        # main window
        self.main_window = w = ElectrumWindow(self.config, self.network, self)
        self.current_window = self.main_window

        #lite window
        self.init_lite()

        # plugins interact with main window
        run_hook('init_qt', self)

        w.load_wallet(wallet)

        # initial configuration
        if self.config.get('hide_gui') is True and self.tray.isVisible():
            self.main_window.hide()
            self.lite_window.hide()
        else:
            if self.config.get('lite_mode') is True:
                self.go_lite()
            else:
                self.go_full()

        s = Timer()
        s.start()

        self.windows.append(w)
        if url:
            self.set_url(url)

        w.connect_slots(s)

        signal.signal(signal.SIGINT, lambda *args: self.app.quit())
        self.app.exec_()
        if self.tray:
            self.tray.hide()

        # clipboard persistence
        # see http://www.mail-archive.com/[email protected]/msg17328.html
        event = QtCore.QEvent(QtCore.QEvent.Clipboard)
        self.app.sendEvent(self.app.clipboard(), event)

        w.close_wallet()
Пример #4
0
 def test_eventFilter_enter(self):
     """Test when the mouse enters the bounds of the icon.
     """
     self.icon_label.mouse_enter_icon.connect(self.assert_icon_emitted)
     self.icon_label.eventFilter(self.icon_label,
                                 QtCore.QEvent(QtCore.QEvent.Enter))
Пример #5
0
 def test_eventFilter_leave(self):
     """Test when the mouse leaves the bounds of the icon.
     """
     self.icon_label.mouse_leave_icon.connect(self.assert_icon_emitted)
     self.icon_label.eventFilter(self.icon_label,
                                 QtCore.QEvent(QtCore.QEvent.Leave))
Пример #6
0
 def postEventWithCallback(self, callback, *args):
     self.queue.put((callback, args))
     QtGui.qApp.postEvent(self, QtCore.QEvent(QtCore.QEvent.User))
Пример #7
0
    def main(self, url):

        last_wallet = self.config.get('gui_last_wallet')
        if last_wallet is not None and self.config.get('wallet_path') is None:
            if os.path.exists(last_wallet):
                self.config.cmdline_options[
                    'default_wallet_path'] = last_wallet

        # init tray
        self.dark_icon = self.config.get("dark_icon", False)
        icon = QIcon(
            ":icons/electrum_dark_icon.png") if self.dark_icon else QIcon(
                ':icons/electrum_light_icon.png')
        self.tray = QSystemTrayIcon(icon, None)
        self.tray.setToolTip('Electrum')
        self.tray.activated.connect(self.tray_activated)
        self.build_tray_menu()
        self.tray.show()

        # main window
        self.main_window = w = ElectrumWindow(self.config, self.network, self)
        self.current_window = self.main_window
        w.show()

        #lite window
        self.init_lite()

        w.load_wallet_file(self.config.get_wallet_path())

        # plugins interact with main window
        run_hook('init_qt', self)

        # initial configuration
        if self.config.get('hide_gui') is True and self.tray.isVisible():
            self.main_window.hide()
            self.lite_window.hide()
        else:
            if self.config.get('lite_mode') is True:
                self.go_lite()
            else:
                self.go_full()

        s = Timer()
        s.start()

        self.windows.append(w)
        if url:
            self.set_url(url)

        w.connect_slots(s)

        signal.signal(signal.SIGINT, lambda *args: self.app.quit())
        self.app.exec_()
        if self.tray:
            self.tray.hide()

        # clipboard persistence
        # see http://www.mail-archive.com/[email protected]/msg17328.html
        event = QtCore.QEvent(QtCore.QEvent.Clipboard)
        self.app.sendEvent(self.app.clipboard(), event)

        w.close_wallet()
Пример #8
0
def setClipboardText(text):
    app = QtGui.QApplication.instance()
    clipboard = app.clipboard()
    clipboard.setText(text)
    event = QtCore.QEvent(QtCore.QEvent.Clipboard)
    app.sendEvent(clipboard, event)
Пример #9
0
 def send(self, text):
     self.clipboard.setText(text)
     event = QtCore.QEvent(QtCore.QEvent.Clipboard)
     self.app.sendEvent(self.clipboard, event)
Пример #10
0
	def x11EventFilter(self,e):
		#print e
		#e.accept()
		QtCore.QEvent(int(e)).accept()
		return False