diff --git a/.gitignore b/.gitignore index 8115cff..15a4d5d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ __pycache__/ .git/ +venv*/ # PyInstaller *.manifest diff --git a/Pipfile b/Pipfile deleted file mode 100644 index 541cb77..0000000 --- a/Pipfile +++ /dev/null @@ -1,19 +0,0 @@ -[[source]] -name = "pypi" -url = "https://pypi.org/simple" -verify_ssl = true - -[dev-packages] - -[packages] -psycopg2 = "==2.8.5" -beautifulsoup4 = "==4.9.0" -requests = "==2.23.0" -PyQt5 = "==5.14.2" -PyInstaller = {editable = true,git = "https://github.com/pyinstaller/pyinstaller.git",ref = "develop"} -PyQt5-sip = "==12.7.2" -idna = "==2.9" -setuptools = "==46.3.1" - -[requires] -python_version = "3.8" diff --git a/Pipfile.lock b/Pipfile.lock deleted file mode 100644 index 8444f6f..0000000 --- a/Pipfile.lock +++ /dev/null @@ -1,158 +0,0 @@ -{ - "_meta": { - "hash": { - "sha256": "1e0d0921246f3707f2761f038593b524827dd2b86a7242ba288a91d086392ec0" - }, - "pipfile-spec": 6, - "requires": { - "python_version": "3.8" - }, - "sources": [ - { - "name": "pypi", - "url": "https://pypi.org/simple", - "verify_ssl": true - } - ] - }, - "default": { - "altgraph": { - "hashes": [ - "sha256:1f05a47122542f97028caf78775a095fbe6a2699b5089de8477eb583167d69aa", - "sha256:c623e5f3408ca61d4016f23a681b9adb100802ca3e3da5e718915a9e4052cebe" - ], - "version": "==0.17" - }, - "beautifulsoup4": { - "hashes": [ - "sha256:594ca51a10d2b3443cbac41214e12dbb2a1cd57e1a7344659849e2e20ba6a8d8", - "sha256:a4bbe77fd30670455c5296242967a123ec28c37e9702a8a81bd2f20a4baf0368", - "sha256:d4e96ac9b0c3a6d3f0caae2e4124e6055c5dcafde8e2f831ff194c104f0775a0" - ], - "index": "pypi", - "version": "==4.9.0" - }, - "certifi": { - "hashes": [ - "sha256:1d987a998c75633c40847cc966fcf5904906c920a7f17ef374f5aa4282abd304", - "sha256:51fcb31174be6e6664c5f69e3e1691a2d72a1a12e90f872cbdb1567eb47b6519" - ], - "version": "==2020.4.5.1" - }, - "chardet": { - "hashes": [ - "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae", - "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691" - ], - "version": "==3.0.4" - }, - "future": { - "hashes": [ - "sha256:b1bead90b70cf6ec3f0710ae53a525360fa360d306a86583adc6bf83a4db537d" - ], - "version": "==0.18.2" - }, - "idna": { - "hashes": [ - "sha256:7588d1c14ae4c77d74036e8c22ff447b26d0fde8f007354fd48a7814db15b7cb", - "sha256:a068a21ceac8a4d63dbfd964670474107f541babbd2250d61922f029858365fa" - ], - "index": "pypi", - "version": "==2.9" - }, - "pefile": { - "hashes": [ - "sha256:a5d6e8305c6b210849b47a6174ddf9c452b2888340b8177874b862ba6c207645" - ], - "version": "==2019.4.18" - }, - "psycopg2": { - "hashes": [ - "sha256:132efc7ee46a763e68a815f4d26223d9c679953cd190f1f218187cb60decf535", - "sha256:2327bf42c1744a434ed8ed0bbaa9168cac7ee5a22a9001f6fc85c33b8a4a14b7", - "sha256:27c633f2d5db0fc27b51f1b08f410715b59fa3802987aec91aeb8f562724e95c", - "sha256:2c0afb40cfb4d53487ee2ebe128649028c9a78d2476d14a67781e45dc287f080", - "sha256:2df2bf1b87305bd95eb3ac666ee1f00a9c83d10927b8144e8e39644218f4cf81", - "sha256:440a3ea2c955e89321a138eb7582aa1d22fe286c7d65e26a2c5411af0a88ae72", - "sha256:6a471d4d2a6f14c97a882e8d3124869bc623f3df6177eefe02994ea41fd45b52", - "sha256:6b306dae53ec7f4f67a10942cf8ac85de930ea90e9903e2df4001f69b7833f7e", - "sha256:a0984ff49e176062fcdc8a5a2a670c9bb1704a2f69548bce8f8a7bad41c661bf", - "sha256:ac5b23d0199c012ad91ed1bbb971b7666da651c6371529b1be8cbe2a7bf3c3a9", - "sha256:acf56d564e443e3dea152efe972b1434058244298a94348fc518d6dd6a9fb0bb", - "sha256:d3b29d717d39d3580efd760a9a46a7418408acebbb784717c90d708c9ed5f055", - "sha256:f7d46240f7a1ae1dd95aab38bd74f7428d46531f69219954266d669da60c0818" - ], - "index": "pypi", - "version": "==2.8.5" - }, - "pyinstaller": { - "editable": true, - "git": "https://github.com/pyinstaller/pyinstaller.git", - "ref": "fe0911772f297b4b40b84af22f57de374aae13fd" - }, - "pyqt5": { - "hashes": [ - "sha256:3b91dd1d0cbfaea85ad057247ba621187e511434b0c9d6d40de69fd5e833b109", - "sha256:a9bdc46ab1f6397770e6b8dca84ac07a0250d26b1a31587f25619cf31a075532", - "sha256:bd230c6fd699eabf1ceb51e13a8b79b74c00a80272c622427b80141a22269eb0", - "sha256:ee168a486c9a758511568147815e2959652cd0aabea832fa5e87cf6b241d2180", - "sha256:f61ddc78547d6ca763323ccd4a9e374c71b29feda1f5ce2d3e91e4f8d2cf1942" - ], - "index": "pypi", - "version": "==5.14.2" - }, - "pyqt5-sip": { - "hashes": [ - "sha256:01919371d32b26208b2f0318f1e15680d3aa60d1ced1812a5dac8bdb483fea69", - "sha256:11f8cc2de287c3457fee53e781f06fb71f04251e7ae408ed22696ed65fd2bcf4", - "sha256:168a6d700daf366b7cf255a8cabf8d07bfe2294859e6b3b2636c36c2f89265c9", - "sha256:16a19b9f36985b8bff30b89fb8859d831713dd528fba5600563e36ff077960a2", - "sha256:16a9a4daf85bfaa3aec35237ff28d8773a3ec937d9f8dc7fc3db7716de42d4a9", - "sha256:31c74602ccd6b70e4352550eb41aa980dc1d6009444f3c8eb1b844e84bd144cf", - "sha256:360de29634e2ce1df84d2b588bd8c1a29b768f3a5225869d63adb03bc21bd32a", - "sha256:3cb9076ba0e574b2f026759103eb0e12051128714f5aa136cca53229d3ad72d1", - "sha256:4f87d59d29ca1c5a4005bbec27af002be787210dc5f8f87fe5d747883a836083", - "sha256:65fceeea2ac738a92f7e3e459ece1b4e2fbf49fd1d6b732a73d0d4bcfc434452", - "sha256:85e68b8936f1756060ddcb3ef0a84af78ce89993fa6594b3049a0eca53d6d2fa", - "sha256:9dd5769e83e64d017d02981563c8159d825425b6c4998c937a880888f4dcb7a3", - "sha256:a8a6c0512641fc042726b6253b2d5f3f3f800098334d198d8ebdf337d85ab3d7", - "sha256:b068f4791e97427d82a27e7df28cc3ee33f7e4353f48ed6a123f8cdba44266b2", - "sha256:b34c1f227a8f8e97059f20e5424f117f66a302b42e34d4039158494c6371b1ce", - "sha256:b68cfe632a512c0551e8860f35c1fcab5cd1ad5e168b4814fddd88121f447b0a", - "sha256:df4f5cdb86f47df5f6fc35be29cc45df7b5a2c171d07dbf377d558b226554ea3" - ], - "index": "pypi", - "version": "==12.7.2" - }, - "pywin32-ctypes": { - "hashes": [ - "sha256:24ffc3b341d457d48e8922352130cf2644024a4ff09762a2261fd34c36ee5942", - "sha256:9dc2d991b3479cc2df15930958b674a48a227d5361d413827a4cfd0b5876fc98" - ], - "version": "==0.2.0" - }, - "requests": { - "hashes": [ - "sha256:43999036bfa82904b6af1d99e4882b560e5e2c68e5c4b0aa03b655f3d7d73fee", - "sha256:b3f43d496c6daba4493e7c431722aeb7dbc6288f52a6e04e7b6023b0247817e6" - ], - "index": "pypi", - "version": "==2.23.0" - }, - "soupsieve": { - "hashes": [ - "sha256:e914534802d7ffd233242b785229d5ba0766a7f487385e3f714446a07bf540ae", - "sha256:fcd71e08c0aee99aca1b73f45478549ee7e7fc006d51b37bec9e9def7dc22b69" - ], - "version": "==2.0" - }, - "urllib3": { - "hashes": [ - "sha256:3018294ebefce6572a474f0604c2021e33b3fd8006ecd11d62107a5d2a963527", - "sha256:88206b0eb87e6d677d424843ac5209e3fb9d0190d0ee169599165ec25e9d9115" - ], - "version": "==1.25.9" - } - }, - "develop": {} -} diff --git a/VERSION b/VERSION index 8c26915..8c50098 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.9 +3.1 diff --git a/launcher.py b/launcher.py index 358c2a9..ecf5d39 100644 --- a/launcher.py +++ b/launcher.py @@ -1,19 +1,15 @@ #! /usr/bin/env python3 -# |***************************************************** # * Copyright : Copyright (C) 2019 # * Author : ddc # * License : GPL v3 # * Python : 3.6 -# |***************************************************** # # -*- coding: utf-8 -*- import os import subprocess import sys - import requests from PyQt5 import QtCore, QtWidgets - from src.utils import constants, messages, utilities @@ -39,7 +35,7 @@ def init(self): self.progressBar.close() self._call_program() - ################################################################################ + def _check_update_required(self): if self.configs['programVersion'] is None: self.client_version = constants.VERSION @@ -52,7 +48,7 @@ def _check_update_required(self): self.new_version_msg = new_version_obj.new_version_msg self._download_new_program_version(False) - ################################################################################ + def _download_new_program_version(self, show_dialog=True): if show_dialog: msg = f"""{messages.new_version_available} @@ -78,7 +74,7 @@ def _download_new_program_version(self, show_dialog=True): utilities.show_message_window("error", "ERROR", f"{messages.error_dl_new_version}") self.log.error(f"{messages.error_dl_new_version} {r.status_code} {r}") - ################################################################################ + def _call_program(self): code = None cmd = [f"{os.path.abspath(os.getcwd())}\\{constants.EXE_PROGRAM_NAME}"] diff --git a/main.py b/main.py index 02b6726..e39ff79 100644 --- a/main.py +++ b/main.py @@ -1,14 +1,11 @@ #! /usr/bin/env python3 -# |***************************************************** # * Copyright : Copyright (C) 2019 # * Author : ddc # * License : GPL v3 # * Python : 3.6 -# |***************************************************** # # -*- coding: utf-8 -*- from PyQt5 import QtCore, QtGui, QtWidgets - from src.main_src import MainSrc from src.utils import constants diff --git a/requirements.txt b/requirements.txt index e539be1..573838a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,15 +1,19 @@ altgraph==0.17 -beautifulsoup4==4.9.0 -certifi==2020.4.5.1 -chardet==3.0.4 +beautifulsoup4==4.9.3 +certifi==2021.5.30 +chardet==4.0.0 +charset-normalizer==2.0.4 future==0.18.2 -idna==2.9 -pefile==2019.4.18 -psycopg2==2.8.5 --e git+https://github.com/pyinstaller/pyinstaller.git@fe0911772f297b4b40b84af22f57de374aae13fd#egg=pyinstaller -PyQt5==5.14.2 -PyQt5-sip==12.7.2 +idna==3.2 +pefile==2021.5.24 +psycopg2==2.9.1 +pyinstaller==4.5.1 +pyinstaller-hooks-contrib==2021.2 +PyQt5==5.15.4 +PyQt5-Qt5==5.15.2 +PyQt5-sip==12.9.0 +PyQt5-stubs==5.15.2.0 pywin32-ctypes==0.2.0 -requests==2.23.0 -soupsieve==2.0 -urllib3==1.25.9 +requests==2.26.0 +soupsieve==2.2.1 +urllib3==1.26.6 diff --git a/resources.rc b/resources.rc index 843c3cb..a119078 100644 --- a/resources.rc +++ b/resources.rc @@ -7,8 +7,8 @@ VSVersionInfo( ffi=FixedFileInfo( # filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4) # Set not needed items to zero 0. -filevers=(2, 9, 0, 0), -prodvers=(2, 9, 0, 0), +filevers=(3, 1, 0, 0), +prodvers=(3, 1, 0, 0), # Contains a bitmask that specifies the valid bits 'flags'r @@ -56,11 +56,11 @@ StringFileInfo( StringStruct(u'Users', u'Unlimited'), StringStruct(u'PrivateBuild', u''), StringStruct(u'SpecialBuild', u''), - StringStruct(u'FileVersion', u'2.9'), - StringStruct(u'ProductVersion', u'2.9'), - StringStruct(u'Build', u'May 2020'), + StringStruct(u'FileVersion', u'3.1'), + StringStruct(u'ProductVersion', u'3.1'), + StringStruct(u'Build', u'August 2021'), ]) - ]), + ]), VarFileInfo([VarStruct(u'Translation', [1033, 1200])]) ] ) diff --git a/src/__init__.py b/src/__init__.py index 5935b6d..e69de29 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -1,4 +0,0 @@ -__all__ = ['ui', - 'utils', - 'main_src' - ] diff --git a/src/main_src.py b/src/main_src.py index b1f64f6..a4c25fe 100644 --- a/src/main_src.py +++ b/src/main_src.py @@ -1,21 +1,16 @@ -#! /usr/bin/env python3 -# |***************************************************** # * Copyright : Copyright (C) 2019 # * Author : ddc # * License : GPL v3 # * Python : 3.6 -# |***************************************************** # # -*- coding: utf-8 -*- import os import sys from time import sleep - import requests from PyQt5 import QtCore from PyQt5.QtGui import QDesktopServices from bs4 import BeautifulSoup - from src.utils import constants, messages, utilities @@ -28,7 +23,7 @@ def __init__(self, qtObj, form): self.new_version_msg = None self.log = None - ################################################################################ + def init(self): self.progressBar.setValues(messages.initializing, 0) utilities.set_paypal_button(self) @@ -70,7 +65,7 @@ def init(self): self.qtObj.findGw2File_button.setFocus() self.progressBar.close() - ################################################################################ + def _check_new_program_version(self): self.qtObj.updateAvail_label.clear() self.qtObj.update_button.setVisible(False) @@ -84,19 +79,19 @@ def _check_new_program_version(self): self.qtObj.updateAvail_label.setText(new_version_obj.new_version_msg) self.qtObj.update_button.setVisible(True) - ################################################################################ + @staticmethod def _update_program(): href = QtCore.QUrl(constants.GITHUB_LATEST_VERSION_URL) QDesktopServices.openUrl(href) - ################################################################################ + @staticmethod def _donate_clicked(): href = QtCore.QUrl(constants.PAYPAL_URL) QDesktopServices.openUrl(href) - ################################################################################ + def _enable_form(self): self.qtObj.startGw2_button.setEnabled(True) self.qtObj.currentParam_groupBox.setEnabled(True) @@ -104,7 +99,7 @@ def _enable_form(self): for x in range(0, num_pages): self.qtObj.main_tabWidget.setTabEnabled(x, True) - ################################################################################ + def _disable_form(self): self.qtObj.startGw2_button.setEnabled(False) self.qtObj.currentParam_groupBox.setEnabled(False) @@ -112,7 +107,7 @@ def _disable_form(self): for x in range(0, num_pages): self.qtObj.main_tabWidget.setTabEnabled(x, False) - ################################################################################ + def _register_form_events(self): # buttons self.qtObj.findGw2File_button.clicked.connect(lambda: self._get_gw2_file_name()) @@ -157,7 +152,7 @@ def _register_form_events(self): self.qtObj.authsrv_textEdit.textChanged.connect(lambda: self._set_authsrv()) self.qtObj.portal_textEdit.textChanged.connect(lambda: self._set_portal()) - ################################################################################ + def _set_all_configs_on_form_from_settings_file(self): self.current_parameters_list = list() self.current_parameters_list.append(f"-clientport:{self.configs['port']}") @@ -354,7 +349,7 @@ def _set_all_configs_on_form_from_settings_file(self): if self.qtObj.gw2Path_label.text() == "": self.qtObj.gw2Path_label.setText(str(self.configs['gw2Path'])) - ################################################################################ + def _get_gw2_file_name(self): path = str(utilities.dialog_get_file_path()) if path != "": @@ -378,7 +373,7 @@ def _get_gw2_file_name(self): self.qtObj.gw2Path_label.setText(messages.need_find_gw2) self.qtObj.findGw2File_button.setFocus() - ################################################################################ + def _get_dat_file_name(self): path = str(utilities.dialog_get_file_path()) if path != "": @@ -404,7 +399,7 @@ def _get_dat_file_name(self): utilities.set_all_ini_file_settings(constants.SETTINGS_FILENAME, final_values) self._set_all_configs_on_form_from_settings_file() - ################################################################################ + def _set_parameters1(self): final_values = {} final_values['Parameters1'] = {} @@ -520,7 +515,7 @@ def _set_parameters1(self): utilities.set_all_ini_file_settings(constants.SETTINGS_FILENAME, final_values) self._set_all_configs_on_form_from_settings_file() - ################################################################################ + def _set_parameters2(self): final_values = {} final_values['Parameters2'] = {} @@ -563,7 +558,7 @@ def _set_parameters2(self): utilities.set_all_ini_file_settings(constants.SETTINGS_FILENAME, final_values) self._set_all_configs_on_form_from_settings_file() - ################################################################################ + def _set_assetsrv(self): assetsrv_textEdit = str(self.qtObj.assetsrv_textEdit.toPlainText()) @@ -575,7 +570,7 @@ def _set_assetsrv(self): utilities.set_file_settings("Parameters2", "assetsrv", f"\"{self.configs['assetsrv']}\"") self._set_all_configs_on_form_from_settings_file() - ################################################################################ + def _set_authsrv(self): authsrv_textEdit = str(self.qtObj.authsrv_textEdit.toPlainText()) @@ -587,7 +582,7 @@ def _set_authsrv(self): utilities.set_file_settings("Parameters2", "authsrv", f"\"{self.configs['authsrv']}\"") self._set_all_configs_on_form_from_settings_file() - ################################################################################ + def _set_portal(self): portal_textEdit = str(self.qtObj.portal_textEdit.toPlainText()) @@ -599,7 +594,7 @@ def _set_portal(self): utilities.set_file_settings("Parameters2", "portal", f"\"{self.configs['portal']}\"") self._set_all_configs_on_form_from_settings_file() - ################################################################################ + def _set_port(self): if self.qtObj.port80_radioButton.isChecked(): self.configs['port'] = 80 @@ -611,7 +606,7 @@ def _set_port(self): utilities.set_file_settings("GW2", "port", str(self.configs['port'])) self._set_all_configs_on_form_from_settings_file() - ################################################################################ + def _set_arcdps(self): self.qtObj.main_tabWidget.setCurrentIndex(2) window_type = None @@ -648,7 +643,7 @@ def _set_arcdps(self): utilities.set_file_settings("GW2", "arcdps", str(self.configs['arcdps'])) utilities.show_message_window(window_type, window_title, msg) - ################################################################################ + def _check_arcdps_installed(self): gw2_dir_path = "" if self.configs['gw2Path'] is not None: @@ -668,7 +663,7 @@ def _check_arcdps_installed(self): self.qtObj.arcdps_no_radioButton.setChecked(True) utilities.set_file_settings("GW2", "arcdps", str(self.configs['arcdps'])) - ################################################################################ + def _update_arcdps(self): gw2_dir_path = os.path.dirname(self.configs['gw2Path']) d3d9_url = constants.D3D9_URL @@ -755,7 +750,7 @@ def _update_arcdps(self): self.qtObj.main_tabWidget.setCurrentIndex(2) return True - ################################################################################ + def _set_arcdps_tab(self): arcdps_url = constants.ARCDPS_URL arcdps_ref = "

= (3, 6) ################################################################################ GW2_64_BIT_EXEC_NAME = "Gw2-64.exe" ################################################################################ APPDATA_PATH = os.getenv('APPDATA') # returns AppData\Roaming. 'LOCALAPPDATA' == AppData\Local. -PROGRAM_PATH = f"{APPDATA_PATH}/{SHORT_PROGRAM_NAME}" +PROGRAM_PATH = os.path.join(APPDATA_PATH, SHORT_PROGRAM_NAME) ################################################################################ -SETTINGS_FILENAME = f"{PROGRAM_PATH}\\settings.ini" -STYLE_QSS_FILENAME = f"{PROGRAM_PATH}\\style.qss" -ERROR_LOGS_FILENAME = f"{PROGRAM_PATH}\\errors.log" +SETTINGS_FILENAME = os.path.join(PROGRAM_PATH, 'settings.ini') +STYLE_QSS_FILENAME = os.path.join(PROGRAM_PATH, 'style.qss') +ERROR_LOGS_FILENAME = os.path.join(PROGRAM_PATH, 'errors.log') +D3D9_PATH = os.path.join('\\bin64', 'd3d9.dll') +D3D9_BAK_PATH = os.path.join('\\bin64', 'd3d9.dll.bak') ################################################################################ ARCDPS_URL = "https://www.deltaconnected.com/arcdps" D3D9_URL = f"{ARCDPS_URL}/x64/d3d9.dll" @@ -51,5 +45,3 @@ PAYPAL_URL = "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=CTYZ8TK5MJV76" GITHUB_LATEST_VERSION_URL = f"https://github.com/ddc/{SHORT_PROGRAM_NAME}/releases/latest" ################################################################################ -D3D9_PATH = "\\bin64\\d3d9.dll" -D3D9_BAK_PATH = "\\bin64\\d3d9.dll.bak" diff --git a/src/utils/create_files.py b/src/utils/create_files.py index ecaafa1..99fb4c8 100644 --- a/src/utils/create_files.py +++ b/src/utils/create_files.py @@ -1,10 +1,7 @@ -#! /usr/bin/env python3 -# |***************************************************** # * Copyright : Copyright (C) 2019 # * Author : ddc # * License : GPL v3 # * Python : 3.6 -# |***************************************************** # # -*- coding: utf-8 -*- from src.utils import constants @@ -14,7 +11,6 @@ class CreateFiles: def __init__(self, log): self.log = log - ################################################################################ @staticmethod def create_settings_file(): file = open(constants.SETTINGS_FILENAME, encoding="utf-8", mode="w") @@ -67,7 +63,7 @@ def create_settings_file(): """) file.close() - ################################################################################ + @staticmethod def create_style_file(): file = open(constants.STYLE_QSS_FILENAME, encoding="utf-8", mode="w") diff --git a/src/utils/messages.py b/src/utils/messages.py index 32f7b46..20e89af 100644 --- a/src/utils/messages.py +++ b/src/utils/messages.py @@ -1,13 +1,9 @@ -#! /usr/bin/env python3 -# |***************************************************** # * Copyright : Copyright (C) 2019 # * Author : ddc # * License : GPL v3 # * Python : 3.6 -# |***************************************************** # # -*- coding: utf-8 -*- - # general error_executing_program = "Could not initialize " error_check_installation = "Please check your installation and try again." diff --git a/src/utils/utilities.py b/src/utils/utilities.py index 1db3b5e..2a98053 100644 --- a/src/utils/utilities.py +++ b/src/utils/utilities.py @@ -1,10 +1,7 @@ -#! /usr/bin/env python3 -# |***************************************************** # * Copyright : Copyright (C) 2019 # * Author : ddc # * License : GPL v3 # * Python : 3.6 -# |***************************************************** # # -*- coding: utf-8 -*- import configparser @@ -15,14 +12,13 @@ import logging.handlers import os import sys - import requests from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtWidgets import QFileDialog - from src.utils import constants, messages from src.utils.create_files import CreateFiles + _date_formatter = "%b/%d/%Y" _time_formatter = "%H:%M:%S" @@ -40,7 +36,6 @@ def toDict(self): return json_dict -################################################################################ class ProgressBar: def __init__(self): _width = 350 @@ -70,12 +65,10 @@ def close(self): self.progressBar.close() -################################################################################ def get_current_path(): return os.path.abspath(os.getcwd()) -################################################################################ def get_all_ini_file_settings(file_name: str): dictionary = {} parser = configparser.ConfigParser(delimiters='=', allow_no_value=True) @@ -97,7 +90,6 @@ def get_all_ini_file_settings(file_name: str): return dictionary -################################################################################ def set_all_ini_file_settings(filename: str, dict_values: dict): parser = configparser.ConfigParser(delimiters='=', allow_no_value=True) parser.optionxform = str # this wont change all values to lowercase @@ -113,7 +105,6 @@ def set_all_ini_file_settings(filename: str, dict_values: dict): return -################################################################################ def set_file_settings(section: str, config_name: str, value): filename = constants.SETTINGS_FILENAME parser = configparser.ConfigParser(delimiters='=', allow_no_value=True) @@ -128,7 +119,6 @@ def set_file_settings(section: str, config_name: str, value): return -################################################################################ def log_uncaught_exceptions(exc_type, exc_value, exc_traceback): logger = logging.getLogger(__name__) stderr_hdlr = logging.StreamHandler(stream=sys.stdout) @@ -141,19 +131,14 @@ def log_uncaught_exceptions(exc_type, exc_value, exc_traceback): logger.exception("Uncaught exception", exc_info=(exc_type, exc_value, exc_traceback)) -################################################################################ def dialog_get_file_path(): full_path = QFileDialog.getOpenFileName(None, 'Open file')[0] if full_path == '': return '' - else: - if constants.IS_WINDOWS: - return str(full_path).replace("/", "\\") - else: - return str(full_path) + + return str(full_path).replace("/", "\\") -################################################################################ def md5_checksum(file_path): md5 = hashlib.md5() with open(file_path, 'rb') as f: @@ -165,7 +150,6 @@ def md5_checksum(file_path): return md5.hexdigest().upper() -################################################################################ def get_download_path(): if constants.IS_WINDOWS: import winreg @@ -181,21 +165,18 @@ def get_download_path(): return downloads_path.replace('\\', '/') -################################################################################ def remove_arcdps_files(self): gw2_dir_path = os.path.dirname(self.configs['gw2Path']) d3d9_path = remove_file(self, f"{gw2_dir_path}{constants.D3D9_PATH}") return True if d3d9_path else False -################################################################################ def remove_arcdps_backup_files(self): gw2_dir_path = os.path.dirname(self.configs['gw2Path']) d3d9_bak = remove_file(self, f"{gw2_dir_path}{constants.D3D9_BAK_PATH}") return True if d3d9_bak else False -################################################################################ def check_dirs(): try: if not os.path.exists(constants.PROGRAM_PATH): @@ -205,7 +186,6 @@ def check_dirs(): exit(1) -################################################################################ def setup_logging(self): logger = logging.getLogger() logger.setLevel(constants.LOG_LEVEL) @@ -221,7 +201,6 @@ def setup_logging(self): return self.log -################################################################################ def check_files(self): create_files = CreateFiles(self) @@ -238,7 +217,6 @@ def check_files(self): self.log.error(f"{e}") -################################################################################ def remove_file(self, file_path): try: if os.path.isfile(file_path): @@ -250,7 +228,6 @@ def remove_file(self, file_path): return success -################################################################################ def backup_arcdps_files(self, type_backup: str): gw2_dir_path = os.path.dirname(self.configs['gw2Path']) d3d9_path = f"{gw2_dir_path}{constants.D3D9_PATH}" @@ -264,7 +241,6 @@ def backup_arcdps_files(self, type_backup: str): os.rename(d3d9_bak_path, d3d9_path) -################################################################################ def show_message_window(window_type: str, window_title: str, msg: str): if window_type.lower() == "error": icon = QtWidgets.QMessageBox.Critical @@ -291,7 +267,6 @@ def show_message_window(window_type: str, window_title: str, msg: str): return user_answer -################################################################################ def check_new_program_version(self): client_version = self.client_version remote_version = None @@ -324,7 +299,6 @@ def check_new_program_version(self): return obj_return -################################################################################ def set_paypal_button(self): url = constants.PAYPAL_REMOTE_FILENAME data = requests.get(url, stream=True)