From 58eaf9ede58b35807272af72a428bdec7f9b3195 Mon Sep 17 00:00:00 2001 From: Ryan Stapleton Date: Sun, 30 Oct 2022 14:46:33 -0400 Subject: [PATCH] Updated to use QT6 --- arcade/glui/font.py | 2 +- arcade/glui/imageloader.py | 4 +- arcade/glui/texture.py | 4 +- arcade/ui/arcade_window.py | 12 +- arcade/ui/event.py | 888 ++++++++++++++++---------------- arcade/ui/gl_widget.py | 6 +- docs/compiling.md | 10 +- fsbuild/fix-pyqt5.py | 4 +- fsgamesys/drivers/gamedriver.py | 21 +- fsgamesys/ui/gamecenterview.py | 2 +- fsgamesys/ui/qwindow.py | 2 +- fsui/common/group.py | 2 +- fsui/qt/__init__.py | 3 - fsui/qt/callafter.py | 2 +- fsui/qt/choice.py | 4 +- fsui/qt/core.py | 6 +- fsui/qt/dialog.py | 16 +- fsui/qt/drawingcontext.py | 12 +- fsui/qt/font.py | 11 +- fsui/qt/gui.py | 2 +- fsui/qt/image.py | 12 +- fsui/qt/label.py | 15 +- fsui/qt/listview.py | 4 +- fsui/qt/menu.py | 2 +- fsui/qt/old_window.py | 5 +- fsui/qt/panel.py | 8 +- fsui/qt/{pyqt5.py => pyqt6.py} | 20 +- fsui/qt/pyside2.py | 4 +- fsui/qt/qt.py | 47 +- fsui/qt/scrollarea.py | 8 +- fsui/qt/textarea.py | 6 +- fsui/qt/toplevelwidget.py | 26 +- fsui/qt/util.py | 8 +- fsui/qt/verticalitemview.py | 14 +- fsui/qt/widgets.py | 4 +- fsui/qt/window.py | 28 +- fswidgets/splitter.py | 5 +- fswidgets/widget.py | 25 +- launcher/apps/fs_game_center.py | 8 +- launcher/apps/launcher2.py | 4 +- launcher/ui/skin.py | 6 +- pyproject.toml | 2 +- system/classes/theme.py | 20 +- system/exceptionhandler.py | 2 +- system/prefs/appearance.py | 6 +- system/utilities/clock.py | 20 +- workspace/shell/window.py | 4 +- workspace/ui/window.py | 6 +- 48 files changed, 674 insertions(+), 658 deletions(-) rename fsui/qt/{pyqt5.py => pyqt6.py} (85%) diff --git a/arcade/glui/font.py b/arcade/glui/font.py index 95baa863..39acde48 100644 --- a/arcade/glui/font.py +++ b/arcade/glui/font.py @@ -74,7 +74,7 @@ def render(self, text, _, color): im = QImage( rect.x() + rect.width(), rect.height(), - QImage.Format_ARGB32_Premultiplied, + QImage.Format.Format_ARGB32_Premultiplied, ) im.fill(QColor(0, 0, 0, 0)) painter = QPainter() diff --git a/arcade/glui/imageloader.py b/arcade/glui/imageloader.py index 0b9ce574..e8a35d9b 100644 --- a/arcade/glui/imageloader.py +++ b/arcade/glui/imageloader.py @@ -94,8 +94,8 @@ def load_image(relative_path: str): if not os.path.exists(path): return None, (0, 0) im = QImage(path) - if im.format() != QImage.Format_ARGB32: - im = im.convertToFormat(QImage.Format_ARGB32) + if im.format() != QImage.Format.Format_ARGB32: + im = im.convertToFormat(QImage.Format.Format_ARGB32) bits = im.bits() try: pixels = bits.tobytes() diff --git a/arcade/glui/texture.py b/arcade/glui/texture.py index e2870d54..69084d06 100644 --- a/arcade/glui/texture.py +++ b/arcade/glui/texture.py @@ -158,8 +158,8 @@ def load( internal_format = gl.GL_RGBA texture_format = gl.GL_BGRA - if im.format() != QImage.Format_ARGB32_Premultiplied: - im = im.convertToFormat(QImage.Format_ARGB32_Premultiplied) + if im.format() != QImage.Format.Format_ARGB32_Premultiplied: + im = im.convertToFormat(QImage.Format.Format_ARGB32_Premultiplied) bits = im.bits() try: diff --git a/arcade/ui/arcade_window.py b/arcade/ui/arcade_window.py index 16e91a63..46ef89a0 100644 --- a/arcade/ui/arcade_window.py +++ b/arcade/ui/arcade_window.py @@ -180,7 +180,7 @@ def __init__(self, callbacks, interval, window): self.interval = interval self.quit_flag = False self.first_time = None - # self.setCursor(Qt.BlankCursor) + # self.setCursor(Qt.CursorShape.BlankCursor) self._window = weakref.ref(window) self.set_blank_cursor() self.show_cursor_until = None @@ -190,9 +190,9 @@ def __init__(self, callbacks, interval, window): def set_blank_cursor(self, blank=True): if blank: - cursor = Qt.BlankCursor + cursor = Qt.CursorShape.BlankCursor else: - cursor = Qt.ArrowCursor + cursor = Qt.CursorShape.ArrowCursor self.setCursor(cursor) if self.gl_widget is not None: self.gl_widget.setCursor(cursor) @@ -224,7 +224,7 @@ def create_gl_window_2(self): self.gl_widget = GLWidget(self, self.callbacks) self.gl_widget.setMouseTracking(True) # if "--show-cursor" not in sys.argv: - # self.gl_widget.setCursor(Qt.BlankCursor) + # self.gl_widget.setCursor(Qt.CursorShape.BlankCursor) self.set_blank_cursor() self.gl_widget.setGeometry( 0, 0, self.size().width(), self.size().height() @@ -309,10 +309,10 @@ def modifier(): if event.isAutoRepeat(): return if modifier(): - if event.key() == Qt.Key_Return: + if event.key() == Qt.Key.Key_Return: self.window().set_fullscreen(not self.window().is_fullscreen()) return - if event.key() == Qt.Key_Q: + if event.key() == Qt.Key.Key_Q: self.window().close() return diff --git a/arcade/ui/event.py b/arcade/ui/event.py index 12e58b4d..d0d46fd7 100644 --- a/arcade/ui/event.py +++ b/arcade/ui/event.py @@ -34,7 +34,7 @@ def create_key_event(cls, ev): else: raise Exception("Unexpected event type in create_key_event") # key_map = get_key_map() - # print(ev.key(), "vs", Qt.Key_Shift) + # print(ev.key(), "vs", Qt.Key.Key_Shift) # event.key.keysym.sym = key_map.get(ev.key(), 0) # event["key"] = key_map.get(ev.key(), 0) event["key"] = get_key(ev) @@ -73,18 +73,18 @@ def get_key(ev): print("Qt key:", ev.key(), int(ev.modifiers()), Qt.KeypadModifier) if System.macos: # FIXME: TODO: CHECK - # if ev.key() == Qt.Key_Meta: + # if ev.key() == Qt.Key.Key_AMeta: # print("Control key, native virtual code:", ev.nativeVirtualCode()) - # elif ev.key() == Qt.Key_Shift: + # elif ev.key() == Qt.Key.Key_Shift: pass else: - if ev.key() == Qt.Key_Control: + if ev.key() == Qt.Key.Key_Control: print("Control key, native scan code:", ev.nativeScanCode()) if ev.nativeScanCode() == 105: # Linux return sdl2.SDLK_RCTRL # FIXME: TODO: WINDOWS return sdl2.SDLK_LCTRL - elif ev.key() == Qt.Key_Shift: + elif ev.key() == Qt.Key.Key_Shift: print("Shift key, native scan code:", ev.nativeScanCode()) if ev.nativeScanCode() == 62: # Linux return sdl2.SDLK_RSHIFT @@ -94,26 +94,26 @@ def get_key(ev): # key is pressed as the arrow keys are considered part of the keypad. # http://doc.qt.io/qt-5/qt.html#KeyboardModifier-enum macos_arrow_key = System.macos and ev.key() in [ - Qt.Key_Left, - Qt.Key_Right, - Qt.Key_Up, - Qt.Key_Down, + Qt.Key.Key_Left, + Qt.Key.Key_Right, + Qt.Key.Key_Up, + Qt.Key.Key_Down, ] if int(ev.modifiers()) & Qt.KeypadModifier and not macos_arrow_key: print("keypad!") - print(ev.key(), "vs", Qt.Key_4) + print(ev.key(), "vs", Qt.Key.Key_4) return { - Qt.Key_Insert: sdl2.SDLK_KP_0, - Qt.Key_End: sdl2.SDLK_KP_1, - Qt.Key_Down: sdl2.SDLK_KP_2, - Qt.Key_PageDown: sdl2.SDLK_KP_3, - Qt.Key_Left: sdl2.SDLK_KP_4, - Qt.Key_Clear: sdl2.SDLK_KP_5, - Qt.Key_Right: sdl2.SDLK_KP_6, - Qt.Key_Home: sdl2.SDLK_KP_7, - Qt.Key_Up: sdl2.SDLK_KP_8, - Qt.Key_PageUp: sdl2.SDLK_KP_9, - Qt.Key_Delete: sdl2.SDLK_KP_PERIOD, + Qt.Key.Key_Insert: sdl2.SDLK_KP_0, + Qt.Key.Key_End: sdl2.SDLK_KP_1, + Qt.Key.Key_Down: sdl2.SDLK_KP_2, + Qt.Key.Key_PageDown: sdl2.SDLK_KP_3, + Qt.Key.Key_Left: sdl2.SDLK_KP_4, + Qt.Key.Key_Clear: sdl2.SDLK_KP_5, + Qt.Key.Key_Right: sdl2.SDLK_KP_6, + Qt.Key.Key_Home: sdl2.SDLK_KP_7, + Qt.Key.Key_Up: sdl2.SDLK_KP_8, + Qt.Key.Key_PageUp: sdl2.SDLK_KP_9, + Qt.Key.Key_Delete: sdl2.SDLK_KP_PERIOD, }.get(ev.key(), 0) key_map = get_key_map() return key_map.get(ev.key(), 0) @@ -122,471 +122,471 @@ def get_key(ev): @lru_cache() def get_key_map(): result = { - Qt.Key_Escape: sdl2.SDLK_ESCAPE, - Qt.Key_Tab: sdl2.SDLK_TAB, - # Qt.Key_Backtab 0x01000002 - Qt.Key_Backspace: sdl2.SDLK_BACKSPACE, - Qt.Key_Return: sdl2.SDLK_RETURN, + Qt.Key.Key_Escape: sdl2.SDLK_ESCAPE, + Qt.Key.Key_Tab: sdl2.SDLK_TAB, + # Qt.Key.Key_Backtab 0x01000002 + Qt.Key.Key_Backspace: sdl2.SDLK_BACKSPACE, + Qt.Key.Key_Return: sdl2.SDLK_RETURN, # Typically located on the keypad. - Qt.Key_Enter: sdl2.SDLK_KP_ENTER, - Qt.Key_Insert: sdl2.SDLK_INSERT, - Qt.Key_Delete: sdl2.SDLK_DELETE, + Qt.Key.Key_Enter: sdl2.SDLK_KP_ENTER, + Qt.Key.Key_Insert: sdl2.SDLK_INSERT, + Qt.Key.Key_Delete: sdl2.SDLK_DELETE, # The Pause/Break key (Note: Not anything to do with pausing media). - Qt.Key_Pause: sdl2.SDLK_PAUSE, - # Qt.Key_Print 0x01000009 - # Qt.Key_SysReq 0x0100000a - # Qt.Key_Clear 0x0100000b - Qt.Key_Home: sdl2.SDLK_HOME, - Qt.Key_End: sdl2.SDLK_END, - Qt.Key_Left: sdl2.SDLK_LEFT, - Qt.Key_Up: sdl2.SDLK_UP, - Qt.Key_Right: sdl2.SDLK_RIGHT, - Qt.Key_Down: sdl2.SDLK_DOWN, - Qt.Key_PageUp: sdl2.SDLK_PAGEUP, - Qt.Key_PageDown: sdl2.SDLK_PAGEDOWN, + Qt.Key.Key_Pause: sdl2.SDLK_PAUSE, + # Qt.Key.Key_Print 0x01000009 + # Qt.Key.Key_SysReq 0x0100000a + # Qt.Key.Key.Key_Clear 0x0100000b + Qt.Key.Key_Home: sdl2.SDLK_HOME, + Qt.Key.Key_End: sdl2.SDLK_END, + Qt.Key.Key_Left: sdl2.SDLK_LEFT, + Qt.Key.Key_Up: sdl2.SDLK_UP, + Qt.Key.Key_Right: sdl2.SDLK_RIGHT, + Qt.Key.Key_Down: sdl2.SDLK_DOWN, + Qt.Key.Key_PageUp: sdl2.SDLK_PAGEUP, + Qt.Key.Key_PageDown: sdl2.SDLK_PAGEDOWN, # FIXME: LSHIFT vs RSHIFT - Qt.Key_Shift: sdl2.SDLK_LSHIFT, + Qt.Key.Key_Shift: sdl2.SDLK_LSHIFT, # On Mac OS X, this corresponds to the Command keys. - # Qt.Key_Control 0x01000021 + # Qt.Key.Key_Control 0x01000021 # FIXME: LCTRL vs RCTRL, OS X, etc - Qt.Key_Control: sdl2.SDLK_LCTRL, + Qt.Key.Key_Control: sdl2.SDLK_LCTRL, # On Mac OS X, this corresponds to the Control keys. On Windows # keyboards, this key is mapped to the Windows key. - # Qt.Key_Meta 0x01000022 - # Qt.Key_Alt 0x01000023 + # Qt.Key.Key_Meta 0x01000022 + # Qt.Key.Key_Alt 0x01000023 # On Windows, when the KeyDown event for this key is sent, the # Ctrl+Alt modifiers are also set. - # Qt.Key_AltGr 0x01001103 - # Qt.Key_CapsLock 0x01000024 - # Qt.Key_NumLock 0x01000025 - # Qt.Key_ScrollLock 0x01000026 - Qt.Key_F1: sdl2.SDLK_F1, - Qt.Key_F2: sdl2.SDLK_F2, - Qt.Key_F3: sdl2.SDLK_F3, - Qt.Key_F4: sdl2.SDLK_F4, - Qt.Key_F5: sdl2.SDLK_F5, - Qt.Key_F6: sdl2.SDLK_F6, - Qt.Key_F7: sdl2.SDLK_F7, - Qt.Key_F8: sdl2.SDLK_F8, - Qt.Key_F9: sdl2.SDLK_F9, - Qt.Key_F10: sdl2.SDLK_F10, - # Qt.Key_F11 0x0100003a - # Qt.Key_F12 0x0100003b - # Qt.Key_F13 0x0100003c - # Qt.Key_F14 0x0100003d - # Qt.Key_F15 0x0100003e - # Qt.Key_F16 0x0100003f - # Qt.Key_F17 0x01000040 - # Qt.Key_F18 0x01000041 - # Qt.Key_F19 0x01000042 - # Qt.Key_F20 0x01000043 - # Qt.Key_F21 0x01000044 - # Qt.Key_F22 0x01000045 - # Qt.Key_F23 0x01000046 - # Qt.Key_F24 0x01000047 - # Qt.Key_F25 0x01000048 - # Qt.Key_F26 0x01000049 - # Qt.Key_F27 0x0100004a - # Qt.Key_F28 0x0100004b - # Qt.Key_F29 0x0100004c - # Qt.Key_F30 0x0100004d - # Qt.Key_F31 0x0100004e - # Qt.Key_F32 0x0100004f - # Qt.Key_F33 0x01000050 - # Qt.Key_F34 0x01000051 - # Qt.Key_F35 0x01000052 - # Qt.Key_Super_L 0x01000053 - # Qt.Key_Super_R 0x01000054 - # Qt.Key_Menu 0x01000055 - # Qt.Key_Hyper_L 0x01000056 - # Qt.Key_Hyper_R 0x01000057 - # Qt.Key_Help 0x01000058 - # Qt.Key_Direction_L 0x01000059 - # Qt.Key_Direction_R 0x01000060 - Qt.Key_Space: sdl2.SDLK_SPACE, - # Qt.Key_Any Key_Space - # Qt.Key_Exclam 0x21 - # Qt.Key_QuoteDbl 0x22 - # Qt.Key_NumberSign 0x23 - # Qt.Key_Dollar 0x24 - # Qt.Key_Percent 0x25 - # Qt.Key_Ampersand 0x26 - # Qt.Key_Apostrophe 0x27 - # Qt.Key_ParenLeft 0x28 - # Qt.Key_ParenRight 0x29 - # Qt.Key_Asterisk 0x2a - # Qt.Key_Plus 0x2b - # Qt.Key_Comma 0x2c - # Qt.Key_Minus 0x2d - # Qt.Key_Period 0x2e - # Qt.Key_Slash 0x2f - # Qt.Key_0 0x30 - # Qt.Key_1 0x31 - # Qt.Key_2 0x32 - # Qt.Key_3 0x33 - # Qt.Key_4 0x34 - # Qt.Key_5 0x35 - # Qt.Key_6 0x36 - # Qt.Key_7 0x37 - # Qt.Key_8 0x38 - # Qt.Key_9 0x39 - # Qt.Key_Colon 0x3a - # Qt.Key_Semicolon 0x3b - # Qt.Key_Less 0x3c - # Qt.Key_Equal 0x3d - # Qt.Key_Greater 0x3e - # Qt.Key_Question 0x3f - # Qt.Key_At 0x40 - Qt.Key_A: sdl2.SDLK_a, - Qt.Key_B: sdl2.SDLK_b, - Qt.Key_C: sdl2.SDLK_c, - Qt.Key_D: sdl2.SDLK_d, - Qt.Key_E: sdl2.SDLK_e, - Qt.Key_F: sdl2.SDLK_f, - Qt.Key_G: sdl2.SDLK_g, - Qt.Key_H: sdl2.SDLK_h, - Qt.Key_I: sdl2.SDLK_i, - Qt.Key_J: sdl2.SDLK_j, - Qt.Key_K: sdl2.SDLK_k, - Qt.Key_L: sdl2.SDLK_l, - Qt.Key_M: sdl2.SDLK_m, - Qt.Key_N: sdl2.SDLK_n, - Qt.Key_O: sdl2.SDLK_o, - Qt.Key_P: sdl2.SDLK_p, - Qt.Key_Q: sdl2.SDLK_q, - Qt.Key_R: sdl2.SDLK_r, - Qt.Key_S: sdl2.SDLK_s, - Qt.Key_T: sdl2.SDLK_t, - Qt.Key_U: sdl2.SDLK_u, - Qt.Key_V: sdl2.SDLK_v, - Qt.Key_W: sdl2.SDLK_w, - Qt.Key_X: sdl2.SDLK_x, - Qt.Key_Y: sdl2.SDLK_y, - Qt.Key_Z: sdl2.SDLK_z, + # Qt.Key.Key_AltGr 0x01001103 + # Qt.Key.Key_CapsLock 0x01000024 + # Qt.Key.Key_NumLock 0x01000025 + # Qt.Key.Key_ScrollLock 0x01000026 + Qt.Key.Key_F1: sdl2.SDLK_F1, + Qt.Key.Key_F2: sdl2.SDLK_F2, + Qt.Key.Key_F3: sdl2.SDLK_F3, + Qt.Key.Key_F4: sdl2.SDLK_F4, + Qt.Key.Key_F5: sdl2.SDLK_F5, + Qt.Key.Key_F6: sdl2.SDLK_F6, + Qt.Key.Key_F7: sdl2.SDLK_F7, + Qt.Key.Key_F8: sdl2.SDLK_F8, + Qt.Key.Key_F9: sdl2.SDLK_F9, + Qt.Key.Key_F10: sdl2.SDLK_F10, + # Qt.Key.Key_F11 0x0100003a + # Qt.Key.Key_F12 0x0100003b + # Qt.Key.Key_F13 0x0100003c + # Qt.Key.Key_F14 0x0100003d + # Qt.Key.Key_F15 0x0100003e + # Qt.Key.Key_F16 0x0100003f + # Qt.Key.Key_F17 0x01000040 + # Qt.Key.Key_F18 0x01000041 + # Qt.Key.Key_F19 0x01000042 + # Qt.Key.Key_F20 0x01000043 + # Qt.Key.Key_F21 0x01000044 + # Qt.Key.Key_F22 0x01000045 + # Qt.Key.Key_F23 0x01000046 + # Qt.Key.Key_F24 0x01000047 + # Qt.Key.Key_F25 0x01000048 + # Qt.Key.Key_F26 0x01000049 + # Qt.Key.Key_F27 0x0100004a + # Qt.Key.Key_F28 0x0100004b + # Qt.Key.Key_F29 0x0100004c + # Qt.Key.Key_F30 0x0100004d + # Qt.Key.Key_F31 0x0100004e + # Qt.Key.Key_F32 0x0100004f + # Qt.Key.Key_F33 0x01000050 + # Qt.Key.Key_F34 0x01000051 + # Qt.Key.Key_F35 0x01000052 + # Qt.Key.Key_Super_L 0x01000053 + # Qt.Key.Key_Super_R 0x01000054 + # Qt.Key.Key_Menu 0x01000055 + # Qt.Key.Key_Hyper_L 0x01000056 + # Qt.Key.Key_Hyper_R 0x01000057 + # Qt.Key.Key_Help 0x01000058 + # Qt.Key.Key_Direction_L 0x01000059 + # Qt.Key.Key_Direction_R 0x01000060 + Qt.Key.Key_Space: sdl2.SDLK_SPACE, + # Qt.Key.Key_Any Key_Space + # Qt.Key.Key_Exclam 0x21 + # Qt.Key.Key_QuoteDbl 0x22 + # Qt.Key.Key_NumberSign 0x23 + # Qt.Key.Key_Dollar 0x24 + # Qt.Key.Key_Percent 0x25 + # Qt.Key.Key_Ampersand 0x26 + # Qt.Key.Key_Apostrophe 0x27 + # Qt.Key.Key_ParenLeft 0x28 + # Qt.Key.Key_ParenRight 0x29 + # Qt.Key.Key_Asterisk 0x2a + # Qt.Key.Key_Plus 0x2b + # Qt.Key.Key_Comma 0x2c + # Qt.Key.Key_Minus 0x2d + # Qt.Key.Key_Period 0x2e + # Qt.Key.Key_Slash 0x2f + # Qt.Key.Key_0 0x30 + # Qt.Key.Key_1 0x31 + # Qt.Key.Key_2 0x32 + # Qt.Key.Key_3 0x33 + # Qt.Key.Key_4 0x34 + # Qt.Key.Key_5 0x35 + # Qt.Key.Key_6 0x36 + # Qt.Key.Key_7 0x37 + # Qt.Key.Key_8 0x38 + # Qt.Key.Key_9 0x39 + # Qt.Key.Key_Colon 0x3a + # Qt.Key.Key_Semicolon 0x3b + # Qt.Key.Key_Less 0x3c + # Qt.Key.Key_Equal 0x3d + # Qt.Key.Key_Greater 0x3e + # Qt.Key.Key_Question 0x3f + # Qt.Key.Key_At 0x40 + Qt.Key.Key_A: sdl2.SDLK_a, + Qt.Key.Key_B: sdl2.SDLK_b, + Qt.Key.Key_C: sdl2.SDLK_c, + Qt.Key.Key_D: sdl2.SDLK_d, + Qt.Key.Key_E: sdl2.SDLK_e, + Qt.Key.Key_F: sdl2.SDLK_f, + Qt.Key.Key_G: sdl2.SDLK_g, + Qt.Key.Key_H: sdl2.SDLK_h, + Qt.Key.Key_I: sdl2.SDLK_i, + Qt.Key.Key_J: sdl2.SDLK_j, + Qt.Key.Key_K: sdl2.SDLK_k, + Qt.Key.Key_L: sdl2.SDLK_l, + Qt.Key.Key_M: sdl2.SDLK_m, + Qt.Key.Key_N: sdl2.SDLK_n, + Qt.Key.Key_O: sdl2.SDLK_o, + Qt.Key.Key_P: sdl2.SDLK_p, + Qt.Key.Key_Q: sdl2.SDLK_q, + Qt.Key.Key_R: sdl2.SDLK_r, + Qt.Key.Key_S: sdl2.SDLK_s, + Qt.Key.Key_T: sdl2.SDLK_t, + Qt.Key.Key_U: sdl2.SDLK_u, + Qt.Key.Key_V: sdl2.SDLK_v, + Qt.Key.Key_W: sdl2.SDLK_w, + Qt.Key.Key_X: sdl2.SDLK_x, + Qt.Key.Key_Y: sdl2.SDLK_y, + Qt.Key.Key_Z: sdl2.SDLK_z, # FIXME: Depends on keymap? - Qt.Key_BracketLeft: sdl2.SDLK_LEFTBRACKET, - # Qt.Key_Backslash 0x5c + Qt.Key.Key_BracketLeft: sdl2.SDLK_LEFTBRACKET, + # Qt.Key.Key_Backslash 0x5c # FIXME: Depends on keymap? - Qt.Key_BracketRight: sdl2.SDLK_RIGHTBRACKET, - # Qt.Key_BracketRight 0x5d - # Qt.Key_AsciiCircum 0x5e - # Qt.Key_Underscore 0x5f - # Qt.Key_QuoteLeft 0x60 - # Qt.Key_BraceLeft 0x7b - # Qt.Key_Bar 0x7c - # Qt.Key_BraceRight 0x7d - # Qt.Key_AsciiTilde 0x7e - # Qt.Key_nobreakspace 0x0a0 - # Qt.Key_exclamdown 0x0a1 - # Qt.Key_cent 0x0a2 - # Qt.Key_sterling 0x0a3 - # Qt.Key_currency 0x0a4 - # Qt.Key_yen 0x0a5 - # Qt.Key_brokenbar 0x0a6 - # Qt.Key_section 0x0a7 - # Qt.Key_diaeresis 0x0a8 - # Qt.Key_copyright 0x0a9 - # Qt.Key_ordfeminine 0x0aa - # Qt.Key_guillemotleft 0x0ab - # Qt.Key_notsign 0x0ac - # Qt.Key_hyphen 0x0ad - # Qt.Key_registered 0x0ae - # Qt.Key_macron 0x0af - # Qt.Key_degree 0x0b0 - # Qt.Key_plusminus 0x0b1 - # Qt.Key_twosuperior 0x0b2 - # Qt.Key_threesuperior 0x0b3 - # Qt.Key_acute 0x0b4 - # Qt.Key_mu 0x0b5 - # Qt.Key_paragraph 0x0b6 - # Qt.Key_periodcentered 0x0b7 - # Qt.Key_cedilla 0x0b8 - # Qt.Key_onesuperior 0x0b9 - # Qt.Key_masculine 0x0ba - # Qt.Key_guillemotright 0x0bb - # Qt.Key_onequarter 0x0bc - # Qt.Key_onehalf 0x0bd - # Qt.Key_threequarters 0x0be - # Qt.Key_questiondown 0x0bf - # Qt.Key_Agrave 0x0c0 - # Qt.Key_Aacute 0x0c1 - # Qt.Key_Acircumflex 0x0c2 - # Qt.Key_Atilde 0x0c3 - # Qt.Key_Adiaeresis 0x0c4 - # Qt.Key_Aring 0x0c5 - # Qt.Key_AE 0x0c6 - # Qt.Key_Ccedilla 0x0c7 - # Qt.Key_Egrave 0x0c8 - # Qt.Key_Eacute 0x0c9 - # Qt.Key_Ecircumflex 0x0ca - # Qt.Key_Ediaeresis 0x0cb - # Qt.Key_Igrave 0x0cc - # Qt.Key_Iacute 0x0cd - # Qt.Key_Icircumflex 0x0ce - # Qt.Key_Idiaeresis 0x0cf - # Qt.Key_ETH 0x0d0 - # Qt.Key_Ntilde 0x0d1 - # Qt.Key_Ograve 0x0d2 - # Qt.Key_Oacute 0x0d3 - # Qt.Key_Ocircumflex 0x0d4 - # Qt.Key_Otilde 0x0d5 - # Qt.Key_Odiaeresis 0x0d6 - # Qt.Key_multiply 0x0d7 - # Qt.Key_Ooblique 0x0d8 - # Qt.Key_Ugrave 0x0d9 - # Qt.Key_Uacute 0x0da - # Qt.Key_Ucircumflex 0x0db - # Qt.Key_Udiaeresis 0x0dc - # Qt.Key_Yacute 0x0dd - # Qt.Key_THORN 0x0de - # Qt.Key_ssharp 0x0df - # Qt.Key_division 0x0f7 - # Qt.Key_ydiaeresis 0x0ff - # Qt.Key_Multi_key 0x01001120 - # Qt.Key_Codeinput 0x01001137 - # Qt.Key_SingleCandidate 0x0100113c - # Qt.Key_MultipleCandidate 0x0100113d - # Qt.Key_PreviousCandidate 0x0100113e - # Qt.Key_Mode_switch 0x0100117e - # Qt.Key_Kanji 0x01001121 - # Qt.Key_Muhenkan 0x01001122 - # Qt.Key_Henkan 0x01001123 - # Qt.Key_Romaji 0x01001124 - # Qt.Key_Hiragana 0x01001125 - # Qt.Key_Katakana 0x01001126 - # Qt.Key_Hiragana_Katakana 0x01001127 - # Qt.Key_Zenkaku 0x01001128 - # Qt.Key_Hankaku 0x01001129 - # Qt.Key_Zenkaku_Hankaku 0x0100112a - # Qt.Key_Touroku 0x0100112b - # Qt.Key_Massyo 0x0100112c - # Qt.Key_Kana_Lock 0x0100112d - # Qt.Key_Kana_Shift 0x0100112e - # Qt.Key_Eisu_Shift 0x0100112f - # Qt.Key_Eisu_toggle 0x01001130 - # Qt.Key_Hangul 0x01001131 - # Qt.Key_Hangul_Start 0x01001132 - # Qt.Key_Hangul_End 0x01001133 - # Qt.Key_Hangul_Hanja 0x01001134 - # Qt.Key_Hangul_Jamo 0x01001135 - # Qt.Key_Hangul_Romaja 0x01001136 - # Qt.Key_Hangul_Jeonja 0x01001138 - # Qt.Key_Hangul_Banja 0x01001139 - # Qt.Key_Hangul_PreHanja 0x0100113a - # Qt.Key_Hangul_PostHanja 0x0100113b - # Qt.Key_Hangul_Special 0x0100113f - # Qt.Key_Dead_Grave 0x01001250 - # Qt.Key_Dead_Acute 0x01001251 - # Qt.Key_Dead_Circumflex 0x01001252 - # Qt.Key_Dead_Tilde 0x01001253 - # Qt.Key_Dead_Macron 0x01001254 - # Qt.Key_Dead_Breve 0x01001255 - # Qt.Key_Dead_Abovedot 0x01001256 - # Qt.Key_Dead_Diaeresis 0x01001257 - # Qt.Key_Dead_Abovering 0x01001258 - # Qt.Key_Dead_Doubleacute 0x01001259 - # Qt.Key_Dead_Caron 0x0100125a - # Qt.Key_Dead_Cedilla 0x0100125b - # Qt.Key_Dead_Ogonek 0x0100125c - # Qt.Key_Dead_Iota 0x0100125d - # Qt.Key_Dead_Voiced_Sound 0x0100125e - # Qt.Key_Dead_Semivoiced_Sound 0x0100125f - # Qt.Key_Dead_Belowdot 0x01001260 - # Qt.Key_Dead_Hook 0x01001261 - # Qt.Key_Dead_Horn 0x01001262 - # Qt.Key_Back 0x01000061 - # Qt.Key_Forward 0x01000062 - # Qt.Key_Stop 0x01000063 - # Qt.Key_Refresh 0x01000064 - # Qt.Key_VolumeDown 0x01000070 - # Qt.Key_VolumeMute 0x01000071 - # Qt.Key_VolumeUp 0x01000072 - # Qt.Key_BassBoost 0x01000073 - # Qt.Key_BassUp 0x01000074 - # Qt.Key_BassDown 0x01000075 - # Qt.Key_TrebleUp 0x01000076 - # Qt.Key_TrebleDown 0x01000077 + Qt.Key.Key_BracketRight: sdl2.SDLK_RIGHTBRACKET, + # Qt.Key.Key_BracketRight 0x5d + # Qt.Key.Key_AsciiCircum 0x5e + # Qt.Key.Key_Underscore 0x5f + # Qt.Key.Key_QuoteLeft 0x60 + # Qt.Key.Key_BraceLeft 0x7b + # Qt.Key.Key_Bar 0x7c + # Qt.Key.Key_BraceRight 0x7d + # Qt.Key.Key_AsciiTilde 0x7e + # Qt.Key.Key_nobreakspace 0x0a0 + # Qt.Key.Key_exclamdown 0x0a1 + # Qt.Key.Key_cent 0x0a2 + # Qt.Key.Key_sterling 0x0a3 + # Qt.Key.Key_currency 0x0a4 + # Qt.Key.Key_yen 0x0a5 + # Qt.Key.Key_brokenbar 0x0a6 + # Qt.Key.Key_section 0x0a7 + # Qt.Key.Key_diaeresis 0x0a8 + # Qt.Key.Key_copyright 0x0a9 + # Qt.Key.Key_ordfeminine 0x0aa + # Qt.Key.Key_guillemotleft 0x0ab + # Qt.Key.Key_notsign 0x0ac + # Qt.Key.Key_hyphen 0x0ad + # Qt.Key.Key_registered 0x0ae + # Qt.Key.Key_macron 0x0af + # Qt.Key.Key_degree 0x0b0 + # Qt.Key.Key_plusminus 0x0b1 + # Qt.Key.Key_twosuperior 0x0b2 + # Qt.Key.Key_threesuperior 0x0b3 + # Qt.Key.Key_acute 0x0b4 + # Qt.Key.Key_mu 0x0b5 + # Qt.Key.Key_paragraph 0x0b6 + # Qt.Key.Key_periodcentered 0x0b7 + # Qt.Key.Key_cedilla 0x0b8 + # Qt.Key.Key_onesuperior 0x0b9 + # Qt.Key.Key_masculine 0x0ba + # Qt.Key.Key_guillemotright 0x0bb + # Qt.Key.Key_onequarter 0x0bc + # Qt.Key.Key_onehalf 0x0bd + # Qt.Key.Key_threequarters 0x0be + # Qt.Key.Key_questiondown 0x0bf + # Qt.Key.Key_Agrave 0x0c0 + # Qt.Key.Key_Aacute 0x0c1 + # Qt.Key.Key_Acircumflex 0x0c2 + # Qt.Key.Key_Atilde 0x0c3 + # Qt.Key.Key_Adiaeresis 0x0c4 + # Qt.Key.Key_Aring 0x0c5 + # Qt.Key.Key_AE 0x0c6 + # Qt.Key.Key_Ccedilla 0x0c7 + # Qt.Key.Key_Egrave 0x0c8 + # Qt.Key.Key_Eacute 0x0c9 + # Qt.Key.Key_Ecircumflex 0x0ca + # Qt.Key.Key_Ediaeresis 0x0cb + # Qt.Key.Key_Igrave 0x0cc + # Qt.Key.Key_Iacute 0x0cd + # Qt.Key.Key_Icircumflex 0x0ce + # Qt.Key.Key_Idiaeresis 0x0cf + # Qt.Key.Key_ETH 0x0d0 + # Qt.Key.Key_Ntilde 0x0d1 + # Qt.Key.Key_Ograve 0x0d2 + # Qt.Key.Key_Oacute 0x0d3 + # Qt.Key.Key_Ocircumflex 0x0d4 + # Qt.Key.Key_Otilde 0x0d5 + # Qt.Key.Key_Odiaeresis 0x0d6 + # Qt.Key.Key_multiply 0x0d7 + # Qt.Key.Key_Ooblique 0x0d8 + # Qt.Key.Key_Ugrave 0x0d9 + # Qt.Key.Key_Uacute 0x0da + # Qt.Key.Key_Ucircumflex 0x0db + # Qt.Key.Key_Udiaeresis 0x0dc + # Qt.Key.Key_Yacute 0x0dd + # Qt.Key.Key_THORN 0x0de + # Qt.Key.Key_ssharp 0x0df + # Qt.Key.Key_division 0x0f7 + # Qt.Key.Key_ydiaeresis 0x0ff + # Qt.Key.Key_Multi_key 0x01001120 + # Qt.Key.Key_Codeinput 0x01001137 + # Qt.Key.Key_ASingleCandidate 0x0100113c + # Qt.Key.Key_AMultipleCandidate 0x0100113d + # Qt.Key.Key_APreviousCandidate 0x0100113e + # Qt.Key.Key_AMode_switch 0x0100117e + # Qt.Key.Key_AKanji 0x01001121 + # Qt.Key.Key_AMuhenkan 0x01001122 + # Qt.Key.Key_AHenkan 0x01001123 + # Qt.Key.Key_ARomaji 0x01001124 + # Qt.Key.Key_AHiragana 0x01001125 + # Qt.Key.Key_AKatakana 0x01001126 + # Qt.Key.Key_AHiragana_Katakana 0x01001127 + # Qt.Key.Key_AZenkaku 0x01001128 + # Qt.Key.Key_AHankaku 0x01001129 + # Qt.Key.Key_AZenkaku_Hankaku 0x0100112a + # Qt.Key.Key_ATouroku 0x0100112b + # Qt.Key.Key_AMassyo 0x0100112c + # Qt.Key.Key_AKana_Lock 0x0100112d + # Qt.Key.Key_AKana_Shift 0x0100112e + # Qt.Key.Key_AEisu_Shift 0x0100112f + # Qt.Key.Key_AEisu_toggle 0x01001130 + # Qt.Key.Key_AHangul 0x01001131 + # Qt.Key.Key_AHangul_Start 0x01001132 + # Qt.Key.Key_AHangul_End 0x01001133 + # Qt.Key.Key_AHangul_Hanja 0x01001134 + # Qt.Key.Key_AHangul_Jamo 0x01001135 + # Qt.Key.Key_AHangul_Romaja 0x01001136 + # Qt.Key.Key_AHangul_Jeonja 0x01001138 + # Qt.Key.Key_AHangul_Banja 0x01001139 + # Qt.Key.Key_AHangul_PreHanja 0x0100113a + # Qt.Key.Key_AHangul_PostHanja 0x0100113b + # Qt.Key.Key_AHangul_Special 0x0100113f + # Qt.Key.Key_ADead_Grave 0x01001250 + # Qt.Key.Key_ADead_Acute 0x01001251 + # Qt.Key.Key_ADead_Circumflex 0x01001252 + # Qt.Key.Key_ADead_Tilde 0x01001253 + # Qt.Key.Key_ADead_Macron 0x01001254 + # Qt.Key.Key_ADead_Breve 0x01001255 + # Qt.Key.Key_ADead_Abovedot 0x01001256 + # Qt.Key.Key_ADead_Diaeresis 0x01001257 + # Qt.Key.Key_ADead_Abovering 0x01001258 + # Qt.Key.Key_ADead_Doubleacute 0x01001259 + # Qt.Key.Key_ADead_Caron 0x0100125a + # Qt.Key.Key_ADead_Cedilla 0x0100125b + # Qt.Key.Key_ADead_Ogonek 0x0100125c + # Qt.Key.Key_ADead_Iota 0x0100125d + # Qt.Key.Key_ADead_Voiced_Sound 0x0100125e + # Qt.Key.Key_ADead_Semivoiced_Sound 0x0100125f + # Qt.Key.Key_ADead_Belowdot 0x01001260 + # Qt.Key.Key_ADead_Hook 0x01001261 + # Qt.Key.Key_ADead_Horn 0x01001262 + # Qt.Key.Key_ABack 0x01000061 + # Qt.Key.Key_AForward 0x01000062 + # Qt.Key.Key_AStop 0x01000063 + # Qt.Key.Key_ARefresh 0x01000064 + # Qt.Key.Key_AVolumeDown 0x01000070 + # Qt.Key.Key_AVolumeMute 0x01000071 + # Qt.Key.Key_AVolumeUp 0x01000072 + # Qt.Key.Key_ABassBoost 0x01000073 + # Qt.Key.Key_ABassUp 0x01000074 + # Qt.Key.Key_ABassDown 0x01000075 + # Qt.Key.Key_ATrebleUp 0x01000076 + # Qt.Key.Key_ATrebleDown 0x01000077 # A key setting the state of the media player to play - # Qt.Key_MediaPlay 0x01000080 + # Qt.Key.Key_AMediaPlay 0x01000080 # A key setting the state of the media player to stop - # Qt.Key_MediaStop 0x01000081 - # Qt.Key_MediaPrevious 0x01000082 - # Qt.Key_MediaNext 0x01000083 - # Qt.Key_MediaRecord 0x01000084 + # Qt.Key.Key_AMediaStop 0x01000081 + # Qt.Key.Key_AMediaPrevious 0x01000082 + # Qt.Key.Key_AMediaNext 0x01000083 + # Qt.Key.Key_AMediaRecord 0x01000084 # A key setting the state of the media player to pause # (Note: not the pause/break key) - # Qt.Key_MediaPause 0x1000085 + # Qt.Key.Key_AMediaPause 0x1000085 # A key to toggle the play/pause state in the media player # (rather than setting an absolute state) - # Qt.Key_MediaTogglePlayPause 0x1000086 - # Qt.Key_HomePage 0x01000090 - # Qt.Key_Favorites 0x01000091 - # Qt.Key_Search 0x01000092 - # Qt.Key_Standby 0x01000093 - # Qt.Key_OpenUrl 0x01000094 - # Qt.Key_LaunchMail 0x010000a0 - # Qt.Key_LaunchMedia 0x010000a1 + # Qt.Key.Key_AMediaTogglePlayPause 0x1000086 + # Qt.Key.Key_HomePage 0x01000090 + # Qt.Key.Key_AFavorites 0x01000091 + # Qt.Key.Key_ASearch 0x01000092 + # Qt.Key.Key_AStandby 0x01000093 + # Qt.Key.Key_AOpenUrl 0x01000094 + # Qt.Key.Key_ALaunchMail 0x010000a0 + # Qt.Key.Key_ALaunchMedia 0x010000a1 # On X11 this key is mapped to "My Computer" (XF86XK_MyComputer) key # for legacy reasons. - # Qt.Key_Launch0 0x010000a2 + # Qt.Key.Key_ALaunch0 0x010000a2 # On X11 this key is mapped to "Calculator" (XF86XK_Calculator) key # for legacy reasons. - # Qt.Key_Launch1 0x010000a3 + # Qt.Key.Key_ALaunch1 0x010000a3 # On X11 this key is mapped to XF86XK_Launch0 key for legacy reasons. - # Qt.Key_Launch2 0x010000a4 - # Qt.Key_Launch3 0x010000a5 On X11 this key is mapped to + # Qt.Key.Key_ALaunch2 0x010000a4 + # Qt.Key.Key_ALaunch3 0x010000a5 On X11 this key is mapped to # XF86XK_Launch1 key for legacy reasons. - # Qt.Key_Launch4 0x010000a6 On X11 this key is mapped to + # Qt.Key.Key_ALaunch4 0x010000a6 On X11 this key is mapped to # XF86XK_Launch2 key for legacy reasons. - # Qt.Key_Launch5 0x010000a7 On X11 this key is mapped to + # Qt.Key.Key_ALaunch5 0x010000a7 On X11 this key is mapped to # XF86XK_Launch3 key for legacy reasons. - # Qt.Key_Launch6 0x010000a8 On X11 this key is mapped to + # Qt.Key.Key_ALaunch6 0x010000a8 On X11 this key is mapped to # XF86XK_Launch4 key for legacy reasons. - # Qt.Key_Launch7 0x010000a9 On X11 this key is mapped to + # Qt.Key.Key_ALaunch7 0x010000a9 On X11 this key is mapped to # XF86XK_Launch5 key for legacy reasons. - # Qt.Key_Launch8 0x010000aa On X11 this key is mapped to + # Qt.Key.Key_ALaunch8 0x010000aa On X11 this key is mapped to # XF86XK_Launch6 key for legacy reasons. - # Qt.Key_Launch9 0x010000ab On X11 this key is mapped to + # Qt.Key.Key_ALaunch9 0x010000ab On X11 this key is mapped to # XF86XK_Launch7 key for legacy reasons. - # Qt.Key_LaunchA 0x010000ac On X11 this key is mapped to + # Qt.Key.Key_ALaunchA 0x010000ac On X11 this key is mapped to # XF86XK_Launch8 key for legacy reasons. - # Qt.Key_LaunchB 0x010000ad On X11 this key is mapped to + # Qt.Key.Key_ALaunchB 0x010000ad On X11 this key is mapped to # XF86XK_Launch9 key for legacy reasons. - # Qt.Key_LaunchC 0x010000ae On X11 this key is mapped to + # Qt.Key.Key_ALaunchC 0x010000ae On X11 this key is mapped to # XF86XK_LaunchA key for legacy reasons. - # Qt.Key_LaunchD 0x010000af On X11 this key is mapped to + # Qt.Key.Key_ALaunchD 0x010000af On X11 this key is mapped to # XF86XK_LaunchB key for legacy reasons. - # Qt.Key_LaunchE 0x010000b0 On X11 this key is mapped to + # Qt.Key.Key_ALaunchE 0x010000b0 On X11 this key is mapped to # XF86XK_LaunchC key for legacy reasons. - # Qt.Key_LaunchF 0x010000b1 On X11 this key is mapped to + # Qt.Key.Key_ALaunchF 0x010000b1 On X11 this key is mapped to # XF86XK_LaunchD key for legacy reasons. - # Qt.Key_LaunchG 0x0100010e On X11 this key is mapped to + # Qt.Key.Key_ALaunchG 0x0100010e On X11 this key is mapped to # XF86XK_LaunchE key for legacy reasons. - # Qt.Key_LaunchH 0x0100010f On X11 this key is mapped to + # Qt.Key.Key_ALaunchH 0x0100010f On X11 this key is mapped to # XF86XK_LaunchF key for legacy reasons. - # Qt.Key_MonBrightnessUp 0x010000b2 - # Qt.Key_MonBrightnessDown 0x010000b3 - # Qt.Key_KeyboardLightOnOff 0x010000b4 - # Qt.Key_KeyboardBrightnessUp 0x010000b5 - # Qt.Key_KeyboardBrightnessDown 0x010000b6 - # Qt.Key_PowerOff 0x010000b7 - # Qt.Key_WakeUp 0x010000b8 - # Qt.Key_Eject 0x010000b9 - # Qt.Key_ScreenSaver 0x010000ba - # Qt.Key_WWW 0x010000bb - # Qt.Key_Memo 0x010000bc - # Qt.Key_LightBulb 0x010000bd - # Qt.Key_Shop 0x010000be - # Qt.Key_History 0x010000bf - # Qt.Key_AddFavorite 0x010000c0 - # Qt.Key_HotLinks 0x010000c1 - # Qt.Key_BrightnessAdjust 0x010000c2 - # Qt.Key_Finance 0x010000c3 - # Qt.Key_Community 0x010000c4 - # Qt.Key_AudioRewind 0x010000c5 - # Qt.Key_BackForward 0x010000c6 - # Qt.Key_ApplicationLeft 0x010000c7 - # Qt.Key_ApplicationRight 0x010000c8 - # Qt.Key_Book 0x010000c9 - # Qt.Key_CD 0x010000ca + # Qt.Key.Key_AMonBrightnessUp 0x010000b2 + # Qt.Key.Key_AMonBrightnessDown 0x010000b3 + # Qt.Key.Key_AKeyboardLightOnOff 0x010000b4 + # Qt.Key.Key_AKeyboardBrightnessUp 0x010000b5 + # Qt.Key.Key_AKeyboardBrightnessDown 0x010000b6 + # Qt.Key.Key_APowerOff 0x010000b7 + # Qt.Key.Key_AWakeUp 0x010000b8 + # Qt.Key.Key_AEject 0x010000b9 + # Qt.Key.Key_AScreenSaver 0x010000ba + # Qt.Key.Key_AWWW 0x010000bb + # Qt.Key.Key_AMemo 0x010000bc + # Qt.Key.Key_ALightBulb 0x010000bd + # Qt.Key.Key_AShop 0x010000be + # Qt.Key.Key_AHistory 0x010000bf + # Qt.Key.Key_AAddFavorite 0x010000c0 + # Qt.Key.Key_AHotLinks 0x010000c1 + # Qt.Key.Key_ABrightnessAdjust 0x010000c2 + # Qt.Key.Key_AFinance 0x010000c3 + # Qt.Key.Key_ACommunity 0x010000c4 + # Qt.Key.Key_AAudioRewind 0x010000c5 + # Qt.Key.Key_ABackForward 0x010000c6 + # Qt.Key.Key_AApplicationLeft 0x010000c7 + # Qt.Key.Key_AApplicationRight 0x010000c8 + # Qt.Key.Key_ABook 0x010000c9 + # Qt.Key.Key_ACD 0x010000ca # On X11 this key is not mapped for legacy reasons. - # Use Qt.Key_Launch1 instead. - # Qt.Key_Calculator 0x010000cb - # Qt.Key_ToDoList 0x010000cc - # Qt.Key_ClearGrab 0x010000cd - # Qt.Key_Close 0x010000ce - # Qt.Key_Copy 0x010000cf - # Qt.Key_Cut 0x010000d0 - # Qt.Key_Display 0x010000d1 - # Qt.Key_DOS 0x010000d2 - # Qt.Key_Documents 0x010000d3 - # Qt.Key_Excel 0x010000d4 - # Qt.Key_Explorer 0x010000d5 - # Qt.Key_Game 0x010000d6 - # Qt.Key_Go 0x010000d7 - # Qt.Key_iTouch 0x010000d8 - # Qt.Key_LogOff 0x010000d9 - # Qt.Key_Market 0x010000da - # Qt.Key_Meeting 0x010000db - # Qt.Key_MenuKB 0x010000dc - # Qt.Key_MenuPB 0x010000dd - # Qt.Key_MySites 0x010000de - # Qt.Key_News 0x010000df - # Qt.Key_OfficeHome 0x010000e0 - # Qt.Key_Option 0x010000e1 - # Qt.Key_Paste 0x010000e2 - # Qt.Key_Phone 0x010000e3 - # Qt.Key_Calendar 0x010000e4 - # Qt.Key_Reply 0x010000e5 - # Qt.Key_Reload 0x010000e6 - # Qt.Key_RotateWindows 0x010000e7 - # Qt.Key_RotationPB 0x010000e8 - # Qt.Key_RotationKB 0x010000e9 - # Qt.Key_Save 0x010000ea - # Qt.Key_Send 0x010000eb - # Qt.Key_Spell 0x010000ec - # Qt.Key_SplitScreen 0x010000ed - # Qt.Key_Support 0x010000ee - # Qt.Key_TaskPane 0x010000ef - # Qt.Key_Terminal 0x010000f0 - # Qt.Key_Tools 0x010000f1 - # Qt.Key_Travel 0x010000f2 - # Qt.Key_Video 0x010000f3 - # Qt.Key_Word 0x010000f4 - # Qt.Key_Xfer 0x010000f5 - # Qt.Key_ZoomIn 0x010000f6 - # Qt.Key_ZoomOut 0x010000f7 - # Qt.Key_Away 0x010000f8 - # Qt.Key_Messenger 0x010000f9 - # Qt.Key_WebCam 0x010000fa - # Qt.Key_MailForward 0x010000fb - # Qt.Key_Pictures 0x010000fc - # Qt.Key_Music 0x010000fd - # Qt.Key_Battery 0x010000fe - # Qt.Key_Bluetooth 0x010000ff - # Qt.Key_WLAN 0x01000100 - # Qt.Key_UWB 0x01000101 - # Qt.Key_AudioForward 0x01000102 - # Qt.Key_AudioRepeat 0x01000103 - # Qt.Key_AudioRandomPlay 0x01000104 - # Qt.Key_Subtitle 0x01000105 - # Qt.Key_AudioCycleTrack 0x01000106 - # Qt.Key_Time 0x01000107 - # Qt.Key_Hibernate 0x01000108 - # Qt.Key_View 0x01000109 - # Qt.Key_TopMenu 0x0100010a - # Qt.Key_PowerDown 0x0100010b - # Qt.Key_Suspend 0x0100010c - # Qt.Key_ContrastAdjust 0x0100010d - # Qt.Key_MediaLast 0x0100ffff - # Qt.Key_unknown 0x01ffffff - # A key to answer or initiate a call (see Qt.Key_ToggleCallHangup + # Use Qt.Key.Key_ALaunch1 instead. + # Qt.Key.Key_ACalculator 0x010000cb + # Qt.Key.Key_AToDoList 0x010000cc + # Qt.Key.Key_ClearGrab 0x010000cd + # Qt.Key.Key_AClose 0x010000ce + # Qt.Key.Key_ACopy 0x010000cf + # Qt.Key.Key_ACut 0x010000d0 + # Qt.Key.Key_ADisplay 0x010000d1 + # Qt.Key.Key_ADOS 0x010000d2 + # Qt.Key.Key_ADocuments 0x010000d3 + # Qt.Key.Key_AExcel 0x010000d4 + # Qt.Key.Key_AExplorer 0x010000d5 + # Qt.Key.Key_AGame 0x010000d6 + # Qt.Key.Key_AGo 0x010000d7 + # Qt.Key.Key_AiTouch 0x010000d8 + # Qt.Key.Key_ALogOff 0x010000d9 + # Qt.Key.Key_AMarket 0x010000da + # Qt.Key.Key_AMeeting 0x010000db + # Qt.Key.Key_AMenuKB 0x010000dc + # Qt.Key.Key_AMenuPB 0x010000dd + # Qt.Key.Key_AMySites 0x010000de + # Qt.Key.Key_ANews 0x010000df + # Qt.Key.Key_AOfficeHome 0x010000e0 + # Qt.Key.Key_AOption 0x010000e1 + # Qt.Key.Key_APaste 0x010000e2 + # Qt.Key.Key_APhone 0x010000e3 + # Qt.Key.Key_ACalendar 0x010000e4 + # Qt.Key.Key_AReply 0x010000e5 + # Qt.Key.Key_AReload 0x010000e6 + # Qt.Key.Key_ARotateWindows 0x010000e7 + # Qt.Key.Key_ARotationPB 0x010000e8 + # Qt.Key.Key_ARotationKB 0x010000e9 + # Qt.Key.Key_ASave 0x010000ea + # Qt.Key.Key_ASend 0x010000eb + # Qt.Key.Key_ASpell 0x010000ec + # Qt.Key.Key_ASplitScreen 0x010000ed + # Qt.Key.Key_ASupport 0x010000ee + # Qt.Key.Key_ATaskPane 0x010000ef + # Qt.Key.Key_ATerminal 0x010000f0 + # Qt.Key.Key_ATools 0x010000f1 + # Qt.Key.Key_ATravel 0x010000f2 + # Qt.Key.Key_AVideo 0x010000f3 + # Qt.Key.Key_AWord 0x010000f4 + # Qt.Key.Key_AXfer 0x010000f5 + # Qt.Key.Key_AZoomIn 0x010000f6 + # Qt.Key.Key_AZoomOut 0x010000f7 + # Qt.Key.Key_AAway 0x010000f8 + # Qt.Key.Key_AMessenger 0x010000f9 + # Qt.Key.Key_AWebCam 0x010000fa + # Qt.Key.Key_AMailForward 0x010000fb + # Qt.Key.Key_APictures 0x010000fc + # Qt.Key.Key_AMusic 0x010000fd + # Qt.Key.Key_ABattery 0x010000fe + # Qt.Key.Key_ABluetooth 0x010000ff + # Qt.Key.Key_AWLAN 0x01000100 + # Qt.Key.Key_AUWB 0x01000101 + # Qt.Key.Key_AAudioForward 0x01000102 + # Qt.Key.Key_AAudioRepeat 0x01000103 + # Qt.Key.Key_AAudioRandomPlay 0x01000104 + # Qt.Key.Key_ASubtitle 0x01000105 + # Qt.Key.Key_AAudioCycleTrack 0x01000106 + # Qt.Key.Key_ATime 0x01000107 + # Qt.Key.Key_AHibernate 0x01000108 + # Qt.Key.Key_AView 0x01000109 + # Qt.Key.Key_ATopMenu 0x0100010a + # Qt.Key.Key_APowerDown 0x0100010b + # Qt.Key.Key_ASuspend 0x0100010c + # Qt.Key.Key_AContrastAdjust 0x0100010d + # Qt.Key.Key_AMediaLast 0x0100ffff + # Qt.Key.Key_Aunknown 0x01ffffff + # A key to answer or initiate a call (see Qt.Key.Key_AToggleCallHangup # for a key to toggle current call state) - # Qt.Key_Call 0x01100004 + # Qt.Key.Key_ACall 0x01100004 # A key to activate the camera shutter - # Qt.Key_Camera 0x01100020 - # Qt.Key_CameraFocus 0x01100021 A key to focus the camera - # Qt.Key_Context1 0x01100000 - # Qt.Key_Context2 0x01100001 - # Qt.Key_Context3 0x01100002 - # Qt.Key_Context4 0x01100003 - # Qt.Key_Flip 0x01100006 - # A key to end an ongoing call (see Qt.Key_ToggleCallHangup for a + # Qt.Key.Key_ACamera 0x01100020 + # Qt.Key.Key_ACameraFocus 0x01100021 A key to focus the camera + # Qt.Key.Key_AContext1 0x01100000 + # Qt.Key.Key_AContext2 0x01100001 + # Qt.Key.Key_AContext3 0x01100002 + # Qt.Key.Key_AContext4 0x01100003 + # Qt.Key.Key_AFlip 0x01100006 + # A key to end an ongoing call (see Qt.Key.Key_AToggleCallHangup for a # key to toggle current call state) - # Qt.Key_Hangup 0x01100005 - # Qt.Key_No 0x01010002 - # Qt.Key_Select 0x01010000 - # Qt.Key_Yes 0x01010001 + # Qt.Key.Key_AHangup 0x01100005 + # Qt.Key.Key_ANo 0x01010002 + # Qt.Key.Key_ASelect 0x01010000 + # Qt.Key.Key_AYes 0x01010001 # A key to toggle the current call state (ie. either answer, or # hangup) depending on current call state - # Qt.Key_ToggleCallHangup 0x01100007 - # Qt.Key_VoiceDial 0x01100008 - # Qt.Key_LastNumberRedial 0x01100009 - # Qt.Key_Execute 0x01020003 - # Qt.Key_Printer 0x01020002 - # Qt.Key_Play 0x01020005 - # Qt.Key_Sleep 0x01020004 - # Qt.Key_Zoom 0x01020006 - # Qt.Key_Cancel 0x01020001 + # Qt.Key.Key_AToggleCallHangup 0x01100007 + # Qt.Key.Key_AVoiceDial 0x01100008 + # Qt.Key.Key_ALastNumberRedial 0x01100009 + # Qt.Key.Key_AExecute 0x01020003 + # Qt.Key.Key_APrinter 0x01020002 + # Qt.Key.Key_APlay 0x01020005 + # Qt.Key.Key_ASleep 0x01020004 + # Qt.Key.Key_AZoom 0x01020006 + # Qt.Key.Key_ACancel 0x01020001 } return result diff --git a/arcade/ui/gl_widget.py b/arcade/ui/gl_widget.py index d4f7a651..847ff890 100644 --- a/arcade/ui/gl_widget.py +++ b/arcade/ui/gl_widget.py @@ -2,13 +2,13 @@ import traceback from arcade.glui.opengl import gl -from fsui.qt import QGLWidget +from fsui.qt import QtOpenGLWidget # noinspection PyPep8Naming -class GLWidget(QGLWidget): +class GLWidget(QtOpenGLWidget): def __init__(self, parent, callbacks): - QGLWidget.__init__(self, parent) + QtOpenGLWidget.__init__(self, parent) self._callbacks = callbacks self._initialized = False self._first_initialize_gl_call = True diff --git a/docs/compiling.md b/docs/compiling.md index a648cb3a..4d381633 100644 --- a/docs/compiling.md +++ b/docs/compiling.md @@ -29,8 +29,8 @@ platforms. The following packages are needed: - sudo apt install python3 python3-pillow python3-pyqt5 \ - python3-pyqt5.qtopengl python3-requests python3-opengl \ + sudo apt install python3 python3-pillow python3-pyqt6 \ + python3-pyqt6.qtopengl python3-requests python3-opengl \ python3-rx python3-typing-extensions To add support for .lha archives, you also need to have the lhafile @@ -69,7 +69,7 @@ FIXME: Write about dependencies for running the launcher from the source directory: pacman -S mingw-w64-x86_64-python3 mingw-w64-x86_64-python3-lhafile \ - mingw-w64-x86_64-python3-pillow mingw-w64-x86_64-python3-pyqt5 \ + mingw-w64-x86_64-python3-pillow mingw-w64-x86_64-python3-pyqt6 \ mingw-w64-x86_64-python3-requests mingw-w64-x86_64-python3-setuptools And finally, from the fs-uae-launcher source directory: @@ -110,7 +110,7 @@ thatyou do not get errors here). Then follow with: cd %LOCALAPPDATA%\Programs\Python\Python36 python -m pip install --upgrade pip - python -m pip install lhafile requests pillow PyQt5==5.12.2 + python -m pip install lhafile requests pillow pyqt6==6.4.0 In the MSYS2 MinGW 64-bit shell: @@ -133,7 +133,7 @@ verify that pip3 is found in the correct place: Then run: - pip3 install lhafile pillow pyobjc pyqt5 requests rx typing_extensions + pip3 install lhafile pillow pyobjc pyqt6 requests rx typing_extensions And finally, from the fs-uae-launcher source directory: diff --git a/fsbuild/fix-pyqt5.py b/fsbuild/fix-pyqt5.py index 5dbe6204..179f192a 100644 --- a/fsbuild/fix-pyqt5.py +++ b/fsbuild/fix-pyqt5.py @@ -3,14 +3,14 @@ import shutil import sys -from PyQt5.QtCore import QLibraryInfo +from PyQt6.QtCore import QLibraryInfo def main() -> None: # This is mainly to avoid bundling libraries that can cause issues, # such as GTK (and dependencies) being included if GTK platform # integration is included. - print("Fixing PyQt5 installation before running pyinstaller") + print("Fixing PyQt6 installation before running pyinstaller") print("(Removing unnecessary stuff") # libraries_path = QLibraryInfo.location(QLibraryInfo.LibrariesPath) diff --git a/fsgamesys/drivers/gamedriver.py b/fsgamesys/drivers/gamedriver.py index e0ae95bf..d26fd48f 100644 --- a/fsgamesys/drivers/gamedriver.py +++ b/fsgamesys/drivers/gamedriver.py @@ -28,7 +28,6 @@ from fsgamesys.util.gamenameutil import GameNameUtil from launcher.option import Option - class TemporaryNamedItem: def __init__( self, root: "TemporaryNamedItem", name: str, directory: bool = False @@ -427,17 +426,23 @@ def _screens(cls): screens = [] try: from fsui.qt import init_qt + from PyQt6 import QtGui + from PyQt6.QtGui import QScreen + + from PyQt6.QtWidgets import QMainWindow, QApplication + + screenList = QtGui.QGuiApplication.screens() - qapplication = init_qt() - desktop = qapplication.desktop() except AttributeError: - # no QApplication, probably not running via QT - # FIXME: log warning + print("Warning No Attributes found for screens.") pass else: - for i in range(desktop.screenCount()): - geometry = desktop.screenGeometry(i) - screens.append([geometry.x(), i, geometry]) + + j = 0 + for i in screenList: + geometry = i.geometry() + screens.append([geometry.x(), j, geometry]) + j = j+1 return screens @classmethod diff --git a/fsgamesys/ui/gamecenterview.py b/fsgamesys/ui/gamecenterview.py index f574501e..65095594 100644 --- a/fsgamesys/ui/gamecenterview.py +++ b/fsgamesys/ui/gamecenterview.py @@ -1,7 +1,7 @@ import os import sys -from PyQt5.QtQuick import QQuickView +from PyQt6.QtQuick import QQuickView # to make sure cxFreeze includes it from fsbc.application import app diff --git a/fsgamesys/ui/qwindow.py b/fsgamesys/ui/qwindow.py index 3ad10442..79b5d277 100644 --- a/fsgamesys/ui/qwindow.py +++ b/fsgamesys/ui/qwindow.py @@ -1,7 +1,7 @@ import os import sys -from PyQt5.QtQuick import QQuickView +from PyQt6.QtQuick import QQuickView # to make sure cxFreeze includes it from fsbc.application import app diff --git a/fsui/common/group.py b/fsui/common/group.py index f5629c42..95ca1a58 100644 --- a/fsui/common/group.py +++ b/fsui/common/group.py @@ -1,6 +1,6 @@ import weakref -from PyQt5.QtWidgets import QWidget +from PyQt6.QtWidgets import QWidget from fscore.deprecated import deprecated from fsui.qt import QObject diff --git a/fsui/qt/__init__.py b/fsui/qt/__init__.py index d2085125..0ee4df9d 100644 --- a/fsui/qt/__init__.py +++ b/fsui/qt/__init__.py @@ -15,15 +15,12 @@ QComboBox, QCoreApplication, QCursor, - QDesktopWidget, - QDialog, QEvent, QFileDialog, QFont, QFontDatabase, QFontMetrics, QFrame, - QGLWidget, QIcon, QImage, QLineEdit, diff --git a/fsui/qt/callafter.py b/fsui/qt/callafter.py index 5294a501..02b51901 100644 --- a/fsui/qt/callafter.py +++ b/fsui/qt/callafter.py @@ -8,7 +8,7 @@ class CustomEvent(QEvent): def __init__(self) -> None: - QEvent.__init__(self, QEvent.User) + QEvent.__init__(self, QEvent.Type.User) class EventHandler(QObject): diff --git a/fsui/qt/choice.py b/fsui/qt/choice.py index 22388bbc..0ceead0e 100644 --- a/fsui/qt/choice.py +++ b/fsui/qt/choice.py @@ -51,8 +51,8 @@ def setIndex(self, index: int) -> None: # keyPressEvent isn't intercepted anymore # def keyPressEvent(self, a0: QKeyEvent) -> None: # if not self.cursor_keys: - # print("cursor keys is false", a0.key(), Qt.Key_Up) - # if a0.key() == Qt.Key_Up or a0.key() == Qt.Key_Down: + # print("cursor keys is false", a0.key(), Qt.Key.Key_Up) + # if a0.key() == Qt.Key.Key_Up or a0.key() == Qt.Key.Key_Down: # print("ignoring") # return # super().keyPressEvent(a0) diff --git a/fsui/qt/core.py b/fsui/qt/core.py index 728f35b3..dd343942 100644 --- a/fsui/qt/core.py +++ b/fsui/qt/core.py @@ -1,4 +1,4 @@ -from PyQt5.QtCore import ( +from PyQt6.QtCore import ( QEvent, QModelIndex, QObject, @@ -9,6 +9,10 @@ QTimerEvent, ) +from PyQt6 import ( + QtGui, +) + __all__ = [ "QEvent", "QObject", diff --git a/fsui/qt/dialog.py b/fsui/qt/dialog.py index cbdc8095..93b890a1 100644 --- a/fsui/qt/dialog.py +++ b/fsui/qt/dialog.py @@ -2,6 +2,7 @@ from typing import Optional, cast from fsui.qt.core import Qt +from fsui.qt.core import QtGui from fsui.qt.gui import QCloseEvent, QResizeEvent, QShowEvent from fsui.qt.qparent import QOptionalParent from fsui.qt.toplevelwidget import TopLevelWidget @@ -20,14 +21,15 @@ def __init__( ): super().__init__(QOptionalParent(parent, window=True)) self.setWindowTitle(title) - self.setAttribute(Qt.WA_DeleteOnClose) + self.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose) - flags: int = Qt.Dialog + flags: int = Qt.WindowType.Dialog if not border: - flags |= Qt.FramelessWindowHint + flags |= Qt.WindowType.FramelessWindowHint # flags |= Qt.NoDropShadowWindowHint # FIXME: How to correctly type? - self.setWindowFlags(cast(Qt.WindowFlags, flags)) + #self.setWindowFlags(cast(Qt.WindowFlags, flags)) + self.setWindowFlags(flags) # Maybe... self._fswidget_ref = weakref.ref(fswidget) @@ -115,13 +117,13 @@ def qDialog(self) -> QDialog: def show(self) -> None: self.center_on_initial_show() # FIXME: Qt.WindowModal? - self.qDialog.setWindowModality(Qt.WindowModal) - self.qDialog.exec_() + self.qDialog.setWindowModality(Qt.WindowModality.WindowModal) + self.qDialog.exec() def show_modal(self) -> int: self.center_on_initial_show() # self.setWindowModality(Qt.WindowModal) - return self.qDialog.exec_() + return self.qDialog.exec() # FIXME: Move to BaseWindow @property diff --git a/fsui/qt/drawingcontext.py b/fsui/qt/drawingcontext.py index 87e264f5..dd1d5305 100644 --- a/fsui/qt/drawingcontext.py +++ b/fsui/qt/drawingcontext.py @@ -30,7 +30,7 @@ def clear(self, color: Optional[Color] = None) -> None: self.qpainter.eraseRect(rect) def setAntialiasing(self, antiAliasing: bool) -> None: - self.qpainter.setRenderHint(QPainter.Antialiasing, antiAliasing) + self.qpainter.setRenderHint(QPainter.RenderHint.Antialiasing, antiAliasing) def get_font(self) -> Font: return Font(qFont=self.qpainter.font()) @@ -41,15 +41,18 @@ def set_font(self, font: Font) -> None: def draw_text(self, text: str, x: int, y: int) -> None: # self.qpainter.drawText(QPoint(x, y), text) self.qpainter.setPen(QPen(self.text_color)) + # FIXME: No idea why x and y are coming in as floats.. + x = int(x) + y = int(y) self.qpainter.drawText( - x, y, 10000, 1000, Qt.AlignLeft | Qt.AlignTop, text + x, y, 10000, 1000, Qt.AlignmentFlag.AlignLeft | Qt.AlignmentFlag.AlignTop, text ) def measure_text(self, text: str) -> Tuple[int, int]: # return self.dc.GetTextExtent(text) # return (10, 10) rect = self.qpainter.boundingRect( - 0, 0, 10000, 1000, Qt.AlignLeft | Qt.AlignTop, text + 0, 0, 10000, 1000, Qt.AlignmentFlag.AlignLeft | Qt.AlignmentFlag.AlignTop, text ) return rect.width(), rect.height() @@ -88,6 +91,9 @@ def draw_line(self, x1: int, y1: int, x2: int, y2: int, c: Color) -> None: def draw_image(self, image: Image, x: int, y: int) -> None: # self.dc.DrawBitmap(image.bitmap, x, y, True) + # FIXME: No idea why x and y are coming in as floats.. + x = int(x) + y = int(y) self.qpainter.drawImage(QPoint(x, y), image.qimage) def drawScaledImage( diff --git a/fsui/qt/font.py b/fsui/qt/font.py index e377d804..6fe31290 100644 --- a/fsui/qt/font.py +++ b/fsui/qt/font.py @@ -1,3 +1,4 @@ +from tkinter.font import NORMAL from typing import Optional, Union from typing_extensions import TypedDict @@ -101,16 +102,16 @@ def set_weight(self, weight: Union[int, str]) -> "Font": iweight = weight # FIXME: Create proper table and add more if iweight == 400: - qt_weight = QFont.Normal + qt_weight = QFont.Weight.Normal elif iweight == 500: - qt_weight = QFont.Medium + qt_weight = QFont.Weight.Medium elif iweight == 600: - qt_weight = QFont.DemiBold + qt_weight = QFont.Weight.DemiBold elif iweight == 700: - qt_weight = QFont.Bold + qt_weight = QFont.Weight.Bold else: print(f"WARNING: Font.set_weight: Unknown font weight {weight}") - qt_weight = QFont.Normal + qt_weight = QFont.Weight.Normal # print(qt_weight) self.font.setWeight(qt_weight) # Allow chaining operations diff --git a/fsui/qt/gui.py b/fsui/qt/gui.py index 11b9d4ec..0ddf6a49 100644 --- a/fsui/qt/gui.py +++ b/fsui/qt/gui.py @@ -1,4 +1,4 @@ -from PyQt5.QtGui import ( +from PyQt6.QtGui import ( QCloseEvent, QColor, QFont, diff --git a/fsui/qt/image.py b/fsui/qt/image.py index 8fc683db..3995cbfb 100644 --- a/fsui/qt/image.py +++ b/fsui/qt/image.py @@ -11,7 +11,7 @@ class Image: @classmethod def create_blank(cls, width: int, height: int) -> "Image": # qimage = QPixmap(16, 16).toImage() - qimage = QImage(QSize(16, 16), QImage.Format_ARGB32) + qimage = QImage(QSize(16, 16), QImage.Format.Format_ARGB32) qimage.fill(QColor(0, 0, 0, 0)) return Image(qimage=qimage) @@ -75,8 +75,8 @@ def qicon(self) -> QIcon: def grey_scale(self) -> "Image": # return Image(qimage=self.qimage.convertToFormat( - # QImage.Format_ARGB32, Qt.AutoOnly)) - copy = self.qimage.convertToFormat(QImage.Format_ARGB32, Qt.AutoColor) + # QImage.Format.Format_ARGB32, Qt.AutoOnly)) + copy = self.qimage.convertToFormat(QImage.Format.Format_ARGB32, Qt.ImageConversionFlag.AutoColor) # copy = self.qimage.copy(0, 0, *self.size) # WARNING: this is presumably a bit slow... @@ -109,11 +109,11 @@ def resize(self, size: Size, filter_: bool = True) -> None: if size == self.size: return if filter_: - q = Qt.SmoothTransformation + q = Qt.TransformationMode.SmoothTransformation else: - q = Qt.FastTransformation + q = Qt.TransformationMode.SmoothTransformation self.qimage = self.qimage.scaled( - size[0], size[1], Qt.IgnoreAspectRatio, q + size[0], size[1], Qt.AspectRatioMode.IgnoreAspectRatio, q ) # self._bitmap = None diff --git a/fsui/qt/label.py b/fsui/qt/label.py index 2da15739..ff246fba 100644 --- a/fsui/qt/label.py +++ b/fsui/qt/label.py @@ -27,14 +27,11 @@ def __init__( ) -> None: super().__init__(parent, label) - self.qLabel.setTextFormat(Qt.RichText) + self.qLabel.setTextFormat(Qt.TextFormat.RichText) # self.setTextInteractionFlags(fsui.qt.Qt.TextBrowserInteraction) if selectable: self.qLabel.setTextInteractionFlags( - cast( - Qt.TextInteractionFlags, - Qt.TextSelectableByMouse | Qt.LinksAccessibleByMouse, - ) + Qt.TextInteractionFlag.TextSelectableByMouse | Qt.TextInteractionFlag.LinksAccessibleByMouse, ) self.qLabel.setOpenExternalLinks(True) # self.setFocusPolicy(Qt.NoFocus) @@ -45,7 +42,7 @@ def __init__( def set_text_alignment(self, alignment: int) -> None: if alignment == 1: - self.qLabel.setAlignment(Qt.AlignHCenter) + self.qLabel.setAlignment(Qt.AlignmentFlag.AlignHCenter) def set_text_color(self, color: Color) -> None: palette = self.qLabel.palette() @@ -95,12 +92,12 @@ def __init__( if min_width: self.set_min_width(min_width) - self.qLabel.setTextFormat(Qt.RichText) - self.qLabel.setTextInteractionFlags(Qt.TextBrowserInteraction) + self.qLabel.setTextFormat(Qt.TextFormat.RichText) + self.qLabel.setTextInteractionFlags(Qt.TextInteractionFlag.TextBrowserInteraction) self.qLabel.setOpenExternalLinks(True) # FIXME: How to correctly fix multiple flags w.r.t typing? self.qLabel.setAlignment( - cast(Qt.AlignmentFlag, Qt.AlignLeft | Qt.AlignTop) + cast(Qt.AlignmentFlag, Qt.AlignmentFlag.AlignLeft | Qt.AlignmentFlag.AlignTop) ) def get_min_height(self, width: int) -> int: diff --git a/fsui/qt/listview.py b/fsui/qt/listview.py index 97975b0c..64ecace4 100644 --- a/fsui/qt/listview.py +++ b/fsui/qt/listview.py @@ -47,7 +47,7 @@ def __init__(self, parent: Widget, border: bool = True): selection_model = self.qListView.selectionModel() print("QListView selectionModel", selection_model) selection_model.selectionChanged.connect(self.__on_selection_changed) - self.qListView.setEditTriggers(QListView.NoEditTriggers) + self.qListView.setEditTriggers(QListView.EditTrigger.NoEditTriggers) self.qListView.doubleClicked.connect(self.__on_double_clicked) # self.returnPressed.connect(self.__double_clicked) # self.activated.connect(self.__double_clicked) @@ -83,7 +83,7 @@ def get_item_count(self) -> int: # FIXME: # def keyPressEvent(self, event): - # if event.key() == Qt.Key_Return: + # if event.key() == Qt.Key.Key_Return: # self.__double_clicked() # else: # super().keyPressEvent(event) diff --git a/fsui/qt/menu.py b/fsui/qt/menu.py index 162a39cf..5f006f8e 100644 --- a/fsui/qt/menu.py +++ b/fsui/qt/menu.py @@ -1,7 +1,7 @@ import weakref from typing import Any, Optional, Type -from PyQt5.QtGui import QMouseEvent +from PyQt6.QtGui import QMouseEvent from fscore.deprecated import deprecated from fscore.types import SimpleCallable diff --git a/fsui/qt/old_window.py b/fsui/qt/old_window.py index b99ea457..74587180 100644 --- a/fsui/qt/old_window.py +++ b/fsui/qt/old_window.py @@ -10,7 +10,7 @@ # from fsui import default_window_center, default_window_parent from fsui.qt.qt import ( - QDesktopWidget, + #QDesktopWidget, QEvent, QMainWindow, QObject, @@ -591,7 +591,8 @@ def offset_from_parent(self, offset): def center_on_screen(self): frame_rect = self._real_window.frameGeometry() - frame_rect.moveCenter(QDesktopWidget().availableGeometry().center()) + #frame_rect.moveCenter(QDesktopWidget().availableGeometry().center()) + frame_rect.moveCenter(QtGui.QGuiApplication.primaryScreen().availableGeometry().center()) self._real_window.move(frame_rect.topLeft()) def set_background_color(self, color): diff --git a/fsui/qt/panel.py b/fsui/qt/panel.py index b4f6a2c2..547178f7 100644 --- a/fsui/qt/panel.py +++ b/fsui/qt/panel.py @@ -124,14 +124,14 @@ def leaveEvent(self, a0: QEvent) -> None: self.owner().on_mouse_leave() def mouseDoubleClickEvent(self, a0: QMouseEvent) -> None: - if a0.button() == Qt.LeftButton: + if a0.button() == Qt.MouseButton.LeftButton: self.owner().on_left_dclick() def mouseMoveEvent(self, a0: QMouseEvent) -> None: self.owner().on_mouse_motion() def mousePressEvent(self, a0: QMouseEvent) -> None: - if a0.button() == Qt.LeftButton: + if a0.button() == Qt.MouseButton.LeftButton: # A temp code is made in case internalIgnoreNextLeftDownEvent is # altered inside on_left_down. ignore = self.owner().internalIgnoreNextLeftDownEvent @@ -142,7 +142,7 @@ def mousePressEvent(self, a0: QMouseEvent) -> None: self.owner().on_left_down() def mouseReleaseEvent(self, a0: QMouseEvent) -> None: - if a0.button() == Qt.LeftButton: + if a0.button() == Qt.MouseButton.LeftButton: self.owner().on_left_up() def owner(self) -> Panel: @@ -154,7 +154,7 @@ def paintEvent(self, a0: QPaintEvent) -> None: # return painter = QPainter(self) - painter.setRenderHint(QPainter.Antialiasing) + painter.setRenderHint(QPainter.RenderHint.Antialiasing) self.owner().internalSetPainter(painter) try: self.owner().on_paint() diff --git a/fsui/qt/pyqt5.py b/fsui/qt/pyqt6.py similarity index 85% rename from fsui/qt/pyqt5.py rename to fsui/qt/pyqt6.py index 0041c6d1..34ee661c 100644 --- a/fsui/qt/pyqt5.py +++ b/fsui/qt/pyqt6.py @@ -1,6 +1,6 @@ # Needed for rxpy scheduler -from PyQt5 import QtCore -from PyQt5.QtCore import ( +from PyQt6 import QtCore +from PyQt6.QtCore import ( QAbstractListModel, QCoreApplication, QEvent, @@ -12,8 +12,8 @@ QTimer, QUrl, ) -from PyQt5.QtCore import pyqtSignal as QSignal -from PyQt5.QtGui import ( +from PyQt6.QtCore import pyqtSignal as QSignal +from PyQt6.QtGui import ( QBrush, QCloseEvent, QColor, @@ -35,14 +35,13 @@ QStandardItemModel, QTextCursor, ) -from PyQt5.QtOpenGL import QGLWidget -from PyQt5.QtSvg import QSvgRenderer -from PyQt5.QtWidgets import ( +from PyQt6.QtOpenGLWidgets import QOpenGLWidget +from PyQt6.QtSvg import QSvgRenderer +from PyQt6.QtWidgets import ( QApplication, QCheckBox, QColorDialog, QComboBox, - QDesktopWidget, QDialog, QFileDialog, QFrame, @@ -59,6 +58,8 @@ QTextEdit, QWidget, ) +from PyQt6 import QtGui + __all__ = [ "QApplication", @@ -67,7 +68,6 @@ "QResizeEvent", "QColorDialog", "QComboBox", - "QDesktopWidget", "QDialog", "QFileDialog", "QFrame", @@ -84,7 +84,7 @@ "QTextEdit", "QWidget", "QSvgRenderer", - "QGLWidget", + #"QGLWidget", "QSvgRenderer", "QBrush", "QColor", diff --git a/fsui/qt/pyside2.py b/fsui/qt/pyside2.py index a1b9e746..e84d56ba 100644 --- a/fsui/qt/pyside2.py +++ b/fsui/qt/pyside2.py @@ -40,7 +40,7 @@ ) # noinspection PyUnresolvedReferences, PyPackageRequirements -from PySide2.QtOpenGL import QGLWidget +from PySide2.QtOpenGL import QWidget # noinspection PyUnresolvedReferences, PyPackageRequirements from PySide2.QtSvg import QSvgRenderer @@ -51,7 +51,7 @@ QCheckBox, QColorDialog, QComboBox, - QDesktopWidget, + #QDesktopWidget, QDialog, QFileDialog, QFrame, diff --git a/fsui/qt/qt.py b/fsui/qt/qt.py index f01b57e4..8d6a096f 100644 --- a/fsui/qt/qt.py +++ b/fsui/qt/qt.py @@ -10,8 +10,8 @@ # # noinspection PyUnresolvedReferences # from fsui.qt.pyside2 import * # else: -# from fsui.qt.pyqt5 import * -from fsui.qt.pyqt5 import * +# from fsui.qt.pyqt6 import * +from fsui.qt.pyqt6 import * # from fsui.qt.pyqt5 import ( # QAbstractListModel, @@ -106,7 +106,8 @@ def init_qt() -> QApplication: # Should not be necessary with Qt 5.2.x: # fix_qt_for_maverick() - QApplication.setAttribute(Qt.AA_EnableHighDpiScaling) + # FIXME commented out cause couldn't make work with Qt6 + #QApplication.setAttribute(Qt.AA_EnableHighDpiScaling) fstd.desktop.set_open_url_in_browser_function(open_url_in_browser) qapplication = QtBaseApplication(sys.argv) @@ -163,12 +164,12 @@ def initialize_qt_style(qapplication: QApplication) -> None: pa = QPalette() # background = QColor("#f6f5f4") background = QColor("#eae7e5") - pa.setColor(QPalette.Window, background) - pa.setColor(QPalette.AlternateBase, background) - pa.setColor(QPalette.Button, background) + pa.setColor(QPalette.ColorRole.Window, background) + pa.setColor(QPalette.ColorRole.AlternateBase, background) + pa.setColor(QPalette.ColorRole.Button, background) # pa.setColor(QPalette.Base, QColor(255, 255, 255)) pa.setColor( - QPalette.Disabled, QPalette.Base, QColor(241, 241, 241) + QPalette.ColorGroup.Disabled, QPalette.ColorRole.Base, QColor(241, 241, 241) ) # pa.setColor(QPalette.Window, QColor("#aeaeae")) @@ -178,25 +179,25 @@ def initialize_qt_style(qapplication: QApplication) -> None: qapplication.setPalette(pa) elif fusion_variant == "fws" or fusion_variant == "windows10": pa = QPalette() - pa.setColor(QPalette.Window, QColor(242, 242, 242)) - pa.setColor(QPalette.AlternateBase, QColor(242, 242, 242)) - pa.setColor(QPalette.Button, QColor(242, 242, 242)) + pa.setColor(QPalette.ColorRole.Window, QColor(242, 242, 242)) + pa.setColor(QPalette.ColorRole.AlternateBase, QColor(242, 242, 242)) + pa.setColor(QPalette.ColorRole.Button, QColor(242, 242, 242)) qapplication.setPalette(pa) elif fusion_variant == "dark": pa = QPalette() - pa.setColor(QPalette.Window, QColor(0x50, 0x50, 0x50)) - pa.setColor(QPalette.WindowText, Qt.white) - pa.setColor(QPalette.Base, QColor(25, 25, 25)) - pa.setColor(QPalette.AlternateBase, QColor(53, 53, 53)) - pa.setColor(QPalette.ToolTipBase, Qt.white) - pa.setColor(QPalette.ToolTipText, Qt.white) - pa.setColor(QPalette.Text, Qt.white) - pa.setColor(QPalette.Button, QColor(0x58, 0x58, 0x58)) - pa.setColor(QPalette.ButtonText, Qt.white) - pa.setColor(QPalette.BrightText, Qt.red) - pa.setColor(QPalette.Link, QColor(42, 130, 218)) - pa.setColor(QPalette.Highlight, QColor(42, 130, 218)) - pa.setColor(QPalette.HighlightedText, Qt.black) + pa.setColor(QPalette.ColorRole.Window, QColor(0x50, 0x50, 0x50)) + pa.setColor(QPalette.ColorRole.WindowText, Qt.GlobalColor.white) + pa.setColor(QPalette.ColorRole.Base, QColor(25, 25, 25)) + pa.setColor(QPalette.ColorRole.AlternateBase, QColor(53, 53, 53)) + pa.setColor(QPalette.ColorRole.ToolTipBase, Qt.GlobalColor.white) + pa.setColor(QPalette.ColorRole.ToolTipText, Qt.GlobalColor.white) + pa.setColor(QPalette.ColorRole.Text, Qt.GlobalColor.white) + pa.setColor(QPalette.ColorRole.Button, QColor(0x58, 0x58, 0x58)) + pa.setColor(QPalette.ColorRole.ButtonText, Qt.GlobalColor.white) + pa.setColor(QPalette.ColorRole.BrightText, Qt.GlobalColor.red) + pa.setColor(QPalette.ColorRole.Link, QColor(42, 130, 218)) + pa.setColor(QPalette.ColorRole.Highlight, QColor(42, 130, 218)) + pa.setColor(QPalette.ColorRole.HighlightedText, Qt.GlobalColor.black) qapplication.setPalette(pa) qapplication.setStyleSheet( "QToolTip { color: #ffffff; background-color: #2a82da; " diff --git a/fsui/qt/scrollarea.py b/fsui/qt/scrollarea.py index 28b38571..28eceda3 100644 --- a/fsui/qt/scrollarea.py +++ b/fsui/qt/scrollarea.py @@ -1,7 +1,7 @@ import weakref from typing import Optional, cast -from PyQt5.QtGui import QResizeEvent +from PyQt6.QtGui import QResizeEvent from typing_extensions import Protocol from fsui.qt.callafter import call_after @@ -58,9 +58,9 @@ def __init__(self, parent: Widget): # through). self.qScrollArea.viewport().setAutoFillBackground(False) - self.qScrollArea.setFrameShape(QFrame.NoFrame) - self.qScrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded) - self.qScrollArea.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded) + self.qScrollArea.setFrameShape(QFrame.Shape.NoFrame) + self.qScrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAsNeeded) + self.qScrollArea.setVerticalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAsNeeded) def get_child(self) -> Optional[Widget]: # child = self.__child() diff --git a/fsui/qt/textarea.py b/fsui/qt/textarea.py index 98496f11..ba4899f1 100644 --- a/fsui/qt/textarea.py +++ b/fsui/qt/textarea.py @@ -26,7 +26,7 @@ def __init__( ) -> None: super().__init__(parent, QTextEdit("", QParent(parent))) if not border: - self.qwidget.setFrameStyle(QFrame.NoFrame) + self.qwidget.setFrameStyle(QFrame.Shape.NoFrame) self.qwidget.setReadOnly(read_only) if font_family: print("FIXME: not respecting font_family yet") @@ -58,7 +58,7 @@ def __init__( def appendText(self, text: str) -> None: self.qwidget.append(text) - self.qwidget.moveCursor(QTextCursor.End) + self.qwidget.moveCursor(QTextCursor.MoveOperation.End) def appendTextWithColor(self, text: str, color: Optional[Color]) -> None: # text = text.replace("\n", "\r\n") @@ -89,7 +89,7 @@ def scrollToStart(self) -> None: # FIXME: The name is a bit misleading because it also moves the # text cursor to the start... """ - self.qwidget.moveCursor(QTextCursor.Start) + self.qwidget.moveCursor(QTextCursor.MoveOperation.Start) def setText(self, text: str) -> None: self.qwidget.setPlainText(text.replace("\n", "\r\n")) diff --git a/fsui/qt/toplevelwidget.py b/fsui/qt/toplevelwidget.py index 8224a2c8..1a0b1ecf 100644 --- a/fsui/qt/toplevelwidget.py +++ b/fsui/qt/toplevelwidget.py @@ -6,7 +6,7 @@ from fscore.deprecated import deprecated from fsui.common.layout import Layout from fsui.qt.icon import Icon -from fsui.qt.qt import QDesktopWidget, QSignal +from fsui.qt.qt import QSignal from fswidgets.qt.core import QEvent, QObject, Qt from fswidgets.qt.gui import QKeyEvent from fswidgets.qt.widgets import QWidget @@ -131,14 +131,14 @@ def isMaximizable(self) -> bool: return self.__maximizable def isMaximized(self) -> bool: - return int(self.qWidget.windowState()) & Qt.WindowMaximized != 0 + return int(self.qWidget.windowState().value) & Qt.WindowState.WindowMaximized.value != 0 def maximize(self, maximize: bool = True) -> None: """The maximize parameter is deprecated.""" self.setMaximized(maximize) def minimize(self) -> None: - self.qwidget.setWindowState(Qt.WindowMinimized) + self.qwidget.setWindowState(Qt.WindowState.WindowMinimized) def onClose(self) -> None: pass @@ -397,7 +397,8 @@ def center_on_window(self, other: "TopLevelWidget") -> None: def center_on_screen(self) -> None: frame_rect = self.qWidget.frameGeometry() - frame_rect.moveCenter(QDesktopWidget().availableGeometry().center()) + #frame_rect.moveCenter(QDesktopWidget().availableGeometry().center()) + frame_rect.moveCenter(QtGui.QGuiApplication.primaryScreen().availableGeometry().center()) self.qWidget.move(frame_rect.topLeft()) def close(self) -> None: @@ -408,7 +409,7 @@ def close(self) -> None: def __handleShortcut(self, key: int, super: bool) -> bool: print("Handleshortcut", key, super) - if key == Qt.Key_Escape: + if key == Qt.Key.Key_Escape: if hasattr(self, "end_modal"): self.end_modal(False) if hasattr(self, "endModal"): @@ -416,7 +417,7 @@ def __handleShortcut(self, key: int, super: bool) -> bool: self.close() return True # if System.windows: - if super and key == Qt.Key_Up: + if super and key == Qt.Key.Key_Up: if self.isMaximizable(): self.setMaximized(True) return False @@ -425,7 +426,7 @@ def eventFilter(self, a0: QObject, a1: QEvent) -> bool: obj = a0 event = a1 eventType = event.type() - if eventType == QEvent.Close: + if eventType == QEvent.Type.Close: assert obj == self._qwidget # print(f"DialogWrapper.closeEvent self={self})") # super().closeEvent(event) @@ -437,14 +438,15 @@ def eventFilter(self, a0: QObject, a1: QEvent) -> bool: internalWindowsSet.remove(self) self.onClose() self.on_close() - elif eventType == QEvent.KeyPress: + elif eventType == QEvent.Type.KeyPress: keyEvent = cast(QKeyEvent, event) - mod = int(keyEvent.modifiers()) + # Seems looking for a value and not the enum name + mod = int(keyEvent.modifiers().value) if self.__handleShortcut( - keyEvent.key(), (mod & Qt.MetaModifier != 0) + keyEvent.key(), (mod & Qt.KeyboardModifier.MetaModifier.value != 0) ): return True - # if keyEvent.key() == Qt.Key_Escape: + # if keyEvent.key() == Qt.Key.Key_Escape: # if hasattr(self, "end_modal"): # self.end_modal(False) # self.close() @@ -591,7 +593,7 @@ def set_maximized( print("size after showMaximized", self.getSize()) else: # self.restore_margins() - self.qwidget.setWindowState(Qt.WindowNoState) + self.qwidget.setWindowState(Qt.WindowState.WindowNoState) def set_size_from_layout(self, layout: Layout) -> None: size = layout.get_min_size() diff --git a/fsui/qt/util.py b/fsui/qt/util.py index 492e3dd4..7b3bfc07 100644 --- a/fsui/qt/util.py +++ b/fsui/qt/util.py @@ -5,15 +5,15 @@ from fsui.qt.qparent import QOptionalParent from fsui.qt.qt import init_qt from fsui.qt.toplevelwidget import TopLevelWidget -from fsui.qt.widgets import QDesktopWidget, QMessageBox +#from fsui.qt.widgets import QDesktopWidget, QMessageBox +from fsui.qt.widgets import QMessageBox from fswidgets.types import Size +from PyQt6 import QtGui def get_screen_size() -> Size: init_qt() - # FIXME: QDesktopWidget is deprecated - desktop = QDesktopWidget() - geometry = desktop.geometry() + geometry = QtGui.QGuiApplication.primaryScreen().availableGeometry() size = geometry.width(), geometry.height() print("using screen size", size) return size diff --git a/fsui/qt/verticalitemview.py b/fsui/qt/verticalitemview.py index 479bf4d0..7558eed5 100644 --- a/fsui/qt/verticalitemview.py +++ b/fsui/qt/verticalitemview.py @@ -27,7 +27,7 @@ def __init__(self, parent: QObject, parent2: HasItemCount) -> None: # def set_item_count(self, count): # self.count = count - # PyQt5-stubs uses parent = ... ? + # PyQt6-stubs uses parent = ... ? def rowCount(self, parent: QModelIndex) -> int: # type: ignore # print("returning count", self.count, "for parent", parent) # return self.count @@ -35,20 +35,20 @@ def rowCount(self, parent: QModelIndex) -> int: # type: ignore assert p is not None return p.get_item_count() - # PyQt5-stubs uses parent = ... ? + # PyQt6-stubs uses parent = ... ? def data(self, index: QModelIndex, role: int) -> Any: # type: ignore row = index.row() # print("data for", index, "role", role) - if role == Qt.SizeHintRole: + if role == Qt.ItemDataRole.SizeHintRole: height = self.parent()._row_height return QSize(height, height) - elif role == Qt.DecorationRole: + elif role == Qt.ItemDataRole.DecorationRole: icon = self.parent().get_item_icon(row) if icon: return icon.qpixmap - elif role == Qt.DisplayRole: + elif role == Qt.ItemDataRole.DisplayRole: return self.parent().get_item_text(row) - elif role == Qt.ForegroundRole: + elif role == Qt.ItemDataRole.ForegroundRole: color = self.parent().get_item_text_color(row) if color is not None: return QBrush(color) @@ -85,7 +85,7 @@ def set_row_height(self, height: int) -> None: # FIXME # def keyPressEvent(self, event): - # if event.key() == Qt.Key_Return: + # if event.key() == Qt.Key.Key_Return: # self.__double_clicked() # else: # QListView.keyPressEvent(self, event) diff --git a/fsui/qt/widgets.py b/fsui/qt/widgets.py index 8c500986..6ffb204f 100644 --- a/fsui/qt/widgets.py +++ b/fsui/qt/widgets.py @@ -1,5 +1,4 @@ -from PyQt5.QtWidgets import ( - QDesktopWidget, +from PyQt6.QtWidgets import ( QDialog, QFrame, QLineEdit, @@ -10,7 +9,6 @@ ) __all__ = [ - "QDesktopWidget", "QDialog", "QFrame", "QLineEdit", diff --git a/fsui/qt/window.py b/fsui/qt/window.py index 86fd128a..a6a241a3 100644 --- a/fsui/qt/window.py +++ b/fsui/qt/window.py @@ -1,7 +1,7 @@ import weakref from typing import Any, Optional, Tuple, cast -from PyQt5.QtGui import QMoveEvent, QResizeEvent, QShowEvent +from PyQt6.QtGui import QMoveEvent, QResizeEvent, QShowEvent from fscore.deprecated import deprecated from fscore.system import System @@ -32,28 +32,28 @@ def __init__( super().__init__(QOptionalParent(parent, window=True)) # self.margins = Margins() self.setWindowTitle(title) - self.setAttribute(Qt.WA_DeleteOnClose) + self.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose) - flags: int = Qt.Window + flags: int = Qt.WindowType.Window if System.macos: - flags &= ~Qt.WindowFullscreenButtonHint + flags &= ~Qt.WindowType.WindowFullscreenButtonHint if border: - flags |= Qt.CustomizeWindowHint - flags |= Qt.WindowCloseButtonHint - flags |= Qt.WindowTitleHint + flags |= Qt.WindowType.CustomizeWindowHint + flags |= Qt.WindowType.WindowCloseButtonHint + flags |= Qt.WindowType.WindowTitleHint if minimizable: - flags |= Qt.WindowMinimizeButtonHint + flags |= Qt.WindowType.WindowMinimizeButtonHint if maximizable: - flags |= Qt.WindowMaximizeButtonHint + flags |= Qt.WindowType.WindowMaximizeButtonHint # else: - # flags &= ~Qt.WindowMaximizeButtonHint + # flags &= ~Qt.WindowType.WindowMaximizeButtonHint else: - flags |= Qt.FramelessWindowHint + flags |= Qt.WindowType.FramelessWindowHint # flags |= Qt.NoDropShadowWindowHint if below: - flags |= Qt.WindowStaysOnBottomHint - self.setWindowFlags(cast(Qt.WindowFlags, flags)) + flags |= Qt.WindowType.WindowStaysOnBottomHint + self.setWindowFlags(flags) # self.setAttribute(Qt.WA_DeleteOnClose, True) # self._child = weakref.ref(child) @@ -290,7 +290,7 @@ def set_fullscreen( print("size after showFullScreen", (self.size())) else: self.restore_margins() - self.setWindowState(Qt.WindowNoState) + self.setWindowState(Qt.WindowState.WindowNoState) def show( self, diff --git a/fswidgets/splitter.py b/fswidgets/splitter.py index 10c4bd70..19b54895 100644 --- a/fswidgets/splitter.py +++ b/fswidgets/splitter.py @@ -1,4 +1,5 @@ from enum import Enum +from tkinter import HORIZONTAL from typing import List, Optional, cast from fsui import Widget @@ -35,9 +36,9 @@ def __init__( super().__init__( parent, qwidget=QSplitter( - Qt.Horizontal + Qt.Orientation.Horizontal if orientation == self.HORIZONTAL - else Qt.Vertical, + else Qt.Orientation.Vertical, QParent(parent), ), ) diff --git a/fswidgets/widget.py b/fswidgets/widget.py index 87ccbb38..5af526da 100644 --- a/fswidgets/widget.py +++ b/fswidgets/widget.py @@ -125,13 +125,13 @@ def eventFilter(self, a0: QObject, a1: QEvent) -> bool: obj = a0 event = a1 event_type = event.type() - if event_type == QEvent.Resize: + if event_type == QEvent.Type.Resize: if obj == self.qwidget: self.on_resize() - elif event_type == QEvent.Show: + elif event_type == QEvent.Type.Show: if obj == self.qwidget: self.on_show() - elif event_type == QEvent.Timer: + elif event_type == QEvent.Type.Timer: timerEvent = cast(QTimerEvent, event) if timerEvent.timerId() == self.__timer_id: # print("-> on_timer") @@ -139,7 +139,7 @@ def eventFilter(self, a0: QObject, a1: QEvent) -> bool: return True # else: # print("other timer event") - elif event_type == QEvent.WindowActivate: + elif event_type == QEvent.Type.WindowActivate: # print("activated", obj) if obj == self.qwidget: if not self.__window_focused: @@ -148,7 +148,7 @@ def eventFilter(self, a0: QObject, a1: QEvent) -> bool: # self.window_focus_changed.emit() self.onWindowFocusChanged() # return True - elif event_type == QEvent.WindowDeactivate: + elif event_type == QEvent.Type.WindowDeactivate: if obj == self.qwidget: # print("deactivateEvent", obj) if self.__window_focused: @@ -339,20 +339,21 @@ def setFont(self, font: Font) -> None: def setMoveCursor(self) -> None: # FIXME: self.setCursor(Cursor.MOVE)? - self.qwidget.setCursor(Qt.SizeAllCursor) + self.qwidget.setCursor(Qt.CursorShape.SizeAllCursor) def setNormalCursor(self) -> None: # FIXME: self.setCursor(Cursor.DEFAULT)? - self.qwidget.setCursor(Qt.ArrowCursor) + self.qwidget.setCursor(Qt.CursorShape.ArrowCursor) def setPointingHandCursor(self) -> None: - self.qwidget.setCursor(Qt.PointingHandCursor) + self.qwidget.setCursor(Qt.CursorShape.PointingHandCursor) def setPosition(self, position: Point) -> None: self.qwidget.move(position[0], position[1]) def setPositionAndSize(self, position: Point, size: Size) -> None: - self.qwidget.setGeometry(position[0], position[1], size[0], size[1]) + # FIXME forcing int unsure why coming in as a float + self.qwidget.setGeometry(position[0], int(position[1]), size[0], size[1]) # return self def setQWidget(self, qwidget: QWidget) -> None: @@ -362,7 +363,7 @@ def setQWidget(self, qwidget: QWidget) -> None: def setResizeCursor(self) -> None: # FIXME: self.setCursor(Cursor.RESIZE)? - self.qwidget.setCursor(Qt.SizeFDiagCursor) + self.qwidget.setCursor(Qt.CursorShape.SizeFDiagCursor) def setSize(self, size: Size) -> None: self.qwidget.resize(size[0], size[1]) @@ -448,7 +449,7 @@ def popup_menu( global_pos = widget.mapToGlobal(QPoint(pos[0], pos[1])) menu.setParent(self) if blocking: - menu.qmenu.exec_(global_pos) + menu.qmenu.exec(global_pos) else: menu.qmenu.popup(global_pos) @@ -464,7 +465,7 @@ def popup_menu( def get_background_color(self) -> Color: # noinspection PyUnresolvedReferences # FIXME: Use cached value from set_background_color? - return Color(self.qwidget.palette().color(QPalette.Window)) + return Color(self.qwidget.palette().color(QPalette.ColorRole.Window)) def get_container(self) -> QWidget: return self.widget() diff --git a/launcher/apps/fs_game_center.py b/launcher/apps/fs_game_center.py index 46a7219a..c7b2a8ec 100644 --- a/launcher/apps/fs_game_center.py +++ b/launcher/apps/fs_game_center.py @@ -31,10 +31,10 @@ def http_server_thread(): # window.setFlags(Qt.FramelessWindowHint) window.setFlags( - Qt.Window - | Qt.FramelessWindowHint - | Qt.WindowMinimizeButtonHint - | Qt.WindowSystemMenuHint + Qt.WindowType.Window + | Qt.WindowType.FramelessWindowHint + | Qt.WindowType.WindowMinimizeButtonHint + | Qt.WindowType.WindowSystemMenuHint ) # window.show() window.showMaximized() diff --git a/launcher/apps/launcher2.py b/launcher/apps/launcher2.py index 5dda549b..0470b518 100644 --- a/launcher/apps/launcher2.py +++ b/launcher/apps/launcher2.py @@ -37,7 +37,7 @@ def app_main(appname=None): except Exception as e: # We should be able to show a Qt error message dialog at least now # pylint: disable=no-name-in-module - from PyQt5.QtWidgets import QMessageBox + from PyQt6.QtWidgets import QMessageBox message = ( f"An error of type {type(e).__name__} occurred during startup." @@ -99,7 +99,7 @@ def _app_main_2(qapplication, appname): else: wsopen("SYS:Launcher") - qapplication.exec_() + qapplication.exec() def wsopen_main(appname): diff --git a/launcher/ui/skin.py b/launcher/ui/skin.py index 2312ed16..ab632836 100644 --- a/launcher/ui/skin.py +++ b/launcher/ui/skin.py @@ -32,13 +32,13 @@ def __init__(self): from fsui.qt import QPalette palette = QPalette() - self.sidebar_list_background = fsui.Color(palette.color(QPalette.Base)) + self.sidebar_list_background = fsui.Color(palette.color(QPalette.ColorRole.Base)) self.sidebar_list_row_height = 28 self.sidebar_list_row_text = fsui.Color( - palette.color(QPalette.HighlightedText) + palette.color(QPalette.ColorRole.HighlightedText) ) self.sidebar_list_row_background = fsui.Color( - palette.color(QPalette.Highlight) + palette.color(QPalette.ColorRole.Highlight) ) if Skin.fws(): diff --git a/pyproject.toml b/pyproject.toml index 3c107fec..91eec880 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,7 +16,7 @@ case_sensitive = false follow_links = false [tool.pylint.MASTER] -extension-pkg-whitelist = ["PyQt5"] +extension-pkg-whitelist = ["PyQt6"] [tool.pylint."MESSAGES CONTROL"] disable = [ diff --git a/system/classes/theme.py b/system/classes/theme.py index cce50c48..8e15001d 100644 --- a/system/classes/theme.py +++ b/system/classes/theme.py @@ -15,7 +15,7 @@ def set_colors( disabled: Union[QColor, str] = None, ): palette.setColor(role, QColor(normal)) - palette.setColor(QPalette.Disabled, role, QColor(disabled)) + palette.setColor(QPalette.ColorGroup.Disabled, role, QColor(disabled)) def initialize_qt_style(qapplication, theme): @@ -33,17 +33,17 @@ def initialize_qt_style(qapplication, theme): text = "#000000" text_disabled = "#777777" - pa.setColor(QPalette.Window, background) - pa.setColor(QPalette.AlternateBase, background) - pa.setColor(QPalette.Button, background) + pa.setColor(QPalette.ColorRole.Window, background) + pa.setColor(QPalette.ColorRole.AlternateBase, background) + pa.setColor(QPalette.ColorRole.Button, background) - pa.setColor(QPalette.Highlight, QColor(0x66, 0x88, 0xBB)) + pa.setColor(QPalette.ColorRole.Highlight, QColor(0x66, 0x88, 0xBB)) - set_colors(pa, QPalette.Base, "#E8E8E8", "#C0C0C0") + set_colors(pa, QPalette.ColorRole.Base, "#E8E8E8", "#C0C0C0") - set_colors(pa, QPalette.Text, text, text_disabled) - set_colors(pa, QPalette.WindowText, text, text_disabled) - set_colors(pa, QPalette.ButtonText, text, text_disabled) + set_colors(pa, QPalette.ColorRole.Text, text, text_disabled) + set_colors(pa, QPalette.ColorRole.WindowText, text, text_disabled) + set_colors(pa, QPalette.ColorRole.ButtonText, text, text_disabled) # pa.setColor(QPalette.Base, QColor(0xE8, 0xE8, 0xE8)) # pa.setColor(QPalette.Disabled, QPalette.Base, QColor(0xC0, 0xC0, 0xC0)) @@ -195,7 +195,7 @@ def initialize_qt_style(qapplication, theme): # font.setHintingPreference(QFont.PreferNoHinting) # font = QFont("Saira Condensed", 16, QFont.Medium) - font = QFont("Roboto", 15, QFont.Normal) + font = QFont("Roboto", 15, QFont.Weight.Normal) font.setPixelSize(15) qapplication.setFont(font) diff --git a/system/exceptionhandler.py b/system/exceptionhandler.py index 018ca517..d2d914cc 100644 --- a/system/exceptionhandler.py +++ b/system/exceptionhandler.py @@ -162,6 +162,6 @@ def error_displaying_exception_2(e, e2): "Please see the log file(s) for full error messages and stack traces." ) # pylint: disable=no-name-in-module - from PyQt5.QtWidgets import QMessageBox + from PyQt6.QtWidgets import QMessageBox QMessageBox.critical(None, "Software Failure (2)", message) diff --git a/system/prefs/appearance.py b/system/prefs/appearance.py index 79c0e1f2..0f67cd43 100644 --- a/system/prefs/appearance.py +++ b/system/prefs/appearance.py @@ -107,8 +107,8 @@ def on_activate(self): self.dialog = QColorDialog(parent=get_window(self)._qwidget) # dialog.setOption(QColorDialog.ShowAlphaChannel) - self.dialog.setOption(QColorDialog.NoButtons) - self.dialog.setOption(QColorDialog.DontUseNativeDialog) + self.dialog.setOption(QColorDialog.ColorDialogOption.NoButtons) + self.dialog.setOption(QColorDialog.ColorDialogOption.DontUseNativeDialog) # Setting initial color only seems to work after setting options. # Calling this method earlier (or setting initial color in constructor) # seems to be ignored causing black color to be pre-selected. @@ -129,7 +129,7 @@ def eventFilter(self, obj, event): from fsui.qt import QEvent # print("eventFilter", obj, event, event.type(), QEvent.Close) - if event.type() == QEvent.Close: + if event.type() == QEvent.Type.Close: print("----") print("Dialog Window closed") print("----") diff --git a/system/utilities/clock.py b/system/utilities/clock.py index 4bd6301a..cbc72ddb 100644 --- a/system/utilities/clock.py +++ b/system/utilities/clock.py @@ -69,11 +69,11 @@ def __init__(self, parent): def paintEvent(self, event): painter = QPainter(self) - painter.setRenderHints(QPainter.Antialiasing) + painter.setRenderHints(QPainter.RenderHint.Antialiasing) pen = QPen(QColor(0x80, 0x80, 0x80)) pen.setWidth(2) painter.setPen(pen) - painter.setBrush(QBrush(Qt.white)) + painter.setBrush(QBrush(Qt.GlobalColor.white)) x = 1 y = 1 w = self.width() - 2 @@ -82,19 +82,19 @@ def paintEvent(self, event): rect = QRect(x, y, w, h) painter.drawEllipse(rect) - cx = x + w / 2 - cy = y + h / 2 + cx = int(x + w / 2) + cy = int(y + h / 2) a = w / 2 * 0.85 b = h / 2 * 0.85 pen.setWidth(0) painter.setPen(pen) - painter.setBrush(QBrush(Qt.black)) + painter.setBrush(QBrush(Qt.GlobalColor.black)) for i in range(12): px = cx + a * math.cos(2 * math.pi * i / 12) py = cy + b * math.sin(2 * math.pi * i / 12) - painter.drawEllipse(px - 3, py - 3, 6, 6) + painter.drawEllipse(int(px - 3), int(py - 3), 6, 6) hours, minutes, seconds = self.time[3:] minutes += seconds / 60.0 @@ -126,8 +126,8 @@ def paintEvent(self, event): def draw_hand_line(self, painter, w, h, cx, cy, a, b, degrees): f2 = -math.pi / 2.0 painter.drawLine( - cx, - cy, - cx + a * math.cos(degrees + f2), - cy + b * math.sin(degrees + f2), + int(cx), + int(cy), + int(cx + a * math.cos(degrees + f2)), + int(cy + b * math.sin(degrees + f2)), ) diff --git a/workspace/shell/window.py b/workspace/shell/window.py index 39f0485d..e3d35fe9 100644 --- a/workspace/shell/window.py +++ b/workspace/shell/window.py @@ -62,14 +62,14 @@ def __init__(self, parent, *, argv, columns=80, rows=24): # FIXME: Using Qt directly from fsui.qt import QPainter, QPixmap, Qt - self._widget.setFocusPolicy(Qt.StrongFocus) + self._widget.setFocusPolicy(Qt.FocusPolicy.StrongFocus) painter = QPainter() pixmap = QPixmap(100, 100) painter.begin(pixmap) painter.setFont(self.font.qfont) size = painter.boundingRect( - 0, 0, 10000, 1000, Qt.AlignLeft | Qt.AlignTop, " " * columns + 0, 0, 10000, 1000, Qt.AlignmentFlag.AlignLeft | Qt.AlignmentFlag.AlignTop, " " * columns ) painter.end() print(size) diff --git a/workspace/ui/window.py b/workspace/ui/window.py index 59fb8727..f5b596e3 100644 --- a/workspace/ui/window.py +++ b/workspace/ui/window.py @@ -44,9 +44,9 @@ def __init__(self, parent, title, child): # self.setWindowFlags(Qt.FramelessWindowHint) from fsui.qt import Qt - self.setAttribute(Qt.WA_NoSystemBackground) - self.setAttribute(Qt.WA_TranslucentBackground) - self.setAttribute(Qt.WA_TransparentForMouseEvents) + self.setAttribute(Qt.WidgetAttribute.WA_NoSystemBackground) + self.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground) + self.setAttribute(Qt.WidgetAttribute.WA_TransparentForMouseEvents) def paintEvent(self, event): # noinspection PyNoneFunctionAssignment