Beispiel #1
0
 def body(self, master):
     tk.Label(master, justify="left", text="About to TRANSFER:").grd()
     self.config(master).grd(columnspan=100)
     tk.Label(master, justify="left",
              text="Target Namecoin address:").grd(row=100)
     self.targetAddressEntry = tk.Entry(
         master, justify="left",
         text="Target Namecoin address:").grd(row=100, column=20)
     return self.targetAddressEntry
Beispiel #2
0
 def body(self, master):
     tk.Label(master, justify="left", text="About to register:").grd()
     self.config(master).grd()
     tk.Label(
         master,
         justify="left",
         text="This will issue both a name_new and a postponed\n" +
         "name_firstupdate. Let the program and client\n" +
         "run for three hours to ensure the process can finish.").grd()
     return self.focus
Beispiel #3
0
    def body(self, master):
        frame = tk.Frame(master).grd(row=10, column=10, columnspan=100)

        # display name
        tk.Label(frame, justify="left", text="Name:").grd(row=10, column=10)
        tk.Label(frame, justify="left", text=self.name).grd(row=10, column=20)

        # display available NMC        
        tk.Label(frame, justify="left", text="Available balance after fee:").grd(row=20, column=10)
        tk.Label(frame, justify="left", text="%.3f" % self.apc.get_available_balance()
                 ).grd(row=20, column=20)

        # display fee
        tk.Label(frame, justify="left", text="Transaction fee (fixed):").grd(row=25, column=10)
        tk.Label(frame, justify="left", text="%.3f" % antpyshared.TXFEENMC
                 ).grd(row=25, column=20)

        # get bid
        tk.Label(frame, justify="left", text="Offer amount [NMC]:").grd(row=30, column=10)
        self.entryAmount = tkentryplus.EntryPlus(frame).grd(row=30, column=20)

        # button to explicitly generate code
        tk.Button(frame, text="Sign half transaction", command=self.generate
                  ).grd(row=35, column=10)

        tk.Button(frame, text="Copy to clipboard", command=self.copy_to_clipboard
                  ).grd(row=35, column=20)
        
        # code output
        tk.Label(frame, justify="left", text="Offer code:").grd(row=40, column=10, columnspan=20)
        self.textCode = tk.Text(frame, width=80, height=10).grd(row=50, column=10, columnspan=20)
Beispiel #4
0
    def config(self, master):
        frame = tk.Frame(master)
        tk.Label(frame, justify="left",
                 text="Name: " + self.name).grd(row=10, column=10, pady=5)

        # setup tabs
        self.notebook = tk.Notebook(frame)
        self.namespaces = []
        self.namespaces.append(datainput.NamespaceD(tk.Frame(
            self.notebook)))  # why not direct, without extra frame?
        self.notebook.add(self.namespaces[-1].parent, text="d/domain")
        self.namespaces.append(datainput.NamespaceId(tk.Frame(self.notebook)))
        self.notebook.add(self.namespaces[-1].parent, text="id/identity")
        self.namespaces.append(
            datainput.NamespaceCustom(tk.Frame(self.notebook)))
        self.notebook.add(self.namespaces[-1].parent,
                          text="Custom Configuration")

        if self.name.startswith('d/'):
            self.namespaces[0].set(self.dValue)
        elif self.name.startswith("id/"):
            self.notebook.select(1)
            self.namespaces[1].set(self.dValue)
        else:
            self.notebook.select(2)
            self.namespaces[2].set(self.value)

        self.notebook.grd(column=10, columnspan=20)

        #self.focus = self.valueEntry
        self.focus = None  # initial focus

        return frame
Beispiel #5
0
    def body(self, master):
        frame = tk.Frame(master).grd(row=10, column=10, columnspan=100)

        tk.Button(frame, text="Paste from clipboard", command=self.paste_from_clipboard
                  ).grd(row=5, column=10)

        # code input
        tk.Label(frame, justify="left", text="Paste code:").grd(row=10, column=10, columnspan=100)
        self.textCode = tk.Text(frame, width=80, height=10).grd(row=20, column=10, columnspan=100)

        tk.Button(frame, text="decode", command=self.decode
                  ).grd(row=25, column=10)

        tk.Button(frame, text="sign", command=self.sign
                  ).grd(row=25, column=20)

        tk.Button(frame, text="broadcast", command=self.broadcast
                  ).grd(row=25, column=30)

        tk.Label(frame, justify="left", text="Name:").grd(row=30, column=10)
        self.labelName = tk.Label(frame, justify="left", text=""
                                     ).grd(row=30, column=20)
        tk.Label(frame, justify="left", text="Offer amount:").grd(row=40, column=10)
        self.labelAmount = tk.Label(frame, justify="left", text=""
                                     ).grd(row=40, column=20)
        tk.Label(frame, justify="left", text="Warning:").grd(row=50, column=10)        
        self.labelWarning = tk.Label(frame, foreground="red", justify="left", text=""
                                     ).grd(row=50, column=20)
Beispiel #6
0
 def __init__(self, parent, text, visible):
     frame = tk.Frame(master=parent)
     if visible:
         frame.pk(side=tk.TOP, anchor=tk.NW, pady=1, fill=tk.X, expand=1)
     self.label = tk.Label(frame, text=text).pk(side=tk.LEFT, padx=1)
     self.entry = tkentryplus.EntryPlus(frame).pk(side=tk.LEFT, fill=tk.X, expand=1, padx=2)
     self.entry.bind('<KeyRelease>', self.refresh)
     self.entry.bind('<<menu_modified>>', self.refresh)        
     self.entry.bind("<FocusIn>", self.refresh)
     self.entry.bind("<FocusOut>", self.refresh)
Beispiel #7
0
 def body(self, master):
     # todo: give more information to the user about what operation needs unlocking
     tk.Label(
         master,
         justify="left",
         text="Enter the wallet passphrase:\n" +
         "(Note the passphrase will remain in memory until you close nameGUI.\n"
         +
         "Alternatively you can also manually unlock the wallet and retry.)"
     ).grd()
     self.entry = tk.Entry(master, width=60, show="*").grd(sticky="ew")
     return self.entry
Beispiel #8
0
 def __init__(self, parent, key=None, text=None, visible=True, padx=(20,0), **kwargs):
     self.key = key
     self.parent = parent
     if key and not text:
         text = key.capitalize() + ":"
     self.outerFrame = tk.Frame(master=self.parent).pk(side=tk.TOP, anchor=tk.NW,
                                                  fill=tk.X, expand=1)
     if text:
         tk.Label(self.outerFrame, text=text).pk(side=tk.TOP, anchor=tk.NW)
     self.visible = visible
     tk.Frame.__init__(self, self.outerFrame, **kwargs)
     self.pk(side=tk.TOP, anchor=tk.NW, padx=padx, fill=tk.X, expand=1)
     try:
         self.parent.items.append(self)
     except AttributeError:  # parent is not a container
         pass
     self.items = []
     self.setup()
Beispiel #9
0
    def __init__(self):
        log.info(
            "__init__ #########################################################"
        )
        self.root = tk.Tk()
        self.root.withdraw(
        )  # hide for now in case an error comes up so the error window is visible

        # keyboard shortcuts
        self.root.bind("<Control-r>", self.renew)
        self.root.bind("<Control-c>", self.configure)

        # client info
        tk.Label(self.root, justify="left", text="Connected:").grd(row=10,
                                                                   column=10)
        self.labelConnected = tk.Label(self.root, justify="left",
                                       text="...").grd(row=10, column=20)

        tk.Label(self.root, justify="left",
                 text="Block height:").grd(row=20, column=10)
        self.labelBlockCount = tk.Label(self.root, justify="left",
                                        text="...").grd(row=20, column=20)

        # remove as it is not so precise?
        tk.Label(self.root, justify="left",
                 text="Blockchain is up to date:").grd(row=20, column=30)
        self.labelBlockchainIsUpToDate = tk.Label(self.root,
                                                  justify="left",
                                                  text="...").grd(row=20,
                                                                  column=40)

        tk.Label(self.root, justify="left", text="Balance:").grd(row=25,
                                                                 column=10)
        self.labelBalance = tk.Label(self.root, justify="left",
                                     text="...").grd(row=25, column=20)

        tk.Label(self.root, justify="left",
                 text="Wallet locked:").grd(row=25, column=30)
        self.labelWalletLocked = tk.Label(self.root,
                                          justify="left",
                                          text="...").grd(row=25, column=40)

        # register name
        tk.Label(self.root, justify="left", text="New name:").grd(row=30,
                                                                  column=10)
        self.newEntry = tk.Entry(self.root).grd(row=30, column=20)
        self.newEntry.insert(0, "d/")
        self.newEntry.bind("<Return>", self.register_name)
        self.newEntry.bind("<KeyRelease>", self.event_key_release_register)
        self.newEntry.bind("<<menu_modified>>",
                           self.event_key_release_register)
        self.newEntry.bind("<Escape>", lambda trash: self.newEntry.set(""))
        nameNewButton = tk.Button(self.root,
                                  text="register",
                                  command=self.register_name).grd(row=30,
                                                                  column=30)
        tk.Button(text="create offer",
                  command=self.create_offer).grd(row=30, column=35)
        tk.Button(self.root,
                  text="copy value",
                  command=lambda: self.copy_field_external("value")).grd(
                      row=30, column=40)
        tk.Button(self.root,
                  text="copy address",
                  command=lambda: self.copy_field_external("address")).grd(
                      row=30, column=50)

        # name lookup info
        self.displayNameDataLabel = tk.Label(self.root,
                                             justify="left",
                                             text="").grd(row=35,
                                                          column=20,
                                                          columnspan=120,
                                                          sticky="w")
        self.displayValueText = tk.Text(
            self.root,
            bg=self.root.cget('bg'),
            border=0,
            height=1,
        ).grd(row=36, column=20, columnspan=120, sticky="w")
        self.hyperParser = jsonhyper.Parser(self.displayValueText)

        # name table
        columns = ("name", "value", "address", "status", "expires_in")
        self.tv = tk.Treeview(self.root,
                              columns=columns,
                              capitalizeHeadings=True).grd(row=40,
                                                           column=10,
                                                           columnspan=100,
                                                           sticky="nesw")
        self.root.columnconfigure(105, weight=10)  #minsize=minColumnWidth
        self.root.rowconfigure(40, weight=10)
        self.tv["selectmode"] = "browse"  # only allow to select a single item
        self.tv.bind('<ButtonRelease-1>', self.event_tv_click)
        self.tv.bind('<KeyRelease>', self.event_tv_click)

        self.tv['show'] = 'headings'  # hide identifier and +
        ysb = tk.Scrollbar(self.root, orient='vertical',
                           command=self.tv.yview).grd(row=40,
                                                      column=110,
                                                      sticky="nesw")
        #xsb = ttk.Scrollbar(self, orient='horizontal', command=self.t.xview)  # enable/hide automatically?
        self.tv.configure(yscroll=ysb.set)  #, xscroll=xsb.set)
        for c in self.tv["columns"]:
            self.tv.heading(c, text=c.capitalize(), anchor="w")

        # mouse wheel scrolling for table
        self.root.bind("<MouseWheel>", self.on_scroll_event)  # Windows
        self.root.bind("<Button-4>", self.on_scroll_event)  # Linux A
        self.root.bind("<Button-5>", self.on_scroll_event)  # Linux B

        # name buttons
        tk.Button(
            self.root,
            text="renew",
            command=self.renew,
            underline=0,
        ).grd(row=50, column=10)
        tk.Button(
            self.root,
            text="configure value",
            command=self.configure,
            underline=0,
        ).grd(row=50, column=20)
        tk.Button(self.root, text="transfer name",
                  command=self.transfer).grd(row=50, column=30)
        tk.Button(self.root, text="accept offer",
                  command=self.accept_offer).grd(row=50, column=35)

        tk.Button(self.root,
                  text="copy name",
                  command=lambda: self.copy_field("name")).grd(row=50,
                                                               column=40)
        tk.Button(self.root,
                  text="copy value",
                  command=lambda: self.copy_field("value")).grd(row=50,
                                                                column=50)
        tk.Button(self.root,
                  text="copy address",
                  command=lambda: self.copy_field("address")).grd(row=50,
                                                                  column=60)

        # set up model
        self.model = namedialog.MyModel()
        self.model.callback_poll_start = self._model_callback_poll_start
        self.model.callback_poll_end = self._model_callback_poll_end

        # update loop
        self.root.after(300, func=self.set_info)
        self.stopping = False

        # set up window
        self.root.report_callback_exception = self.show_error
        self.root.title("nameGUI - Namecoin RPC Frontend - v" + shared.VERSION)
        self.root.wm_iconbitmap(bitmap=favicon, default=favicon)
        self.root.protocol("WM_DELETE_WINDOW", self.shutdown)
        self.root.focus_force()
        self.root.deiconify()

        # start gui loop
        log.info("__init__: starting mainloop")
        self.root.mainloop()
Beispiel #10
0
 def __init__(self, parent, **kwargs):
     kwargs["padx"] = None  # no indentation for top level container
     Container.__init__(self, parent, **kwargs)
     tk.Label(self.outerFrame, text="Preview:").pk(side=tk.TOP, anchor=tk.NW, pady=(20,1))
     self.preview = tk.Message(self.outerFrame, text="", anchor=tk.NW).pk(side=tk.TOP,
                                               anchor=tk.NW)
Beispiel #11
0
 def body(self, master):
     frame = tk.Frame(master)
     l = tk.Label(frame, justify="left", text="Name:").grd(row=10,
                                                           column=10)
     return l
Beispiel #12
0
            modelW, root, "id/phelix")

    def on_click_transfer():
        print "NameTransferDialog:", NameTransferDialog(
            modelW, root, "d/nx", validate_address_callback)

    def on_click_unlock():
        print "Unlock Dialog..."
        a = modelW.call("getnewaddress")
        print "new address:", a
        print "privkey for a:", modelW.call("dumpprivkey", [a], guiParent=root)

    def shutdown():
        modelW.stop()
        root.destroy()

    root.protocol("WM_DELETE_WINDOW", shutdown)
    mainLabel = tk.Label(root, text='Example for pop up input box')
    mainLabel.pack()
    mainButton = tk.Button(root, text='new', command=on_click_new)
    mainButton.pack()
    mainButton = tk.Button(root, text='configure', command=on_click_configure)
    mainButton.pack()
    mainButton = tk.Button(root, text='transfer', command=on_click_transfer)
    mainButton.pack()

    mainButton = tk.Button(root, text='unlockwallet', command=on_click_unlock)
    mainButton.pack()

    root.mainloop()