This repository has been archived by the owner on Jan 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
609 additions
and
170 deletions.
There are no files selected for viewing
This file contains 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,23 +1,24 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
*.pyc | ||
*.sh | ||
setup.cfg | ||
pywebview.egg-info | ||
MANIFEST | ||
build | ||
dist | ||
.cache | ||
.idea | ||
.vs | ||
bin | ||
obj | ||
node_modules | ||
dist | ||
gui | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
venv* | ||
.vscode | ||
.pytest_cache | ||
__pycache__ | ||
src/__pycache__ | ||
.eggs | ||
yarn-error.log | ||
yarn.lock |
This file contains 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,29 @@ | ||
BSD 3-Clause License | ||
|
||
Copyright (c) 2020, Roman | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
3. Neither the name of the copyright holder nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains 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,46 +1,66 @@ | ||
# Getting Started with Create React App | ||
# pywebview-react-boilerplate | ||
This is a simple boilerplate to help you start with _pywebview_ and React. It sets up the development environment, install dependencies, as well as provides scripts for building an executable. Stack is based on Pywebview, React (create-react-app), SASS, Pyinstaller (Windows/Linux) and Py2app (macOS). | ||
|
||
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). | ||
## Requirements | ||
- Python 3 | ||
- Node | ||
- virtualenv | ||
|
||
## Available Scripts | ||
## Installation | ||
|
||
In the project directory, you can run: | ||
``` bash | ||
yarn run init | ||
``` | ||
|
||
### `yarn start` | ||
This will create a virtual environment, install pip and Node dependencies. Alternatively you can perform these steps manually. | ||
|
||
Runs the app in the development mode.\ | ||
Open [http://localhost:3000](http://localhost:3000) to view it in the browser. | ||
``` bash | ||
yarn install | ||
pip install -r requirements.txt | ||
``` | ||
|
||
The page will reload if you make edits.\ | ||
You will also see any lint errors in the console. | ||
On Linux systems installation system makes educated guesses. If you run KDE, QT dependencies are installed, otherwise GTK is chosen. `apt` is used for installing GTK dependencies. In case you are running a non apt-based system, you will have to install GTK dependencies manually. See [installation](https://pywebview.flowrl.com/guide/installation.html) for details. | ||
|
||
### `yarn test` | ||
## Usage | ||
|
||
Launches the test runner in the interactive watch mode.\ | ||
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. | ||
To launch the application. | ||
|
||
### `yarn build` | ||
``` bash | ||
yarn run start | ||
``` | ||
|
||
Builds the app for production to the `build` folder.\ | ||
It correctly bundles React in production mode and optimizes the build for the best performance. | ||
To build an executable. The output binary will be produced in the `dist` directory. | ||
|
||
The build is minified and the filenames include the hashes.\ | ||
Your app is ready to be deployed! | ||
``` bash | ||
yarn run build | ||
``` | ||
|
||
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. | ||
To start a development server (only for testing frontend code). | ||
|
||
### `yarn eject` | ||
``` bash | ||
yarn run dev | ||
``` | ||
|
||
**Note: this is a one-way operation. Once you `eject`, you can’t go back!** | ||
To clean the developement environment, this will delete `gui`, `dist`, `build` directories. | ||
|
||
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. | ||
``` bash | ||
yarn run clean | ||
``` | ||
|
||
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. | ||
|
||
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. | ||
To eject create-react-app and tweak the configuration as you may wish. | ||
|
||
## Learn More | ||
``` bash | ||
yarn run eject | ||
``` | ||
|
||
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). | ||
To test the frontend code if you have written tests. | ||
|
||
To learn React, check out the [React documentation](https://reactjs.org/). | ||
``` bash | ||
yarn run frontend:test | ||
``` | ||
|
||
|
||
## Bug reporting | ||
|
||
Please report _pywebview_ related bugs directly to [pywebview's repository](https://github.com/r0x0r/pywebview). This repository is only for the issues related to this boilerplate. |
This file contains 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,34 @@ | ||
# -*- mode: python -*- | ||
|
||
block_cipher = None | ||
|
||
added_files = [ | ||
('./gui', 'gui'), | ||
] | ||
|
||
a = Analysis(['./src/index.py'], | ||
pathex=['./dist'], | ||
binaries=None, | ||
datas=added_files, | ||
hiddenimports=['clr'], | ||
excludes=[], | ||
win_no_prefer_redirects=False, | ||
win_private_assemblies=False, | ||
cipher=block_cipher) | ||
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) | ||
exe = EXE(pyz, | ||
a.scripts, | ||
exclude_binaries=True, | ||
name='pywebview-react-app', | ||
debug=False, | ||
strip=True, | ||
#icon='./src/assets/\logo.ico', | ||
upx=True, | ||
console=False ) # set this to see error output of the executable | ||
coll = COLLECT(exe, | ||
a.binaries, | ||
a.zipfiles, | ||
a.datas, | ||
strip=False, | ||
upx=False, | ||
name='pywebview-react-app') |
This file contains 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,33 @@ | ||
import os | ||
import py2app | ||
import shutil | ||
|
||
from distutils.core import setup | ||
|
||
def tree(src): | ||
return [(root, map(lambda f: os.path.join(root, f), files)) | ||
for (root, dirs, files) in os.walk(os.path.normpath(src))] | ||
|
||
|
||
if os.path.exists('build'): | ||
shutil.rmtree('build') | ||
|
||
if os.path.exists('dist/index.app'): | ||
shutil.rmtree('dist/index.app') | ||
|
||
ENTRY_POINT = ['src/index.py'] | ||
|
||
DATA_FILES = tree('dist') | ||
OPTIONS = { | ||
'argv_emulation': False, | ||
'strip': True, | ||
'iconfile': 'src/assets/logo.icns', | ||
'includes': ['WebKit', 'Foundation', 'webview', 'pkg_resources.py2_warn'] | ||
} | ||
|
||
setup( | ||
app=ENTRY_POINT, | ||
data_files=DATA_FILES, | ||
options={'py2app': OPTIONS}, | ||
setup_requires=['py2app'], | ||
) |
This file contains 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,34 @@ | ||
# -*- mode: python -*- | ||
|
||
block_cipher = None | ||
|
||
added_files = [ | ||
('.\\gui', 'gui'), | ||
] | ||
|
||
a = Analysis(['.\\src\\index.py'], | ||
pathex=['.\\dist'], | ||
binaries=None, | ||
datas=added_files, | ||
hiddenimports=['clr'], | ||
excludes=[], | ||
win_no_prefer_redirects=False, | ||
win_private_assemblies=False, | ||
cipher=block_cipher) | ||
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) | ||
exe = EXE(pyz, | ||
a.scripts, | ||
exclude_binaries=True, | ||
name='pywebview-react-app', | ||
debug=False, | ||
strip=True, | ||
icon='.\\src\\assets\\logo.ico', | ||
upx=True, | ||
console=False ) # set this to see error output of the executable | ||
coll = COLLECT(exe, | ||
a.binaries, | ||
a.zipfiles, | ||
a.datas, | ||
strip=False, | ||
upx=False, | ||
name='pywebview-react-app') |
This file contains 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,40 @@ | ||
# -*- mode: python ; coding: utf-8 -*- | ||
|
||
|
||
block_cipher = None | ||
|
||
|
||
a = Analysis(['src/index.py'], | ||
pathex=[], | ||
binaries=[], | ||
datas=[], | ||
hiddenimports=[], | ||
hookspath=[], | ||
hooksconfig={}, | ||
runtime_hooks=[], | ||
excludes=[], | ||
win_no_prefer_redirects=False, | ||
win_private_assemblies=False, | ||
cipher=block_cipher, | ||
noarchive=False) | ||
pyz = PYZ(a.pure, a.zipped_data, | ||
cipher=block_cipher) | ||
|
||
exe = EXE(pyz, | ||
a.scripts, | ||
a.binaries, | ||
a.zipfiles, | ||
a.datas, | ||
[], | ||
name='index', | ||
debug=False, | ||
bootloader_ignore_signals=False, | ||
strip=False, | ||
upx=True, | ||
upx_exclude=[], | ||
runtime_tmpdir=None, | ||
console=True, | ||
disable_windowed_traceback=False, | ||
target_arch=None, | ||
codesign_identity=None, | ||
entitlements_file=None ) |
This file contains 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
Oops, something went wrong.