Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

303 lines
11KB

  1. #!/usr/bin/env python3
  2. # SPDX-FileCopyrightText: 2011-2024 Filipe Coelho <falktx@falktx.com>
  3. # SPDX-License-Identifier: GPL-2.0-or-later
  4. from qt_config import qt as qt_config
  5. if qt_config == 5:
  6. from PyQt5.QtCore import Qt
  7. Qt.CheckState = int
  8. Qt.MiddleButton = Qt.MidButton
  9. elif qt_config == 6:
  10. from PyQt6.QtCore import Qt, QEvent, QEventLoop
  11. from PyQt6.QtGui import QFont, QPainter, QPalette
  12. from PyQt6.QtWidgets import (
  13. QAbstractItemView,
  14. QAbstractSpinBox,
  15. QApplication,
  16. QColorDialog,
  17. QDialog,
  18. QDialogButtonBox,
  19. QFileDialog,
  20. QFrame,
  21. QGraphicsItem,
  22. QGraphicsScene,
  23. QGraphicsView,
  24. QHeaderView,
  25. QLineEdit,
  26. QListWidgetItem,
  27. QMenu,
  28. QMessageBox,
  29. QSizePolicy,
  30. QStyle,
  31. )
  32. Qt.AlignCenter = Qt.AlignmentFlag.AlignCenter
  33. Qt.AlignLeft = Qt.AlignmentFlag.AlignLeft
  34. Qt.AA_DontShowIconsInMenus = Qt.ApplicationAttribute.AA_DontShowIconsInMenus
  35. Qt.DownArrow = Qt.ArrowType.DownArrow
  36. Qt.RightArrow = Qt.ArrowType.RightArrow
  37. Qt.IgnoreAspectRatio = Qt.AspectRatioMode.IgnoreAspectRatio
  38. Qt.KeepAspectRatio = Qt.AspectRatioMode.KeepAspectRatio
  39. Qt.NoBrush = Qt.BrushStyle.NoBrush
  40. Qt.ToolButtonTextBesideIcon = Qt.ToolButtonStyle.ToolButtonTextBesideIcon
  41. Qt.Checked = Qt.CheckState.Checked
  42. Qt.Unchecked = Qt.CheckState.Unchecked
  43. Qt.CustomContextMenu = Qt.ContextMenuPolicy.CustomContextMenu
  44. Qt.NoContextMenu = Qt.ContextMenuPolicy.NoContextMenu
  45. Qt.ArrowCursor = Qt.CursorShape.ArrowCursor
  46. Qt.ClosedHandCursor = Qt.CursorShape.ClosedHandCursor
  47. Qt.CrossCursor = Qt.CursorShape.CrossCursor
  48. Qt.OpenHandCursor = Qt.CursorShape.OpenHandCursor
  49. Qt.PointingHandCursor = Qt.CursorShape.PointingHandCursor
  50. Qt.SizeAllCursor = Qt.CursorShape.SizeAllCursor
  51. Qt.SizeHorCursor = Qt.CursorShape.SizeHorCursor
  52. Qt.black = Qt.GlobalColor.black
  53. Qt.blue = Qt.GlobalColor.blue
  54. Qt.cyan = Qt.GlobalColor.cyan
  55. Qt.darkGray = Qt.GlobalColor.darkGray
  56. Qt.red = Qt.GlobalColor.red
  57. Qt.transparent = Qt.GlobalColor.transparent
  58. Qt.white = Qt.GlobalColor.white
  59. Qt.yellow = Qt.GlobalColor.yellow
  60. Qt.Key_0 = Qt.Key.Key_0
  61. Qt.Key_1 = Qt.Key.Key_1
  62. Qt.Key_2 = Qt.Key.Key_2
  63. Qt.Key_3 = Qt.Key.Key_3
  64. Qt.Key_5 = Qt.Key.Key_5
  65. Qt.Key_6 = Qt.Key.Key_6
  66. Qt.Key_7 = Qt.Key.Key_7
  67. Qt.Key_9 = Qt.Key.Key_9
  68. Qt.Key_A = Qt.Key.Key_A
  69. Qt.Key_Agrave = Qt.Key.Key_Agrave
  70. Qt.Key_B = Qt.Key.Key_B
  71. Qt.Key_C = Qt.Key.Key_C
  72. Qt.Key_Ccedilla = Qt.Key.Key_Ccedilla
  73. Qt.Key_Comma = Qt.Key.Key_Comma
  74. Qt.Key_D = Qt.Key.Key_D
  75. Qt.Key_Delete = Qt.Key.Key_Delete
  76. Qt.Key_E = Qt.Key.Key_E
  77. Qt.Key_Eacute = Qt.Key.Key_Eacute
  78. Qt.Key_Egrave = Qt.Key.Key_Egrave
  79. Qt.Key_End = Qt.Key.Key_End
  80. Qt.Key_Enter = Qt.Key.Key_Enter
  81. Qt.Key_Escape = Qt.Key.Key_Escape
  82. Qt.Key_F = Qt.Key.Key_F
  83. Qt.Key_G = Qt.Key.Key_G
  84. Qt.Key_H = Qt.Key.Key_H
  85. Qt.Key_Home = Qt.Key.Key_Home
  86. Qt.Key_I = Qt.Key.Key_I
  87. Qt.Key_J = Qt.Key.Key_J
  88. Qt.Key_M = Qt.Key.Key_M
  89. Qt.Key_Minus = Qt.Key.Key_Minus
  90. Qt.Key_N = Qt.Key.Key_N
  91. Qt.Key_O = Qt.Key.Key_O
  92. Qt.Key_P = Qt.Key.Key_P
  93. Qt.Key_PageDown = Qt.Key.Key_PageDown
  94. Qt.Key_PageUp = Qt.Key.Key_PageUp
  95. Qt.Key_ParenLeft = Qt.Key.Key_ParenLeft
  96. Qt.Key_Plus = Qt.Key.Key_Plus
  97. Qt.Key_Q = Qt.Key.Key_Q
  98. Qt.Key_QuoteDbl = Qt.Key.Key_QuoteDbl
  99. Qt.Key_R = Qt.Key.Key_R
  100. Qt.Key_Return = Qt.Key.Key_Return
  101. Qt.Key_S = Qt.Key.Key_S
  102. Qt.Key_Space = Qt.Key.Key_Space
  103. Qt.Key_T = Qt.Key.Key_T
  104. Qt.Key_U = Qt.Key.Key_U
  105. Qt.Key_V = Qt.Key.Key_V
  106. Qt.Key_W = Qt.Key.Key_W
  107. Qt.Key_X = Qt.Key.Key_X
  108. Qt.Key_Y = Qt.Key.Key_Y
  109. Qt.Key_Z = Qt.Key.Key_Z
  110. Qt.AltModifier = Qt.KeyboardModifier.AltModifier
  111. Qt.ControlModifier = Qt.KeyboardModifier.ControlModifier
  112. Qt.MetaModifier = Qt.KeyboardModifier.MetaModifier
  113. Qt.NoModifier = Qt.KeyboardModifier.NoModifier
  114. Qt.ShiftModifier = Qt.KeyboardModifier.ShiftModifier
  115. Qt.UserRole = Qt.ItemDataRole.UserRole
  116. Qt.ItemIsDragEnabled = Qt.ItemFlag.ItemIsDragEnabled
  117. Qt.ItemIsEnabled = Qt.ItemFlag.ItemIsEnabled
  118. Qt.ItemIsSelectable = Qt.ItemFlag.ItemIsSelectable
  119. Qt.ContainsItemShape = Qt.ItemSelectionMode.ContainsItemShape
  120. Qt.LeftButton = Qt.MouseButton.LeftButton
  121. Qt.MiddleButton = Qt.MouseButton.MiddleButton
  122. Qt.RightButton = Qt.MouseButton.RightButton
  123. Qt.MouseEventSynthesizedByApplication = Qt.MouseEventSource.MouseEventSynthesizedByApplication
  124. Qt.Horizontal = Qt.Orientation.Horizontal
  125. Qt.FlatCap = Qt.PenCapStyle.FlatCap
  126. Qt.RoundCap = Qt.PenCapStyle.RoundCap
  127. Qt.MiterJoin = Qt.PenJoinStyle.MiterJoin
  128. Qt.RoundJoin = Qt.PenJoinStyle.RoundJoin
  129. Qt.DashLine = Qt.PenStyle.DashLine
  130. Qt.NoPen = Qt.PenStyle.NoPen
  131. Qt.SolidLine = Qt.PenStyle.SolidLine
  132. Qt.ScrollBarAlwaysOn = Qt.ScrollBarPolicy.ScrollBarAlwaysOn
  133. Qt.ScrollBarAlwaysOff = Qt.ScrollBarPolicy.ScrollBarAlwaysOff
  134. Qt.AscendingOrder = Qt.SortOrder.AscendingOrder
  135. Qt.TextSelectableByMouse = Qt.TextInteractionFlag.TextSelectableByMouse
  136. Qt.ToolButtonIconOnly = Qt.ToolButtonStyle.ToolButtonIconOnly
  137. Qt.ToolButtonTextBesideIcon = Qt.ToolButtonStyle.ToolButtonTextBesideIcon
  138. Qt.SmoothTransformation = Qt.TransformationMode.SmoothTransformation
  139. Qt.WA_OpaquePaintEvent = Qt.WidgetAttribute.WA_OpaquePaintEvent
  140. Qt.WindowModal = Qt.WindowModality.WindowModal
  141. Qt.WindowActive = Qt.WindowState.WindowActive
  142. Qt.WindowMinimized = Qt.WindowState.WindowMinimized
  143. Qt.MSWindowsFixedSizeDialogHint = Qt.WindowType.MSWindowsFixedSizeDialogHint
  144. Qt.WindowContextHelpButtonHint = Qt.WindowType.WindowContextHelpButtonHint
  145. QAbstractItemView.DropOnly = QAbstractItemView.DragDropMode.DropOnly
  146. QAbstractItemView.SingleSelection = QAbstractItemView.SelectionMode.SingleSelection
  147. QAbstractSpinBox.NoButtons = QAbstractSpinBox.ButtonSymbols.NoButtons
  148. QAbstractSpinBox.UpDownArrows = QAbstractSpinBox.ButtonSymbols.UpDownArrows
  149. QAbstractSpinBox.StepNone = QAbstractSpinBox.StepEnabledFlag.StepNone
  150. QAbstractSpinBox.StepDownEnabled = QAbstractSpinBox.StepEnabledFlag.StepDownEnabled
  151. QAbstractSpinBox.StepUpEnabled = QAbstractSpinBox.StepEnabledFlag.StepUpEnabled
  152. QApplication.exec_ = lambda a: a.exec()
  153. QColorDialog.DontUseNativeDialog = QColorDialog.ColorDialogOption.DontUseNativeDialog
  154. QDialog.exec_ = lambda d: d.exec()
  155. QDialogButtonBox.Ok = QDialogButtonBox.StandardButton.Ok
  156. QDialogButtonBox.Reset = QDialogButtonBox.StandardButton.Reset
  157. QEvent.EnabledChange = QEvent.Type.EnabledChange
  158. QEvent.MouseButtonPress = QEvent.Type.MouseButtonPress
  159. QEvent.PaletteChange = QEvent.Type.PaletteChange
  160. QEvent.StyleChange = QEvent.Type.StyleChange
  161. QEvent.User = QEvent.Type.User
  162. QEventLoop.ExcludeUserInputEvents = QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents
  163. QFileDialog.AcceptSave = QFileDialog.AcceptMode.AcceptSave
  164. QFileDialog.AnyFile = QFileDialog.FileMode.AnyFile
  165. QFileDialog.DontUseCustomDirectoryIcons = QFileDialog.Option.DontUseCustomDirectoryIcons
  166. QFileDialog.ShowDirsOnly = QFileDialog.Option.ShowDirsOnly
  167. QFont.AllUppercase = QFont.Capitalization.AllUppercase
  168. QFont.Bold = QFont.Weight.Bold
  169. QFont.Normal = QFont.Weight.Normal
  170. QFrame.HLine = QFrame.Shape.HLine
  171. QFrame.StyledPanel = QFrame.Shape.StyledPanel
  172. QFrame.Raised = QFrame.Shadow.Raised
  173. QFrame.Sunken = QFrame.Shadow.Sunken
  174. QGraphicsItem.ItemSelectedHasChanged = QGraphicsItem.GraphicsItemChange.ItemSelectedHasChanged
  175. QGraphicsItem.ItemIsFocusable = QGraphicsItem.GraphicsItemFlag.ItemIsFocusable
  176. QGraphicsItem.ItemIsMovable = QGraphicsItem.GraphicsItemFlag.ItemIsMovable
  177. QGraphicsItem.ItemIsSelectable = QGraphicsItem.GraphicsItemFlag.ItemIsSelectable
  178. QGraphicsItem.ItemSendsGeometryChanges = QGraphicsItem.GraphicsItemFlag.ItemSendsGeometryChanges
  179. QGraphicsScene.NoIndex = QGraphicsScene.ItemIndexMethod.NoIndex
  180. QGraphicsView.NoDrag = QGraphicsView.DragMode.NoDrag
  181. QGraphicsView.ScrollHandDrag = QGraphicsView.DragMode.ScrollHandDrag
  182. QGraphicsView.FullViewportUpdate = QGraphicsView.ViewportUpdateMode.FullViewportUpdate
  183. QGraphicsView.MinimalViewportUpdate = QGraphicsView.ViewportUpdateMode.MinimalViewportUpdate
  184. QHeaderView.Fixed = QHeaderView.ResizeMode.Fixed
  185. QHeaderView.ResizeToContents = QHeaderView.ResizeMode.ResizeToContents
  186. QLineEdit.Normal = QLineEdit.EchoMode.Normal
  187. QListWidgetItem.UserType = QListWidgetItem.ItemType.UserType
  188. QMenu.exec_ = lambda m, p: m.exec(p)
  189. QMessageBox.exec_ = lambda mb: mb.exec()
  190. QMessageBox.Cancel = QMessageBox.StandardButton.Cancel
  191. QMessageBox.No = QMessageBox.StandardButton.No
  192. QMessageBox.Ok = QMessageBox.StandardButton.Ok
  193. QMessageBox.Yes = QMessageBox.StandardButton.Yes
  194. QMessageBox.Critical = QMessageBox.Icon.Critical
  195. QMessageBox.Information = QMessageBox.Icon.Information
  196. QMessageBox.Warning = QMessageBox.Icon.Warning
  197. QPainter.CompositionMode_Difference = QPainter.CompositionMode.CompositionMode_Difference
  198. QPainter.CompositionMode_Multiply = QPainter.CompositionMode.CompositionMode_Multiply
  199. QPainter.CompositionMode_Plus = QPainter.CompositionMode.CompositionMode_Plus
  200. QPainter.CompositionMode_SourceOver = QPainter.CompositionMode.CompositionMode_SourceOver
  201. QPainter.HighQualityAntialiasing = None
  202. QPainter.Antialiasing = QPainter.RenderHint.Antialiasing
  203. QPainter.SmoothPixmapTransform = QPainter.RenderHint.SmoothPixmapTransform
  204. QPainter.TextAntialiasing = QPainter.RenderHint.TextAntialiasing
  205. QPalette.Active = QPalette.ColorGroup.Active
  206. QPalette.Disabled = QPalette.ColorGroup.Disabled
  207. QPalette.Inactive = QPalette.ColorGroup.Inactive
  208. QPalette.AlternateBase = QPalette.ColorRole.AlternateBase
  209. QPalette.Base = QPalette.ColorRole.Base
  210. QPalette.BrightText = QPalette.ColorRole.BrightText
  211. QPalette.Button = QPalette.ColorRole.Button
  212. QPalette.ButtonText = QPalette.ColorRole.ButtonText
  213. QPalette.Dark = QPalette.ColorRole.Dark
  214. QPalette.Highlight = QPalette.ColorRole.Highlight
  215. QPalette.HighlightedText = QPalette.ColorRole.HighlightedText
  216. QPalette.Light = QPalette.ColorRole.Light
  217. QPalette.Link = QPalette.ColorRole.Link
  218. QPalette.LinkVisited = QPalette.ColorRole.LinkVisited
  219. QPalette.Mid = QPalette.ColorRole.Mid
  220. QPalette.Midlight = QPalette.ColorRole.Midlight
  221. QPalette.Shadow = QPalette.ColorRole.Shadow
  222. QPalette.Text = QPalette.ColorRole.Text
  223. QPalette.ToolTipBase = QPalette.ColorRole.ToolTipBase
  224. QPalette.ToolTipText = QPalette.ColorRole.ToolTipText
  225. QPalette.Window = QPalette.ColorRole.Window
  226. QPalette.WindowText = QPalette.ColorRole.WindowText
  227. # TODO remove this QPalette.Background is deprecated already in Qt5
  228. QPalette.Background = QPalette.Window
  229. QSizePolicy.Expanding = QSizePolicy.Policy.Expanding
  230. QSizePolicy.Preferred = QSizePolicy.Policy.Preferred
  231. QStyle.State_Selected = QStyle.StateFlag.State_Selected