Skip to content

Commit

Permalink
Fix initial file creation
Browse files Browse the repository at this point in the history
  • Loading branch information
revoxhere authored Nov 5, 2020
1 parent ac422a5 commit 701d460
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions Wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
# © Duino-Coin Community 2020
##########################################

from tkinter import Tk, Label, Canvas, Frame, Entry, StringVar, IntVar, Button, PhotoImage, Listbox, Scrollbar, Checkbutton
from tkinter import Tk, Label, Frame, Entry, StringVar, IntVar, Button, PhotoImage, Listbox, Scrollbar, Checkbutton
from tkinter.font import Font
from tkinter import CENTER, LEFT, BOTH, RIGHT, END, BOTTOM, TOP, N, E, S, W
from tkinter import LEFT, BOTH, RIGHT, END, BOTTOM, TOP, N, E, S, W
from webbrowser import open_new_tab
from urllib.request import urlopen, urlretrieve
from pathlib import Path
Expand All @@ -28,6 +28,11 @@
backgroundColor = "#FEEEDA"
foregroundColor = "#212121"

try:
mkdir(resources)
except FileExistsError:
pass

with urlopen("https://raw.githubusercontent.com/revoxhere/duino-coin/gh-pages/serverip.txt") as content:
content = content.read().decode().splitlines()
pool_address = content[0]
Expand Down Expand Up @@ -240,21 +245,6 @@ def _register_btn_clicked(self):
font=textFont2)
self.logbtn.grid(columnspan=2, sticky="nswe", padx=(5, 5), pady=(5,0))


if not Path(resources + "userdata.bin").is_file():
root = Tk()
lf = LoginFrame(root)
root.mainloop()
else:
config.read(resources + "userdata.bin")
username = config["wallet"]["username"]
passwordEnc = config["wallet"]["password"]
password = b64decode(passwordEnc[2:-1]).decode("utf8")

try:
mkdir(resources)
except FileExistsError:
pass
if not Path(resources + "transactions.bin").is_file():
open(resources + 'transactions.bin', 'w+')
if not Path(resources + "duco.png").is_file():
Expand All @@ -276,6 +266,16 @@ def _register_btn_clicked(self):
if not Path(resources + "transactions.png").is_file():
urlretrieve('https://i.imgur.com/lR8ZCwA.png', resources + 'transactions.png')

if not Path(resources + "userdata.bin").is_file():
root = Tk()
lf = LoginFrame(root)
root.mainloop()
else:
config.read(resources + "userdata.bin")
username = config["wallet"]["username"]
passwordEnc = config["wallet"]["password"]
password = b64decode(passwordEnc[2:-1]).decode("utf8")

def openWebsite(handler):
open_new_tab("https://duinocoin.com")

Expand Down

0 comments on commit 701d460

Please sign in to comment.