Skip to content

Commit

Permalink
Merge pull request #355 from beeware/tweaks
Browse files Browse the repository at this point in the history
Minor tweaks and updates to reflect current console output
  • Loading branch information
freakboy3742 committed May 15, 2024
2 parents 3a17124 + dec1c1a commit 828a8bf
Show file tree
Hide file tree
Showing 12 changed files with 100 additions and 101 deletions.
2 changes: 2 additions & 0 deletions docs/spelling_wordlist
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ backend
backends
beachball
conda
coroutine
coroutines
Ctrl
dialogs
distributable
Expand Down
38 changes: 18 additions & 20 deletions docs/tutorial/tutorial-1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,26 +121,24 @@ followed this tutorial so far, and accepted the defaults as described, your
file system should look something like::

beeware-tutorial/
beeware-venv/
...
helloworld/
CHANGELOG
LICENSE
README.rst
pyproject.toml
src/
helloworld/
resources/
helloworld.icns
helloworld.ico
helloworld.png
__init__.py
__main__.py
app.py
tests/
__init__.py
helloworld.py
test_app.py
├── beeware-venv/
│ └── ...
└── helloworld/
├── CHANGELOG
├── LICENSE
├── pyproject.toml
├── README.rst
├── src/
│ └── helloworld/
│ ├── app.py
│ ├── __init__.py
│ ├── __main__.py
│ └── resources/
│ └── README
└── tests/
├── helloworld.py
├── __init__.py
└── test_app.py

This skeleton is actually a fully functioning application without adding
anything else. The ``src`` folder contains all the code for the application, the
Expand Down
26 changes: 13 additions & 13 deletions docs/tutorial/tutorial-10.rst
Original file line number Diff line number Diff line change
Expand Up @@ -167,19 +167,19 @@ Let's provide some actual icons. Download :download:`this icons.zip bundle
directory. After unpacking, your project directory should look something like::

beeware-tutorial/
beeware-venv/
...
helloworld/
...
pyproject.toml
icons/
helloworld.icns
helloworld.ico
helloworld.png
helloworld-16.png
...
src/
...
├── beeware-venv/
└── ...
└── helloworld/
├── ...
└── pyproject.toml
├── icons/
├── helloworld.icns
├── helloworld.ico
├── helloworld.png
├── helloworld-16.png
├── ...
└── src/
└── ...

There's a *lot* of icons in this folder, but most of them should look the same:
a green snake on a light blue background:
Expand Down
16 changes: 8 additions & 8 deletions docs/tutorial/tutorial-2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ executing. The contents of ``__main__.py`` is relatively simple::

from helloworld.app import main

if __name__ == '__main__':
if __name__ == "__main__":
main().main_loop()

That is - it imports the ``main`` method from the ``helloworld`` app; and if
Expand Down Expand Up @@ -89,7 +89,7 @@ matching the application's name. A Main Window is a special kind of window in
Toga - it's a window that is closely bound to the life cycle of the app. When
the Main Window is closed, the application exits. The Main Window is also the
window that has the application's menu (if you're on a platform like Windows
where menu bars are part of the window)
where menu bars are part of the window).

We then add our empty box as the content of the main window, and instruct the
application to show our window::
Expand Down Expand Up @@ -122,7 +122,7 @@ looks like this::

name_label = toga.Label(
"Your name: ",
style=Pack(padding=(0, 5))
style=Pack(padding=(0, 5)),
)
self.name_input = toga.TextInput(style=Pack(flex=1))

Expand All @@ -133,7 +133,7 @@ looks like this::
button = toga.Button(
"Say Hello!",
on_press=self.say_hello,
style=Pack(padding=5)
style=Pack(padding=5),
)

main_box.add(name_box)
Expand Down Expand Up @@ -168,7 +168,7 @@ Next, we define a couple of widgets::

name_label = toga.Label(
"Your name: ",
style=Pack(padding=(0, 5))
style=Pack(padding=(0, 5)),
)
self.name_input = toga.TextInput(style=Pack(flex=1))

Expand Down Expand Up @@ -196,7 +196,7 @@ Now we define a button::
button = toga.Button(
"Say Hello!",
on_press=self.say_hello,
style=Pack(padding=5)
style=Pack(padding=5),
)

The button also has 5px of padding on all sides. We also define a *handler* -
Expand All @@ -208,15 +208,15 @@ Then, we add the name box and the button to the main box::
main_box.add(button)

This completes our layout; the rest of the startup method is as it was
previously - defining a MainWindow, and assigning the main box as the window's
previously - defining a ``MainWindow``, and assigning the main box as the window's
content::

self.main_window = toga.MainWindow(title=self.formal_name)
self.main_window.content = main_box
self.main_window.show()

The last thing we need to do is define the handler for the button. A handler
can be any method, generator, or asynchronous co-routine; it accepts the widget
can be any method, generator, or asynchronous coroutine; it accepts the widget
that generated the event as an argument, and will be invoked whenever the
button is pressed::

Expand Down
56 changes: 27 additions & 29 deletions docs/tutorial/tutorial-3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ From the ``helloworld`` directory, run:
(beeware-venv) $ briefcase create
[helloworld] Generating application template...
Using app template: https://github.com/beeware/briefcase-macOS-app-template.git, branch v0.3.14
Using app template: https://github.com/beeware/briefcase-macOS-app-template.git, branch v0.3.18
...
[helloworld] Installing support package...
Expand All @@ -45,7 +45,7 @@ From the ``helloworld`` directory, run:
...
[helloworld] Removing unneeded app content...
...
Removing unneeded app bundle content... done
[helloworld] Created build/helloworld/macos/app
Expand All @@ -58,12 +58,11 @@ From the ``helloworld`` directory, run:
[helloworld] Finalizing application configuration...
Targeting ubuntu:jammy (Vendor base debian)
Determining glibc version... done
Targeting glibc 2.35
Targeting Python3.10
[helloworld] Generating application template...
Using app template: https://github.com/beeware/briefcase-linux-AppImage-template.git, branch v0.3.14
Using app template: https://github.com/beeware/briefcase-linux-AppImage-template.git, branch v0.3.18
...
[helloworld] Installing support package...
Expand All @@ -79,7 +78,7 @@ From the ``helloworld`` directory, run:
...
[helloworld] Removing unneeded app content...
...
Removing unneeded app bundle content... done
[helloworld] Created build/helloworld/linux/ubuntu/jammy
Expand All @@ -90,7 +89,7 @@ From the ``helloworld`` directory, run:
(beeware-venv) C:\...>briefcase create
[helloworld] Generating application template...
Using app template: https://github.com/beeware/briefcase-windows-app-template.git, branch v0.3.14
Using app template: https://github.com/beeware/briefcase-windows-app-template.git, branch v0.3.18
...
[helloworld] Installing support package...
Expand Down Expand Up @@ -125,13 +124,13 @@ just happened? Briefcase has done the following:
got a bit more experience using Briefcase's default template.

2. It **downloaded and installed a support package**. The packaging approach
taken by briefcase is best described as "the simplest thing that could
taken by Briefcase is best described as "the simplest thing that could
possibly work" - it ships a complete, isolated Python interpreter as part of
every application it builds. This is slightly space inefficient - if you
have 5 applications packaged with Briefcase, you'll have 5 copies of the
Python interpreter. However, this approach guarantees that every application
is completely independent, using a specific version of Python that is known
to work with the application.
every application it builds (except for Linux native system package builds).
This is slightly space inefficient - if you have 5 applications packaged with
Briefcase, you'll have 5 copies of the Python interpreter. However, this
approach guarantees that every application is completely independent, using
a specific version of Python that is known to work with the application.

Again, Briefcase provides a default support package for each platform; if
you want, you can provide your own support package, and have that package
Expand All @@ -144,6 +143,11 @@ just happened? Briefcase has done the following:
downloaded a specific support package, that cached copy will be used on
future builds.

As noted above, when Briefcase packages an app as a native Linux system
package (the default package format for Linux), a support package is not
included with the app. Instead, the app will use the Python that is provided
by the distribution of Linux being targeted.

3. It **installed application requirements**. Your application can specify any
third-party modules that are required at runtime. These will be installed
using ``pip`` into your application's installer.
Expand Down Expand Up @@ -199,7 +203,6 @@ target platform.
[helloworld] Finalizing application configuration...
Targeting ubuntu:jammy (Vendor base debian)
Determining glibc version... done
Targeting glibc 2.35
Targeting Python3.10
Expand All @@ -212,8 +215,6 @@ target platform.
Installing license... done
Installing changelog... done
Installing man page... done
Update file permissions...
...
Updating file permissions... done
Stripping binary... done
Expand Down Expand Up @@ -286,7 +287,6 @@ You can now use Briefcase to run your application:
[helloworld] Finalizing application configuration...
Targeting ubuntu:jammy (Vendor base debian)
Determining glibc version... done
Targeting glibc 2.35
Targeting Python3.10
Expand Down Expand Up @@ -326,8 +326,8 @@ You can now use Briefcase to run your application:
Running app module: helloworld
---------------------------------------------------------------------------
This will start to run your native application, using the output of the
``build`` command.
This will start to run your native application, using the app bundle created by
the ``build`` command.

You might notice some small differences in the way your application looks
when it's running. For example, icons and the name displayed by the operating
Expand Down Expand Up @@ -396,7 +396,7 @@ or doing other pre-distribution tasks.

When you're ready to publish a real application, check out the Briefcase
How-To guide on `Setting up a macOS code signing identity
<https://briefcase.readthedocs.io/en/latest/how-to/code-signing/macOS.html>`__
<https://briefcase.readthedocs.io/en/latest/how-to/code-signing/macOS.html>`__.

.. group-tab:: Linux

Expand All @@ -410,7 +410,6 @@ or doing other pre-distribution tasks.
[helloworld] Finalizing application configuration...
Targeting ubuntu:jammy (Vendor base debian)
Determining glibc version... done
Targeting glibc 2.35
Targeting Python3.10
Expand All @@ -431,11 +430,10 @@ or doing other pre-distribution tasks.
(beeware-venv) $ briefcase package
[helloworld] Finalizing application configuration...
Targeting fedora:36 (Vendor base rhel)
Targeting fedora:40 (Vendor base rhel)
Determining glibc version... done
Targeting glibc 2.35
Targeting Python3.10
Targeting glibc 2.39
Targeting Python3.12
[helloworld] Building .rpm package...
Generating rpmbuild layout... done
Expand All @@ -450,7 +448,7 @@ or doing other pre-distribution tasks.
+ exit 0
Building RPM package... done
[helloworld] Packaged dist/helloworld-0.0.1-1.fc36.x86_64.rpm
[helloworld] Packaged dist/helloworld-0.0.1-1.fc40.x86_64.rpm
The ``dist`` folder will contain the ``.rpm`` file that was generated.

Expand All @@ -461,10 +459,10 @@ or doing other pre-distribution tasks.
(beeware-venv) $ briefcase package
[helloworld] Finalizing application configuration...
Targeting arch:rolling (Vendor base arch)
Targeting arch:20240101 (Vendor base arch)
Determining glibc version... done
Targeting glibc 2.37
Targeting Python3.10
Targeting glibc 2.38
Targeting Python3.12
[helloworld] Building .pkg.tar.zst package...
...
Expand All @@ -489,7 +487,7 @@ or doing other pre-distribution tasks.

.. code-block:: console
$ docker run -it ubuntu:22.04
$ docker run --rm -it ubuntu:22.04
will show you a Unix prompt (something like ``root@84444e31cff9:/#``)
inside an Ubuntu 22.04 Docker container. Type Ctrl-D to exit Docker and
Expand Down
11 changes: 7 additions & 4 deletions docs/tutorial/tutorial-4.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Modify the ``say_hello`` callback so it looks like this::
def say_hello(self, widget):
self.main_window.info_dialog(
f"Hello, {self.name_input.value}",
"Hi there!"
"Hi there!",
)

This directs Toga to open a modal dialog box when the button is pressed.
Expand Down Expand Up @@ -87,14 +87,18 @@ code for your existing bundled application:
(beeware-venv) $ briefcase update
[helloworld] Finalizing application configuration...
Targeting ubuntu:jammy (Vendor base debian)
Determining glibc version... done
Targeting glibc 2.35
Targeting Python3.10
[helloworld] Updating application code...
Installing src/helloworld... done
[helloworld] Removing unneeded app content...
Removing unneeded app bundle content... done
[helloworld] Removing unneeded app content...
Removing unneeded app bundle content... done
[helloworld] Application updated.
Expand Down Expand Up @@ -194,7 +198,6 @@ new logic works; then update, build and run the app with one command:
[helloworld] Finalizing application configuration...
Targeting ubuntu:jammy (Vendor base debian)
Determining glibc version... done
Targeting glibc 2.35
Targeting Python3.10
Expand Down

0 comments on commit 828a8bf

Please sign in to comment.