-
Notifications
You must be signed in to change notification settings - Fork 15
Preparation in order to support multiple OS #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
SumolX
wants to merge
4
commits into
hd-zero:main
Choose a base branch
from
SumolX:support-multiple-os
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
d5ceee0
the name "Download" overshadows python3 built in module, renamed to d…
SumolX 7db1e2b
Added platform checks in preparation for other OS support
SumolX 8d66485
UI handling must be handled in main thread to remain compatible with …
SumolX 0ac6160
Fixed run path when running directly within python or as a packaged d…
SumolX File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,52 +1,22 @@ | ||
| import threading | ||
| import os | ||
| import sys | ||
| import shutil | ||
| from main_window import ui_thread_proc | ||
| from download import download_thread_proc | ||
| from main_window import main_window_ui | ||
| from downloader import download_thread_proc | ||
| from ch341 import ch341_thread_proc | ||
|
|
||
|
|
||
| def get_resource_folder(): | ||
| if getattr(sys, 'frozen', False): | ||
| base_path = sys._MEIPASS | ||
| else: | ||
| base_path = os.path.dirname(os.path.abspath(__file__)) | ||
|
|
||
| resource_folder = os.path.join(base_path, "data_folder") | ||
| print(resource_folder) | ||
|
|
||
| return resource_folder | ||
|
|
||
|
|
||
| def check_and_release_resource(): | ||
|
|
||
| resource_folder = get_resource_folder() | ||
|
|
||
| if os.path.exists("resource"): | ||
| pass | ||
| else: | ||
| for filename in os.listdir(resource_folder): | ||
| source_file = os.path.join(resource_folder, filename) | ||
| destination_file = os.path.join("resource", filename) | ||
| if os.path.isfile(source_file): | ||
| shutil.copy(source_file, destination_file) | ||
| elif os.path.isdir(source_file): | ||
| shutil.copytree(source_file, destination_file) | ||
|
|
||
| run_path = getattr(sys, '_MEIPASS', os.path.abspath(os.path.dirname(__file__))) | ||
| os.chdir(run_path) | ||
|
|
||
| def main(): | ||
| check_and_release_resource() | ||
| download_thread = threading.Thread( | ||
| target=download_thread_proc, name="download") | ||
| download_thread.start() | ||
|
|
||
| ui_thread = threading.Thread(target=ui_thread_proc, name="ui") | ||
| ui_thread.start() | ||
| download_thread = threading.Thread(target=download_thread_proc, name="downloader") | ||
| download_thread.start() | ||
|
|
||
| ch341_thread = threading.Thread(target=ch341_thread_proc, name="ch341") | ||
| ch341_thread.start() | ||
|
|
||
| main_window_ui() | ||
|
|
||
| if __name__ == '__main__': | ||
| main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| pyinstaller -i HDZeroIcon.ico -w --onefile --add-data "resource;data_folder" hdzero_programmer.py | ||
| pyinstaller -i HDZeroIcon.ico -w --onefile --add-data "resource;resource" hdzero_programmer.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| rm -rf build dist | ||
| pyinstaller -i HDZeroIcon.ico -w --onefile --add-data="resource:resource" hdzero_programmer.py |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unknown Tinker option. Supported options are as follows:
_tkinter.TclError: bad attribute "-disable": must be -alpha, -fullscreen, -modified, -notify, -titlepath, -topmost, -transparent, or -type