From 99c4ede7f8bfaa34d64e0a684b0c364d3508e08e Mon Sep 17 00:00:00 2001 From: Segunlee Date: Sat, 25 Apr 2020 16:29:39 +0900 Subject: [PATCH] update --- .gitignore | 1 + .vscode/.ropeproject/config.py | 114 +++++++++++++++++++++++ icon.ico | Bin 0 -> 23305 bytes lightcomics.json | 4 +- lightcomics.py | 109 ++++++++++++++++------ lightcomics.spec => lightcomics_win.spec | 22 ++--- 6 files changed, 208 insertions(+), 42 deletions(-) create mode 100644 .vscode/.ropeproject/config.py create mode 100644 icon.ico rename lightcomics.spec => lightcomics_win.spec (59%) diff --git a/.gitignore b/.gitignore index b42a47c..43af641 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ files/* __pycache__ build +dist/ diff --git a/.vscode/.ropeproject/config.py b/.vscode/.ropeproject/config.py new file mode 100644 index 0000000..dee2d1a --- /dev/null +++ b/.vscode/.ropeproject/config.py @@ -0,0 +1,114 @@ +# The default ``config.py`` +# flake8: noqa + + +def set_prefs(prefs): + """This function is called before opening the project""" + + # Specify which files and folders to ignore in the project. + # Changes to ignored resources are not added to the history and + # VCSs. Also they are not returned in `Project.get_files()`. + # Note that ``?`` and ``*`` match all characters but slashes. + # '*.pyc': matches 'test.pyc' and 'pkg/test.pyc' + # 'mod*.pyc': matches 'test/mod1.pyc' but not 'mod/1.pyc' + # '.svn': matches 'pkg/.svn' and all of its children + # 'build/*.o': matches 'build/lib.o' but not 'build/sub/lib.o' + # 'build//*.o': matches 'build/lib.o' and 'build/sub/lib.o' + prefs['ignored_resources'] = ['*.pyc', '*~', '.ropeproject', + '.hg', '.svn', '_svn', '.git', '.tox'] + + # Specifies which files should be considered python files. It is + # useful when you have scripts inside your project. Only files + # ending with ``.py`` are considered to be python files by + # default. + # prefs['python_files'] = ['*.py'] + + # Custom source folders: By default rope searches the project + # for finding source folders (folders that should be searched + # for finding modules). You can add paths to that list. Note + # that rope guesses project source folders correctly most of the + # time; use this if you have any problems. + # The folders should be relative to project root and use '/' for + # separating folders regardless of the platform rope is running on. + # 'src/my_source_folder' for instance. + # prefs.add('source_folders', 'src') + + # You can extend python path for looking up modules + # prefs.add('python_path', '~/python/') + + # Should rope save object information or not. + prefs['save_objectdb'] = True + prefs['compress_objectdb'] = False + + # If `True`, rope analyzes each module when it is being saved. + prefs['automatic_soa'] = True + # The depth of calls to follow in static object analysis + prefs['soa_followed_calls'] = 0 + + # If `False` when running modules or unit tests "dynamic object + # analysis" is turned off. This makes them much faster. + prefs['perform_doa'] = True + + # Rope can check the validity of its object DB when running. + prefs['validate_objectdb'] = True + + # How many undos to hold? + prefs['max_history_items'] = 32 + + # Shows whether to save history across sessions. + prefs['save_history'] = True + prefs['compress_history'] = False + + # Set the number spaces used for indenting. According to + # :PEP:`8`, it is best to use 4 spaces. Since most of rope's + # unit-tests use 4 spaces it is more reliable, too. + prefs['indent_size'] = 4 + + # Builtin and c-extension modules that are allowed to be imported + # and inspected by rope. + prefs['extension_modules'] = [] + + # Add all standard c-extensions to extension_modules list. + prefs['import_dynload_stdmods'] = True + + # If `True` modules with syntax errors are considered to be empty. + # The default value is `False`; When `False` syntax errors raise + # `rope.base.exceptions.ModuleSyntaxError` exception. + prefs['ignore_syntax_errors'] = False + + # If `True`, rope ignores unresolvable imports. Otherwise, they + # appear in the importing namespace. + prefs['ignore_bad_imports'] = False + + # If `True`, rope will insert new module imports as + # `from import ` by default. + prefs['prefer_module_from_imports'] = False + + # If `True`, rope will transform a comma list of imports into + # multiple separate import statements when organizing + # imports. + prefs['split_imports'] = False + + # If `True`, rope will remove all top-level import statements and + # reinsert them at the top of the module when making changes. + prefs['pull_imports_to_top'] = True + + # If `True`, rope will sort imports alphabetically by module name instead + # of alphabetically by import statement, with from imports after normal + # imports. + prefs['sort_imports_alphabetically'] = False + + # Location of implementation of + # rope.base.oi.type_hinting.interfaces.ITypeHintingFactory In general + # case, you don't have to change this value, unless you're an rope expert. + # Change this value to inject you own implementations of interfaces + # listed in module rope.base.oi.type_hinting.providers.interfaces + # For example, you can add you own providers for Django Models, or disable + # the search type-hinting in a class hierarchy, etc. + prefs['type_hinting_factory'] = ( + 'rope.base.oi.type_hinting.factory.default_type_hinting_factory') + + +def project_opened(project): + """This function is called after opening the project""" + # Do whatever you like here! diff --git a/icon.ico b/icon.ico new file mode 100644 index 0000000000000000000000000000000000000000..6a63fc42a2e4257435ff84df257ed9cce30918d0 GIT binary patch literal 23305 zcmeHu2|U!>`~PQ#VTgzkB1^X{DN7WUGNn)<(Rx*+g}9>Cl4VHQiXwz;k&;STQpuJS zp%N7(WXVqUZOr+fGsFGKt!{nq^8NRHIj`55&z#SkE$;*$H=U`a72y6foYJYe-h6S#|FezAu zRpA@Pd-%XG*w4fSekApL1Yl(N`&-ax0JOgW;Ds*$H>h0oe;Z5fuK|de z13>KDaakIGEAs&eoeF>t27oUHMuMh*_TX7yp!_DIE2AZ5P&{r5R+J1B{O-}*vhxG%Q==D%t5CHoMo&wuX10aYQmeKfZ zp!p;Q`kx0)Xb;EtL+xQ3SdX61!)GuXY|lNeJrOj!!S>H4jz8J{ukr6o>xcONmGyfT z`1$%Zj*}m>jwmA;3S?!hA6!a|5^RHzTlr!TM9^}E6||gY2GsVqpZ7mTe^nyg7SQ_~!`ksrgu96DFZPf6CV&<%NPpX8|8)EG z8UH8w119BXQop{055MCZ#2#^bX)#OIS=!sk(6xiJp_=!b(V^PsOS^W}_w3x;E$agi^C z`iJwR26KV-C?(JlvlNW+o)1Utrf`|ZyW=+`tspDW)9`ZWpwoM)!nq;J~C-+TPQ z@#wa=41gjJKzm>e?fbxJPk+`A`u$58HHYtMke_s$^k@ArhMVXQ{oQ5chl#;Vh8gVx z=?QHBCnN?nf72(j{d6B~RJQ)6Zok>h?_-Yng`@oMYXY>!r{8S)hac(wA*3Cx<@e-? zK4Et)0I$OVxU+%o5Y*L?C^0zf zcgXjc&xZEBx6}bhS_ku5nAdzcC&Ks1+5jM57VW1ICZPQ?^1Ff{PNDrVw42nBY2Z_$ zA?UoW4f^uD7!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_pI!mrobngt#8Ss|uX^zdfW3D^Dz#_iugHHK=6WK>AJ@kx8MGr!?Ob9zHYn?i8 z_laS6w`}Gs{u(lvUsSh>{0zCE{1MhVL*EaEzD;dA98HTZZhu@LbI9qJvI_OG@VSq= z-KZ2@)rMNWm~+bq`bD8`9XTI)W6iCKg)&Bt0!EHo`$LAj zcy`II639wUVvjp(I*U1GSpsI*U}5jhdgy2^KYpTvJ0@VmI<9M__l za%|z z266Py9gyT^O?7h-P8ZVbcx;n-HAuNgMn>h>if1?Tazjl*$joephMgR&T9#6j5wc`$ zW##c%5h~mnpHz0*ZntV{HWUr5<*&QEmujy*W2q~*2R92AK*qHyE?L`H_hxF*(>Ke{ zBsl(R6FOAMclZ#D+|;GVCnn7yzFkXMR`Q@K3hR?hA51CN3m=>vJ{Uu*RUFC``q;y> zbNhMaH+8RLiIK(Ub@`+yj=GC7V|iG*29I|R9`CgZe;Hu-v0}Bb;d#*=ekq0~9Na4| zz22-E=8EGX$j?vivUnfo$~=o}=EKy8tkj4XXDquP&v|fH%2c){=S*brD%DLM?2<*p z#_@6l`7=Gbd_INl&qZ^)HIJr6sco|e-}=aNj-B(48DViNFN7#P5sK=F*pgTG5yK=N zYMq{+dF&9|6aM9zqZbZE{bZeS*^S3=1ODN{|9DHj|~6- literal 0 HcmV?d00001 diff --git a/lightcomics.json b/lightcomics.json index 3e7a282..206054e 100644 --- a/lightcomics.json +++ b/lightcomics.json @@ -1,6 +1,6 @@ { - "ROOT": "/home/ubuntu/apps/LightProvider/files", - "PORT": 8909, + "ROOT": "C:\\Users\\LEESEGUN\\Documents\\LightProvider\\dist", + "PORT": 12370, "HOST": "0.0.0.0", "PASSWORD": "" } diff --git a/lightcomics.py b/lightcomics.py index dd6cc1d..d0cfbef 100755 --- a/lightcomics.py +++ b/lightcomics.py @@ -22,9 +22,13 @@ from io import StringIO from urllib.parse import * import tkinter as tk +from tkinter import filedialog +from tkinter import messagebox import threading from urllib.request import urlopen import re +import socket + __version__ = (1, 0, 0) @@ -41,25 +45,30 @@ CONF_ROOT_PATH = "" -CONF_SERVER_PORT = 8906 +CONF_SERVER_PORT = 12370 +CONF_PASSWORD = "" if os.name == 'nt': + # Windows CONF_ROOT_PATH = "c:\\" - CONF_SERVER_PORT = 8906 + CONF_SERVER_PORT = 12370 + CONF_PASSWORD = "" else: + # Linux Base OS CONF = json.loads(open('./lightcomics.json', 'r').read()) CONF_SERVER_PORT = CONF['ROOT'] + CONF_PASSWORD = CONF['PASSWORD'] if not os.path.exists(CONF_ROOT_PATH): raise Exception("No Root Directory!!!!") - # 앱 선언 app = flask.Flask(__name__) # 권한 체크 def check_auth(username, password): - return username == 'LightComics' and password == CONF['PASSWORD'] + app.logger.info("check auth, recevie password: " + password + " / save password: " + CONF_PASSWORD) + return username == 'LightComics' and password == CONF_PASSWORD # 권한 오류 반환 def authenticate(): @@ -330,7 +339,7 @@ def getSizeOf(path): def root(): """ 리스팅 - localhost:8909/ + localhost:12370/ """ app.logger.info("@app.route('/')") @@ -342,7 +351,7 @@ def root(): def listing(req_path): """ 리스팅 - localhost:8909/dir/ + localhost:12370/dir/ """ app.logger.info("@app.route('//')") @@ -363,7 +372,7 @@ def listing(req_path): def load_image_model(archive, archive_ext): """ 압축파일 내부 이미지 정보 - localhost:8909/sample.zip/ + localhost:12370/sample.zip/ """ app.logger.info("@app.route('/./')") @@ -375,7 +384,7 @@ def load_image_model(archive, archive_ext): def load_image_model2(req_path, archive, archive_ext): """ 압축파일 내부 이미지 정보 - localhost:8909/dir/sglee/sample.zip/ + localhost:12370/dir/sglee/sample.zip/ """ app.logger.info("@app.route('//./')") @@ -412,8 +421,8 @@ def load_image_model2(req_path, archive, archive_ext): def load_image_data(archive, archive_ext, img_path): """ 압축파일 내부 이미지 데이터 반환 - localhost:8909/sample.zip/img1.jpg - localhost:8909/sample.zip/test/img1.jpg + localhost:12370/sample.zip/img1.jpg + localhost:12370/sample.zip/test/img1.jpg """ app.logger.info("@app.route('/./')") @@ -424,8 +433,8 @@ def load_image_data(archive, archive_ext, img_path): def load_image_data2(req_path, archive, archive_ext, img_path): """ 압축파일 내부 이미지 데이터 반환 - localhost:8909/dir/sglee/sample.zip/img1.jpg - localhost:8909/dir/sglee/sample.zip/test/img1.jpg + localhost:12370/dir/sglee/sample.zip/img1.jpg + localhost:12370/dir/sglee/sample.zip/test/img1.jpg """ app.logger.info("@app.route('//./')") @@ -457,7 +466,7 @@ def load_image_data2(req_path, archive, archive_ext, img_path): def get_identifier(req_path): """ 해당하는 경로의 파일 identifier를 반환한다. - localhost:8909/dir/hello.zip + localhost:12370/dir/hello.zip """ app.logger.info("@app.route('/id/')") @@ -478,27 +487,30 @@ def get_identifier(req_path): # UI 구현 -def okClick(): +def onClickServerState(): global server_run global server_state_label global server_on_off_button global server_threading if server_run == True: + tk.messagebox.showinfo("알림", "서버 정지는 정상적으로 동작되지 않습니다.\n프로그램 종료후 재시작 해야 합니다.") + return shutdown_server() - server_state_label['text'] = "Server: Stopped" - server_on_off_button['text'] = " Start " + server_state_label['text'] = "서버: 정지됨" + server_on_off_button['text'] = " 가동 " else: updateServerPort() + updatePassword() server_threading.start() - server_state_label['text'] = "Server: Started" - server_on_off_button['text'] = " Stop " + server_state_label['text'] = "서버: 가동중" + server_on_off_button['text'] = " 정지 " server_run = not server_run def start_server(): app.logger.info("Server Start: " + str(CONF_SERVER_PORT)) - app.run(host="0.0.0.0", port=CONF_SERVER_PORT) + app.run(host=local_ip.get(), port=CONF_SERVER_PORT) def shutdown_server(): # TODO: 서버 어떻게 멈추냐.. 안되네 @@ -516,6 +528,7 @@ def getPublicIp(): def updateServerIP(): app.logger.info(getPublicIp()) + local_ip.set(socket.gethostbyname(socket.gethostname())) public_ip.set(getPublicIp()) def updateServerPort(): @@ -523,20 +536,48 @@ def updateServerPort(): CONF_SERVER_PORT = int(server_port.get()) app.logger.info(CONF_SERVER_PORT) +def updatePassword(): + global CONF_PASSWORD + CONF_PASSWORD = password_var.get() + app.logger.info(CONF_PASSWORD) + +def updateRootPath(): + global CONF_ROOT_PATH + folder_selected = filedialog.askdirectory() + CONF_ROOT_PATH = folder_selected + root_path_var.set(CONF_ROOT_PATH) + app.logger.info(CONF_ROOT_PATH) + +def resource_path(relative_path): + try: + base_path = sys._MEIPASS + except Exception: + base_path = os.path.abspath(".") + return os.path.join(base_path, relative_path) + server_run = False server_threading = threading.Thread(target=start_server) window = tk.Tk() -server_state_label = tk.Label(window, text="Server: Stopped", width=15, anchor="w", padx=10, pady=5) -server_on_off_button = tk.Button(window, text=" Start ", command=okClick, width=20) +server_state_label = tk.Label(window, text="서버: 중지됨", width=15, anchor="w", padx=10, pady=5) +server_on_off_button = tk.Button(window, text=" 가동 ", command=onClickServerState, width=20) +change_root_path_button = tk.Button(window, text=" 변경 ", command=updateRootPath, width=20) public_ip = tk.StringVar() +local_ip = tk.StringVar() server_port = tk.StringVar() server_port.set(CONF_SERVER_PORT) +password_var = tk.StringVar() +password_var.set(CONF_PASSWORD) +root_path_var = tk.StringVar() +root_path_var.set(CONF_ROOT_PATH) + +local_ip_textbox = tk.Entry(window, width=20, textvariable=local_ip, state='readonly') public_ip_textbox = tk.Entry(window, width=20, textvariable=public_ip, state='readonly') server_port_textbox = tk.Entry(window, width=20, textvariable=server_port) - +password_textbox = tk.Entry(window, width=20, textvariable=password_var) +root_path_textbox = tk.Entry(window, width=20, textvariable=root_path_var, state='readonly') def applicationUI(): global window @@ -547,22 +588,36 @@ def applicationUI(): window.geometry("300x200") window.title("Light Provider") window.resizable(False, False) - + window.iconbitmap(default=resource_path('icon.ico')) reuse_label = tk.Label(window, text=" ", width=15, anchor="w") reuse_label.grid(row=0, column=0) server_state_label.grid(row=1, column=0) server_on_off_button.grid(row=1, column=1) - reuse_label = tk.Label(window, text="Server IP", width=15, anchor="w") + reuse_label = tk.Label(window, text="Local IP", width=15, anchor="w") reuse_label.grid(row=2, column=0) - public_ip_textbox.grid(row=2, column=1) + local_ip_textbox.grid(row=2, column=1) - reuse_label = tk.Label(window, text="Server Port", width=15, anchor="w") + reuse_label = tk.Label(window, text="Remote IP", width=15, anchor="w") reuse_label.grid(row=3, column=0) - server_port_textbox.grid(row=3, column=1) + public_ip_textbox.grid(row=3, column=1) + + reuse_label = tk.Label(window, text="서버 Port", width=15, anchor="w") + reuse_label.grid(row=4, column=0) + server_port_textbox.grid(row=4, column=1) + + reuse_label = tk.Label(window, text="비밀번호", width=15, anchor="w") + reuse_label.grid(row=5, column=0) + password_textbox.grid(row=5, column=1) + reuse_label = tk.Label(window, text="공유 폴더", width=15, anchor="w") + reuse_label.grid(row=6, column=0) + root_path_textbox.grid(row=6, column=1) + reuse_label = tk.Label(window, text="폴더 변경", width=15, anchor="w") + reuse_label.grid(row=7, column=0) + change_root_path_button.grid(row=7, column=1) updateServerIP() diff --git a/lightcomics.spec b/lightcomics_win.spec similarity index 59% rename from lightcomics.spec rename to lightcomics_win.spec index bdd0038..cee4fd0 100644 --- a/lightcomics.spec +++ b/lightcomics_win.spec @@ -4,10 +4,10 @@ block_cipher = None a = Analysis(['lightcomics.py'], - pathex=['/home/ubuntu/apps/LightProvider'], + pathex=['C:\\Users\\LEESEGUN\\Documents\\LightProvider'], binaries=[], datas=[], - hiddenimports=['pkg_resources.py2_warn'], + hiddenimports=[], hookspath=[], runtime_hooks=[], excludes=[], @@ -19,19 +19,15 @@ pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) exe = EXE(pyz, a.scripts, + a.binaries + [('icon.ico', 'C:\\Users\\LEESEGUN\\Documents\\LightProvider\\icon.ico', 'DATA')], + a.zipfiles, + a.datas, [], - exclude_binaries=True, - name='lightcomics', + name='LightProvider', debug=False, bootloader_ignore_signals=False, strip=False, upx=True, - console=True ) -coll = COLLECT(exe, - a.binaries, - a.zipfiles, - a.datas, - strip=False, - upx=True, - upx_exclude=[], - name='lightcomics') + upx_exclude=[], + runtime_tmpdir=None, + console=False , icon='icon.ico')