pyloid 0.13.1__py3-none-any.whl → 0.14.1__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.
pyloid/monitor.py CHANGED
@@ -1,8 +1,18 @@
1
1
  from PySide6.QtGui import QScreen
2
- from typing import Optional, Callable
2
+ from typing import Optional, Callable, Any
3
3
 
4
4
  class Monitor():
5
5
  def __init__(self, index: int, screen: QScreen):
6
+ """
7
+ Constructor for the Monitor class.
8
+
9
+ Parameters
10
+ ----------
11
+ index : int
12
+ Index of the monitor.
13
+ screen : QScreen
14
+ QScreen object of the monitor.
15
+ """
6
16
  super().__init__()
7
17
  self.index = index
8
18
  self.screen = screen
@@ -10,9 +20,34 @@ class Monitor():
10
20
  def capture(self, save_path: str, x: Optional[int] = None, y: Optional[int] = None, width: Optional[int] = None, height: Optional[int] = None):
11
21
  """
12
22
  Captures the entire desktop screen.
13
-
14
- :param save_path: Path to save the captured image. If not specified, it will be saved in the current directory.
15
- :return: Path of the saved image
23
+
24
+ Parameters
25
+ ----------
26
+ save_path : str
27
+ Path to save the captured image. If not specified, it will be saved in the current directory.
28
+ x : int, optional
29
+ x-coordinate of the area to capture. Default is None.
30
+ y : int, optional
31
+ y-coordinate of the area to capture. Default is None.
32
+ width : int, optional
33
+ Width of the area to capture. Default is None.
34
+ height : int, optional
35
+ Height of the area to capture. Default is None.
36
+
37
+ Returns
38
+ -------
39
+ str or None
40
+ Returns the path of the saved image. Returns None if an error occurs.
41
+
42
+ Examples
43
+ --------
44
+ ```python
45
+ app = Pyloid("Pyloid-App")
46
+
47
+ monitor = app.get_primary_monitor()
48
+ save_path = monitor.capture("screenshot.png")
49
+ print(f"Screenshot saved at: {save_path}")
50
+ ```
16
51
  """
17
52
  try:
18
53
  screenshot = self.screen.grabWindow(0, x, y, width, height)
@@ -23,11 +58,95 @@ class Monitor():
23
58
  print(f"Error occurred while capturing the desktop: {e}")
24
59
  return None
25
60
 
26
- def info(self):
61
+ def info(self) -> dict[str, Any]:
27
62
  """
28
- Returns monitor information.
29
-
30
- :return: Dictionary containing monitor information
63
+ Returns information about the monitor.
64
+
65
+ Returns
66
+ -------
67
+ dict[str, Any]
68
+ A dictionary containing monitor information.
69
+
70
+ Examples
71
+ --------
72
+ ```python
73
+ app = Pyloid("Pyloid-App")
74
+
75
+ monitor = app.get_primary_monitor()
76
+ info = monitor.info()
77
+ print("Monitor Info:", info)
78
+ ```
79
+
80
+ Output Example
81
+ --------------
82
+ ```
83
+ {
84
+ "index": 0,
85
+ "name": "Primary Monitor",
86
+ "manufacturer": "Dell",
87
+ "model": "U2718Q",
88
+ "serial_number": "SN123456789",
89
+ "x": 0,
90
+ "y": 0,
91
+ "width": 2560,
92
+ "height": 1440,
93
+ "is_primary": True,
94
+ "geometry": {
95
+ "x": 0,
96
+ "y": 0,
97
+ "width": 2560,
98
+ "height": 1440,
99
+ },
100
+ "size": {
101
+ "width": 2560,
102
+ "height": 1440,
103
+ },
104
+ "available_geometry": {
105
+ "x": 0,
106
+ "y": 0,
107
+ "width": 2560,
108
+ "height": 1400,
109
+ },
110
+ "available_size": {
111
+ "width": 2560,
112
+ "height": 1400,
113
+ },
114
+ "virtual_geometry":{
115
+ "x": 0,
116
+ "y": 0,
117
+ "width": 5120,
118
+ "height": 1440,
119
+ },
120
+ "virtual_size": {
121
+ "width": 5120,
122
+ "height": 1440,
123
+ },
124
+ "available_virtual_geometry": {
125
+ "x": 0,
126
+ "y": 0,
127
+ "width": 5120,
128
+ "height": 1400,
129
+ },
130
+ "available_virtual_size": {
131
+ "width": 5120,
132
+ "height": 1400,
133
+ },
134
+ "physical_size": {
135
+ "width": 600,
136
+ "height": 340,
137
+ },
138
+ "depth": 24,
139
+ "device_pixel_ratio": 1.0,
140
+ "logical_dots_per_inch": 96.0,
141
+ "logical_dots_per_inch_x": 96.0,
142
+ "logical_dots_per_inch_y": 96.0,
143
+ "orientation": "Landscape",
144
+ "physical_dots_per_inch": 109.0,
145
+ "physical_dots_per_inch_x": 109.0,
146
+ "physical_dots_per_inch_y": 109.0,
147
+ "refresh_rate": 60.0,
148
+ }
149
+ ```
31
150
  """
32
151
  monitor = self.screen
33
152
 
@@ -102,17 +221,43 @@ class Monitor():
102
221
 
103
222
  def is_primary(self) -> bool:
104
223
  """
105
- Checks if the given monitor is the primary monitor.
106
-
107
- :return: True if the primary monitor, False otherwise
224
+ Checks if the monitor is the primary monitor.
225
+
226
+ Returns
227
+ -------
228
+ bool
229
+ Returns True if the monitor is the primary monitor, otherwise False.
230
+
231
+ Examples
232
+ --------
233
+ ```python
234
+ app = Pyloid("Pyloid-App")
235
+
236
+ monitor = app.get_all_monitors()[1]
237
+ is_primary = monitor.is_primary()
238
+ print(f"Is primary monitor: {is_primary}") # False
239
+ ```
108
240
  """
109
241
  return self.index == 0
110
242
 
111
- def size(self) -> dict:
243
+ def size(self) -> dict[str, int]:
112
244
  """
113
245
  Returns the size of the monitor.
114
-
115
- :return: Size of the monitor
246
+
247
+ Returns
248
+ -------
249
+ dict[str, int]
250
+ A dictionary containing the width and height of the monitor.
251
+
252
+ Examples
253
+ --------
254
+ ```python
255
+ app = Pyloid("Pyloid-App")
256
+
257
+ monitor = app.get_primary_monitor()
258
+ size = monitor.size()
259
+ print("Monitor Size:", size)
260
+ ```
116
261
  """
117
262
  monitor = self.screen
118
263
  return {
@@ -120,11 +265,24 @@ class Monitor():
120
265
  "height": monitor.size().height(),
121
266
  },
122
267
 
123
- def geometry(self) -> dict:
268
+ def geometry(self) -> dict[str, int]:
124
269
  """
125
270
  Returns the geometry of the monitor.
126
-
127
- :return: Geometry of the monitor
271
+
272
+ Returns
273
+ -------
274
+ dict[str, int]
275
+ A dictionary containing the x and y coordinates, width, and height of the monitor.
276
+
277
+ Examples
278
+ --------
279
+ ```python
280
+ app = Pyloid("Pyloid-App")
281
+
282
+ monitor = app.get_primary_monitor()
283
+ geometry = monitor.geometry()
284
+ print("Monitor Geometry:", geometry)
285
+ ```
128
286
  """
129
287
  monitor = self.screen
130
288
  return {
@@ -134,11 +292,26 @@ class Monitor():
134
292
  "height": monitor.geometry().height(),
135
293
  }
136
294
 
137
- def available_geometry(self) -> dict:
295
+ def available_geometry(self) -> dict[str, int]:
138
296
  """
139
297
  Returns the available geometry of the monitor.
140
-
141
- :return: Available geometry of the monitor
298
+
299
+ The available geometry refers to the portion of the monitor's geometry that is not occupied by system UI elements such as taskbars or docks.
300
+
301
+ Returns
302
+ -------
303
+ dict[str, int]
304
+ A dictionary containing the x and y coordinates, width, and height of the available geometry.
305
+
306
+ Examples
307
+ --------
308
+ ```python
309
+ app = Pyloid("Pyloid-App")
310
+
311
+ monitor = app.get_primary_monitor()
312
+ available_geometry = monitor.available_geometry()
313
+ print("Available Geometry:", available_geometry)
314
+ ```
142
315
  """
143
316
  monitor = self.screen
144
317
  return {
@@ -148,11 +321,26 @@ class Monitor():
148
321
  "height": monitor.availableGeometry().height(),
149
322
  }
150
323
 
151
- def available_size(self) -> dict:
324
+ def available_size(self) -> dict[str, int]:
152
325
  """
153
326
  Returns the available size of the monitor.
154
-
155
- :return: Available size of the monitor
327
+
328
+ The available size refers to the portion of the monitor's size that is not occupied by system UI elements such as taskbars or docks.
329
+
330
+ Returns
331
+ -------
332
+ dict[str, int]
333
+ A dictionary containing the width and height of the available size.
334
+
335
+ Examples
336
+ --------
337
+ ```python
338
+ app = Pyloid("Pyloid-App")
339
+
340
+ monitor = app.get_primary_monitor()
341
+ available_size = monitor.available_size()
342
+ print("Available Size:", available_size)
343
+ ```
156
344
  """
157
345
  monitor = self.screen
158
346
  return {
@@ -160,11 +348,26 @@ class Monitor():
160
348
  "height": monitor.availableSize().height(),
161
349
  }
162
350
 
163
- def virtual_geometry(self) -> dict:
351
+ def virtual_geometry(self) -> dict[str, int]:
164
352
  """
165
353
  Returns the virtual geometry of the monitor.
166
-
167
- :return: Virtual geometry of the monitor
354
+
355
+ The virtual geometry refers to the combined geometry of all monitors in a multi-monitor setup.
356
+
357
+ Returns
358
+ -------
359
+ dict[str, int]
360
+ A dictionary containing the x and y coordinates, width, and height of the virtual geometry.
361
+
362
+ Examples
363
+ --------
364
+ ```python
365
+ app = Pyloid("Pyloid-App")
366
+
367
+ monitor = app.get_primary_monitor()
368
+ virtual_geometry = monitor.virtual_geometry()
369
+ print("Virtual Geometry:", virtual_geometry)
370
+ ```
168
371
  """
169
372
  monitor = self.screen
170
373
  return {
@@ -174,11 +377,26 @@ class Monitor():
174
377
  "height": monitor.virtualGeometry().height(),
175
378
  }
176
379
 
177
- def virtual_size(self) -> dict:
380
+ def virtual_size(self) -> dict[str, int]:
178
381
  """
179
382
  Returns the virtual size of the monitor.
180
-
181
- :return: Virtual size of the monitor
383
+
384
+ The virtual size refers to the combined size of all monitors in a multi-monitor setup.
385
+
386
+ Returns
387
+ -------
388
+ dict[str, int]
389
+ A dictionary containing the width and height of the virtual size.
390
+
391
+ Examples
392
+ --------
393
+ ```python
394
+ app = Pyloid("Pyloid-App")
395
+
396
+ monitor = app.get_primary_monitor()
397
+ virtual_size = monitor.virtual_size()
398
+ print("Virtual Size:", virtual_size)
399
+ ```
182
400
  """
183
401
  monitor = self.screen
184
402
  return {
@@ -186,11 +404,26 @@ class Monitor():
186
404
  "height": monitor.virtualSize().height(),
187
405
  }
188
406
 
189
- def available_virtual_geometry(self) -> dict:
407
+ def available_virtual_geometry(self) -> dict[str, int]:
190
408
  """
191
409
  Returns the available virtual geometry of the monitor.
192
-
193
- :return: Available virtual geometry of the monitor
410
+
411
+ The available virtual geometry refers to the portion of the virtual geometry that is not occupied by system UI elements such as taskbars or docks.
412
+
413
+ Returns
414
+ -------
415
+ dict[str, int]
416
+ A dictionary containing the x and y coordinates, width, and height of the available virtual geometry.
417
+
418
+ Examples
419
+ --------
420
+ ```python
421
+ app = Pyloid("Pyloid-App")
422
+
423
+ monitor = app.get_primary_monitor()
424
+ available_virtual_geometry = monitor.available_virtual_geometry()
425
+ print("Available Virtual Geometry:", available_virtual_geometry)
426
+ ```
194
427
  """
195
428
  monitor = self.screen
196
429
  return {
@@ -200,11 +433,26 @@ class Monitor():
200
433
  "height": monitor.availableVirtualGeometry().height(),
201
434
  }
202
435
 
203
- def available_virtual_size(self) -> dict:
436
+ def available_virtual_size(self) -> dict[str, int]:
204
437
  """
205
438
  Returns the available virtual size of the monitor.
206
-
207
- :return: Available virtual size of the monitor
439
+
440
+ The available virtual size refers to the portion of the virtual size that is not occupied by system UI elements such as taskbars or docks.
441
+
442
+ Returns
443
+ -------
444
+ dict[str, int]
445
+ A dictionary containing the width and height of the available virtual size.
446
+
447
+ Examples
448
+ --------
449
+ ```python
450
+ app = Pyloid("Pyloid-App")
451
+
452
+ monitor = app.get_primary_monitor()
453
+ available_virtual_size = monitor.available_virtual_size()
454
+ print("Available Virtual Size:", available_virtual_size)
455
+ ```
208
456
  """
209
457
  monitor = self.screen
210
458
  return {
@@ -212,11 +460,26 @@ class Monitor():
212
460
  "height": monitor.availableVirtualSize().height(),
213
461
  }
214
462
 
215
- def physical_size(self) -> dict:
463
+ def physical_size(self) -> dict[str, float]:
216
464
  """
217
465
  Returns the physical size of the monitor.
218
-
219
- :return: Physical size of the monitor
466
+
467
+ The physical size refers to the actual physical dimensions of the monitor.
468
+
469
+ Returns
470
+ -------
471
+ dict[str, float]
472
+ A dictionary containing the width and height of the physical size.
473
+
474
+ Examples
475
+ --------
476
+ ```python
477
+ app = Pyloid("Pyloid-App")
478
+
479
+ monitor = app.get_primary_monitor()
480
+ physical_size = monitor.physical_size()
481
+ print("Physical Size:", physical_size)
482
+ ```
220
483
  """
221
484
  monitor = self.screen
222
485
  return {
@@ -227,8 +490,23 @@ class Monitor():
227
490
  def depth(self) -> int:
228
491
  """
229
492
  Returns the depth of the monitor.
230
-
231
- :return: Depth of the monitor
493
+
494
+ The depth refers to the color depth of the monitor, which is the number of bits used to represent the color of a single pixel.
495
+
496
+ Returns
497
+ -------
498
+ int
499
+ The color depth of the monitor.
500
+
501
+ Examples
502
+ --------
503
+ ```python
504
+ app = Pyloid("Pyloid-App")
505
+
506
+ monitor = app.get_primary_monitor()
507
+ depth = monitor.depth()
508
+ print("Color Depth:", depth)
509
+ ```
232
510
  """
233
511
  monitor = self.screen
234
512
  return monitor.depth()
@@ -236,35 +514,95 @@ class Monitor():
236
514
  def device_pixel_ratio(self) -> float:
237
515
  """
238
516
  Returns the device pixel ratio of the monitor.
239
-
240
- :return: Device pixel ratio of the monitor
517
+
518
+ The device pixel ratio is the ratio between physical pixels and device-independent pixels (DIPs).
519
+
520
+ Returns
521
+ -------
522
+ float
523
+ The device pixel ratio of the monitor.
524
+
525
+ Examples
526
+ --------
527
+ ```python
528
+ app = Pyloid("Pyloid-App")
529
+
530
+ monitor = app.get_primary_monitor()
531
+ device_pixel_ratio = monitor.device_pixel_ratio()
532
+ print("Device Pixel Ratio:", device_pixel_ratio)
533
+ ```
241
534
  """
242
535
  monitor = self.screen
243
536
  return monitor.devicePixelRatio()
244
537
 
245
538
  def logical_dots_per_inch(self) -> float:
246
539
  """
247
- Returns the logical dots per inch of the monitor.
248
-
249
- :return: Logical dots per inch of the monitor
540
+ Returns the logical dots per inch (DPI) of the monitor.
541
+
542
+ The logical DPI is the number of device-independent pixels (DIPs) per inch.
543
+
544
+ Returns
545
+ -------
546
+ float
547
+ The logical DPI of the monitor.
548
+
549
+ Examples
550
+ --------
551
+ ```python
552
+ app = Pyloid("Pyloid-App")
553
+
554
+ monitor = app.get_primary_monitor()
555
+ logical_dpi = monitor.logical_dots_per_inch()
556
+ print("Logical DPI:", logical_dpi)
557
+ ```
250
558
  """
251
559
  monitor = self.screen
252
560
  return monitor.logicalDotsPerInch()
253
561
 
254
562
  def logical_dots_per_inch_x(self) -> float:
255
563
  """
256
- Returns the logical dots per inch X of the monitor.
257
-
258
- :return: Logical dots per inch X of the monitor
259
- """
564
+ Returns the logical dots per inch (DPI) along the X axis of the monitor.
565
+
566
+ The logical DPI along the X axis is the number of device-independent pixels (DIPs) per inch along the horizontal axis.
567
+
568
+ Returns
569
+ -------
570
+ float
571
+ The logical DPI along the X axis of the monitor.
572
+
573
+ Examples
574
+ --------
575
+ ```python
576
+ app = Pyloid("Pyloid-App")
577
+
578
+ monitor = app.get_primary_monitor()
579
+ logical_dpi_x = monitor.logical_dots_per_inch_x()
580
+ print("Logical DPI X:", logical_dpi_x)
581
+ ```
582
+ """
260
583
  monitor = self.screen
261
584
  return monitor.logicalDotsPerInchX()
262
585
 
263
586
  def logical_dots_per_inch_y(self) -> float:
264
587
  """
265
- Returns the logical dots per inch Y of the monitor.
266
-
267
- :return: Logical dots per inch Y of the monitor
588
+ Returns the logical dots per inch (DPI) along the Y axis of the monitor.
589
+
590
+ The logical DPI along the Y axis is the number of device-independent pixels (DIPs) per inch along the vertical axis.
591
+
592
+ Returns
593
+ -------
594
+ float
595
+ The logical DPI along the Y axis of the monitor.
596
+
597
+ Examples
598
+ --------
599
+ ```python
600
+ app = Pyloid("Pyloid-App")
601
+
602
+ monitor = app.get_primary_monitor()
603
+ logical_dpi_y = monitor.logical_dots_per_inch_y()
604
+ print("Logical DPI Y:", logical_dpi_y)
605
+ ```
268
606
  """
269
607
  monitor = self.screen
270
608
  return monitor.logicalDotsPerInchY()
@@ -272,35 +610,95 @@ class Monitor():
272
610
  def orientation(self) -> str:
273
611
  """
274
612
  Returns the orientation of the monitor.
275
-
276
- :return: Orientation of the monitor
277
- """
613
+
614
+ The orientation refers to the current orientation of the monitor, such as landscape or portrait.
615
+
616
+ Returns
617
+ -------
618
+ str
619
+ The orientation of the monitor.
620
+
621
+ Examples
622
+ --------
623
+ ```python
624
+ app = Pyloid("Pyloid-App")
625
+
626
+ monitor = app.get_primary_monitor()
627
+ orientation = monitor.orientation()
628
+ print("Orientation:", orientation)
629
+ ```
630
+ """
278
631
  monitor = self.screen
279
632
  return monitor.orientation().name
280
633
 
281
634
  def physical_dots_per_inch(self) -> float:
282
635
  """
283
- Returns the physical dots per inch of the monitor.
284
-
285
- :return: Physical dots per inch of the monitor
636
+ Returns the physical dots per inch (DPI) of the monitor.
637
+
638
+ The physical DPI is the number of physical pixels per inch.
639
+
640
+ Returns
641
+ -------
642
+ float
643
+ The physical DPI of the monitor.
644
+
645
+ Examples
646
+ --------
647
+ ```python
648
+ app = Pyloid("Pyloid-App")
649
+
650
+ monitor = app.get_primary_monitor()
651
+ physical_dpi = monitor.physical_dots_per_inch()
652
+ print("Physical DPI:", physical_dpi)
653
+ ```
286
654
  """
287
655
  monitor = self.screen
288
656
  return monitor.physicalDotsPerInch()
289
657
 
290
658
  def physical_dots_per_inch_x(self) -> float:
291
659
  """
292
- Returns the physical dots per inch X of the monitor.
293
-
294
- :return: Physical dots per inch X of the monitor
660
+ Returns the physical dots per inch (DPI) along the X axis of the monitor.
661
+
662
+ The physical DPI along the X axis is the number of physical pixels per inch along the horizontal axis.
663
+
664
+ Returns
665
+ -------
666
+ float
667
+ The physical DPI along the X axis of the monitor.
668
+
669
+ Examples
670
+ --------
671
+ ```python
672
+ app = Pyloid("Pyloid-App")
673
+
674
+ monitor = app.get_primary_monitor()
675
+ physical_dpi_x = monitor.physical_dots_per_inch_x()
676
+ print("Physical DPI X:", physical_dpi_x)
677
+ ```
295
678
  """
296
679
  monitor = self.screen
297
680
  return monitor.physicalDotsPerInchX()
298
681
 
299
682
  def physical_dots_per_inch_y(self) -> float:
300
683
  """
301
- Returns the physical dots per inch Y of the monitor.
302
-
303
- :return: Physical dots per inch Y of the monitor
684
+ Returns the physical dots per inch (DPI) along the Y axis of the monitor.
685
+
686
+ The physical DPI along the Y axis is the number of physical pixels per inch along the vertical axis.
687
+
688
+ Returns
689
+ -------
690
+ float
691
+ The physical DPI along the Y axis of the monitor.
692
+
693
+ Examples
694
+ --------
695
+ ```python
696
+ app = Pyloid("Pyloid-App")
697
+
698
+ monitor = app.get_primary_monitor()
699
+ physical_dpi_y = monitor.physical_dots_per_inch_y()
700
+ print("Physical DPI Y:", physical_dpi_y)
701
+ ```
304
702
  """
305
703
  monitor = self.screen
306
704
  return monitor.physicalDotsPerInchY()
@@ -308,8 +706,23 @@ class Monitor():
308
706
  def refresh_rate(self) -> float:
309
707
  """
310
708
  Returns the refresh rate of the monitor.
311
-
312
- :return: Refresh rate of the monitor
709
+
710
+ The refresh rate is the number of times the monitor updates with new information per second, measured in Hertz (Hz).
711
+
712
+ Returns
713
+ -------
714
+ float
715
+ The refresh rate of the monitor.
716
+
717
+ Examples
718
+ --------
719
+ ```python
720
+ app = Pyloid("Pyloid-App")
721
+
722
+ monitor = app.get_primary_monitor()
723
+ refresh_rate = monitor.refresh_rate()
724
+ print("Refresh Rate:", refresh_rate)
725
+ ```
313
726
  """
314
727
  monitor = self.screen
315
728
  return monitor.refreshRate()
@@ -317,8 +730,23 @@ class Monitor():
317
730
  def manufacturer(self) -> str:
318
731
  """
319
732
  Returns the manufacturer of the monitor.
320
-
321
- :return: Manufacturer of the monitor
733
+
734
+ The manufacturer refers to the company that produced the monitor.
735
+
736
+ Returns
737
+ -------
738
+ str
739
+ The manufacturer of the monitor.
740
+
741
+ Examples
742
+ --------
743
+ ```python
744
+ app = Pyloid("Pyloid-App")
745
+
746
+ monitor = app.get_primary_monitor()
747
+ manufacturer = monitor.manufacturer()
748
+ print("Manufacturer:", manufacturer)
749
+ ```
322
750
  """
323
751
  monitor = self.screen
324
752
  return monitor.manufacturer()
@@ -326,8 +754,23 @@ class Monitor():
326
754
  def model(self) -> str:
327
755
  """
328
756
  Returns the model of the monitor.
329
-
330
- :return: Model of the monitor
757
+
758
+ The model refers to the specific model name or number assigned by the manufacturer.
759
+
760
+ Returns
761
+ -------
762
+ str
763
+ The model of the monitor.
764
+
765
+ Examples
766
+ --------
767
+ ```python
768
+ app = Pyloid("Pyloid-App")
769
+
770
+ monitor = app.get_primary_monitor()
771
+ model = monitor.model()
772
+ print("Model:", model)
773
+ ```
331
774
  """
332
775
  monitor = self.screen
333
776
  return monitor.model()
@@ -335,8 +778,23 @@ class Monitor():
335
778
  def name(self) -> str:
336
779
  """
337
780
  Returns the name of the monitor.
338
-
339
- :return: Name of the monitor
781
+
782
+ The name refers to the user-friendly name assigned to the monitor.
783
+
784
+ Returns
785
+ -------
786
+ str
787
+ The name of the monitor.
788
+
789
+ Examples
790
+ --------
791
+ ```python
792
+ app = Pyloid("Pyloid-App")
793
+
794
+ monitor = app.get_primary_monitor()
795
+ name = monitor.name()
796
+ print("Name:", name)
797
+ ```
340
798
  """
341
799
  monitor = self.screen
342
800
  return monitor.name()
@@ -344,29 +802,96 @@ class Monitor():
344
802
  def serial_number(self) -> str:
345
803
  """
346
804
  Returns the serial number of the monitor.
347
-
348
- :return: Serial number of the monitor
805
+
806
+ The serial number is a unique identifier assigned to the monitor by the manufacturer.
807
+
808
+ Returns
809
+ -------
810
+ str
811
+ The serial number of the monitor.
812
+
813
+ Examples
814
+ --------
815
+ ```python
816
+ app = Pyloid("Pyloid-App")
817
+
818
+ monitor = app.get_primary_monitor()
819
+ serial_number = monitor.serial_number()
820
+ print("Serial Number:", serial_number)
821
+ ```
349
822
  """
350
823
  monitor = self.screen
351
824
  return monitor.serialNumber()
352
825
 
353
826
  def geometry_changed(self, callback: Callable):
354
827
  """
355
- Returns the event that occurs when the geometry of the monitor changes.
828
+ Registers a callback for the event that occurs when the geometry of the monitor changes.
829
+
830
+ Parameters
831
+ ----------
832
+ callback : Callable
833
+ The function to be called when the geometry changes.
834
+
835
+ Examples
836
+ --------
837
+ ```python
838
+ app = Pyloid("Pyloid-App")
839
+
840
+ def on_geometry_changed():
841
+ print("Geometry changed!")
842
+
843
+ monitor = app.get_primary_monitor()
844
+ monitor.geometry_changed(on_geometry_changed)
845
+ ```
356
846
  """
357
847
  monitor = self.screen
358
848
  monitor.geometryChanged.connect(callback)
359
849
 
360
850
  def orientation_changed(self, callback: Callable):
361
851
  """
362
- Returns the event that occurs when the orientation of the monitor changes.
852
+ Registers a callback for the event that occurs when the orientation of the monitor changes.
853
+
854
+ Parameters
855
+ ----------
856
+ callback : Callable
857
+ The function to be called when the orientation changes.
858
+
859
+ Examples
860
+ --------
861
+ ```python
862
+ app = Pyloid("Pyloid-App")
863
+
864
+ def on_orientation_changed():
865
+ print("Orientation changed!")
866
+
867
+ monitor = app.get_primary_monitor()
868
+ monitor.orientation_changed(on_orientation_changed)
869
+ ```
363
870
  """
364
871
  monitor = self.screen
365
872
  monitor.orientationChanged.connect(callback)
366
873
 
367
874
  def refresh_rate_changed(self, callback: Callable):
368
875
  """
369
- Returns the event that occurs when the refresh rate of the monitor changes.
876
+ Registers a callback for the event that occurs when the refresh rate of the monitor changes.
877
+
878
+ Parameters
879
+ ----------
880
+ callback : Callable
881
+ The function to be called when the refresh rate changes.
882
+
883
+ Examples
884
+ --------
885
+ ```python
886
+ app = Pyloid("Pyloid-App")
887
+
888
+ def on_refresh_rate_changed():
889
+ print("Refresh rate changed!")
890
+
891
+ monitor = app.get_primary_monitor()
892
+ monitor.refresh_rate_changed(on_refresh_rate_changed)
893
+ ```
370
894
  """
371
895
  monitor = self.screen
372
896
  monitor.refreshRateChanged.connect(callback)
897
+