Skip to content

Commit

Permalink
Fix config save
Browse files Browse the repository at this point in the history
  • Loading branch information
elanjcoop committed Mar 26, 2023
1 parent 63b0a30 commit c95f913
Show file tree
Hide file tree
Showing 12 changed files with 328 additions and 313 deletions.
208 changes: 104 additions & 104 deletions build/main/Analysis-00.toc

Large diffs are not rendered by default.

195 changes: 99 additions & 96 deletions build/main/EXE-00.toc

Large diffs are not rendered by default.

Binary file modified build/main/Elan's Mod.pkg
Binary file not shown.
193 changes: 98 additions & 95 deletions build/main/PKG-00.toc

Large diffs are not rendered by default.

Binary file modified build/main/PYZ-00.pyz
Binary file not shown.
Binary file modified build/main/base_library.zip
Binary file not shown.
Binary file modified build/main/main.pkg
Binary file not shown.
8 changes: 4 additions & 4 deletions build/main/warn-main.txt
Expand Up @@ -15,19 +15,19 @@ IMPORTANT: Do NOT post this list to the issue-tracker. Use it as a basis for
tracking down the missing module yourself. Thanks!

missing module named _posixshmem - imported by multiprocessing.resource_tracker (conditional), multiprocessing.shared_memory (conditional)
missing module named 'org.python' - imported by copy (optional), xml.sax (delayed, conditional)
missing module named org - imported by copy (optional)
missing module named 'org.python' - imported by pickle (optional), xml.sax (delayed, conditional)
missing module named 'java.lang' - imported by platform (delayed, optional), xml.sax._exceptions (conditional)
missing module named multiprocessing.BufferTooShort - imported by multiprocessing (top-level), multiprocessing.connection (top-level)
missing module named multiprocessing.AuthenticationError - imported by multiprocessing (top-level), multiprocessing.connection (top-level)
missing module named _posixsubprocess - imported by subprocess (optional), multiprocessing.util (delayed)
missing module named _frozen_importlib_external - imported by importlib._bootstrap (delayed), importlib (optional), importlib.abc (optional), zipimport (top-level)
excluded module named _frozen_importlib - imported by importlib (optional), importlib.abc (optional), zipimport (top-level)
missing module named pep517 - imported by importlib.metadata (delayed)
missing module named pwd - imported by posixpath (delayed, conditional), subprocess (delayed, conditional, optional), shutil (delayed, optional), tarfile (optional), pathlib (delayed, optional), netrc (delayed, conditional), getpass (delayed)
missing module named grp - imported by subprocess (delayed, conditional, optional), shutil (delayed, optional), tarfile (optional), pathlib (delayed, optional)
missing module named pwd - imported by posixpath (delayed, conditional), shutil (delayed, optional), tarfile (optional), pathlib (delayed, optional), subprocess (delayed, conditional, optional), netrc (delayed, conditional), getpass (delayed)
missing module named grp - imported by shutil (delayed, optional), tarfile (optional), pathlib (delayed, optional), subprocess (delayed, conditional, optional)
missing module named posix - imported by os (conditional, optional), shutil (conditional), importlib._bootstrap_external (conditional)
missing module named resource - imported by posix (top-level)
missing module named org - imported by pickle (optional)
missing module named multiprocessing.get_context - imported by multiprocessing (top-level), multiprocessing.pool (top-level), multiprocessing.managers (top-level), multiprocessing.sharedctypes (top-level)
missing module named multiprocessing.TimeoutError - imported by multiprocessing (top-level), multiprocessing.pool (top-level)
missing module named fcntl - imported by subprocess (optional)
Expand Down
12 changes: 6 additions & 6 deletions build/main/xref-main.html
Expand Up @@ -292,7 +292,7 @@ <h1>modulegraph cross reference for main.py, pyi_rth_inspect.py, pyi_rth_multipr
<a target="code" href="" type="text/plain"><tt>'org.python'</tt></a>
<span class="moduletype">MissingModule</span> <div class="import">
imported by:
<a href="#copy">copy</a>
<a href="#pickle">pickle</a>
&#8226; <a href="#xml.sax">xml.sax</a>

</div>
Expand Down Expand Up @@ -2812,8 +2812,8 @@ <h1>modulegraph cross reference for main.py, pyi_rth_inspect.py, pyi_rth_multipr
<a target="code" href="///C:/Users/coope/AppData/Local/Programs/Python/Python310/lib/copy.py" type="text/plain"><tt>copy</tt></a>
<span class="moduletype">SourceModule</span> <div class="import">
imports:
<a href="#'org.python'">'org.python'</a>
&#8226; <a href="#copyreg">copyreg</a>
<a href="#copyreg">copyreg</a>
&#8226; <a href="#org">org</a>
&#8226; <a href="#types">types</a>
&#8226; <a href="#weakref">weakref</a>

Expand Down Expand Up @@ -8329,7 +8329,7 @@ <h1>modulegraph cross reference for main.py, pyi_rth_inspect.py, pyi_rth_multipr
<a target="code" href="" type="text/plain"><tt>org</tt></a>
<span class="moduletype">MissingModule</span> <div class="import">
imported by:
<a href="#pickle">pickle</a>
<a href="#copy">copy</a>

</div>

Expand Down Expand Up @@ -8493,14 +8493,14 @@ <h1>modulegraph cross reference for main.py, pyi_rth_inspect.py, pyi_rth_multipr
<a target="code" href="///C:/Users/coope/AppData/Local/Programs/Python/Python310/lib/pickle.py" type="text/plain"><tt>pickle</tt></a>
<span class="moduletype">SourceModule</span> <div class="import">
imports:
<a href="#_compat_pickle">_compat_pickle</a>
<a href="#'org.python'">'org.python'</a>
&#8226; <a href="#_compat_pickle">_compat_pickle</a>
&#8226; <a href="#_pickle">_pickle</a>
&#8226; <a href="#codecs">codecs</a>
&#8226; <a href="#copyreg">copyreg</a>
&#8226; <a href="#functools">functools</a>
&#8226; <a href="#io">io</a>
&#8226; <a href="#itertools">itertools</a>
&#8226; <a href="#org">org</a>
&#8226; <a href="#pprint">pprint</a>
&#8226; <a href="#re">re</a>
&#8226; <a href="#struct">struct</a>
Expand Down
Binary file modified dist/Elan's Mod.exe
Binary file not shown.
23 changes: 16 additions & 7 deletions main.py
Expand Up @@ -327,10 +327,19 @@ def resource_path(relative_path):
else:
base_path = os.path.abspath(".")
return os.path.join(base_path, relative_path)
def config_path(relative_path):
if getattr(sys, 'frozen', False):
base_path = os.path.dirname(sys.executable)
base_path = os.path.join(base_path, "..")
else:
base_path = os.path.abspath(".")
return os.path.join(base_path, relative_path)
win.setWindowIcon(QIcon(resource_path('resources/images/ja.jpg')))

parser = ConfigParser()
parser.read(resource_path('dev.cfg'))
#config_path('resources/files/dev.cfg')
parser.read(config_path('resources/files/dev.cfg'))
#parser.read('resources/files/dev.cfg')

lbl_please_open_game = QtWidgets.QLabel(win)
lbl_please_open_game.setText("")
Expand Down Expand Up @@ -422,7 +431,7 @@ def enable_target_score_clicked(self):
txt_overtime_deadline.setDisabled(True)
target_score_enabled = False
parser.set('settings', 'target_score_enabled', 'False')
with open(resource_path("dev.cfg"), "w") as f:
with open(config_path('resources/files/dev.cfg'), "w") as f:
parser.write(f)

checkbox_enable_target_score = QtWidgets.QCheckBox(win)
Expand Down Expand Up @@ -459,7 +468,7 @@ def disable_threes(self):
threes_disabled = False
checkbox_shorten_threes.setDisabled(False)
parser.set('settings', 'disable_three_pointers_enabled', 'False')
with open(resource_path("dev.cfg"), "w") as f:
with open(config_path('resources/files/dev.cfg'), "w") as f:
parser.write(f)

checkbox_disable_threes = QtWidgets.QCheckBox(win)
Expand All @@ -478,7 +487,7 @@ def enable_shortened_threes(self):
txt_shortened_threes_length.setDisabled(True)
shorten_threes_enabled = False
parser.set('settings', 'shorten_three_pointers_enabled', 'False')
with open(resource_path("dev.cfg"), "w") as f:
with open(config_path('resources/files/dev.cfg'), "w") as f:
parser.write(f)

checkbox_shorten_threes = QtWidgets.QCheckBox(win)
Expand All @@ -500,7 +509,7 @@ def override_period_length(self):
txt_override_period_length.setDisabled(True)
override_period_length_enabled = False
parser.set('settings', 'override_period_length_enabled', 'False')
with open(resource_path("dev.cfg"), "w") as f:
with open(config_path('resources/files/dev.cfg'), "w") as f:
parser.write(f)

checkbox_override_period_length = QtWidgets.QCheckBox(win)
Expand Down Expand Up @@ -561,9 +570,9 @@ def apply_clicked(self = None):
parser.set('settings', 'ot_deadline', txt_overtime_deadline.text())
parser.set('settings', 'shortened_three_pointer_length', txt_shortened_threes_length.text())
parser.set('settings', 'period_length', txt_override_period_length.text())
with open(resource_path("dev.cfg"), "w") as f:
with open(config_path('resources/files/dev.cfg'), "w") as f:
parser.write(f)

txt_shot_clock.setText(parser.get('settings', 'shot_clock'))
txt_reset_shot_clock.setText(parser.get('settings', 'reset_shot_clock'))
checkbox_enable_ten_second.setChecked(parser.get('settings', 'ten_second_backcourt_enabled') == 'True')
Expand Down
2 changes: 1 addition & 1 deletion dev.cfg → resources/files/dev.cfg
@@ -1,6 +1,6 @@
[settings]
shot_clock = 24
reset_shot_clock = 24
reset_shot_clock = 14
ten_second_backcourt_enabled = False
target_score_enabled = False
ot_target_score = 5
Expand Down

0 comments on commit c95f913

Please sign in to comment.