Skip to content

Commit

Permalink
Renamed new element to app_fullscreen to stay consistent to Quasar an…
Browse files Browse the repository at this point in the history
…d keep the named reserved for a potential fullscreen view
  • Loading branch information
Alyxion committed Jan 3, 2025
1 parent 29a0c57 commit 913ff31
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from nicegui.events import ValueChangeEventArguments


class Fullscreen(Element, component='fullscreen.js'):
class AppFullscreen(Element, component='app_fullscreen.js'):

def __init__(self, *, require_escape_hold: bool = False, on_state_change: Callable[[ValueChangeEventArguments], None] = None):
"""Fullscreen control element
Expand Down
4 changes: 2 additions & 2 deletions nicegui/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
'element',
'expansion',
'footer',
'fullscreen',
'app_fullscreen',
'grid',
'header',
'highchart',
Expand Down Expand Up @@ -155,7 +155,7 @@
from .elements.echart import EChart as echart
from .elements.editor import Editor as editor
from .elements.expansion import Expansion as expansion
from .elements.fullscreen import Fullscreen as fullscreen
from .elements.app_fullscreen import AppFullscreen as app_fullscreen
from .elements.grid import Grid as grid
from .elements.highchart import highchart
from .elements.html import Html as html
Expand Down
14 changes: 7 additions & 7 deletions tests/test_fullscreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
def test_fullscreen_creation(screen: Screen):
@ui.page('/')
def page():
fs = ui.fullscreen()
fs = ui.app_fullscreen()
assert not fs.state
assert not fs.require_escape_hold

Expand All @@ -17,7 +17,7 @@ def page():
def test_fullscreen_initial_state(screen: Screen):
@ui.page('/')
def page():
fs = ui.fullscreen(require_escape_hold=True)
fs = ui.app_fullscreen(require_escape_hold=True)
assert fs.require_escape_hold
assert not fs.state

Expand All @@ -29,7 +29,7 @@ def test_fullscreen_state_change(screen: Screen):

@ui.page('/')
def page():
fs = ui.fullscreen()
fs = ui.app_fullscreen()

def on_state_change(e):
states.append(e.value)
Expand All @@ -51,7 +51,7 @@ def on_state_change(e):
def test_fullscreen_methods(screen: Screen):
@ui.page('/')
def page():
fs = ui.fullscreen(require_escape_hold=True)
fs = ui.app_fullscreen(require_escape_hold=True)

with patch.object(fs, 'run_method') as mock_run:
fs.enter()
Expand All @@ -71,7 +71,7 @@ def page():
def test_fullscreen_property_binding(screen: Screen):
@ui.page('/')
def page():
fs = ui.fullscreen()
fs = ui.app_fullscreen()

fs.require_escape_hold = True
assert fs.require_escape_hold
Expand All @@ -94,7 +94,7 @@ def test_fullscreen_button_click(screen: Screen):

@ui.page('/')
def page():
fs = ui.fullscreen()
fs = ui.app_fullscreen()
ui.button('Enter Fullscreen', on_click=fs.enter)
ui.button('Exit Fullscreen', on_click=fs.exit)

Expand All @@ -111,7 +111,7 @@ def test_fullscreen_switch_binding(screen: Screen):
"""Test that the require_escape_hold switch properly binds to the fullscreen control."""
@ui.page('/')
def page():
fs = ui.fullscreen()
fs = ui.app_fullscreen()
ui.label('Require escape hold:')
switch = ui.switch().bind_value_to(fs, 'require_escape_hold')

Expand Down
10 changes: 5 additions & 5 deletions website/documentation/content/fullscreen_documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
from . import doc


@doc.demo(ui.fullscreen)
@doc.demo(ui.app_fullscreen)
def main_demo() -> None:
fs = ui.fullscreen()
fs = ui.app_fullscreen()

with ui.card().classes('w-full items-center'):
ui.label('Try fullscreen mode!')
Expand All @@ -22,7 +22,7 @@ def main_demo() -> None:
Note that this feature only works in some browsers like Google Chrome or Microsoft Edge.
''')
def toggle_demo():
fs = ui.fullscreen()
fs = ui.app_fullscreen()
with ui.card().classes('w-full items-center'):
ui.label('Toggle fullscreen with optional long-press escape')
with ui.row():
Expand All @@ -45,7 +45,7 @@ def update_state():
state = fs.state
label.text = f'Fullscreen: {"Yes" if state else "No"}'

fs = ui.fullscreen(on_state_change=state_change)
fs = ui.app_fullscreen(on_state_change=state_change)
label = ui.label()
update_state()

Expand All @@ -54,4 +54,4 @@ def update_state():
label


doc.reference(ui.fullscreen)
doc.reference(ui.app_fullscreen)

0 comments on commit 913ff31

Please sign in to comment.