flet 0.70.0.dev6176__py3-none-any.whl → 0.70.0.dev6196__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of flet might be problematic. Click here for more details.

flet/__init__.py CHANGED
@@ -195,6 +195,18 @@ from flet.controls.cupertino.cupertino_timer_picker import (
195
195
  CupertinoTimerPickerMode,
196
196
  )
197
197
  from flet.controls.cupertino.cupertino_tinted_button import CupertinoTintedButton
198
+ from flet.controls.device_info import (
199
+ AndroidBuildVersion,
200
+ AndroidDeviceInfo,
201
+ DeviceInfo,
202
+ IosDeviceInfo,
203
+ IosUtsname,
204
+ LinuxDeviceInfo,
205
+ MacOsDeviceInfo,
206
+ WebBrowserName,
207
+ WebDeviceInfo,
208
+ WindowsDeviceInfo,
209
+ )
198
210
  from flet.controls.dialog_control import DialogControl
199
211
  from flet.controls.duration import (
200
212
  DateTimeValue,
@@ -516,6 +528,8 @@ __all__ = [
516
528
  "AdaptiveControl",
517
529
  "AlertDialog",
518
530
  "Alignment",
531
+ "AndroidBuildVersion",
532
+ "AndroidDeviceInfo",
519
533
  "AnimatedSwitcher",
520
534
  "AnimatedSwitcherTransition",
521
535
  "Animation",
@@ -643,6 +657,7 @@ __all__ = [
643
657
  "DateRangePicker",
644
658
  "DateTimeValue",
645
659
  "DecorationImage",
660
+ "DeviceInfo",
646
661
  "DialogControl",
647
662
  "DialogTheme",
648
663
  "DismissDirection",
@@ -713,6 +728,8 @@ __all__ = [
713
728
  "InputBorder",
714
729
  "InputFilter",
715
730
  "InteractiveViewer",
731
+ "IosDeviceInfo",
732
+ "IosUtsname",
716
733
  "Key",
717
734
  "KeyDownEvent",
718
735
  "KeyRepeatEvent",
@@ -724,6 +741,7 @@ __all__ = [
724
741
  "LabelPosition",
725
742
  "LayoutControl",
726
743
  "LinearGradient",
744
+ "LinuxDeviceInfo",
727
745
  "ListTile",
728
746
  "ListTileStyle",
729
747
  "ListTileTheme",
@@ -734,6 +752,7 @@ __all__ = [
734
752
  "LoginEvent",
735
753
  "LongPressEndEvent",
736
754
  "LongPressStartEvent",
755
+ "MacOsDeviceInfo",
737
756
  "MainAxisAlignment",
738
757
  "Margin",
739
758
  "MarginValue",
@@ -926,12 +945,15 @@ __all__ = [
926
945
  "View",
927
946
  "ViewPopEvent",
928
947
  "VisualDensity",
948
+ "WebBrowserName",
949
+ "WebDeviceInfo",
929
950
  "WebRenderer",
930
951
  "Window",
931
952
  "WindowDragArea",
932
953
  "WindowEvent",
933
954
  "WindowEventType",
934
955
  "WindowResizeEdge",
956
+ "WindowsDeviceInfo",
935
957
  "alignment",
936
958
  "app",
937
959
  "app_async",
@@ -6,6 +6,9 @@ from flet.controls.control import Control
6
6
  from flet.controls.control_event import Event, EventHandler
7
7
 
8
8
  __all__ = [
9
+ "KeyDownEvent",
10
+ "KeyRepeatEvent",
11
+ "KeyUpEvent",
9
12
  "KeyboardListener",
10
13
  ]
11
14
 
@@ -0,0 +1,837 @@
1
+ from dataclasses import dataclass
2
+ from datetime import datetime
3
+ from enum import Enum
4
+ from typing import Optional
5
+
6
+ __all__ = [
7
+ "AndroidBuildVersion",
8
+ "AndroidDeviceInfo",
9
+ "DeviceInfo",
10
+ "IosDeviceInfo",
11
+ "IosUtsname",
12
+ "LinuxDeviceInfo",
13
+ "MacOsDeviceInfo",
14
+ "WebBrowserName",
15
+ "WebDeviceInfo",
16
+ "WindowsDeviceInfo",
17
+ ]
18
+
19
+
20
+ @dataclass
21
+ class DeviceInfo:
22
+ """
23
+ Base class for device information.
24
+
25
+ Platform-specific classes include:
26
+ - [`AndroidDeviceInfo`][flet.]
27
+ - [`IosDeviceInfo`][flet.]
28
+ - [`LinuxDeviceInfo`][flet.]
29
+ - [`MacOsDeviceInfo`][flet.]
30
+ - [`WebDeviceInfo`][flet.]
31
+ - [`WindowsDeviceInfo`][flet.]
32
+ """
33
+
34
+
35
+ @dataclass
36
+ class MacOsDeviceInfo(DeviceInfo):
37
+ active_cpus: int
38
+ """Number of active CPUs."""
39
+
40
+ arch: str
41
+ """Machine CPU architecture.
42
+
43
+ Note:
44
+ Apple Silicon Macs can return `"x86_64"` if app runs via Rosetta.
45
+ """
46
+
47
+ computer_name: str
48
+ """Name given to the local machine."""
49
+
50
+ cpu_frequency: int
51
+ """Device CPU frequency."""
52
+
53
+ host_name: str
54
+ """Operating system type."""
55
+
56
+ kernel_version: str
57
+ """Machine kernel version.
58
+
59
+ Examples:
60
+ - `"Darwin Kernel Version 15.3.0: Thu Dec 10 18:40:58 PST 2015; root:xnu-3248.30.4~1/RELEASE_X86_64"`
61
+ - `"Darwin Kernel Version 15.0.0: Wed Dec 9 22:19:38 PST 2015; root:xnu-3248.31.3~2/RELEASE_ARM64_S8000"`
62
+ """
63
+
64
+ major_version: int
65
+ """The major release number, such as `10` in version 10.9.3."""
66
+
67
+ memory_size: int
68
+ """Machine's memory size."""
69
+
70
+ minor_version: int
71
+ """The minor release number, such as `9` in version 10.9.3."""
72
+
73
+ model: str
74
+ """Device model identifier.
75
+
76
+ For example: `"MacBookPro18,3"`, `"Mac16,2"`.
77
+ """
78
+
79
+ model_name: str
80
+ """Device model name.
81
+
82
+ For example: `"MacBook Pro (16-inch, 2021)"`, `"iMac (24-inch, 2024)"`.
83
+ """
84
+
85
+ os_release: str
86
+ """Operating system release number."""
87
+
88
+ patch_version: int
89
+ """The update release number, such as `3` in `version 10.9.3`."""
90
+
91
+ system_guid: Optional[str] = None
92
+ """Device GUID."""
93
+
94
+
95
+ class WebBrowserName(Enum):
96
+ """
97
+ Represents commonly used browsers.
98
+ """
99
+
100
+ FIREFOX = "firefox"
101
+ """Mozilla Firefox"""
102
+
103
+ SAMSUNG_INTERNET = "samsungInternet"
104
+ """Samsung Internet Browser"""
105
+
106
+ OPERA = "opera"
107
+ """Opera Web Browser"""
108
+
109
+ MSIE = "msie"
110
+ """Microsoft Internet Explorer"""
111
+
112
+ EDGE = "edge"
113
+ """Microsoft Edge"""
114
+
115
+ CHROME = "chrome"
116
+ """Google Chrome"""
117
+
118
+ SAFARI = "safari"
119
+ """Apple Safari"""
120
+
121
+ UNKNOWN = "unknown"
122
+ """Unknown web browser"""
123
+
124
+
125
+ @dataclass
126
+ class WebDeviceInfo(DeviceInfo):
127
+ """
128
+ Information derived from `navigator`.
129
+
130
+ More info: https://developer.mozilla.org/en-US/docs/Web/API/Window/navigator
131
+ """
132
+
133
+ browser_name: WebBrowserName
134
+ """The name of the browser in use."""
135
+
136
+ app_code_name: Optional[str] = None
137
+ """The internal 'code' name of the current browser.
138
+
139
+ More info: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/appCodeName
140
+
141
+ Note:
142
+ Do not rely on this property to return the correct value.
143
+ """
144
+
145
+ app_name: Optional[str] = None
146
+ """A string with the official name of the browser.
147
+
148
+ More info: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/appName
149
+
150
+ Note:
151
+ Do not rely on this property to return the correct value.
152
+ """
153
+
154
+ app_version: Optional[str] = None
155
+ """The version of the browser as a string.
156
+
157
+ More info: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/appVersion
158
+
159
+ Note:
160
+ Do not rely on this property to return the correct value.
161
+ """
162
+
163
+ device_memory: Optional[float] = None
164
+ """The amount of device memory in gigabytes.
165
+
166
+ This value is an approximation given by rounding to the nearest power of `2` and
167
+ dividing that number by `1024`.
168
+
169
+ More info: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/deviceMemory
170
+ """
171
+
172
+ language: Optional[str] = None
173
+ """A string representing the preferred language of the user, usually the language
174
+ of the browser UI.
175
+
176
+ Will be `None` if unknown.
177
+
178
+ More info: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/language
179
+ """
180
+
181
+ languages: Optional[list[str]] = None
182
+ """A list of strings representing the languages known to the user, by order of
183
+ preference.
184
+
185
+ More info: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/languages
186
+ """
187
+
188
+ platform: Optional[str] = None
189
+ """A string representing the platform of the browser.
190
+
191
+ More info: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/platform
192
+
193
+ Note:
194
+ Do not rely on this property to return the correct value.
195
+ """
196
+
197
+ product: Optional[str] = None
198
+ """Always returns `"Gecko"`, on any browser.
199
+
200
+ More info: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/product
201
+
202
+ Note:
203
+ Do not rely on this property to return the correct value. This property is
204
+ kept only for compatibility purposes.
205
+ """
206
+
207
+ product_sub: Optional[str] = None
208
+ """The build number of the current browser.
209
+
210
+ More info: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/productSub
211
+
212
+ Note:
213
+ Do not rely on this property to return the correct value.
214
+ """
215
+
216
+ user_agent: Optional[str] = None
217
+ """The user agent string for the current browser (e.g., 'Mozilla/5.0 ...').
218
+
219
+ More info: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/userAgent
220
+ """
221
+
222
+ vendor: Optional[str] = None
223
+ """The vendor name of the current browser.
224
+
225
+ More info: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/vendor
226
+ """
227
+
228
+ vendor_sub: Optional[str] = None
229
+ """Returns the vendor version number (e.g., '6.1').
230
+
231
+ More info: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/vendorSub
232
+
233
+ Note:
234
+ Do not rely on this property to return the correct value.
235
+ """
236
+
237
+ max_touch_points: Optional[int] = None
238
+ """The maximum number of simultaneous touch contact points supported
239
+ by the current device.
240
+
241
+ More info: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/maxTouchPoints
242
+ """
243
+
244
+ hardware_concurrency: Optional[int] = None
245
+ """The number of logical processor cores available.
246
+
247
+ More info:
248
+ https://developer.mozilla.org/en-US/docs/Web/API/Navigator/hardwareConcurrency
249
+ """
250
+
251
+
252
+ @dataclass
253
+ class AndroidBuildVersion:
254
+ code_name: str
255
+ """
256
+ The current development codename, or the string "REL" if this is a release build.
257
+ """
258
+
259
+ incremental: str
260
+ """
261
+ The internal value used by the underlying source control to represent this build.
262
+
263
+ Note:
264
+ Available only on Android M (API 23) and newer.
265
+ """
266
+
267
+ release: str
268
+ """The user-visible version string."""
269
+
270
+ sdk: int
271
+ """The user-visible SDK version of the framework.
272
+
273
+ Possible values are defined in:
274
+ https://developer.android.com/reference/android/os/Build.VERSION_CODES.html
275
+ """
276
+
277
+ base_os: Optional[str] = None
278
+ """The base OS build the product is based on.
279
+
280
+ Note:
281
+ Available only on Android M (API 23) and newer.
282
+ """
283
+
284
+ preview_sdk: Optional[int] = None
285
+ """The developer preview revision of a pre-release SDK."""
286
+
287
+ security_patch: Optional[str] = None
288
+ """The user-visible security patch level.
289
+
290
+ Note:
291
+ Available only on Android M (API 23) and newer.
292
+ """
293
+
294
+
295
+ @dataclass
296
+ class AndroidDeviceInfo(DeviceInfo):
297
+ available_ram_size: int
298
+ """Total available RAM size in bytes."""
299
+
300
+ board: str
301
+ """The name of the underlying board, like `"goldfish"`.
302
+
303
+ More info: https://developer.android.com/reference/android/os/Build#BOARD
304
+ """
305
+
306
+ bootloader: str
307
+ """The system bootloader version number.
308
+
309
+ More info: https://developer.android.com/reference/android/os/Build#BOOTLOADER
310
+ """
311
+
312
+ brand: str
313
+ """The consumer-visible brand with which the product/hardware will be associated,
314
+ if any.
315
+
316
+ More info: https://developer.android.com/reference/android/os/Build#BRAND
317
+ """
318
+
319
+ device: str
320
+ """The name of the industrial design.
321
+
322
+ More info: https://developer.android.com/reference/android/os/Build#DEVICE
323
+ """
324
+
325
+ display: str
326
+ """A build ID string meant for displaying to the user.
327
+
328
+ More info: https://developer.android.com/reference/android/os/Build#DISPLAY
329
+ """
330
+
331
+ fingerprint: str
332
+ """A string that uniquely identifies this build.
333
+
334
+ More info: https://developer.android.com/reference/android/os/Build#FINGERPRINT
335
+ """
336
+
337
+ free_disk_size: int
338
+ """Free disk size in bytes."""
339
+
340
+ hardware: str
341
+ """The name of the hardware (from the kernel command line or /proc).
342
+
343
+ More info: https://developer.android.com/reference/android/os/Build#HARDWARE
344
+ """
345
+
346
+ host: str
347
+ """Hostname.
348
+
349
+ More info: https://developer.android.com/reference/android/os/Build#HOST
350
+ """
351
+
352
+ id: str
353
+ """Either a changelist number, or a label like `"M4-rc20"`.
354
+
355
+ More info: https://developer.android.com/reference/android/os/Build#ID
356
+ """
357
+
358
+ is_low_ram_device: bool
359
+ """`True` if the application is running on a low-RAM device, `False` otherwise."""
360
+
361
+ is_physical_device: bool
362
+ """`False` if the application is running in an emulator, `True` otherwise."""
363
+
364
+ manufacturer: str
365
+ """The manufacturer of the product/hardware.
366
+
367
+ More info: https://developer.android.com/reference/android/os/Build#MANUFACTURER
368
+ """
369
+
370
+ model: str
371
+ """The end-user-visible name for the end product.
372
+
373
+ More info: https://developer.android.com/reference/android/os/Build#MODEL
374
+ """
375
+
376
+ name: str
377
+ """The name of the device."""
378
+
379
+ physical_ram_size: int
380
+ """Total physical RAM size in bytes."""
381
+
382
+ product: str
383
+ """The name of the overall product.
384
+
385
+ More info: https://developer.android.com/reference/android/os/Build#PRODUCT
386
+ """
387
+
388
+ supported_32_bit_abis: list[str]
389
+ """An ordered list of 32 bit ABIs supported by this device.
390
+ Available only on Android L (API 21) and newer.
391
+
392
+ More info:
393
+ https://developer.android.com/reference/android/os/Build#SUPPORTED_32_BIT_ABIS
394
+ """
395
+
396
+ supported_64_bit_abis: list[str]
397
+ """An ordered list of 64 bit ABIs supported by this device.
398
+ Available only on Android L (API 21) and newer.
399
+
400
+ More info:
401
+ https://developer.android.com/reference/android/os/Build#SUPPORTED_64_BIT_ABIS
402
+ """
403
+
404
+ supported_abis: list[str]
405
+ """An ordered list of ABIs supported by this device.
406
+ Available only on Android L (API 21) and newer.
407
+
408
+ More info: https://developer.android.com/reference/android/os/Build#SUPPORTED_ABIS
409
+ """
410
+
411
+ system_features: list[str]
412
+ """Describes what features are available on the current device.
413
+
414
+ This can be used to check if the device has, for example, a front-facing
415
+ camera, or a touchscreen. However, in many cases this is not the best
416
+ API to use. For example, if you are interested in bluetooth, this API
417
+ can tell you if the device has a bluetooth radio, but it cannot tell you
418
+ if bluetooth is currently enabled, or if you have been granted the
419
+ necessary permissions to use it. Please only use this if there is no
420
+ other way to determine if a feature is supported.
421
+
422
+ This data comes from Android's PackageManager.getSystemAvailableFeatures,
423
+ and many of the common feature strings to look for are available in
424
+ PackageManager's public documentation:
425
+ https://developer.android.com/reference/android/content/pm/PackageManager
426
+ """
427
+
428
+ tags: str
429
+ """Comma-separated tags describing the build, like `"unsigned,debug"`.
430
+
431
+ More info: https://developer.android.com/reference/android/os/Build#TAGS
432
+ """
433
+
434
+ total_disk_size: int
435
+ """Total disk size in bytes."""
436
+
437
+ type: str
438
+ """The type of build, like `"user"` or `"eng"`.
439
+
440
+ More info: https://developer.android.com/reference/android/os/Build#TYPE
441
+ """
442
+
443
+ version: AndroidBuildVersion
444
+ """
445
+ Android operating system version values derived from `android.os.Build.VERSION`.
446
+ """
447
+
448
+
449
+ @dataclass
450
+ class LinuxDeviceInfo(DeviceInfo):
451
+ """
452
+ Device information for a Linux system.
453
+
454
+ More info:
455
+ - https://www.freedesktop.org/software/systemd/man/os-release.html
456
+ - https://www.freedesktop.org/software/systemd/man/machine-id.html
457
+ """
458
+
459
+ name: str
460
+ """A string identifying the operating system, without a version component,
461
+ and suitable for presentation to the user.
462
+
463
+ Examples: `"Fedora"`, `"Debian GNU/Linux"`.
464
+
465
+ If not set, defaults to `"Linux"`.
466
+ """
467
+
468
+ id: str
469
+ """A lower-case string identifying the operating system, excluding any version
470
+ information and suitable for processing by scripts or usage in generated filenames.
471
+
472
+ The ID contains no spaces or other characters outside of 0–9, a–z, '.', '_' and '-'.
473
+
474
+ Examples: `"fedora"`, `"debian"`.
475
+
476
+ If not set, defaults to `"linux"`.
477
+ """
478
+
479
+ pretty_name: str
480
+ """A pretty operating system name in a format suitable for presentation to the
481
+ user. May or may not contain a release code name or OS version of some kind,
482
+ as suitable.
483
+
484
+ Examples: `"Fedora 17 (Beefy Miracle)"`.
485
+
486
+ If not set, defaults to `"Linux"`.
487
+ """
488
+
489
+ version: Optional[str] = None
490
+ """A string identifying the operating system version, excluding any OS name
491
+ information, possibly including a release code name, and suitable for presentation
492
+ to the user.
493
+
494
+ Examples: `"17"`, `"17 (Beefy Miracle)"`.
495
+
496
+ May be `None` on some systems.
497
+ """
498
+
499
+ id_like: Optional[list[str]] = None
500
+ """A space-separated list of operating system identifiers in the same syntax as
501
+ the id value. It lists identifiers of operating systems that are closely related
502
+ to the local operating system in regards to packaging and programming interfaces,
503
+ for example listing one or more OS identifiers the local OS is a derivative from.
504
+
505
+ Examples: an operating system with id `"centos"`, would list `"rhel"`
506
+ and `"fedora"`, and an operating system with id `"ubuntu"` would list `"debian"`.
507
+
508
+ May be `None` on some systems.
509
+ """
510
+
511
+ version_code_name: Optional[str] = None
512
+ """A lower-case string identifying the operating system release code name,
513
+ excluding any OS name information or release version, and suitable for processing
514
+ by scripts or usage in generated filenames.
515
+
516
+ The codename contains no spaces or other characters outside of 0–9, a–z, '.', '_'
517
+ and '-'.
518
+
519
+ Examples: `"buster"`, `"xenial"`.
520
+
521
+ May be `None` on some systems.
522
+ """
523
+
524
+ version_id: Optional[str] = None
525
+ """A lower-case string identifying the operating system version, excluding any
526
+ OS name information or release code name, and suitable for processing by scripts or
527
+ usage in generated filenames.
528
+
529
+ The version is mostly numeric, and contains no spaces or other characters outside
530
+ of 0–9, a–z, '.', '_' and '-'.
531
+
532
+ Examples: `"17"`, `"11.04"`.
533
+
534
+ May be `None` on some systems.
535
+ """
536
+
537
+ build_id: Optional[str] = None
538
+ """A string uniquely identifying the system image used as the origin for a
539
+ distribution (it is not updated with system updates). The field can be identical
540
+ between different version_id values as build_id is only a unique identifier to a
541
+ specific version.
542
+
543
+ Examples: `"2013-03-20.3"`, `"201303203"`.
544
+
545
+ May be `None` on some systems.
546
+ """
547
+
548
+ variant: Optional[str] = None
549
+ """A string identifying a specific variant or edition of the operating system
550
+ suitable for presentation to the user. This field may be used to inform the user
551
+ that the configuration of this system is subject to a specific divergent set of
552
+ rules or default configuration settings.
553
+
554
+ Examples: `"Server Edition"`, `"Smart Refrigerator Edition"`.
555
+
556
+ Note: this field is for display purposes only. The variant_id field should be used
557
+ for making programmatic decisions.
558
+
559
+ May be `None` on some systems.
560
+ """
561
+
562
+ variant_id: Optional[str] = None
563
+ """A lower-case string identifying a specific variant or edition of the operating
564
+ system. This may be interpreted in order to determine a divergent default
565
+ configuration.
566
+
567
+ The variant ID contains no spaces or other characters outside of
568
+ 0–9, a–z, '.', '_' and '-'.
569
+
570
+ Examples: `"server"`, `"embedded"`.
571
+
572
+ May be `None` on some systems.
573
+ """
574
+
575
+ machine_id: Optional[str] = None
576
+ """A unique machine ID of the local system that is set during installation or boot.
577
+ The machine ID is hexadecimal, 32-character, lowercase ID. When decoded from
578
+ hexadecimal, this corresponds to a 16-byte/128-bit value.
579
+ """
580
+
581
+
582
+ @dataclass
583
+ class WindowsDeviceInfo(DeviceInfo):
584
+ computer_name: str
585
+ """The computer's fully-qualified DNS name, where available."""
586
+
587
+ number_of_cores: int
588
+ """Number of CPU cores on the local machine."""
589
+
590
+ system_memory: int
591
+ """The physically installed memory in the computer, in megabytes.
592
+
593
+ This may not be the same as available memory.
594
+ """
595
+
596
+ user_name: str
597
+
598
+ major_version: int
599
+ """The major version number of the operating system.
600
+
601
+ For example, for Windows 2000, the major version number is `5`.
602
+
603
+ For more info, see the table in Remarks:
604
+ https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/ns-wdm-_osversioninfoexw#remarks
605
+ """
606
+
607
+ minor_version: int
608
+ """The minor version number of the operating system.
609
+
610
+ For example, for Windows 2000, the minor version number is `0`.
611
+
612
+ For more info, see the table in Remarks:
613
+ https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/ns-wdm-_osversioninfoexw#remarks
614
+ """
615
+
616
+ build_number: int
617
+ """The build number of the operating system.
618
+
619
+ Examples:
620
+ - `22000` or greater for Windows 11.
621
+ - `10240` or greater for Windows 10.
622
+ """
623
+
624
+ platform_id: int
625
+ """The operating system platform.
626
+
627
+ For Win32 on NT-based operating systems,
628
+ RtlGetVersion returns the value `VER_PLATFORM_WIN32_NT`.
629
+ """
630
+
631
+ csd_version: str
632
+ """The service-pack version string.
633
+
634
+ This member contains a string, such as "Service Pack 3",
635
+ which indicates the latest service pack installed on the system.
636
+ """
637
+
638
+ service_pack_major: int
639
+ """The major version number of the latest service pack installed on the system.
640
+
641
+ For example, for Service Pack 3, the major version number is three.
642
+ If no service pack has been installed, the value is zero.
643
+ """
644
+
645
+ service_pack_minor: int
646
+ """The minor version number of the latest service pack installed on the system.
647
+
648
+ For example, for Service Pack 3, the minor version number is zero.
649
+ """
650
+
651
+ suit_mask: int
652
+ """The product suites available on the system."""
653
+
654
+ product_type: int
655
+ """The product type.
656
+
657
+ This member contains additional information about the system.
658
+ """
659
+
660
+ reserved: int
661
+ """Reserved for future use."""
662
+
663
+ build_lab: str
664
+ """Value of `HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\BuildLab`
665
+ registry key.
666
+
667
+ For example: `"22000.co_release.210604-1628"`.
668
+ """
669
+
670
+ build_lab_ex: str
671
+ """Value of `HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\BuildLabEx`
672
+ registry key.
673
+
674
+ For example: `"22000.1.amd64fre.co_release.210604-1628"`.
675
+ """
676
+
677
+ # digital_product_id: str
678
+
679
+ display_version: str
680
+ """Value of `HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\DisplayVersion`
681
+ registry key.
682
+
683
+ For example: `"21H2"`.
684
+ """
685
+
686
+ edition_id: str
687
+ """Value of `HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\EditionID`
688
+ registry key.
689
+ """
690
+
691
+ install_date: datetime
692
+ """Value of `HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\InstallDate`
693
+ registry key.
694
+ """
695
+
696
+ product_id: str
697
+ """Displayed as "Product ID" in Windows Settings.
698
+
699
+ Value of the `HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProductId`
700
+ registry key.
701
+
702
+ For example: `"00000-00000-0000-AAAAA"`.
703
+ """
704
+
705
+ product_name: str
706
+ """Value of `HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProductName`
707
+ registry key.
708
+
709
+ For example: `"Windows 10 Home Single Language"`.
710
+ """
711
+
712
+ registered_owner: str
713
+ """Value of the `HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\RegisteredOwner`
714
+ registry key.
715
+
716
+ For example: `"Microsoft Corporation"`.
717
+ """
718
+
719
+ release_id: str
720
+ """
721
+ Value of the `HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ReleaseId`
722
+ registry key.
723
+
724
+ For example: `"1903"`.
725
+ """
726
+
727
+ device_id: str
728
+ """Displayed as "Device ID" in Windows Settings.
729
+
730
+ Value of `HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\SQMClient\\MachineId`
731
+ registry key.
732
+ """
733
+
734
+
735
+ @dataclass
736
+ class IosUtsname:
737
+ """
738
+ Information derived from `utsname`.
739
+
740
+ More info: http://pubs.opengroup.org/onlinepubs/7908799/xsh/sysutsname.h.html
741
+ """
742
+
743
+ machine: str
744
+ """Hardware type (e.g. `"iPhone7,1"` for iPhone 6 Plus)."""
745
+
746
+ node_name: str
747
+ """Network node name."""
748
+
749
+ release: str
750
+ """Release level."""
751
+
752
+ sys_name: str
753
+ """Operating system name."""
754
+
755
+ version: str
756
+ """Version level."""
757
+
758
+
759
+ @dataclass
760
+ class IosDeviceInfo(DeviceInfo):
761
+ available_ram_size: int
762
+ """Current unallocated RAM size of the device in megabytes."""
763
+
764
+ free_disk_size: int
765
+ """Free disk size in bytes."""
766
+
767
+ is_ios_app_on_mac: bool
768
+ """Indicates whether the process is an iPhone or iPad app running on a Mac.
769
+
770
+ More info:
771
+ https://developer.apple.com/documentation/foundation/nsprocessinfo/3608556-iosapponmac
772
+ """
773
+
774
+ is_physical_device: bool
775
+ """`False` if the application is running in a simulator, `True` otherwise."""
776
+
777
+ localized_model: str
778
+ """Localized name of the device model.
779
+
780
+ More info:
781
+ https://developer.apple.com/documentation/uikit/uidevice/1620029-localizedmodel
782
+ """
783
+
784
+ model: str
785
+ """Device model according to OS.
786
+
787
+ More info:
788
+ https://developer.apple.com/documentation/uikit/uidevice/1620044-model
789
+ """
790
+
791
+ model_name: str
792
+ """Commercial or user-known model name.
793
+
794
+ For example: `"iPhone 16 Pro"`, `"iPad Pro 11-Inch 3"`
795
+ """
796
+
797
+ name: str
798
+ """The device name.
799
+
800
+ Note:
801
+ - On iOS < 16 returns user-assigned device name.
802
+ - On iOS >= 16 returns a generic device name if project has
803
+ no entitlement to get user-assigned device name.
804
+
805
+ More info:
806
+ https://developer.apple.com/documentation/uikit/uidevice/1620015-name
807
+ """
808
+
809
+ physical_ram_size: int
810
+ """Total physical RAM size of the device in megabytes."""
811
+
812
+ system_name: str
813
+ """The name of the current operating system.
814
+
815
+ More info:
816
+ https://developer.apple.com/documentation/uikit/uidevice/1620054-systemname
817
+ """
818
+
819
+ system_version: str
820
+ """The current operating system version.
821
+
822
+ More info:
823
+ https://developer.apple.com/documentation/uikit/uidevice/1620043-systemversion
824
+ """
825
+
826
+ total_disk_size: int
827
+ """Total disk size in bytes."""
828
+
829
+ utsname: IosUtsname
830
+ """Operating system information derived from `sys/utsname.h`."""
831
+
832
+ identifier_for_vendor: Optional[str] = None
833
+ """Unique UUID value identifying the current device.
834
+
835
+ More info:
836
+ https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor
837
+ """
@@ -10,7 +10,7 @@ from flet.controls.transform import OffsetValue, RotateValue, ScaleValue
10
10
  from flet.controls.types import Number
11
11
  from flet.utils import deprecated_class
12
12
 
13
- __all__ = ["LayoutControl"]
13
+ __all__ = ["ConstrainedControl", "LayoutControl"]
14
14
 
15
15
 
16
16
  @control(kw_only=True)
flet/controls/page.py CHANGED
@@ -33,6 +33,15 @@ from flet.controls.control_event import (
33
33
  )
34
34
  from flet.controls.core.view import View
35
35
  from flet.controls.core.window import Window
36
+ from flet.controls.device_info import (
37
+ AndroidDeviceInfo,
38
+ DeviceInfo,
39
+ IosDeviceInfo,
40
+ LinuxDeviceInfo,
41
+ MacOsDeviceInfo,
42
+ WebDeviceInfo,
43
+ WindowsDeviceInfo,
44
+ )
36
45
  from flet.controls.multi_view import MultiView
37
46
  from flet.controls.query_string import QueryString
38
47
  from flet.controls.ref import Ref
@@ -52,6 +61,7 @@ from flet.controls.types import (
52
61
  )
53
62
  from flet.utils import is_pyodide
54
63
  from flet.utils.deprecated import deprecated
64
+ from flet.utils.from_dict import from_dict
55
65
  from flet.utils.strings import random_string
56
66
 
57
67
  if not is_pyodide():
@@ -326,8 +336,8 @@ class Page(BasePage):
326
336
  used for reference and the values:
327
337
  - Key: The font family name used for reference.
328
338
  - Value: The font source, either an absolute URL or a relative path to a
329
- local asset. The following font file formats are supported `.ttc`, `.ttf`
330
- and `.otf`.
339
+ local asset. The following font file formats are supported `.ttc`, `.ttf`
340
+ and `.otf`.
331
341
 
332
342
  Usage example [here](https://flet.dev/docs/cookbook/fonts#importing-fonts).
333
343
  """
@@ -904,3 +914,28 @@ class Page(BasePage):
904
914
  The PubSub client for the current page.
905
915
  """
906
916
  return self.session.pubsub_client
917
+
918
+ async def get_device_info(self) -> Optional[DeviceInfo]:
919
+ """
920
+ Returns device information.
921
+
922
+ Returns:
923
+ The device information object for the current platform,
924
+ or `None` if unavailable.
925
+ """
926
+ info = await self._invoke_method("get_device_info")
927
+
928
+ if self.web:
929
+ return from_dict(WebDeviceInfo, info)
930
+ elif self.platform == PagePlatform.ANDROID:
931
+ return from_dict(AndroidDeviceInfo, info)
932
+ elif self.platform == PagePlatform.IOS:
933
+ return from_dict(IosDeviceInfo, info)
934
+ elif self.platform == PagePlatform.MACOS:
935
+ return from_dict(MacOsDeviceInfo, info)
936
+ elif self.platform == PagePlatform.LINUX:
937
+ return from_dict(LinuxDeviceInfo, info)
938
+ elif self.platform == PagePlatform.WINDOWS:
939
+ return from_dict(WindowsDeviceInfo, info)
940
+ else:
941
+ return None
@@ -72,6 +72,8 @@ def decode_ext_from_msgpack(code, data):
72
72
  return datetime.time(*map(int, data.decode("utf-8").split(":")))
73
73
  elif code == 3:
74
74
  return Duration.from_unit(microseconds=int(data))
75
+ elif code == 4:
76
+ return data.decode("utf-8")
75
77
  return msgpack.ExtType(code, data)
76
78
 
77
79
 
flet/version.py CHANGED
@@ -10,7 +10,7 @@ from flet.utils import is_mobile, is_windows, which
10
10
  DEFAULT_VERSION = "0.1.0"
11
11
 
12
12
  # will be replaced by CI
13
- version = "0.70.0.dev6176"
13
+ version = "0.70.0.dev6196"
14
14
 
15
15
 
16
16
  def update_version():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flet
3
- Version: 0.70.0.dev6176
3
+ Version: 0.70.0.dev6196
4
4
  Summary: Flet for Python - easily build interactive multi-platform apps in Python
5
5
  Author-email: "Appveyor Systems Inc." <hello@flet.dev>
6
6
  License-Expression: Apache-2.0
@@ -1,7 +1,7 @@
1
- flet/__init__.py,sha256=n5qVCP3EFldZdmB22hoO751d9fB5U9-AN6uMU-55IPA,25684
1
+ flet/__init__.py,sha256=rj0DuM9ZNrzkM-TpQ35iIspYLzsrxOCwkVxOHRX6oiU,26152
2
2
  flet/app.py,sha256=HSws0Zm4ZO0-Hp2P9h7xirCVnRkKCVXhuekyAXT_9Fo,11883
3
3
  flet/cli.py,sha256=IUM25fY_sqMtl0hlQGhlMQaBb1oNyO0VZeeBgRodhuA,204
4
- flet/version.py,sha256=OOXW9v5bFD449k3IMfq3V3RcnBQc0NkTYV1ezhwJh_Y,2512
4
+ flet/version.py,sha256=lEjT4drDCZ7zed-DtGi2t3mCSr7d6dXpf52GgcVaM9A,2512
5
5
  flet/auth/__init__.py,sha256=eDqmi0Ki8Resd198S7XxgYa2R14wnNqIXnYhBLPl8fQ,289
6
6
  flet/auth/authorization.py,sha256=hP_36RiRPtSwmK_Yp6MMzAjQdDxbBiEcZ2yFNqyNiRs,357
7
7
  flet/auth/authorization_service.py,sha256=6N2LvisSt7KI_VgfyCH0OaJ6jTcmXCkAldN1yYlakzQ,6410
@@ -46,6 +46,7 @@ flet/controls/context.py,sha256=xmmkrF2r4jD9ILe9lIrwtmkhvXv6awYpnwjHeqM5jFk,4239
46
46
  flet/controls/control.py,sha256=7uZKB9NOtj3zM-5uGq_x2GjsuDaXuSuVzuEKLJ1ysJU,4473
47
47
  flet/controls/control_event.py,sha256=wuI62LF8K42U6Ba2LK5R5YyhBtmxyTHBgZN4XfRKGRk,3107
48
48
  flet/controls/control_state.py,sha256=7Pi_WirBkE5dmUN0QnQLjSaW17Nj_escRlUvNxlrNR8,433
49
+ flet/controls/device_info.py,sha256=fWhy73oldll9BZagLcPZG-YKi_wu6caEKCdOwP6SZXA,23465
49
50
  flet/controls/dialog_control.py,sha256=4a1poIK4al6DAsdiV56jE-Q4E-eKrvP12DqYw5HFvYM,507
50
51
  flet/controls/duration.py,sha256=Fwb26eyHKrU_lqvmGuTLw4m-28leLHOlgHxtqRIQsnA,7398
51
52
  flet/controls/embed_json_encoder.py,sha256=Ahd6wArEwiquZUb22FPIDRs-ppokznfTSK1QB9DQo0w,1251
@@ -56,12 +57,12 @@ flet/controls/gradients.py,sha256=oUYQTL0wI4FYbhOzd2b-KkbCUsijBgGpH9gSRIMYQdk,58
56
57
  flet/controls/icon_data.py,sha256=dtlNXm8_8yd_PRp_ogBuTDPz3-IXCXP47FA9C6SGoSk,2357
57
58
  flet/controls/id_counter.py,sha256=YhZT-dB_yYYqPEBJ8IoTA98NU_EPFnx6T7FWbA9ENB4,627
58
59
  flet/controls/keys.py,sha256=YpcAeINKelX3WgSOMF8_T7wMzcFmAXNg-ssPej_NZWY,614
59
- flet/controls/layout_control.py,sha256=17JFILKY6_G73VgoyGofF41E3hykUl4ipQh6EKCig3Y,7279
60
+ flet/controls/layout_control.py,sha256=wF4W4u3MAHLjpin5nH4iOAyoq29v3QrqI6swYnl67js,7301
60
61
  flet/controls/margin.py,sha256=ni5FwkchO1LPKPTKV0Cimvh2YzABi-t5DhOqTS25eIQ,2305
61
62
  flet/controls/multi_view.py,sha256=7RbM1nt8t75qgTKyfemsV06XQ04Mer0Op409Nu9q9Vs,304
62
63
  flet/controls/object_patch.py,sha256=0OE8TswTyYH_l1yEqJPIf-Z6kLnOCCQCYiV-gNUvuSA,44111
63
64
  flet/controls/padding.py,sha256=AdxAZ5dbg1-Bo8aKeJ7AptUdyjaX7VWBIJto5mBT9Pk,2485
64
- flet/controls/page.py,sha256=OerVhgInFcr2C53LwvG8s5ksZ7TI9uw7WF5VL6-hTCg,26623
65
+ flet/controls/page.py,sha256=vJAJo1purDrX-RFeWzsFtoHeI1ttUrXhbpQoyKrroj8,27788
65
66
  flet/controls/painting.py,sha256=GCEycacejiCAdA4eZBQlTgxmE2ccXyad4Gy7VsjIwn0,12108
66
67
  flet/controls/query_string.py,sha256=NDrf1P0cxSWuJd4Rqz1qYld_JKDJpHY7mKcP52-70DI,3575
67
68
  flet/controls/ref.py,sha256=Lde_Nlly6NEtJX_LYv_DxIDkao6w4Buo7Nus4XUPQDA,580
@@ -84,7 +85,7 @@ flet/controls/core/grid_view.py,sha256=kzln6PKgQ2jGEoNkNMjx0auoFfUndfzx6x0TgzLn5
84
85
  flet/controls/core/icon.py,sha256=fOf8mCKtQ8tlm_lzSliPq_qk8QTBGFE8Tq5OfiyfK3M,4001
85
86
  flet/controls/core/image.py,sha256=ES4byvkgl3z_YbsBVNnYVox8QN4_qCnOn9RjBK_3vUY,3950
86
87
  flet/controls/core/interactive_viewer.py,sha256=id5x4Z3Gf41naRy1kOj_cmBnfTlsoeBCJOmf8lLJp-o,4857
87
- flet/controls/core/keyboard_listener.py,sha256=S8h0ZELveIT8EyAxNilnUNPg9I9MVnOMmSKW_7cwylQ,2467
88
+ flet/controls/core/keyboard_listener.py,sha256=Rml7c7pHNzTyBiSbW15cUXwhr5YddTrSo98z2tzWhaI,2527
88
89
  flet/controls/core/list_view.py,sha256=zyWHHG8Tpr4VYztQFWA_mRipLXKO6bVJ-Ra1Gso4qp4,3273
89
90
  flet/controls/core/markdown.py,sha256=zTAlVDJpwh5Ay1Lh7aHlTNCJ0zktCwNGit1QiyWjUyE,10939
90
91
  flet/controls/core/merge_semantics.py,sha256=o2olHjIDU-QNKAc8JHdQABiZUKeR4dWJApOCEcBaFF4,627
@@ -216,7 +217,7 @@ flet/controls/services/url_launcher.py,sha256=YfvNGaivvwJ2vrSkxwgQ2R1l3A5wbgY6Ax
216
217
  flet/fastapi/__init__.py,sha256=crLmmKE-B-O-cm5MTlXFreYCUnqkw6mK4eIPUUMvSCM,45
217
218
  flet/messaging/connection.py,sha256=yd7NlEAwAMxhCEhh6mLN-cihYfeJdUlHhx5SycRVct4,1646
218
219
  flet/messaging/flet_socket_server.py,sha256=bFeC-hlKFhBoVHBYy6o_LzWiuFaUmT-vMT81t5lGEUM,9146
219
- flet/messaging/protocol.py,sha256=LTdTUHD2RQfP55rL6InG2w0FfTJPWoKo_SGcand3YpA,3856
220
+ flet/messaging/protocol.py,sha256=dxd17TINWzSYNAGbP-UC8lbhoOtRkzyvlyek5fw9488,3912
220
221
  flet/messaging/pyodide_connection.py,sha256=-bNGKh0nYNtgdJ_nhBGJTF1TNX3vHqgxygetv2ZQwUs,4313
221
222
  flet/messaging/session.py,sha256=RQkYkZDIKW-l9ShUvbYKPD6ZXgfD4yVz2WERgUnp_OA,12310
222
223
  flet/messaging/session_store.py,sha256=80yy3fjEGJs_60UxS_o2tXl2QCenFb9IVDaJCK8wckY,557
@@ -245,8 +246,8 @@ flet/utils/platform_utils.py,sha256=U4cqV3EPi5QNYjbhfZmtk41-KMtI_P7KvVdnZzMOgJA,
245
246
  flet/utils/slugify.py,sha256=e-lsoDc2_dk5jQnySaHCU83AA4O6mguEgCEdk2smW2Y,466
246
247
  flet/utils/strings.py,sha256=R63_i7PdSAStCDPJ-O_WHBt3H02JQ14GSbnjLIpPTUc,178
247
248
  flet/utils/vector.py,sha256=pYZzjldBWCZbSeSkZ8VmujwcZC7VBWk1NLBPA-2th3U,3207
248
- flet-0.70.0.dev6176.dist-info/METADATA,sha256=dbegGXkovTUQPhsOkyr_2moO0StiTRMY-ME27Z9e8BQ,6051
249
- flet-0.70.0.dev6176.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
250
- flet-0.70.0.dev6176.dist-info/entry_points.txt,sha256=mbBhHNUnLHiDqR36WeJrfLJU0Y0y087-M4wagQmaQ_Y,39
251
- flet-0.70.0.dev6176.dist-info/top_level.txt,sha256=HbLrSnWJX2jZOEZAI14cGzW8Q5BbOGTtE-7knD5FDh0,5
252
- flet-0.70.0.dev6176.dist-info/RECORD,,
249
+ flet-0.70.0.dev6196.dist-info/METADATA,sha256=Zzqg4QTkYfEixyxtUtW-zhU10VTmSze8QbRrcHbkkJo,6051
250
+ flet-0.70.0.dev6196.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
251
+ flet-0.70.0.dev6196.dist-info/entry_points.txt,sha256=mbBhHNUnLHiDqR36WeJrfLJU0Y0y087-M4wagQmaQ_Y,39
252
+ flet-0.70.0.dev6196.dist-info/top_level.txt,sha256=HbLrSnWJX2jZOEZAI14cGzW8Q5BbOGTtE-7knD5FDh0,5
253
+ flet-0.70.0.dev6196.dist-info/RECORD,,