-
Notifications
You must be signed in to change notification settings - Fork 129
/
shared.py
1093 lines (1002 loc) · 52.6 KB
/
shared.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
'''
shared
======
Shared imports and compatibility definitions between Qt5 and Qt6.
'''
# pylint: disable=import-error
import argparse
import importlib
import logging
import os
import sys
example_dir = os.path.dirname(os.path.realpath(__file__))
home = os.path.dirname(example_dir)
dist = os.path.join(home, 'dist')
sys.path.append(home)
THEME = None
from example.detect import system_theme # noqa # pylint: disable=wrong-import-position,import-error
def create_parser():
'''Create an argparser with the base settings for all Qt applications.'''
parser = argparse.ArgumentParser(description='Configurations for the Qt5 application.')
parser.add_argument(
'--stylesheet',
help='stylesheet name (`dark`, `light`, `native`, `auto`, ...)',
default='native',
)
# Know working styles include:
# 1. Fusion
# 2. Windows
parser.add_argument(
'--style',
help='application style (`Fusion`, `Windows`, `native`, ...)',
default='native',
)
parser.add_argument('--font-size', help='font size for the application', type=float, default=-1)
parser.add_argument('--font-family', help='the font family')
parser.add_argument(
'--scale',
help='scale factor for the UI',
type=float,
default=1,
)
parser.add_argument(
'--qt-framework',
help=(
'target framework to build for. Default = pyqt5. '
'Note: building for PyQt6 requires PySide6-rcc to be installed.'
),
choices=['pyqt5', 'pyqt6', 'pyside2', 'pyside6'],
default='pyqt5',
)
# Linux or Unix-like only.
parser.add_argument('--use-x11', help='force the use of x11 on compatible systems.', action='store_true')
return parser
def parse_args(parser):
'''Parse the command-line arguments and hot-patch the args.'''
args, unknown = parser.parse_known_args()
# Need to fix an issue on Wayland on Linux:
# conda-forge does not support Wayland, for who knows what reason.
if sys.platform.lower().startswith('linux') and 'CONDA_PREFIX' in os.environ:
args.use_x11 = True
if args.use_x11:
os.environ['XDG_SESSION_TYPE'] = 'x11'
os.environ['QT_QPA_PLATFORM'] = 'xcb'
args.stylesheet = normalize_stylesheet(args.stylesheet)
return args, unknown
def normalize_stylesheet(stylesheet):
'''Normalize the stylesheet, removing and normalizing any aliases.'''
# now we need to normalize our theme. we don't use Qt6 features
# so we can differentiat between light/dark/unknown.
if stylesheet.startswith('auto'):
theme = system_theme.get_theme()
if theme == system_theme.Theme.DARK:
stylesheet = stylesheet.replace('auto', 'dark', 1)
elif theme == system_theme.Theme.LIGHT:
stylesheet = stylesheet.replace('auto', 'light', 1)
else:
logging.warning('Unknown an unknown system theme, falling back to the system native theme.')
stylesheet = 'native'
# Needed so we remove any aliases. See #106.
if stylesheet in ('dark', 'light'):
stylesheet += '-blue'
return stylesheet
def is_qt6(args):
'''Get if we're using Qt6 and not Qt5.'''
return args.qt_framework in ('pyqt6', 'pyside6')
def import_qt(args, load_resources=True):
'''Import the Qt modules'''
if args.qt_framework == 'pyqt6':
from PyQt6 import QtCore, QtGui, QtWidgets # pyright: ignore[reportMissingImports]
elif args.qt_framework == 'pyside6':
from PySide6 import QtCore, QtGui, QtWidgets # pyright: ignore[reportMissingImports]
elif args.qt_framework == "pyqt5":
from PyQt5 import QtCore, QtGui, QtWidgets # pyright: ignore[reportMissingImports]
elif args.qt_framework == 'pyside2':
from PySide2 import QtCore, QtGui, QtWidgets # pyright: ignore[reportMissingImports]
else:
raise ValueError(f'Got an invalid Qt framework of "{args.qt_framework}".')
if load_resources:
sys.path.insert(0, f'{home}/resources')
importlib.import_module(f'breeze_{args.qt_framework}')
return QtCore, QtGui, QtWidgets
def get_resources(args):
'''Get the resource format for the Qt application.'''
return f':/{args.stylesheet}/'
def get_stylesheet(resource_format):
'''Get the path to the stylesheet.'''
return f'{resource_format}stylesheet.qss'
def get_version(args):
'''Get the current version of the Qt library.'''
QtCore, _, __ = import_qt(args, load_resources=False)
if args.qt_framework in ('pyqt5', 'pyqt6'):
# QT_VERSION is stored in 0xMMmmpp, each in 8 bit pairs.
# Goes major, minor, patch. 393984 is "6.3.0"
return (QtCore.QT_VERSION >> 16, (QtCore.QT_VERSION >> 8) & 0xFF, QtCore.QT_VERSION & 0xFF)
return QtCore.__version_info__[:3]
def get_compat_definitions(args): # pylint: disable=too-many-statements
'''Create our compatibility definitions.'''
ns = argparse.Namespace()
QtCore, QtGui, QtWidgets = import_qt(args, load_resources=False)
ns.QtCore = QtCore
ns.QtGui = QtGui
ns.QtWidgets = QtWidgets
# ensure we store the QT_VERSION
if args.qt_framework in ('pyqt5', 'pyqt6'):
# QT_VERSION is stored in 0xMMmmpp, each in 8 bit pairs.
# Goes major, minor, patch. 393984 is "6.3.0"
ns.QT_VERSION = (QtCore.QT_VERSION >> 16, (QtCore.QT_VERSION >> 8) & 0xFF, QtCore.QT_VERSION & 0xFF)
else:
ns.QT_VERSION = QtCore.__version_info__[:3]
if is_qt6(args):
# Scoped enums.
ns.Orientation = QtCore.Qt.Orientation
ns.StandardPixmap = QtWidgets.QStyle.StandardPixmap
ns.ToolBarArea = QtCore.Qt.ToolBarArea
ns.FrameShape = QtWidgets.QFrame.Shape
ns.FrameShadow = QtWidgets.QFrame.Shadow
ns.FrameStyleMask = QtWidgets.QFrame.StyleMask
ns.ToolButtonPopupMode = QtWidgets.QToolButton.ToolButtonPopupMode
ns.AlignmentFlag = QtCore.Qt.AlignmentFlag
ns.OpenModeFlag = QtCore.QFile.OpenModeFlag
ns.TabShape = QtWidgets.QTabWidget.TabShape
ns.ItemFlag = QtCore.Qt.ItemFlag
ns.CheckState = QtCore.Qt.CheckState
ns.TabPosition = QtWidgets.QTabWidget.TabPosition
ns.EchoMode = QtWidgets.QLineEdit.EchoMode
ns.ArrowType = QtCore.Qt.ArrowType
ns.WindowState = QtCore.Qt.WindowState
ns.PenStyle = QtCore.Qt.PenStyle
ns.PenCapStyle = QtCore.Qt.PenCapStyle
ns.PenJoinStyle = QtCore.Qt.PenJoinStyle
ns.StateFlag = QtWidgets.QStyle.StateFlag
ns.EventType = QtCore.QEvent.Type
ns.ColorRole = QtGui.QPalette.ColorRole
ns.TickPosition = QtWidgets.QSlider.TickPosition
ns.ComplexControl = QtWidgets.QStyle.ComplexControl
ns.SubControl = QtWidgets.QStyle.SubControl
ns.ScrollBarPolicy = QtCore.Qt.ScrollBarPolicy
ns.AspectRatioMode = QtCore.Qt.AspectRatioMode
ns.MessageStandardButton = QtWidgets.QMessageBox.StandardButton
ns.MessageIcon = QtWidgets.QMessageBox.Icon
ns.FileMode = QtWidgets.QFileDialog.FileMode
ns.ColorOption = QtWidgets.QColorDialog.ColorDialogOption
ns.SegmentStyle = QtWidgets.QLCDNumber.SegmentStyle
ns.FileIconType = QtWidgets.QFileIconProvider.IconType
ns.FontDialogOption = QtWidgets.QFontDialog.FontDialogOption
ns.TextFormat = QtCore.Qt.TextFormat
ns.AspectRatioMode = QtCore.Qt.AspectRatioMode
ns.ScrollBarPolicy = QtCore.Qt.ScrollBarPolicy
ns.ToolButtonStyle = QtCore.Qt.ToolButtonStyle
ns.FileOption = QtWidgets.QFileDialog.Option.DontUseNativeDialog
ns.DialogStandardButton = QtWidgets.QDialogButtonBox.StandardButton
ns.DialogButtonRole = QtWidgets.QDialogButtonBox.ButtonRole
ns.WizardStyle = QtWidgets.QWizard.WizardStyle
ns.WizardOption = QtWidgets.QWizard.WizardOption
ns.WizardPixmap = QtWidgets.QWizard.WizardPixmap
ns.DockWidgetArea = QtCore.Qt.DockWidgetArea
ns.DockWidgetFeature = QtWidgets.QDockWidget.DockWidgetFeature
ns.InputDialogOption = QtWidgets.QInputDialog.InputDialogOption
ns.ProgressDirection = QtWidgets.QProgressBar.Direction
ns.ButtonPosition = QtWidgets.QTabBar.ButtonPosition
ns.TabShape = QtWidgets.QTabWidget.TabShape
ns.InputMode = QtWidgets.QInputDialog.InputMode
ns.RubberBandShape = QtWidgets.QRubberBand.Shape
ns.TextInteractionFlag = QtCore.Qt.TextInteractionFlag
ns.WindowType = QtCore.Qt.WindowType
ns.WindowState = QtCore.Qt.WindowState
ns.WidgetAttribute = QtCore.Qt.WidgetAttribute
ns.TextElideMode = QtCore.Qt.TextElideMode
ns.CursorShape = QtCore.Qt.CursorShape
ns.MouseButton = QtCore.Qt.MouseButton
ns.KeyboardModifier = QtCore.Qt.KeyboardModifier
ns.SizePolicy = QtWidgets.QSizePolicy.Policy
ns.SizeConstraint = QtWidgets.QLayout.SizeConstraint
# QObjects
ns.QAction = QtGui.QAction
if args.qt_framework == 'pyqt6':
ns.QFileSystemModel = QtGui.QFileSystemModel
else:
ns.QFileSystemModel = QtWidgets.QFileSystemModel
ns.QUndoGroup = QtGui.QUndoGroup
ns.QUndoStack = QtGui.QUndoStack
ns.QUndoCommand = QtGui.QUndoCommand
# Enumerations
ns.Horizontal = ns.Orientation.Horizontal
ns.Vertical = ns.Orientation.Vertical
ns.AlignTop = ns.AlignmentFlag.AlignTop
ns.AlignBottom = ns.AlignmentFlag.AlignBottom
ns.AlignLeft = ns.AlignmentFlag.AlignLeft
ns.AlignRight = ns.AlignmentFlag.AlignRight
ns.AlignHCenter = ns.AlignmentFlag.AlignHCenter
ns.AlignVCenter = ns.AlignmentFlag.AlignVCenter
ns.AlignCenter = ns.AlignmentFlag.AlignCenter
ns.NoFrame = ns.FrameShape.NoFrame
ns.Box = ns.FrameShape.Box
ns.Panel = ns.FrameShape.Panel
ns.StyledPanel = ns.FrameShape.StyledPanel
ns.HLine = ns.FrameShape.HLine
ns.VLine = ns.FrameShape.VLine
ns.WinPanel = ns.FrameShape.WinPanel
ns.TopToolBarArea = ns.ToolBarArea.TopToolBarArea
ns.LeftToolBarArea = ns.ToolBarArea.LeftToolBarArea
ns.Plain = ns.FrameShadow.Plain
ns.Raised = ns.FrameShadow.Raised
ns.Sunken = ns.FrameShadow.Sunken
ns.InstantPopup = ns.ToolButtonPopupMode.InstantPopup
ns.MenuButtonPopup = ns.ToolButtonPopupMode.MenuButtonPopup
ns.ItemIsEditable = ns.ItemFlag.ItemIsEditable
ns.ItemIsUserCheckable = ns.ItemFlag.ItemIsUserCheckable
ns.ItemIsUserTristate = ns.ItemFlag.ItemIsUserTristate
ns.Checked = ns.CheckState.Checked
ns.Unchecked = ns.CheckState.Unchecked
ns.PartiallyChecked = ns.CheckState.PartiallyChecked
ns.ReadOnly = ns.OpenModeFlag.ReadOnly
ns.Text = ns.OpenModeFlag.Text
ns.North = ns.TabPosition.North
ns.West = ns.TabPosition.West
ns.East = ns.TabPosition.East
ns.South = ns.TabPosition.South
ns.LeftArrow = ns.ArrowType.LeftArrow
ns.RightArrow = ns.ArrowType.RightArrow
ns.UpArrow = ns.ArrowType.UpArrow
ns.DownArrow = ns.ArrowType.DownArrow
ns.Triangular = ns.TabShape.Triangular
ns.NoEcho = ns.EchoMode.NoEcho
ns.Password = ns.EchoMode.Password
ns.PasswordEchoOnEdit = ns.EchoMode.PasswordEchoOnEdit
ns.SolidLine = ns.PenStyle.SolidLine
ns.DotLine = ns.PenStyle.DotLine
ns.FlatCap = ns.PenCapStyle.FlatCap
ns.SquareCap = ns.PenCapStyle.SquareCap
ns.RoundCap = ns.PenCapStyle.RoundCap
ns.MiterJoin = ns.PenJoinStyle.MiterJoin
ns.BevelJoin = ns.PenJoinStyle.BevelJoin
ns.RoundJoin = ns.PenJoinStyle.RoundJoin
ns.SvgMiterJoin = ns.PenJoinStyle.SvgMiterJoin
ns.State_HasFocus = ns.StateFlag.State_HasFocus
ns.State_Selected = ns.StateFlag.State_Selected
ns.Enter = ns.EventType.Enter
ns.Leave = ns.EventType.Leave
ns.HoverEnter = ns.EventType.HoverEnter
ns.HoverMove = ns.EventType.HoverMove
ns.HoverLeave = ns.EventType.HoverLeave
ns.MouseButtonPress = ns.EventType.MouseButtonPress
ns.MouseButtonRelease = ns.EventType.MouseButtonRelease
ns.MouseMove = ns.EventType.MouseMove
ns.WindowStateChange = ns.EventType.WindowStateChange
ns.ActivationChange = ns.EventType.ActivationChange
ns.WindowPalette = ns.ColorRole.Window
ns.WindowTextPalette = ns.ColorRole.WindowText
ns.LightPalette = ns.ColorRole.Light
ns.DarkPalette = ns.ColorRole.Dark
ns.PlaceholderText = ns.ColorRole.PlaceholderText
ns.Link = ns.ColorRole.Link
ns.LinkVisited = ns.ColorRole.LinkVisited
ns.ToolTipBase = ns.ColorRole.ToolTipBase
ns.ToolTipText = ns.ColorRole.ToolTipText
ns.NoTicks = ns.TickPosition.NoTicks
ns.TicksAbove = ns.TickPosition.TicksAbove
ns.TicksBelow = ns.TickPosition.TicksBelow
ns.TicksBothSides = ns.TickPosition.TicksBothSides
ns.CC_Slider = ns.ComplexControl.CC_Slider
ns.SC_SliderHandle = ns.SubControl.SC_SliderHandle
ns.SC_SliderGroove = ns.SubControl.SC_SliderGroove
ns.SP_ArrowBack = ns.StandardPixmap.SP_ArrowBack
ns.SP_ArrowDown = ns.StandardPixmap.SP_ArrowDown
ns.SP_ArrowForward = ns.StandardPixmap.SP_ArrowForward
ns.SP_ArrowLeft = ns.StandardPixmap.SP_ArrowLeft
ns.SP_ArrowRight = ns.StandardPixmap.SP_ArrowRight
ns.SP_ArrowUp = ns.StandardPixmap.SP_ArrowUp
ns.SP_BrowserReload = ns.StandardPixmap.SP_BrowserReload
ns.SP_BrowserStop = ns.StandardPixmap.SP_BrowserStop
ns.SP_CommandLink = ns.StandardPixmap.SP_CommandLink
ns.SP_ComputerIcon = ns.StandardPixmap.SP_ComputerIcon
ns.SP_CustomBase = ns.StandardPixmap.SP_CustomBase
ns.SP_DesktopIcon = ns.StandardPixmap.SP_DesktopIcon
ns.SP_DialogApplyButton = ns.StandardPixmap.SP_DialogApplyButton
ns.SP_DialogCancelButton = ns.StandardPixmap.SP_DialogCancelButton
ns.SP_DialogCloseButton = ns.StandardPixmap.SP_DialogCloseButton
ns.SP_DialogDiscardButton = ns.StandardPixmap.SP_DialogDiscardButton
ns.SP_DialogHelpButton = ns.StandardPixmap.SP_DialogHelpButton
ns.SP_DialogNoButton = ns.StandardPixmap.SP_DialogNoButton
ns.SP_DialogOkButton = ns.StandardPixmap.SP_DialogOkButton
ns.SP_DialogOpenButton = ns.StandardPixmap.SP_DialogOpenButton
ns.SP_DialogResetButton = ns.StandardPixmap.SP_DialogResetButton
ns.SP_DialogSaveButton = ns.StandardPixmap.SP_DialogSaveButton
ns.SP_DialogYesButton = ns.StandardPixmap.SP_DialogYesButton
ns.SP_DirClosedIcon = ns.StandardPixmap.SP_DirClosedIcon
ns.SP_DirHomeIcon = ns.StandardPixmap.SP_DirHomeIcon
ns.SP_DirIcon = ns.StandardPixmap.SP_DirIcon
ns.SP_DirLinkIcon = ns.StandardPixmap.SP_DirLinkIcon
ns.SP_DirLinkOpenIcon = ns.StandardPixmap.SP_DirLinkOpenIcon
ns.SP_DirOpenIcon = ns.StandardPixmap.SP_DirOpenIcon
ns.SP_DockWidgetCloseButton = ns.StandardPixmap.SP_DockWidgetCloseButton
ns.SP_DriveCDIcon = ns.StandardPixmap.SP_DriveCDIcon
ns.SP_DriveDVDIcon = ns.StandardPixmap.SP_DriveDVDIcon
ns.SP_DriveFDIcon = ns.StandardPixmap.SP_DriveFDIcon
ns.SP_DriveHDIcon = ns.StandardPixmap.SP_DriveHDIcon
ns.SP_DriveNetIcon = ns.StandardPixmap.SP_DriveNetIcon
ns.SP_FileDialogBack = ns.StandardPixmap.SP_FileDialogBack
ns.SP_FileDialogContentsView = ns.StandardPixmap.SP_FileDialogContentsView
ns.SP_FileDialogDetailedView = ns.StandardPixmap.SP_FileDialogDetailedView
ns.SP_FileDialogEnd = ns.StandardPixmap.SP_FileDialogEnd
ns.SP_FileDialogInfoView = ns.StandardPixmap.SP_FileDialogInfoView
ns.SP_FileDialogListView = ns.StandardPixmap.SP_FileDialogListView
ns.SP_FileDialogNewFolder = ns.StandardPixmap.SP_FileDialogNewFolder
ns.SP_FileDialogStart = ns.StandardPixmap.SP_FileDialogStart
ns.SP_FileDialogToParent = ns.StandardPixmap.SP_FileDialogToParent
ns.SP_FileIcon = ns.StandardPixmap.SP_FileIcon
ns.SP_FileLinkIcon = ns.StandardPixmap.SP_FileLinkIcon
ns.SP_MediaPause = ns.StandardPixmap.SP_MediaPause
ns.SP_MediaPlay = ns.StandardPixmap.SP_MediaPlay
ns.SP_MediaSeekBackward = ns.StandardPixmap.SP_MediaSeekBackward
ns.SP_MediaSeekForward = ns.StandardPixmap.SP_MediaSeekForward
ns.SP_MediaSkipBackward = ns.StandardPixmap.SP_MediaSkipBackward
ns.SP_MediaSkipForward = ns.StandardPixmap.SP_MediaSkipForward
ns.SP_MediaStop = ns.StandardPixmap.SP_MediaStop
ns.SP_MediaVolume = ns.StandardPixmap.SP_MediaVolume
ns.SP_MediaVolumeMuted = ns.StandardPixmap.SP_MediaVolumeMuted
ns.SP_LineEditClearButton = ns.StandardPixmap.SP_LineEditClearButton
ns.SP_DialogYesToAllButton = ns.StandardPixmap.SP_DialogYesToAllButton
ns.SP_DialogNoToAllButton = ns.StandardPixmap.SP_DialogNoToAllButton
ns.SP_DialogSaveAllButton = ns.StandardPixmap.SP_DialogSaveAllButton
ns.SP_DialogAbortButton = ns.StandardPixmap.SP_DialogAbortButton
ns.SP_DialogRetryButton = ns.StandardPixmap.SP_DialogRetryButton
ns.SP_DialogIgnoreButton = ns.StandardPixmap.SP_DialogIgnoreButton
ns.SP_RestoreDefaultsButton = ns.StandardPixmap.SP_RestoreDefaultsButton
if ns.QT_VERSION >= (6, 3, 0):
ns.SP_TabCloseButton = ns.StandardPixmap.SP_TabCloseButton
ns.SP_MessageBoxCritical = ns.StandardPixmap.SP_MessageBoxCritical
ns.SP_MessageBoxInformation = ns.StandardPixmap.SP_MessageBoxInformation
ns.SP_MessageBoxQuestion = ns.StandardPixmap.SP_MessageBoxQuestion
ns.SP_MessageBoxWarning = ns.StandardPixmap.SP_MessageBoxWarning
ns.SP_TitleBarCloseButton = ns.StandardPixmap.SP_TitleBarCloseButton
ns.SP_TitleBarContextHelpButton = ns.StandardPixmap.SP_TitleBarContextHelpButton
ns.SP_TitleBarMaxButton = ns.StandardPixmap.SP_TitleBarMaxButton
ns.SP_TitleBarMenuButton = ns.StandardPixmap.SP_TitleBarMenuButton
ns.SP_TitleBarMinButton = ns.StandardPixmap.SP_TitleBarMinButton
ns.SP_TitleBarNormalButton = ns.StandardPixmap.SP_TitleBarNormalButton
ns.SP_TitleBarShadeButton = ns.StandardPixmap.SP_TitleBarShadeButton
ns.SP_TitleBarUnshadeButton = ns.StandardPixmap.SP_TitleBarUnshadeButton
ns.SP_ToolBarHorizontalExtensionButton = ns.StandardPixmap.SP_ToolBarHorizontalExtensionButton
ns.SP_ToolBarVerticalExtensionButton = ns.StandardPixmap.SP_ToolBarVerticalExtensionButton
ns.SP_TrashIcon = ns.StandardPixmap.SP_TrashIcon
ns.SP_VistaShield = ns.StandardPixmap.SP_VistaShield
ns.MessageOk = ns.MessageStandardButton.Ok
ns.MessageCancel = ns.MessageStandardButton.Cancel
ns.MessageClose = ns.MessageStandardButton.Close
ns.MessageOpen = ns.MessageStandardButton.Open
ns.MessageReset = ns.MessageStandardButton.Reset
ns.MessageSave = ns.MessageStandardButton.Save
ns.MessageSaveAll = ns.MessageStandardButton.SaveAll
ns.MessageRestoreDefaults = ns.MessageStandardButton.RestoreDefaults
ns.MessageYes = ns.MessageStandardButton.Yes
ns.MessageHelp = ns.MessageStandardButton.Help
ns.MessageNo = ns.MessageStandardButton.No
ns.MessageApply = ns.MessageStandardButton.Apply
ns.MessageDiscard = ns.MessageStandardButton.Discard
ns.MessageCritical = ns.MessageIcon.Critical
ns.MessageInformation = ns.MessageIcon.Information
ns.MessageNoIcon = ns.MessageIcon.NoIcon
ns.MessageQuestion = ns.MessageIcon.Question
ns.MessageWarning = ns.MessageIcon.Warning
# Qt6 expects an int value, not enumerated value for the StyleMask.
ns.Shadow_Mask = ns.FrameStyleMask.Shadow_Mask.value
ns.Shape_Mask = ns.FrameStyleMask.Shape_Mask.value
ns.AnyFile = ns.FileMode.AnyFile
ns.ExistingFile = ns.FileMode.ExistingFile
ns.ExistingFiles = ns.FileMode.ExistingFiles
ns.Directory = ns.FileMode.Directory
ns.ColorShowAlphaChannel = ns.ColorOption.ShowAlphaChannel
ns.ColorNoButtons = ns.ColorOption.NoButtons
ns.ColorDontUseNativeDialog = ns.ColorOption.DontUseNativeDialog
ns.LCDOutline = ns.SegmentStyle.Outline
ns.LCDFlat = ns.SegmentStyle.Flat
ns.NetworkIcon = ns.FileIconType.Network
ns.FontNoButtons = ns.FontDialogOption.NoButtons
ns.FontDontUseNativeDialog = ns.FontDialogOption.DontUseNativeDialog
ns.ClassicStyle = ns.WizardStyle.ClassicStyle
ns.ModernStyle = ns.WizardStyle.ModernStyle
ns.MacStyle = ns.WizardStyle.MacStyle
ns.AeroStyle = ns.WizardStyle.AeroStyle
ns.PlainText = ns.TextFormat.PlainText
ns.RichText = ns.TextFormat.RichText
ns.AutoText = ns.TextFormat.AutoText
ns.MarkdownText = ns.TextFormat.MarkdownText
ns.KeepAspectRatio = ns.AspectRatioMode.KeepAspectRatio
ns.ScrollBarAsNeeded = ns.ScrollBarPolicy.ScrollBarAsNeeded
ns.ToolButtonIconOnly = ns.ToolButtonStyle.ToolButtonIconOnly
ns.ToolButtonTextOnly = ns.ToolButtonStyle.ToolButtonTextOnly
ns.ToolButtonTextBesideIcon = ns.ToolButtonStyle.ToolButtonTextBesideIcon
ns.ToolButtonTextUnderIcon = ns.ToolButtonStyle.ToolButtonTextUnderIcon
ns.ToolButtonFollowStyle = ns.ToolButtonStyle.ToolButtonFollowStyle
ns.FileDontUseNativeDialog = ns.FileOption.DontUseNativeDialog
ns.DialogYesRole = ns.DialogButtonRole.YesRole
ns.DialogOk = ns.DialogStandardButton.Ok
ns.DialogCancel = ns.DialogStandardButton.Cancel
ns.HaveHelpButton = ns.WizardOption.HaveHelpButton
ns.WatermarkPixmap = ns.WizardPixmap.WatermarkPixmap
ns.LogoPixmap = ns.WizardPixmap.LogoPixmap
ns.BannerPixmap = ns.WizardPixmap.BannerPixmap
ns.BackgroundPixmap = ns.WizardPixmap.BackgroundPixmap
ns.LeftDockWidgetArea = ns.DockWidgetArea.LeftDockWidgetArea
DockWidgetClosable = ns.DockWidgetFeature.DockWidgetClosable
DockWidgetFloatable = ns.DockWidgetFeature.DockWidgetFloatable
DockWidgetMovable = ns.DockWidgetFeature.DockWidgetMovable
ns.AllDockWidgetFeatures = DockWidgetClosable | DockWidgetFloatable | DockWidgetMovable
ns.DockWidgetVerticalTitleBar = ns.DockWidgetFeature.DockWidgetVerticalTitleBar
ns.InputNoButtons = ns.InputDialogOption.NoButtons
ns.UseListViewForComboBoxItems = ns.InputDialogOption.UseListViewForComboBoxItems
ns.TopToBottom = ns.ProgressDirection.TopToBottom
ns.BottomToTop = ns.ProgressDirection.BottomToTop
ns.Rounded = ns.TabShape.Rounded
ns.Triangular = ns.TabShape.Triangular
ns.LeftSide = ns.ButtonPosition.LeftSide
ns.RightSide = ns.ButtonPosition.RightSide
ns.IntInput = ns.InputMode.IntInput
ns.DoubleInput = ns.InputMode.DoubleInput
ns.RubberBandLine = ns.RubberBandShape.Line
ns.RubberBandRectangle = ns.RubberBandShape.Rectangle
ns.TextSelectableByMouse = ns.TextInteractionFlag.TextSelectableByMouse
ns.TextEditorInteraction = ns.TextInteractionFlag.TextEditorInteraction
ns.TextBrowserInteraction = ns.TextInteractionFlag.TextBrowserInteraction
ns.Window = ns.WindowType.Window
ns.Dialog = ns.WindowType.Dialog
ns.SubWindow = ns.WindowType.SubWindow
ns.WindowContextHelpButtonHint = ns.WindowType.WindowContextHelpButtonHint
ns.WindowShadeButtonHint = ns.WindowType.WindowShadeButtonHint
ns.BypassWindowManagerHint = ns.WindowType.BypassWindowManagerHint
ns.X11BypassWindowManagerHint = ns.WindowType.X11BypassWindowManagerHint
ns.FramelessWindowHint = ns.WindowType.FramelessWindowHint
ns.WindowStaysOnTopHint = ns.WindowType.WindowStaysOnTopHint
ns.WindowStaysOnBottomHint = ns.WindowType.WindowStaysOnBottomHint
ns.WindowNoState = ns.WindowState.WindowNoState
ns.WindowMinimized = ns.WindowState.WindowMinimized
ns.WindowMaximized = ns.WindowState.WindowMaximized
ns.WA_Hover = ns.WidgetAttribute.WA_Hover
ns.WA_LayoutOnEntireRect = ns.WidgetAttribute.WA_LayoutOnEntireRect
ns.WA_LayoutUsesWidgetRect = ns.WidgetAttribute.WA_LayoutUsesWidgetRect
ns.ElideLeft = ns.TextElideMode.ElideLeft
ns.ElideRight = ns.TextElideMode.ElideRight
ns.ElideMiddle = ns.TextElideMode.ElideMiddle
ns.ElideNone = ns.TextElideMode.ElideNone
ns.CrossCursor = ns.CursorShape.CrossCursor
ns.SizeVerCursor = ns.CursorShape.SizeVerCursor
ns.SizeHorCursor = ns.CursorShape.SizeHorCursor
ns.SizeBDiagCursor = ns.CursorShape.SizeBDiagCursor
ns.SizeFDiagCursor = ns.CursorShape.SizeFDiagCursor
ns.SizeAllCursor = ns.CursorShape.SizeAllCursor
ns.WhatsThisCursor = ns.CursorShape.WhatsThisCursor
ns.LeftButton = ns.MouseButton.LeftButton
ns.RightButton = ns.MouseButton.RightButton
ns.NoModifier = ns.KeyboardModifier.NoModifier
ns.SizeFixed = ns.SizePolicy.Fixed
ns.SizeMinimum = ns.SizePolicy.Minimum
ns.SizeMaximum = ns.SizePolicy.Maximum
ns.SizePreferred = ns.SizePolicy.Preferred
ns.SizeExpanding = ns.SizePolicy.Expanding
ns.SizeMinimumExpanding = ns.SizePolicy.MinimumExpanding
ns.SizeIgnored = ns.SizePolicy.Ignored
ns.SetFixedSize = ns.SizeConstraint.SetFixedSize
else:
# QObjects
ns.QAction = QtWidgets.QAction
ns.QFileSystemModel = QtWidgets.QFileSystemModel
ns.QUndoGroup = QtWidgets.QUndoGroup
ns.QUndoStack = QtWidgets.QUndoStack
ns.QUndoCommand = QtWidgets.QUndoCommand
# Enumerations
ns.Horizontal = QtCore.Qt.Horizontal
ns.Vertical = QtCore.Qt.Vertical
ns.TopToolBarArea = QtCore.Qt.TopToolBarArea
ns.LeftToolBarArea = QtCore.Qt.LeftToolBarArea
ns.NoFrame = QtWidgets.QFrame.NoFrame
ns.Box = QtWidgets.QFrame.Box
ns.Panel = QtWidgets.QFrame.Panel
ns.StyledPanel = QtWidgets.QFrame.StyledPanel
ns.HLine = QtWidgets.QFrame.HLine
ns.VLine = QtWidgets.QFrame.VLine
ns.WinPanel = QtWidgets.QFrame.WinPanel
ns.Plain = QtWidgets.QFrame.Plain
ns.Raised = QtWidgets.QFrame.Raised
ns.Sunken = QtWidgets.QFrame.Sunken
ns.InstantPopup = QtWidgets.QToolButton.InstantPopup
ns.MenuButtonPopup = QtWidgets.QToolButton.MenuButtonPopup
ns.AlignTop = QtCore.Qt.AlignTop
ns.AlignBottom = QtCore.Qt.AlignBottom
ns.AlignLeft = QtCore.Qt.AlignLeft
ns.AlignRight = QtCore.Qt.AlignRight
ns.AlignHCenter = QtCore.Qt.AlignHCenter
ns.AlignVCenter = QtCore.Qt.AlignVCenter
ns.AlignCenter = QtCore.Qt.AlignCenter
ns.ItemIsEditable = QtCore.Qt.ItemIsEditable
ns.ItemIsUserCheckable = QtCore.Qt.ItemIsUserCheckable
ns.ItemIsUserTristate = QtCore.Qt.ItemIsUserTristate
ns.Checked = QtCore.Qt.Checked
ns.Unchecked = QtCore.Qt.Unchecked
ns.PartiallyChecked = QtCore.Qt.PartiallyChecked
ns.ReadOnly = QtCore.QFile.ReadOnly
ns.Text = QtCore.QFile.Text
ns.North = QtWidgets.QTabWidget.North
ns.West = QtWidgets.QTabWidget.West
ns.East = QtWidgets.QTabWidget.East
ns.South = QtWidgets.QTabWidget.South
ns.SP_DockWidgetCloseButton = QtWidgets.QStyle.SP_DockWidgetCloseButton
ns.LeftArrow = QtCore.Qt.LeftArrow
ns.RightArrow = QtCore.Qt.RightArrow
ns.UpArrow = QtCore.Qt.UpArrow
ns.DownArrow = QtCore.Qt.DownArrow
ns.Triangular = QtWidgets.QTabWidget.Triangular
ns.NoEcho = QtWidgets.QLineEdit.NoEcho
ns.Password = QtWidgets.QLineEdit.Password
ns.PasswordEchoOnEdit = QtWidgets.QLineEdit.PasswordEchoOnEdit
ns.SolidLine = QtCore.Qt.SolidLine
ns.DotLine = QtCore.Qt.DotLine
ns.FlatCap = QtCore.Qt.FlatCap
ns.SquareCap = QtCore.Qt.SquareCap
ns.RoundCap = QtCore.Qt.RoundCap
ns.MiterJoin = QtCore.Qt.MiterJoin
ns.BevelJoin = QtCore.Qt.BevelJoin
ns.RoundJoin = QtCore.Qt.RoundJoin
ns.SvgMiterJoin = QtCore.Qt.SvgMiterJoin
ns.State_HasFocus = QtWidgets.QStyle.State_HasFocus
ns.State_Selected = QtWidgets.QStyle.State_Selected
ns.Enter = QtCore.QEvent.Enter
ns.Leave = QtCore.QEvent.Leave
ns.HoverEnter = QtCore.QEvent.HoverEnter
ns.HoverMove = QtCore.QEvent.HoverMove
ns.HoverLeave = QtCore.QEvent.HoverLeave
ns.MouseButtonPress = QtCore.QEvent.MouseButtonPress
ns.MouseButtonRelease = QtCore.QEvent.MouseButtonRelease
ns.MouseMove = QtCore.QEvent.MouseMove
ns.WindowStateChange = QtCore.QEvent.WindowStateChange
ns.ActivationChange = QtCore.QEvent.ActivationChange
ns.WindowPalette = QtGui.QPalette.Window
ns.WindowTextPalette = QtGui.QPalette.WindowText
ns.LightPalette = QtGui.QPalette.Light
ns.DarkPalette = QtGui.QPalette.Dark
ns.PlaceholderText = QtGui.QPalette.PlaceholderText
ns.Link = QtGui.QPalette.Link
ns.LinkVisited = QtGui.QPalette.LinkVisited
ns.ToolTipBase = QtGui.QPalette.ToolTipBase
ns.ToolTipText = QtGui.QPalette.ToolTipText
ns.NoTicks = QtWidgets.QSlider.NoTicks
ns.TicksAbove = QtWidgets.QSlider.TicksAbove
ns.TicksBelow = QtWidgets.QSlider.TicksBelow
ns.TicksBothSides = QtWidgets.QSlider.TicksBothSides
ns.CC_Slider = QtWidgets.QStyle.CC_Slider
ns.SC_SliderHandle = QtWidgets.QStyle.SC_SliderHandle
ns.SC_SliderGroove = QtWidgets.QStyle.SC_SliderGroove
ns.SP_ArrowBack = QtWidgets.QStyle.SP_ArrowBack
ns.SP_ArrowDown = QtWidgets.QStyle.SP_ArrowDown
ns.SP_ArrowForward = QtWidgets.QStyle.SP_ArrowForward
ns.SP_ArrowLeft = QtWidgets.QStyle.SP_ArrowLeft
ns.SP_ArrowRight = QtWidgets.QStyle.SP_ArrowRight
ns.SP_ArrowUp = QtWidgets.QStyle.SP_ArrowUp
ns.SP_BrowserReload = QtWidgets.QStyle.SP_BrowserReload
ns.SP_BrowserStop = QtWidgets.QStyle.SP_BrowserStop
ns.SP_CommandLink = QtWidgets.QStyle.SP_CommandLink
ns.SP_ComputerIcon = QtWidgets.QStyle.SP_ComputerIcon
ns.SP_CustomBase = QtWidgets.QStyle.SP_CustomBase
ns.SP_DesktopIcon = QtWidgets.QStyle.SP_DesktopIcon
ns.SP_DialogApplyButton = QtWidgets.QStyle.SP_DialogApplyButton
ns.SP_DialogCancelButton = QtWidgets.QStyle.SP_DialogCancelButton
ns.SP_DialogCloseButton = QtWidgets.QStyle.SP_DialogCloseButton
ns.SP_DialogDiscardButton = QtWidgets.QStyle.SP_DialogDiscardButton
ns.SP_DialogHelpButton = QtWidgets.QStyle.SP_DialogHelpButton
ns.SP_DialogNoButton = QtWidgets.QStyle.SP_DialogNoButton
ns.SP_DialogOkButton = QtWidgets.QStyle.SP_DialogOkButton
ns.SP_DialogOpenButton = QtWidgets.QStyle.SP_DialogOpenButton
ns.SP_DialogResetButton = QtWidgets.QStyle.SP_DialogResetButton
ns.SP_DialogSaveButton = QtWidgets.QStyle.SP_DialogSaveButton
ns.SP_DialogYesButton = QtWidgets.QStyle.SP_DialogYesButton
ns.SP_DirClosedIcon = QtWidgets.QStyle.SP_DirClosedIcon
ns.SP_DirHomeIcon = QtWidgets.QStyle.SP_DirHomeIcon
ns.SP_DirIcon = QtWidgets.QStyle.SP_DirIcon
ns.SP_DirLinkIcon = QtWidgets.QStyle.SP_DirLinkIcon
ns.SP_DirLinkOpenIcon = QtWidgets.QStyle.SP_DirLinkOpenIcon
ns.SP_DirOpenIcon = QtWidgets.QStyle.SP_DirOpenIcon
ns.SP_DockWidgetCloseButton = QtWidgets.QStyle.SP_DockWidgetCloseButton
ns.SP_DriveCDIcon = QtWidgets.QStyle.SP_DriveCDIcon
ns.SP_DriveDVDIcon = QtWidgets.QStyle.SP_DriveDVDIcon
ns.SP_DriveFDIcon = QtWidgets.QStyle.SP_DriveFDIcon
ns.SP_DriveHDIcon = QtWidgets.QStyle.SP_DriveHDIcon
ns.SP_DriveNetIcon = QtWidgets.QStyle.SP_DriveNetIcon
ns.SP_FileDialogBack = QtWidgets.QStyle.SP_FileDialogBack
ns.SP_FileDialogContentsView = QtWidgets.QStyle.SP_FileDialogContentsView
ns.SP_FileDialogDetailedView = QtWidgets.QStyle.SP_FileDialogDetailedView
ns.SP_FileDialogEnd = QtWidgets.QStyle.SP_FileDialogEnd
ns.SP_FileDialogInfoView = QtWidgets.QStyle.SP_FileDialogInfoView
ns.SP_FileDialogListView = QtWidgets.QStyle.SP_FileDialogListView
ns.SP_FileDialogNewFolder = QtWidgets.QStyle.SP_FileDialogNewFolder
ns.SP_FileDialogStart = QtWidgets.QStyle.SP_FileDialogStart
ns.SP_FileDialogToParent = QtWidgets.QStyle.SP_FileDialogToParent
ns.SP_FileIcon = QtWidgets.QStyle.SP_FileIcon
ns.SP_FileLinkIcon = QtWidgets.QStyle.SP_FileLinkIcon
ns.SP_MediaPause = QtWidgets.QStyle.SP_MediaPause
ns.SP_MediaPlay = QtWidgets.QStyle.SP_MediaPlay
ns.SP_MediaSeekBackward = QtWidgets.QStyle.SP_MediaSeekBackward
ns.SP_MediaSeekForward = QtWidgets.QStyle.SP_MediaSeekForward
ns.SP_MediaSkipBackward = QtWidgets.QStyle.SP_MediaSkipBackward
ns.SP_MediaSkipForward = QtWidgets.QStyle.SP_MediaSkipForward
ns.SP_MediaStop = QtWidgets.QStyle.SP_MediaStop
ns.SP_MediaVolume = QtWidgets.QStyle.SP_MediaVolume
ns.SP_MediaVolumeMuted = QtWidgets.QStyle.SP_MediaVolumeMuted
ns.SP_LineEditClearButton = QtWidgets.QStyle.SP_LineEditClearButton
ns.SP_DialogYesToAllButton = QtWidgets.QStyle.SP_DialogYesToAllButton
ns.SP_DialogNoToAllButton = QtWidgets.QStyle.SP_DialogNoToAllButton
ns.SP_DialogSaveAllButton = QtWidgets.QStyle.SP_DialogSaveAllButton
ns.SP_DialogAbortButton = QtWidgets.QStyle.SP_DialogAbortButton
ns.SP_DialogRetryButton = QtWidgets.QStyle.SP_DialogRetryButton
ns.SP_DialogIgnoreButton = QtWidgets.QStyle.SP_DialogIgnoreButton
ns.SP_RestoreDefaultsButton = QtWidgets.QStyle.SP_RestoreDefaultsButton
ns.SP_MessageBoxCritical = QtWidgets.QStyle.SP_MessageBoxCritical
ns.SP_MessageBoxInformation = QtWidgets.QStyle.SP_MessageBoxInformation
ns.SP_MessageBoxQuestion = QtWidgets.QStyle.SP_MessageBoxQuestion
ns.SP_MessageBoxWarning = QtWidgets.QStyle.SP_MessageBoxWarning
ns.SP_TitleBarCloseButton = QtWidgets.QStyle.SP_TitleBarCloseButton
ns.SP_TitleBarContextHelpButton = QtWidgets.QStyle.SP_TitleBarContextHelpButton
ns.SP_TitleBarMaxButton = QtWidgets.QStyle.SP_TitleBarMaxButton
ns.SP_TitleBarMenuButton = QtWidgets.QStyle.SP_TitleBarMenuButton
ns.SP_TitleBarMinButton = QtWidgets.QStyle.SP_TitleBarMinButton
ns.SP_TitleBarNormalButton = QtWidgets.QStyle.SP_TitleBarNormalButton
ns.SP_TitleBarShadeButton = QtWidgets.QStyle.SP_TitleBarShadeButton
ns.SP_TitleBarUnshadeButton = QtWidgets.QStyle.SP_TitleBarUnshadeButton
ns.SP_ToolBarHorizontalExtensionButton = QtWidgets.QStyle.SP_ToolBarHorizontalExtensionButton
ns.SP_ToolBarVerticalExtensionButton = QtWidgets.QStyle.SP_ToolBarVerticalExtensionButton
ns.SP_TrashIcon = QtWidgets.QStyle.SP_TrashIcon
ns.SP_VistaShield = QtWidgets.QStyle.SP_VistaShield
ns.MessageOk = QtWidgets.QMessageBox.Ok
ns.MessageCancel = QtWidgets.QMessageBox.Cancel
ns.MessageClose = QtWidgets.QMessageBox.Close
ns.MessageOpen = QtWidgets.QMessageBox.Open
ns.MessageReset = QtWidgets.QMessageBox.Reset
ns.MessageSave = QtWidgets.QMessageBox.Save
ns.MessageSaveAll = QtWidgets.QMessageBox.SaveAll
ns.MessageRestoreDefaults = QtWidgets.QMessageBox.RestoreDefaults
ns.MessageYes = QtWidgets.QMessageBox.Yes
ns.MessageHelp = QtWidgets.QMessageBox.Help
ns.MessageNo = QtWidgets.QMessageBox.No
ns.MessageApply = QtWidgets.QMessageBox.Apply
ns.MessageDiscard = QtWidgets.QMessageBox.Discard
ns.MessageCritical = QtWidgets.QMessageBox.Critical
ns.MessageInformation = QtWidgets.QMessageBox.Information
ns.MessageNoIcon = QtWidgets.QMessageBox.NoIcon
ns.MessageQuestion = QtWidgets.QMessageBox.Question
ns.MessageWarning = QtWidgets.QMessageBox.Warning
ns.Shadow_Mask = QtWidgets.QFrame.Shadow_Mask
ns.Shape_Mask = QtWidgets.QFrame.Shape_Mask
ns.AnyFile = QtWidgets.QFileDialog.AnyFile
ns.ExistingFile = QtWidgets.QFileDialog.ExistingFile
ns.ExistingFiles = QtWidgets.QFileDialog.ExistingFiles
ns.Directory = QtWidgets.QFileDialog.Directory
ns.ColorShowAlphaChannel = QtWidgets.QColorDialog.ShowAlphaChannel
ns.ColorNoButtons = QtWidgets.QColorDialog.NoButtons
ns.ColorDontUseNativeDialog = QtWidgets.QColorDialog.DontUseNativeDialog
ns.LCDOutline = QtWidgets.QLCDNumber.Outline
ns.LCDFlat = QtWidgets.QLCDNumber.Flat
ns.NetworkIcon = QtWidgets.QFileIconProvider.Network
ns.FontNoButtons = QtWidgets.QFontDialog.NoButtons
ns.FontDontUseNativeDialog = QtWidgets.QFontDialog.DontUseNativeDialog
ns.ClassicStyle = QtWidgets.QWizard.ClassicStyle
ns.ModernStyle = QtWidgets.QWizard.ModernStyle
ns.MacStyle = QtWidgets.QWizard.MacStyle
ns.AeroStyle = QtWidgets.QWizard.AeroStyle
ns.PlainText = QtCore.Qt.PlainText
ns.RichText = QtCore.Qt.RichText
ns.AutoText = QtCore.Qt.AutoText
ns.MarkdownText = QtCore.Qt.MarkdownText
ns.KeepAspectRatio = QtCore.Qt.KeepAspectRatio
ns.ScrollBarAsNeeded = QtCore.Qt.ScrollBarAsNeeded
ns.ToolButtonIconOnly = QtCore.Qt.ToolButtonIconOnly
ns.ToolButtonTextOnly = QtCore.Qt.ToolButtonTextOnly
ns.ToolButtonTextBesideIcon = QtCore.Qt.ToolButtonTextBesideIcon
ns.ToolButtonTextUnderIcon = QtCore.Qt.ToolButtonTextUnderIcon
ns.ToolButtonFollowStyle = QtCore.Qt.ToolButtonFollowStyle
ns.FileDontUseNativeDialog = QtWidgets.QFileDialog.DontUseNativeDialog
ns.DialogYesRole = QtWidgets.QDialogButtonBox.YesRole
ns.DialogOk = QtWidgets.QDialogButtonBox.Ok
ns.DialogCancel = QtWidgets.QDialogButtonBox.Cancel
ns.HaveHelpButton = QtWidgets.QWizard.HaveHelpButton
ns.WatermarkPixmap = QtWidgets.QWizard.WatermarkPixmap
ns.LogoPixmap = QtWidgets.QWizard.LogoPixmap
ns.BannerPixmap = QtWidgets.QWizard.BannerPixmap
ns.BackgroundPixmap = QtWidgets.QWizard.BackgroundPixmap
ns.LeftDockWidgetArea = QtCore.Qt.LeftDockWidgetArea
ns.AllDockWidgetFeatures = QtWidgets.QDockWidget.AllDockWidgetFeatures
ns.DockWidgetVerticalTitleBar = QtWidgets.QDockWidget.DockWidgetVerticalTitleBar
ns.InputNoButtons = QtWidgets.QInputDialog.NoButtons
ns.TopToBottom = QtWidgets.QProgressBar.TopToBottom
ns.BottomToTop = QtWidgets.QProgressBar.BottomToTop
ns.Rounded = QtWidgets.QTabWidget.Rounded
ns.Triangular = QtWidgets.QTabWidget.Triangular
ns.LeftSide = QtWidgets.QTabBar.LeftSide
ns.RightSide = QtWidgets.QTabBar.RightSide
ns.UseListViewForComboBoxItems = QtWidgets.QInputDialog.UseListViewForComboBoxItems
ns.IntInput = QtWidgets.QInputDialog.IntInput
ns.DoubleInput = QtWidgets.QInputDialog.DoubleInput
ns.RubberBandLine = QtWidgets.QRubberBand.Line
ns.RubberBandRectangle = QtWidgets.QRubberBand.Rectangle
ns.TextSelectableByMouse = QtCore.Qt.TextSelectableByMouse
ns.TextEditorInteraction = QtCore.Qt.TextEditorInteraction
ns.TextBrowserInteraction = QtCore.Qt.TextBrowserInteraction
ns.Window = QtCore.Qt.Window
ns.Dialog = QtCore.Qt.Dialog
ns.SubWindow = QtCore.Qt.SubWindow
ns.WindowContextHelpButtonHint = QtCore.Qt.WindowContextHelpButtonHint
ns.WindowShadeButtonHint = QtCore.Qt.WindowShadeButtonHint
ns.BypassWindowManagerHint = QtCore.Qt.BypassWindowManagerHint
ns.X11BypassWindowManagerHint = QtCore.Qt.X11BypassWindowManagerHint
ns.FramelessWindowHint = QtCore.Qt.FramelessWindowHint
ns.WindowStaysOnTopHint = QtCore.Qt.WindowStaysOnTopHint
ns.WindowStaysOnBottomHint = QtCore.Qt.WindowStaysOnBottomHint
ns.WindowNoState = QtCore.Qt.WindowNoState
ns.WindowMinimized = QtCore.Qt.WindowMinimized
ns.WindowMaximized = QtCore.Qt.WindowMaximized
ns.WA_Hover = QtCore.Qt.WA_Hover
ns.WA_LayoutOnEntireRect = QtCore.Qt.WA_LayoutOnEntireRect
ns.WA_LayoutUsesWidgetRect = QtCore.Qt.WA_LayoutUsesWidgetRect
ns.ElideLeft = QtCore.Qt.ElideLeft
ns.ElideRight = QtCore.Qt.ElideRight
ns.ElideMiddle = QtCore.Qt.ElideMiddle
ns.ElideNone = QtCore.Qt.ElideNone
ns.CrossCursor = QtCore.Qt.CrossCursor
ns.SizeVerCursor = QtCore.Qt.SizeVerCursor
ns.SizeHorCursor = QtCore.Qt.SizeHorCursor
ns.SizeBDiagCursor = QtCore.Qt.SizeBDiagCursor
ns.SizeFDiagCursor = QtCore.Qt.SizeFDiagCursor
ns.SizeAllCursor = QtCore.Qt.SizeAllCursor
ns.WhatsThisCursor = QtCore.Qt.WhatsThisCursor
ns.LeftButton = QtCore.Qt.LeftButton
ns.RightButton = QtCore.Qt.RightButton
ns.NoModifier = QtCore.Qt.NoModifier
ns.SizeFixed = QtWidgets.QSizePolicy.Fixed
ns.SizeMinimum = QtWidgets.QSizePolicy.Minimum
ns.SizeMaximum = QtWidgets.QSizePolicy.Maximum
ns.SizePreferred = QtWidgets.QSizePolicy.Preferred
ns.SizeExpanding = QtWidgets.QSizePolicy.Expanding
ns.SizeMinimumExpanding = QtWidgets.QSizePolicy.MinimumExpanding
ns.SizeIgnored = QtWidgets.QSizePolicy.Ignored
ns.SetFixedSize = QtWidgets.QLayout.SetFixedSize
return ns
def get_colors(args, compat):
'''Create shared colors dependent on the stylesheet.'''
ns = argparse.Namespace()
ns.Background = compat.QtGui.QColor(255, 255, 0)
ns.Foreground = compat.QtGui.QColor(0, 255, 255)
ns.Selected = compat.QtGui.QColor(61, 174, 233)
ns.PlaceholderColor = compat.QtGui.QColor(255, 0, 0)
ns.TickColor = compat.QtGui.QColor(255, 0, 0)
ns.ToolTipBase = compat.QtGui.QColor(0, 255, 0)
ns.ToolTipText = compat.QtGui.QColor(0, 0, 255)
ns.MidTone = compat.QtGui.QColor(127, 127, 127)
ns.ViewBackground = compat.QtGui.QColor(0, 0, 0)
ns.TabBackground = compat.QtGui.QColor(0, 0, 0)
ns.HighLightDark = compat.QtGui.QColor(255, 0, 0)
if args.stylesheet.startswith('dark'):
ns.Background = compat.QtGui.QColor(49, 54, 59)
ns.Foreground = compat.QtGui.QColor(239, 240, 241)
ns.GrooveBackground = compat.QtGui.QColor(98, 101, 104)
ns.GrooveBorder = compat.QtGui.QColor(49, 54, 59)
ns.HandleBackground = compat.QtGui.QColor(29, 32, 35)
ns.HandleBorder = compat.QtGui.QColor(98, 101, 104)
ns.Notch = compat.QtGui.QColor(51, 78, 94)
ns.PlaceholderColor = compat.QtGui.QColor(118, 121, 124)
ns.TickColor = compat.QtGui.QColor(51, 78, 94)
ns.ToolTipBase = compat.QtGui.QColor(49, 54, 59)
ns.ToolTipText = compat.QtGui.QColor(239, 240, 241)
ns.MidTone = compat.QtGui.QColor(118, 121, 124)
ns.ViewBackground = compat.QtGui.QColor(29, 32, 35)
ns.TabBackground = compat.QtGui.QColor(44, 48, 52)
ns.HighLightDark = compat.QtGui.QColor(42, 121, 163)
ns.LinkColor = compat.QtGui.QColor(88, 166, 255)
ns.LinkVisitedColor = compat.QtGui.QColor(255, 88, 250)
elif args.stylesheet.startswith('light'):
ns.Background = compat.QtGui.QColor(239, 240, 241)
ns.Foreground = compat.QtGui.QColor(49, 54, 59)
ns.GrooveBackground = compat.QtGui.QColor(106, 105, 105, 179)
ns.GrooveBorder = compat.QtGui.QColor(239, 240, 241)
ns.HandleBackground = compat.QtGui.QColor(239, 240, 241)
ns.HandleBorder = compat.QtGui.QColor(106, 105, 105, 179)
ns.Notch = compat.QtGui.QColor(61, 173, 232, 51)
ns.PlaceholderColor = compat.QtGui.QColor(186, 185, 184)
ns.TickColor = compat.QtGui.QColor(61, 173, 232, 51)
ns.ToolTipBase = compat.QtGui.QColor(49, 54, 59)
ns.ToolTipText = compat.QtGui.QColor(239, 240, 241)
ns.MidTone = compat.QtGui.QColor(186, 185, 184)
ns.ViewBackground = compat.QtGui.QColor(239, 240, 241)
ns.TabBackground = compat.QtGui.QColor(217, 216, 215)
ns.HighLightDark = compat.QtGui.QColor(45, 147, 200, 127)
ns.LinkColor = compat.QtGui.QColor(70, 132, 204)
ns.LinkVisitedColor = compat.QtGui.QColor(204, 70, 200)
return ns
def get_icon_map(compat):
'''Create a map of standard icons to resource paths.'''
icon_map = {
compat.SP_TitleBarMinButton: 'minimize.svg',
compat.SP_TitleBarMenuButton: 'menu.svg',
compat.SP_TitleBarMaxButton: 'maximize.svg',
compat.SP_TitleBarCloseButton: 'window_close.svg',
compat.SP_TitleBarNormalButton: 'restore.svg',
compat.SP_TitleBarShadeButton: 'shade.svg',
compat.SP_TitleBarUnshadeButton: 'unshade.svg',
compat.SP_TitleBarContextHelpButton: 'help.svg',
compat.SP_MessageBoxInformation: 'message_information.svg',
compat.SP_MessageBoxWarning: 'message_warning.svg',
compat.SP_MessageBoxCritical: 'message_critical.svg',
compat.SP_MessageBoxQuestion: 'message_question.svg',
compat.SP_DesktopIcon: 'desktop.svg',
compat.SP_TrashIcon: 'trash.svg',
compat.SP_ComputerIcon: 'computer.svg',
compat.SP_DriveFDIcon: 'floppy_drive.svg',
compat.SP_DriveHDIcon: 'hard_drive.svg',
compat.SP_DriveCDIcon: 'disc_drive.svg',
compat.SP_DriveDVDIcon: 'disc_drive.svg',
compat.SP_DriveNetIcon: 'network_drive.svg',
compat.SP_DirHomeIcon: 'home_directory.svg',
compat.SP_DirOpenIcon: 'folder_open.svg',
compat.SP_DirClosedIcon: 'folder.svg',
compat.SP_DirIcon: 'folder.svg',
compat.SP_DirLinkIcon: 'folder_link.svg',
compat.SP_DirLinkOpenIcon: 'folder_open_link.svg',
compat.SP_FileIcon: 'file.svg',
compat.SP_FileLinkIcon: 'file_link.svg',
compat.SP_FileDialogStart: 'file_dialog_start.svg',
compat.SP_FileDialogEnd: 'file_dialog_end.svg',
compat.SP_FileDialogToParent: 'up_arrow.svg',
compat.SP_FileDialogNewFolder: 'folder.svg',
compat.SP_FileDialogDetailedView: 'file_dialog_detailed.svg',
compat.SP_FileDialogInfoView: 'file_dialog_info.svg',
compat.SP_FileDialogContentsView: 'file_dialog_contents.svg',
compat.SP_FileDialogListView: 'file_dialog_list.svg',
compat.SP_FileDialogBack: 'left_arrow.svg',
compat.SP_DockWidgetCloseButton: 'close.svg',
compat.SP_ToolBarHorizontalExtensionButton: 'horizontal_extension.svg',
compat.SP_ToolBarVerticalExtensionButton: 'vertical_extension.svg',
compat.SP_DialogOkButton: 'dialog_ok.svg',
compat.SP_DialogCancelButton: 'dialog_cancel.svg',
compat.SP_DialogHelpButton: 'dialog_help.svg',
compat.SP_DialogOpenButton: 'dialog_open.svg',
compat.SP_DialogSaveButton: 'dialog_save.svg',
compat.SP_DialogCloseButton: 'dialog_close.svg',
compat.SP_DialogApplyButton: 'dialog_apply.svg',
compat.SP_DialogResetButton: 'dialog_reset.svg',
compat.SP_DialogDiscardButton: 'dialog_discard.svg',
compat.SP_DialogYesButton: 'dialog_apply.svg',
compat.SP_DialogNoButton: 'dialog_no.svg',
compat.SP_ArrowUp: 'up_arrow.svg',
compat.SP_ArrowDown: 'down_arrow.svg',
compat.SP_ArrowLeft: 'left_arrow.svg',
compat.SP_ArrowRight: 'right_arrow.svg',
compat.SP_ArrowBack: 'left_arrow.svg',
compat.SP_ArrowForward: 'right_arrow.svg',
compat.SP_CommandLink: 'right_arrow.svg',
compat.SP_VistaShield: 'vista_shield.svg',
compat.SP_BrowserReload: 'browser_refresh.svg',
compat.SP_BrowserStop: 'browser_refresh_stop.svg',
compat.SP_MediaPlay: 'play.svg',
compat.SP_MediaStop: 'stop.svg',
compat.SP_MediaPause: 'pause.svg',
compat.SP_MediaSkipForward: 'skip_backward.svg',
compat.SP_MediaSkipBackward: 'skip_forward.svg',
compat.SP_MediaSeekForward: 'seek_forward.svg',
compat.SP_MediaSeekBackward: 'seek_backward.svg',
compat.SP_MediaVolume: 'volume.svg',
compat.SP_MediaVolumeMuted: 'volume_muted.svg',
compat.SP_LineEditClearButton: 'clear_text.svg',
compat.SP_DialogYesToAllButton: 'dialog_yes_to_all.svg',
compat.SP_DialogNoToAllButton: 'dialog_no.svg',
compat.SP_DialogSaveAllButton: 'dialog_save_all.svg',
compat.SP_DialogAbortButton: 'dialog_cancel.svg',
compat.SP_DialogRetryButton: 'dialog_retry.svg',
compat.SP_DialogIgnoreButton: 'dialog_ignore.svg',
compat.SP_RestoreDefaultsButton: 'restore_defaults.svg',
}
if compat.QT_VERSION > (6, 3, 0):
icon_map[compat.SP_TabCloseButton] = 'tab_close.svg'
return icon_map
def setup_app(args, unknown, compat, style_class=None, window_class=None):
'''Setup code for the Qt application.'''
if args.scale != 1:
os.environ['QT_SCALE_FACTOR'] = str(args.scale)
else:
os.environ['QT_AUTO_SCREEN_SCALE_FACTOR'] = '1'
app = compat.QtWidgets.QApplication.instance()
is_initial = app is None
if app is None:
app = compat.QtWidgets.QApplication(sys.argv[:1] + unknown)
# NOTE: Need to detect if the style is dark mode here
_ = get_theme(compat)
if args.style != 'native':
style = compat.QtWidgets.QStyleFactory.create(args.style)
if style_class is not None:
style = style_class(style)
app.setStyle(style)
if window_class is None:
window_class = compat.QtWidgets.QMainWindow
window = window_class()
# only need to override the font on the first run
if not is_initial:
# use the default font size
font = app.font()
if args.font_size > 0:
font.setPointSizeF(args.font_size)
if args.font_family:
font.setFamily(args.font_family)
app.setFont(font)
return app, window
def get_theme(compat, reinitialize=False):
'''Determine if the system theme is in dark mode.'''
global THEME
if THEME is not None and not reinitialize:
return THEME
app = compat.QtWidgets.QApplication.instance()
if app is None:
raise RuntimeError('Must initialize the global application prior to getting dark mode.')
if compat.QT_VERSION >= (6, 5, 0):
color_scheme = app.styleHints().colorScheme()
theme_cls = color_scheme.__class__
if color_scheme == theme_cls.Unknown: