Skip to content

Commit 243930e

Browse files
committed
replace deprecation usage throughout
1 parent 3bedc66 commit 243930e

28 files changed

Lines changed: 92 additions & 80 deletions

File tree

sdk/python/examples/controls/types/border/container/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ def main(page: ft.Page):
1414
bgcolor=ft.Colors.AMBER,
1515
padding=15,
1616
border=ft.Border.all(10, ft.Colors.PINK_600),
17-
border_radius=ft.border_radius.all(30),
17+
border_radius=ft.BorderRadius.all(30),
1818
width=150,
1919
height=150,
2020
),
2121
ft.Container(
2222
bgcolor=ft.Colors.DEEP_PURPLE,
2323
padding=15,
2424
border=ft.Border.all(3, ft.Colors.LIGHT_GREEN_ACCENT),
25-
border_radius=ft.border_radius.only(
25+
border_radius=ft.BorderRadius.only(
2626
top_left=10, bottom_right=10
2727
),
2828
width=150,
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
import flet as ft
2+
13
SLOT_WIDTH = 70
24
SLOT_HEIGHT = 100
35

4-
import flet as ft
5-
66

77
class Slot(ft.Container):
88
def __init__(self, top, left):
@@ -12,4 +12,4 @@ def __init__(self, top, left):
1212
self.height = SLOT_HEIGHT
1313
self.left = left
1414
self.top = top
15-
self.border = ft.border.all(1)
15+
self.border = ft.Border.all(1)

sdk/python/examples/tutorials/solitaire/solitaire-drag-and-drop/step2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def drop(e: ft.DragEndEvent):
4141

4242
e.control.update()
4343

44-
slot = ft.Container(width=70, height=100, left=200, top=0, border=ft.border.all(1))
44+
slot = ft.Container(width=70, height=100, left=200, top=0, border=ft.Border.all(1))
4545

4646
card = ft.GestureDetector(
4747
mouse_cursor=ft.MouseCursor.MOVE,

sdk/python/examples/tutorials/solitaire/solitaire-drag-and-drop/step3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def drop(e: ft.DragEndEvent):
4545

4646
e.control.update()
4747

48-
slot = ft.Container(width=70, height=100, left=200, top=0, border=ft.border.all(1))
48+
slot = ft.Container(width=70, height=100, left=200, top=0, border=ft.Border.all(1))
4949

5050
card1 = ft.GestureDetector(
5151
mouse_cursor=ft.MouseCursor.MOVE,

sdk/python/examples/tutorials/solitaire/solitaire-drag-and-drop/step4.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ def drop(e: ft.DragEndEvent):
5252
bounce_back(solitaire, e.control)
5353
e.control.update()
5454

55-
slot0 = ft.Container(width=70, height=100, left=0, top=0, border=ft.border.all(1))
55+
slot0 = ft.Container(width=70, height=100, left=0, top=0, border=ft.Border.all(1))
5656

57-
slot1 = ft.Container(width=70, height=100, left=200, top=0, border=ft.border.all(1))
57+
slot1 = ft.Container(width=70, height=100, left=200, top=0, border=ft.Border.all(1))
5858

59-
slot2 = ft.Container(width=70, height=100, left=300, top=0, border=ft.border.all(1))
59+
slot2 = ft.Container(width=70, height=100, left=300, top=0, border=ft.Border.all(1))
6060

6161
slots = [slot0, slot1, slot2]
6262

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
import flet as ft
2+
13
SLOT_WIDTH = 70
24
SLOT_HEIGHT = 100
35

4-
import flet as ft
5-
66

77
class Slot(ft.Container):
88
def __init__(self, top, left):
@@ -12,4 +12,4 @@ def __init__(self, top, left):
1212
self.height = SLOT_HEIGHT
1313
self.left = left
1414
self.top = top
15-
self.border = ft.border.all(1)
15+
self.border = ft.Border.all(1)

sdk/python/examples/tutorials/solitaire/solitaire-final-part1/card.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def __init__(self, solitaire, suite, rank):
2626
self.content = ft.Container(
2727
width=CARD_WIDTH,
2828
height=CARD_HEIGHT,
29-
border_radius=ft.border_radius.all(6),
29+
border_radius=ft.BorderRadius.all(6),
3030
content=ft.Image(src="/images/card_back.png"),
3131
)
3232
self.draggable_pile = [self]

sdk/python/examples/tutorials/solitaire/solitaire-final-part1/slot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def __init__(self, solitaire, top, left, border):
1515
self.on_click = self.click
1616
self.solitaire = solitaire
1717
self.border = border
18-
self.border_radius = ft.border_radius.all(6)
18+
self.border_radius = ft.BorderRadius.all(6)
1919

2020
def get_top_card(self):
2121
if len(self.pile) > 0:

sdk/python/examples/tutorials/solitaire/solitaire-final-part1/solitaire.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
SOLITAIRE_WIDTH = 1000
2-
SOLITAIRE_HEIGHT = 500
3-
41
import random
52

6-
import flet as ft
73
from card import Card
84
from slot import Slot
95

6+
import flet as ft
7+
8+
SOLITAIRE_WIDTH = 1000
9+
SOLITAIRE_HEIGHT = 500
10+
1011

1112
class Suite:
1213
def __init__(self, suite_name, suite_color):
@@ -62,15 +63,15 @@ def create_card_deck(self):
6263
self.cards.append(Card(solitaire=self, suite=suite, rank=rank))
6364

6465
def create_slots(self):
65-
self.stock = Slot(solitaire=self, top=0, left=0, border=ft.border.all(1))
66+
self.stock = Slot(solitaire=self, top=0, left=0, border=ft.Border.all(1))
6667

6768
self.waste = Slot(solitaire=self, top=0, left=100, border=None)
6869

6970
self.foundations = []
7071
x = 300
7172
for i in range(4):
7273
self.foundations.append(
73-
Slot(solitaire=self, top=0, left=x, border=ft.border.all(1, "outline"))
74+
Slot(solitaire=self, top=0, left=x, border=ft.Border.all(1, "outline"))
7475
)
7576
x += 100
7677

sdk/python/examples/tutorials/solitaire/solitaire-final/card.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def __init__(self, solitaire, suite, rank):
2020
self.content = ft.Container(
2121
width=70,
2222
height=100,
23-
border_radius=ft.border_radius.all(6),
23+
border_radius=ft.BorderRadius.all(6),
2424
# content=ft.Image(src=f"/images/card_back.svg"),
2525
content=ft.Image(src=self.solitaire.settings.card_back),
2626
)
@@ -166,7 +166,10 @@ def place(self, slot):
166166
self.solitaire.update()
167167

168168
def get_cards_to_move(self):
169-
"""returns list of cards that will be dragged together, starting with the current card"""
169+
"""
170+
Returns a list of cards that will be dragged together,
171+
starting with the current card.
172+
"""
170173
if self.slot is not None:
171174
return self.slot.pile[self.slot.pile.index(self) :]
172175

0 commit comments

Comments
 (0)