def __init__(self, parent, size=(300, 200)): wx.Dialog.__init__(self, parent, size=size, title="Receive", style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER) Observable.__init__(self) # Create Controls self.address_label = wx.StaticText(self, -1, "Address:") self.address_textctrl = wx.TextCtrl(self, -1, "", size=(250,-1), style=wx.TE_READONLY|wx.BORDER_SIMPLE) self.address_textctrl.SetBackgroundColour((196,196,196)) self.label_label = wx.StaticText(self, -1, "Label:") self.label_textctrl = wx.TextCtrl(self, -1, "", size=(80,-1)) # Setup Sizers sizer = wx.BoxSizer(wx.VERTICAL) formsizer = wx.FlexGridSizer(2, 2) formsizer.Add(self.address_label, 0, wx.LEFT|wx.ALL, 5) formsizer.Add(self.address_textctrl, 1, wx.LEFT|wx.ALL|wx.EXPAND, 5) formsizer.Add(self.label_label, 0, wx.LEFT|wx.ALL, 5) formsizer.Add(self.label_textctrl, 1, wx.LEFT|wx.ALL|wx.EXPAND, 5) formsizer.AddGrowableCol(1) sizer.Add(formsizer, 1, wx.EXPAND|wx.TOP|wx.BOTTOM, 20) btnsizer = wx.StdDialogButtonSizer() ok_button = wx.Button(self, wx.ID_OK) ok_button.SetDefault() btnsizer.AddButton(ok_button) cancel_button = wx.Button(self, wx.ID_CANCEL) btnsizer.AddButton(cancel_button) btnsizer.Realize() sizer.Add(btnsizer, 0, wx.ALIGN_RIGHT|wx.ALL, 5) self.SetSizer(sizer) # Bind Events ok_button.Bind(wx.EVT_BUTTON, self.on_ok)
def __init__(self, parent): Observable.__init__(self) wx.aui.AuiNotebook.__init__(self, parent, -1, wx.DefaultPosition, wx.Size(400, 300)) #page = WalletNoteBookPage(self) #self.AddPage(page, "wallet.dat 1") self.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSE, self.on_wallet_close) self.pages = {} # id => WalletNoteBookPage
def __init__(self, log, sockaddr): Observable.__init__(self) asyncore.dispatcher_with_send.__init__(self) self.sockaddr = sockaddr self.create_socket(socket.AF_INET, socket.SOCK_STREAM) self.connect(sockaddr) self.incommingbuff = "" self.log = log
def __init__(self, parent): wx.Panel.__init__(self, parent) #, style=wx.SIMPLE_BORDER Observable.__init__(self) # Controls self.balance = BalancePanel(self) self.send_button = wx.Button(self, label="Send") self.receive_button = wx.Button(self, label="Receive") self.keylist = wx.ListCtrl(self, style=wx.LC_REPORT, size=(400,100)) self.keylist.InsertColumn(0, "Public Key") self.keylist.InsertColumn(1, "Private Key") self.keylist.InsertColumn(2, "Address") self.keylist.InsertColumn(3, "Description") self.keylist.SetColumnWidth(2, 250) self.keylist.SetColumnWidth(3, 250) self.show_hide_private_keys_button = wx.Button(self, label="Show Hide Private Keys") self.txhistory_list = wx.ListCtrl(self,style=wx.LC_REPORT, size=(400,100)) self.txhistory_list.InsertColumn(0, "Date") self.txhistory_list.InsertColumn(1, "Address") self.txhistory_list.InsertColumn(2, "Label") self.txhistory_list.InsertColumn(3, "Amount") self.txhistory_list.InsertColumn(4, "Confirmed") self.txhistory_list.SetColumnWidth(0, 120) self.txhistory_list.SetColumnWidth(1, 250) # Sizers self.sizer = wx.BoxSizer(orient=wx.VERTICAL) self.sizer.Add(self.balance, 0, wx.EXPAND) send_receive_sizer = wx.BoxSizer(orient=wx.HORIZONTAL) send_receive_sizer.Add(self.send_button, 0, wx.LEFT) send_receive_sizer.Add(self.receive_button, 0, wx.LEFT) self.sizer.Add(send_receive_sizer, 0, wx.EXPAND) self.sizer.Add(wx.StaticText(self, -1, "Keys: "), 0) self.sizer.Add(self.keylist, 0, wx.EXPAND) self.sizer.Add(self.show_hide_private_keys_button, 0) #self.sizer.Add(self.address_book, 0, wx.EXPAND) self.sizer.Add(wx.StaticText(self, -1, "Transactions: "), 0) self.sizer.Add(self.txhistory_list, 1, wx.EXPAND) self.SetSizer(self.sizer) # Events self.show_hide_private_keys_button.Bind(wx.EVT_BUTTON, self.on_show_hide_private_keys) self.send_button.Bind(wx.EVT_BUTTON, self.on_send) self.receive_button.Bind(wx.EVT_BUTTON, self.on_receive) # ChildViews (could be moved into some View directory service) self.send_view = SendView(self) self.receive_view = ReceiveView(self) self.enter_passphrase_view = EnterPassphraseView(self) # Initialize private data self.keylist_idpool = IdPool() self.keys = {} self.key_itemids = {} self.itemdata_ids = IdPool() self.tx_history_items = {} # id => itemdata_ids
def __init__(self, sockaddr, sock=None): Observable.__init__(self) asyncore.dispatcher.__init__(self, sock=sock) self.sockaddr = sockaddr self.isoutbound = (sock == None) self.out_buffer = "" if not sock: self.create_socket(socket.AF_INET, socket.SOCK_STREAM) self.connect((sockaddr.ip, sockaddr.port))
def __init__(self, sockaddr, sock=None): Observable.__init__(self) asyncore.dispatcher.__init__(self, sock=sock) self.sockaddr = sockaddr self.isoutbound = (sock == None) self.out_buffer = "" if not sock: self.create_socket(socket.AF_INET, socket.SOCK_STREAM) self.connect((sockaddr.ip, sockaddr.port))
def __init__(self, params, log): Observable.__init__(self) asyncore.dispatcher.__init__(self) self.params = params self.log = log self.message_encoder = MessageSerializer(self.params.runmode) self.create_socket(socket.AF_INET, socket.SOCK_STREAM) self.set_reuse_addr() self.bind(('localhost', self.params.port)) self.listen(5) self.log.info("Listening on port :%d " % (self.params.port)) self.peers = {} # addr => handler self.peer_states = {} # handler => state
def __init__(self, params, log): Observable.__init__(self) asyncore.dispatcher.__init__(self) self.params = params self.log = log self.message_encoder = MessageSerializer(self.params.runmode) self.create_socket(socket.AF_INET, socket.SOCK_STREAM) self.set_reuse_addr() self.bind(('localhost', self.params.port)) self.listen(5) self.log.info("Listening on port :%d " % (self.params.port)) self.peers = {} # addr => handler self.peer_states = {} # handler => state
def __init__(self, node, blockchain, txpool, process_pool, log): Observable.__init__(self) self.node = node self.blockchain = blockchain self.txpool = txpool self.log = log self.items_to_download = deque() self.requested_tx = {} self.orphan_tx = {} self.process_pool = process_pool self.txverifier = TxVerifier(self.blockchain.database.runmode) node.subscribe((VersionExchangeService.EVT_MESSAGE, MSG_INV), self.on_inv) node.subscribe((VersionExchangeService.EVT_MESSAGE, MSG_TX), self.on_tx) self.node.subscribe (Node.EVT_DISCONNECTED, self.on_peer_disconnected)
def __init__(self, parent, size=(300, 200)): wx.Dialog.__init__(self, parent, size=size, title="Receive", style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) Observable.__init__(self) # Create Controls self.address_label = wx.StaticText(self, -1, "Address:") self.address_textctrl = wx.TextCtrl(self, -1, "", size=(250, -1), style=wx.TE_READONLY | wx.BORDER_SIMPLE) self.address_textctrl.SetBackgroundColour((196, 196, 196)) self.label_label = wx.StaticText(self, -1, "Label:") self.label_textctrl = wx.TextCtrl(self, -1, "", size=(80, -1)) # Setup Sizers sizer = wx.BoxSizer(wx.VERTICAL) formsizer = wx.FlexGridSizer(2, 2) formsizer.Add(self.address_label, 0, wx.LEFT | wx.ALL, 5) formsizer.Add(self.address_textctrl, 1, wx.LEFT | wx.ALL | wx.EXPAND, 5) formsizer.Add(self.label_label, 0, wx.LEFT | wx.ALL, 5) formsizer.Add(self.label_textctrl, 1, wx.LEFT | wx.ALL | wx.EXPAND, 5) formsizer.AddGrowableCol(1) sizer.Add(formsizer, 1, wx.EXPAND | wx.TOP | wx.BOTTOM, 20) btnsizer = wx.StdDialogButtonSizer() ok_button = wx.Button(self, wx.ID_OK) ok_button.SetDefault() btnsizer.AddButton(ok_button) cancel_button = wx.Button(self, wx.ID_CANCEL) btnsizer.AddButton(cancel_button) btnsizer.Realize() sizer.Add(btnsizer, 0, wx.ALIGN_RIGHT | wx.ALL, 5) self.SetSizer(sizer) # Bind Events ok_button.Bind(wx.EVT_BUTTON, self.on_ok)
def __init__(self, log): Observable.__init__(self) self.log = log self.blocks = {} self.blocks_by_prev = {} # { prevhash => [blkhash1, blkhash2, ...], ...}
def __init__(self, parent, id=-1, title="", pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE | wx.SUNKEN_BORDER | wx.CLIP_CHILDREN): wx.Frame.__init__(self, parent, id, title, pos, size, style) Observable.__init__(self) # Create Menu mb = wx.MenuBar() # File file_menu = wx.Menu() file_menu.Append(wx.ID_NEW, "New") self.Bind(wx.EVT_MENU, self.on_cmd_new_wallet, id=wx.ID_NEW) file_menu.Append(wx.ID_OPEN, "Open") self.Bind(wx.EVT_MENU, self.on_cmd_open_wallet, id=wx.ID_OPEN) file_menu.Append(wx.ID_EXIT, "Exit") self.Bind(wx.EVT_MENU, self.on_exit_menu, id=wx.ID_EXIT) self.Bind(wx.EVT_CLOSE, self.on_close) # Window ID_MENU_SHOWHIDE_CONNECTIONS = wx.NewId() ID_MENU_SHOWHIDE_LOGS = wx.NewId() ID_MENU_SHOWHIDE_POOLS = wx.NewId() ID_MENU_SHOWHIDE_BLOCKCHAIN_SUMMARY = wx.NewId() window_menu = wx.Menu() self.mi_showhide_connections = window_menu.Append(ID_MENU_SHOWHIDE_CONNECTIONS, "Connections", kind=wx.ITEM_CHECK) self.mi_showhide_connections.Check(True) self.mi_showhide_logs = window_menu.Append(ID_MENU_SHOWHIDE_LOGS, "Logs", kind=wx.ITEM_CHECK) self.mi_showhide_logs.Check(True) self.mi_showhide_pools = window_menu.Append(ID_MENU_SHOWHIDE_POOLS, "Pools", kind=wx.ITEM_CHECK) self.mi_showhide_pools.Check(False) self.mi_showhide_blockchain_summary = window_menu.Append(ID_MENU_SHOWHIDE_BLOCKCHAIN_SUMMARY, "Blockchain", kind=wx.ITEM_CHECK) self.mi_showhide_blockchain_summary.Check(True) mb.Append(file_menu, "File") mb.Append(window_menu, "Window") self.SetMenuBar(mb) self.Bind(wx.EVT_MENU, self.on_showhide_connections, id=ID_MENU_SHOWHIDE_CONNECTIONS) self.Bind(wx.EVT_MENU, self.on_showhide_logs, id=ID_MENU_SHOWHIDE_LOGS) self.Bind(wx.EVT_MENU, self.on_showhide_pools, id=ID_MENU_SHOWHIDE_POOLS) self.Bind(wx.EVT_MENU, self.on_showhide_blockchain_summary, id=ID_MENU_SHOWHIDE_BLOCKCHAIN_SUMMARY) # Create Child Windows self._mgr = wx.aui.AuiManager() self._mgr.SetManagedWindow(self) self.nb_wallet = WalletNotebook(self) self.log_panel = LogPanel(self) self.node_view = NodeView(self) self.pools_view = PoolsPanel(self, size=(250,300)) self.blockchain_summary_view = BlockchainSummaryView(self, size=(10, 10)) self._mgr.AddPane(self.nb_wallet, wx.aui.AuiPaneInfo(). Name("wallet_notebook").Caption("Wallet Notebook").MaximizeButton(True). CenterPane()) self._mgr.AddPane(self.pools_view, wx.aui.AuiPaneInfo(). Name("pools").Layer(2).Caption("Pools").MaximizeButton(True). Right().Hide()) self._mgr.AddPane(self.node_view, wx.aui.AuiPaneInfo(). Name("node").Layer(1).BestSize(wx.Size(300,500)).Caption("Connections").MaximizeButton(True). Right()) self._mgr.AddPane(self.log_panel, wx.aui.AuiPaneInfo(). Name("logs").Caption("Logs").MaximizeButton(True). Bottom()) blockchain_summary_paneinfo = wx.aui.AuiPaneInfo(). \ Name("blockchain_summary").BestSize(wx.Size(300,150)).Caption("Blockchain").Layer(1). \ Right().MaximizeButton(True) blockchain_summary_paneinfo.dock_proportion = 20000 self._mgr.AddPane(self.blockchain_summary_view, blockchain_summary_paneinfo) self.Bind(wx.aui.EVT_AUI_PANE_CLOSE, self.on_close_pane) self._mgr.Update() #Statusbar self.statusbar = self.CreateStatusBar(2, wx.ST_SIZEGRIP) #MessageBoxes self.messages_view = MessageView(self) self.nb_wallet.subscribe(self.nb_wallet.EVT_CLOSE_WALLET, self.on_cmd_close_wallet)
def __init__(self, log): Observable.__init__(self) self.log = log self.blocks = {} self.blocks_by_prev = { } # { prevhash => [blkhash1, blkhash2, ...], ...}
def __init__(self, parent, id=-1, title="", pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE | wx.SUNKEN_BORDER | wx.CLIP_CHILDREN): wx.Frame.__init__(self, parent, id, title, pos, size, style) Observable.__init__(self) # Create Menu mb = wx.MenuBar() # File file_menu = wx.Menu() file_menu.Append(wx.ID_NEW, "New") self.Bind(wx.EVT_MENU, self.on_cmd_new_wallet, id=wx.ID_NEW) file_menu.Append(wx.ID_OPEN, "Open") self.Bind(wx.EVT_MENU, self.on_cmd_open_wallet, id=wx.ID_OPEN) file_menu.Append(wx.ID_EXIT, "Exit") self.Bind(wx.EVT_MENU, self.on_exit_menu, id=wx.ID_EXIT) self.Bind(wx.EVT_CLOSE, self.on_close) # Window ID_MENU_SHOWHIDE_CONNECTIONS = wx.NewId() ID_MENU_SHOWHIDE_LOGS = wx.NewId() ID_MENU_SHOWHIDE_POOLS = wx.NewId() ID_MENU_SHOWHIDE_BLOCKCHAIN_SUMMARY = wx.NewId() window_menu = wx.Menu() self.mi_showhide_connections = window_menu.Append( ID_MENU_SHOWHIDE_CONNECTIONS, "Connections", kind=wx.ITEM_CHECK) self.mi_showhide_connections.Check(True) self.mi_showhide_logs = window_menu.Append(ID_MENU_SHOWHIDE_LOGS, "Logs", kind=wx.ITEM_CHECK) self.mi_showhide_logs.Check(True) self.mi_showhide_pools = window_menu.Append(ID_MENU_SHOWHIDE_POOLS, "Pools", kind=wx.ITEM_CHECK) self.mi_showhide_pools.Check(False) self.mi_showhide_blockchain_summary = window_menu.Append( ID_MENU_SHOWHIDE_BLOCKCHAIN_SUMMARY, "Blockchain", kind=wx.ITEM_CHECK) self.mi_showhide_blockchain_summary.Check(True) mb.Append(file_menu, "File") mb.Append(window_menu, "Window") self.SetMenuBar(mb) self.Bind(wx.EVT_MENU, self.on_showhide_connections, id=ID_MENU_SHOWHIDE_CONNECTIONS) self.Bind(wx.EVT_MENU, self.on_showhide_logs, id=ID_MENU_SHOWHIDE_LOGS) self.Bind(wx.EVT_MENU, self.on_showhide_pools, id=ID_MENU_SHOWHIDE_POOLS) self.Bind(wx.EVT_MENU, self.on_showhide_blockchain_summary, id=ID_MENU_SHOWHIDE_BLOCKCHAIN_SUMMARY) # Create Child Windows self._mgr = wx.aui.AuiManager() self._mgr.SetManagedWindow(self) self.nb_wallet = WalletNotebook(self) self.log_panel = LogPanel(self) self.node_view = NodeView(self) self.pools_view = PoolsPanel(self, size=(250, 300)) self.blockchain_summary_view = BlockchainSummaryView(self, size=(10, 10)) self._mgr.AddPane( self.nb_wallet, wx.aui.AuiPaneInfo().Name("wallet_notebook").Caption( "Wallet Notebook").MaximizeButton(True).CenterPane()) self._mgr.AddPane( self.pools_view, wx.aui.AuiPaneInfo().Name("pools").Layer(2).Caption( "Pools").MaximizeButton(True).Right().Hide()) self._mgr.AddPane( self.node_view, wx.aui.AuiPaneInfo().Name("node").Layer(1).BestSize( wx.Size( 300, 500)).Caption("Connections").MaximizeButton(True).Right()) self._mgr.AddPane( self.log_panel, wx.aui.AuiPaneInfo().Name("logs").Caption("Logs").MaximizeButton( True).Bottom()) blockchain_summary_paneinfo = wx.aui.AuiPaneInfo(). \ Name("blockchain_summary").BestSize(wx.Size(300,150)).Caption("Blockchain").Layer(1). \ Right().MaximizeButton(True) blockchain_summary_paneinfo.dock_proportion = 20000 self._mgr.AddPane(self.blockchain_summary_view, blockchain_summary_paneinfo) self.Bind(wx.aui.EVT_AUI_PANE_CLOSE, self.on_close_pane) self._mgr.Update() #Statusbar self.statusbar = self.CreateStatusBar(2, wx.ST_SIZEGRIP) #MessageBoxes self.messages_view = MessageView(self) self.nb_wallet.subscribe(self.nb_wallet.EVT_CLOSE_WALLET, self.on_cmd_close_wallet)
def __init__(self): Observable.__init__(self) self.txs = {} self.spent_outpoints = {} # outpoint => (txhash, in_index)