diff --git a/.gitignore b/.gitignore index b6e4761..b1a3438 100644 --- a/.gitignore +++ b/.gitignore @@ -104,6 +104,7 @@ celerybeat.pid # Environments .env .venv +.vscode env/ venv/ ENV/ diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..1279eda --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,2 @@ +include README.md +include source/image/*.gif diff --git a/setup.py b/setup.py index 9c1860a..eccc836 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ setup( name='SMPG-Project', - packages=['test', 'source'], + packages=['test', 'source', 'source.image'], entry_points={'console_scripts': ['runfile = source.build:main']}, version='1.2.0', description='This is a rainfall forecast generator & analysis tool', @@ -18,5 +18,6 @@ author_email='jeaustin.sirias@ucr.ac.cr', url='https://github.com/JeaustinSirias/Seasonal_Monitoring_Probability_Generator', license=license, + include_package_data=True, ) \ No newline at end of file diff --git a/source/api.py b/source/api.py index 156c84f..f64dca0 100644 --- a/source/api.py +++ b/source/api.py @@ -3,17 +3,31 @@ # Copyright (c) 2020 Jeaustin Sirias # import os +import tkinter as tk +import webbrowser from .utils import * from .core import smpgTool -import tkinter as tk from ttk import Combobox -import webbrowser + +''' +script_dir = os.path.dirname(__file__) +rel_path = 'image/' +abs_file_path = os.path.join(script_dir, rel_path) +current_file = 'background.gif' +current_file2 = 'icon.gif' +file1 = abs_file_path + current_file +file2 = abs_file_path + current_file2 +''' class App(): def __init__(self, master): + # LOADING ABS PATH + files = 'background.gif', 'icon.gif' + bgs, icon = filepath('image/', *files) + # BACKGROUND CANVAS - self.background = tk.PhotoImage(file='./source/image/background.gif') + self.background = tk.PhotoImage(file=bgs) bg = tk.Canvas(master, width=800, height=100) bg.create_image(0, 0, image=self.background, anchor='nw') bg.pack() @@ -24,7 +38,7 @@ def __init__(self, master): master.title('SMPG Project v1.2.0') # WINDOWED LOGO - self.logo = tk.PhotoImage(file='./source/image/icon.gif') + self.logo = tk.PhotoImage(file=icon) master.iconphoto(True, self.logo) # GUI ATTRIBUTES diff --git a/source/image/__init__.py b/source/image/__init__.py index 907e384..6b90ee9 100644 --- a/source/image/__init__.py +++ b/source/image/__init__.py @@ -1 +1 @@ -#from .api import App +from .dirpath import images diff --git a/source/image/dirpath.py b/source/image/dirpath.py new file mode 100644 index 0000000..1d172f3 --- /dev/null +++ b/source/image/dirpath.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# +# Copyright (c) 2020 Jeaustin Sirias +# +def images(): + return \ No newline at end of file diff --git a/source/utils.py b/source/utils.py index 772ed8b..6181e88 100644 --- a/source/utils.py +++ b/source/utils.py @@ -2,6 +2,7 @@ # # Copyright (c) 2020 Jeaustin Sirias # +import os import numpy import pandas from scipy.stats import rankdata @@ -342,5 +343,11 @@ def lt_stats(act_accums, sstats, estats): return lt_sts #============================================================ +def filepath(rel_path, *filenames): + path = os.path.dirname(__file__) + abspath = os.path.join(path, rel_path) + paths = [abspath + files for files in filenames] + return paths #============================================================ #============================================================ +