Skip to content

Commit

Permalink
Build works, need to check installer
Browse files Browse the repository at this point in the history
  • Loading branch information
eoakley committed Nov 27, 2018
1 parent ef84977 commit bb153a4
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 25 deletions.
7 changes: 4 additions & 3 deletions artibuff_scrape.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ def scrape(page_link):

tier_list_dict = {}
for c in tier_list:
tier_list_dict[c.name]= c
#tier_list_dict[c.name]= c
tier_list_dict[c.name]= {'win_rate':c.win_rate,'pick_rate':c.pick_rate,'name':c.name, 'str':str(c)}

return tier_list_dict
except Exception as err:
Expand Down Expand Up @@ -117,11 +118,11 @@ def run_scrape():

full_dict = dict_union(heroes_dict,main_dict,items_dict)

file_name="model/card_dict.pkl"
file_name="card_dict.pkl"

save_pickle(full_dict,file_name)
print("Done, saved on: ",file_name)

if __name__ == "__main__":
from bs4 import BeautifulSoup
import requests
Expand Down
36 changes: 21 additions & 15 deletions artifact_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from artibuff_scrape import Artibuff_Card
from tier_list_scrape import read_tier_text, Tier_List_Card
import os
import sys
import pickle
import webbrowser
import time
Expand All @@ -11,6 +12,13 @@
from PIL import Image, ImageTk
from mss import mss

path_root = os.path.dirname(sys.modules['__main__'].__file__)
print('PATH:', path_root)

def path(filename):
global path_root
return os.path.join(path_root, filename)

def OpenUrl():
webbrowser.open_new('https://github.com/eoakley/artifacthelper')

Expand All @@ -25,14 +33,11 @@ def load_pickle(file_name="card_dict.pkl"):

executor = ThreadPoolExecutor(40)

path_root = '.'

stats = load_pickle(os.path.join(path_root, 'resources/card_dict.pkl'))
stats = load_pickle(path('resources/card_dict.pkl'))

tiers = read_tier_text(os.path.join(path_root, 'tier_list.txt'))
tiers = read_tier_text(path('tier_list.txt'))

#sp = ScreenProcessor(os.path.join(os.path.dirname(sys.modules['__main__'].__file__), 'model/cnn_v4.h5'), os.path.join(os.path.dirname(sys.modules['__main__'].__file__), 'model/label_to_name.pkl'))
sp = ScreenProcessor(os.path.join(path_root, 'resources/cnn_v5.h5'), os.path.join(path_root, 'resources/label_to_name.pkl'))
sp = ScreenProcessor(path('resources/cnn_v5.h5'), path('resources/label_to_name.pkl'))

def compare_images(img, img2):
dif = np.mean(np.abs(img.astype(int) - img2.astype(int)))
Expand Down Expand Up @@ -129,7 +134,7 @@ def btnProcessScreen(ll, root):
continue

try:
wr = stats[card_name]
wr = stats[card_name]['str']
tier = tiers[card_name]
except:
tier = ''
Expand Down Expand Up @@ -172,8 +177,8 @@ def swap_window(root, first_time=False):
root.lift()
root.overrideredirect(1) #Remove border

logo = ImageTk.PhotoImage(Image.open(os.path.join(path_root, 'resources/banner_1.png')))
btnImgScan = ImageTk.PhotoImage(Image.open(os.path.join(path_root, 'resources/btn_scan_1.png')))
logo = ImageTk.PhotoImage(Image.open(path('resources/banner_1.png')))
btnImgScan = ImageTk.PhotoImage(Image.open(path('resources/btn_scan_1.png')))

lg = tk.Label(root, image=logo, borderwidth=0, relief="solid")
lg.image = logo
Expand Down Expand Up @@ -213,8 +218,8 @@ def swap_window(root, first_time=False):
#root.lower()
pass

logo = ImageTk.PhotoImage(Image.open(os.path.join(path_root, 'resources/launcher_bg.png')))
btnImgScan = ImageTk.PhotoImage(Image.open(os.path.join(path_root, 'resources/btn_launch_overlay.png')))
logo = ImageTk.PhotoImage(Image.open(path('resources/launcher_bg.png')))
btnImgScan = ImageTk.PhotoImage(Image.open(path('resources/btn_launch_overlay.png')))

lg = tk.Label(root, image=logo, borderwidth=0, relief="solid")
lg.image = logo
Expand All @@ -235,11 +240,12 @@ def swap_window(root, first_time=False):

def main():
root = tk.Tk()
root.iconbitmap('favicon.ico')
root.iconbitmap(path('favicon.ico'))

swap_window(root, first_time=True)

root.mainloop()

#run
main()

if __name__ == "__main__":
#run
main()
13 changes: 8 additions & 5 deletions installer.cfg
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
[Application]
name=Artifact Helper
version=0.2
version=0.3

# How to launch the app - this calls the 'main' function from the 'myapp' package:
entry_point=main:main
icon=favico.ico
entry_point=artifact_helper:main
icon=favicon.ico

[Python]
version=3.6.5
Expand All @@ -14,6 +15,8 @@ packages= tkinter
_tkinter
modelo_cnn
screen_processor
artibuff_scrape
tier_list_scrape

# These must have wheels on PyPI:
pypi_wheels = astor==0.7.1
Expand All @@ -22,7 +25,6 @@ pypi_wheels = astor==0.7.1
h5py==2.8.0
image==1.5.27
Pillow==5.3.0
termcolor==1.1.0
pytz==2018.7
Keras==2.2.4
Keras-Applications==1.0.6
Expand All @@ -46,4 +48,5 @@ local_wheels = wheels/*.whl

# Other files and folders that should be installed
files = lib
model
resources
tier_list.txt
5 changes: 3 additions & 2 deletions make_installer.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ atualizar main.py com Interface_vX.ipynb


D:
cd D:\Google Drive\Jupyter\Artifact\Helper\pynsist
cd D:\Artifact Helper\artifacthelper


pynsist installer.cfg --no-makensis
pynsist installer.cfg


cd D:\Google Drive\Jupyter\Artifact\Helper\pynsist\build\nsis\Python
python.exe ../Artifact_Helper.launch.pyw

Expand Down
Binary file modified resources/card_dict.pkl
Binary file not shown.
Binary file modified resources/launcher_bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit bb153a4

Please sign in to comment.