Skip to content
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

Update examples to explicitly list gradle dependencies. #2363

Merged
merged 3 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/2363.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Examples were updated to explicitly list Android Gradle dependencies.
8 changes: 8 additions & 0 deletions demo/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,11 @@ requires = [
requires = [
"../android",
]

base_theme = "Theme.MaterialComponents.Light.DarkActionBar"

build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]
6 changes: 3 additions & 3 deletions docs/tutorial/tutorial-0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ We can then define a button. When we create the button, we can set the button
text, and we also set the behavior that we want to invoke when the button is
pressed, referencing the handler that we defined earlier::

button = toga.Button('Hello world', on_press=button_handler)
button = toga.Button("Hello world", on_press=button_handler)

Now we have to define how the button will appear in the window. By default,
Toga uses a style algorithm called ``Pack``, which is a bit like "CSS-lite".
Expand Down Expand Up @@ -173,13 +173,13 @@ method defining the main window contents. We wrap this creation process into a
method called ``main()``, which returns a new instance of our application::

def main():
return toga.App('First App', 'org.beeware.helloworld', startup=build)
return toga.App("First App", "org.beeware.toga.tutorial", startup=build)

The entry point for the project then needs to instantiate this entry point
and start the main app loop. The call to ``main_loop()`` is a blocking call;
it won't return until you quit the main app::

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

And that's it! Save this script as ``helloworld.py``, and you're ready to go.
Expand Down
17 changes: 16 additions & 1 deletion examples/.template/{{ cookiecutter.name }}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["briefcase"]

[tool.briefcase]
project_name = "{{ cookiecutter.formal_name }}"
bundle = "org.beeware"
bundle = "org.beeware.toga.examples"
version = "0.0.1"
url = "https://beeware.org"
license = "BSD license"
Expand Down Expand Up @@ -46,3 +46,18 @@ requires = [
requires = [
'../../android',
]

base_theme = "Theme.MaterialComponents.Light.DarkActionBar"

build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
[tool.briefcase.app.{{ cookiecutter.name }}.web]
requires = [
"../../web",
]
style_framework = "Shoelace v2.3"
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Examples of valid version strings
# __version__ = '1.2.3.dev1' # Development release 1
# __version__ = '1.2.3a1' # Alpha Release 1
# __version__ = '1.2.3b1' # Beta Release 1
# __version__ = '1.2.3rc1' # RC Release 1
# __version__ = '1.2.3' # Final Release
# __version__ = '1.2.3.post1' # Post Release 1
# __version__ = "1.2.3.dev1" # Development release 1
# __version__ = "1.2.3a1" # Alpha Release 1
# __version__ = "1.2.3b1" # Beta Release 1
# __version__ = "1.2.3rc1" # RC Release 1
# __version__ = "1.2.3" # Final Release
# __version__ = "1.2.3.post1" # Post Release 1

__version__ = '0.0.1'
__version__ = "0.0.1"
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from {{ cookiecutter.name }}.app import main

if __name__ == '__main__':
if __name__ == "__main__":
main().main_loop()
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ def startup(self):
self.main_window = toga.MainWindow()

# Label to show responses.
self.label = toga.Label('Ready.')
self.label = toga.Label("Ready.")

widget = toga.{{ cookiecutter.widget_name }}()

# Buttons
btn_style = Pack(flex=1)
btn_do_stuff = toga.Button('Do stuff', on_press=self.do_stuff, style=btn_style)
btn_clear = toga.Button('Clear', on_press=self.do_clear, style=btn_style)
btn_do_stuff = toga.Button("Do stuff", on_press=self.do_stuff, style=btn_style)
btn_clear = toga.Button("Clear", on_press=self.do_clear, style=btn_style)
btn_box = toga.Box(
children=[
btn_do_stuff,
Expand Down Expand Up @@ -52,9 +52,9 @@ def startup(self):


def main():
return Example{{ cookiecutter.widget_name }}App('{{ cookiecutter.formal_name }}', 'org.beeware.widgets.{{ cookiecutter.name }}')
return Example{{ cookiecutter.widget_name }}App("{{ cookiecutter.formal_name }}", "org.beeware.toga.examples.{{ cookiecutter.name }}")


if __name__ == '__main__':
if __name__ == "__main__":
app = main()
app.main_loop()
2 changes: 1 addition & 1 deletion examples/activityindicator/activityindicator/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def startup(self):

def main():
return ExampleActivityIndicatorApp(
"Activity Indicator", "org.beeware.widgets.activityindicator"
"Activity Indicator", "org.beeware.toga.examples.activityindicator"
)


Expand Down
10 changes: 9 additions & 1 deletion examples/activityindicator/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["briefcase"]

[tool.briefcase]
project_name = "Activity Indicator"
bundle = "org.beeware"
bundle = "org.beeware.toga.examples"
version = "0.0.1"
url = "https://beeware.org"
license = "BSD license"
Expand Down Expand Up @@ -47,6 +47,14 @@ requires = [
"../../android",
]

base_theme = "Theme.MaterialComponents.Light.DarkActionBar"

build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
[tool.briefcase.app.activityindicator.web]
requires = [
Expand Down
2 changes: 1 addition & 1 deletion examples/beeliza/beeliza/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def startup(self):


def main():
return BeelizaApp("Beeliza", "org.beeware.beeliza")
return BeelizaApp("Beeliza", "org.beeware.toga.examples.beeliza")


if __name__ == "__main__":
Expand Down
10 changes: 9 additions & 1 deletion examples/beeliza/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["briefcase"]

[tool.briefcase]
project_name = "Beeliza"
bundle = "org.beeware"
bundle = "org.beeware.toga.examples"
version = "0.0.1"
url = "https://beeware.org"
license = "BSD license"
Expand Down Expand Up @@ -47,6 +47,14 @@ requires = [
"../../android",
]

base_theme = "Theme.MaterialComponents.Light.DarkActionBar"

build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
[tool.briefcase.app.beeliza.web]
requires = [
Expand Down
2 changes: 1 addition & 1 deletion examples/box/box/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def toggle_yellow_button(self, widget):
def main():
# Application class
# App name and namespace
app = ExampleBoxApp("Box", "org.beeware.widgets.boxes")
app = ExampleBoxApp("Box", "org.beeware.toga.examples.boxes")
return app


Expand Down
10 changes: 9 additions & 1 deletion examples/box/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["briefcase"]

[tool.briefcase]
project_name = "Box Demo"
bundle = "org.beeware"
bundle = "org.beeware.toga.examples"
version = "0.0.1"
url = "https://beeware.org"
license = "BSD license"
Expand Down Expand Up @@ -47,6 +47,14 @@ requires = [
"../../android",
]

base_theme = "Theme.MaterialComponents.Light.DarkActionBar"

build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
[tool.briefcase.app.box.web]
requires = [
Expand Down
2 changes: 1 addition & 1 deletion examples/button/button/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def callback_smaller(self, button):
def main():
# Application class
# App name and namespace
app = ExampleButtonApp("Button", "org.beeware.widgets.buttons")
app = ExampleButtonApp("Button", "org.beeware.toga.examples.buttons")
return app


Expand Down
10 changes: 9 additions & 1 deletion examples/button/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["briefcase"]

[tool.briefcase]
project_name = "Button Demo"
bundle = "org.beeware"
bundle = "org.beeware.toga.examples"
version = "0.0.1"
url = "https://beeware.org"
license = "BSD license"
Expand Down Expand Up @@ -47,6 +47,14 @@ requires = [
"../../android",
]

base_theme = "Theme.MaterialComponents.Light.DarkActionBar"

build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
[tool.briefcase.app.button.web]
requires = [
Expand Down
2 changes: 1 addition & 1 deletion examples/canvas/canvas/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ def get_context(self, canvas):


def main():
return ExampleCanvasApp("Canvas", "org.beeware.widgets.canvas")
return ExampleCanvasApp("Canvas", "org.beeware.toga.examples.canvas")


if __name__ == "__main__":
Expand Down
10 changes: 9 additions & 1 deletion examples/canvas/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["briefcase"]

[tool.briefcase]
project_name = "Canvas Demo"
bundle = "org.beeware"
bundle = "org.beeware.toga.examples"
version = "0.0.1"
url = "https://beeware.org"
license = "BSD license"
Expand Down Expand Up @@ -47,6 +47,14 @@ requires = [
"../../android",
]

base_theme = "Theme.MaterialComponents.Light.DarkActionBar"

build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
[tool.briefcase.app.canvas.web]
requires = [
Expand Down
2 changes: 1 addition & 1 deletion examples/colors/colors/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def startup(self):


def main():
return ColorsApp("Colors", "org.beeware.widgets.colors")
return ColorsApp("Colors", "org.beeware.toga.examples.colors")


if __name__ == "__main__":
Expand Down
10 changes: 9 additions & 1 deletion examples/colors/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["briefcase"]

[tool.briefcase]
project_name = "colors"
bundle = "org.beeware"
bundle = "org.beeware.toga.examples"
version = "0.0.1"
url = "https://beeware.org"
license = "BSD license"
Expand Down Expand Up @@ -47,6 +47,14 @@ requires = [
"../../android",
]

base_theme = "Theme.MaterialComponents.Light.DarkActionBar"

build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
[tool.briefcase.app.colors.web]
requires = [
Expand Down
2 changes: 1 addition & 1 deletion examples/command/command/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def action4(widget):


def main():
return ExampleTestCommandApp("Test Command", "org.beeware.widgets.command")
return ExampleTestCommandApp("Test Command", "org.beeware.toga.examples.command")


if __name__ == "__main__":
Expand Down
10 changes: 9 additions & 1 deletion examples/command/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["briefcase"]

[tool.briefcase]
project_name = "Command Example"
bundle = "org.beeware"
bundle = "org.beeware.toga.examples"
version = "0.0.1"
url = "https://beeware.org"
license = "BSD license"
Expand Down Expand Up @@ -47,6 +47,14 @@ requires = [
"../../android",
]

base_theme = "Theme.MaterialComponents.Light.DarkActionBar"

build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
[tool.briefcase.app.command.web]
requires = [
Expand Down
2 changes: 1 addition & 1 deletion examples/date_and_time/date_and_time/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def startup(self):


def main():
return DateAndTimeApp("Dates and Times", "org.beeware.widgets.date_and_time")
return DateAndTimeApp("Dates and Times", "org.beeware.toga.examples.date_and_time")


if __name__ == "__main__":
Expand Down
10 changes: 9 additions & 1 deletion examples/date_and_time/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["briefcase"]

[tool.briefcase]
project_name = "Date And Time"
bundle = "org.beeware"
bundle = "org.beeware.toga.examples"
version = "0.0.1"
url = "https://beeware.org"
license = "BSD license"
Expand Down Expand Up @@ -47,6 +47,14 @@ requires = [
"../../android",
]

base_theme = "Theme.MaterialComponents.Light.DarkActionBar"

build_gradle_dependencies = [
"androidx.appcompat:appcompat:1.6.1",
"com.google.android.material:material:1.11.0",
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
]

# Web deployment
[tool.briefcase.app.date_and_time.web]
requires = [
Expand Down
4 changes: 3 additions & 1 deletion examples/detailedlist/detailedlist/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ def startup(self):


def main():
return ExampleDetailedListApp("Detailed List", "org.beeware.widgets.detailedlist")
return ExampleDetailedListApp(
"Detailed List", "org.beeware.toga.examples.detailedlist"
)


if __name__ == "__main__":
Expand Down
Loading