Compare commits
16 Commits
python-ins
...
pyside6-un
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b7b1d6d4e9 | ||
|
|
a90417de55 | ||
|
|
73f08df224 | ||
|
|
db9babbdca | ||
|
|
463dd2261e | ||
|
|
4dd66969af | ||
|
|
2c98003219 | ||
|
|
dd853a8f72 | ||
|
|
88d5e6b29d | ||
|
|
71e5d8cc31 | ||
|
|
15b3843172 | ||
|
|
3cffe3b3be | ||
|
|
9dd87b7777 | ||
|
|
b057cf905b | ||
|
|
d7943d30d8 | ||
|
|
1826d68841 |
@@ -1,4 +1,4 @@
|
|||||||
[codespell]
|
[codespell]
|
||||||
skip = ./build-*,.git
|
skip = ./build-*,.git,*.svg,rc_assets.py
|
||||||
interactive = 3
|
interactive = 3
|
||||||
ignore-words-list = overlay,overlayed
|
ignore-words-list = overlay,overlayed
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT APPLE) OR
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# cannot enable this for clang + sanitizers
|
# cannot enable this for clang + sanitizers
|
||||||
if (NOT sanitizers_enabled OR NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
if(NOT sanitizers_enabled OR NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||||
# Do not allow undefined symbols, even in non-symbolic shared libraries
|
# Do not allow undefined symbols, even in non-symbolic shared libraries
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_SHARED_LINKER_FLAGS}")
|
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_SHARED_LINKER_FLAGS}")
|
||||||
set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_MODULE_LINKER_FLAGS}")
|
set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_MODULE_LINKER_FLAGS}")
|
||||||
@@ -267,13 +267,6 @@ endif()
|
|||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|
||||||
if(${PROJECT_NAME}_PYTHON_BINDINGS)
|
|
||||||
if(CMAKE_BUILD_TYPE MATCHES "^[Dd]eb" OR ${PROJECT_NAME}_STATIC)
|
|
||||||
message(FATAL_ERROR "** Python Bindings are disabled in debug or static builds.")
|
|
||||||
endif()
|
|
||||||
add_subdirectory(python)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(${PROJECT_NAME}_IS_ROOT_PROJECT)
|
if(${PROJECT_NAME}_IS_ROOT_PROJECT)
|
||||||
if(${PROJECT_NAME}_EXAMPLES)
|
if(${PROJECT_NAME}_EXAMPLES)
|
||||||
if(${PROJECT_NAME}_QTQUICK)
|
if(${PROJECT_NAME}_QTQUICK)
|
||||||
@@ -339,4 +332,11 @@ if(${PROJECT_NAME}_IS_ROOT_PROJECT)
|
|||||||
include(ECMUninstallTarget)
|
include(ECMUninstallTarget)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(${PROJECT_NAME}_PYTHON_BINDINGS)
|
||||||
|
if(CMAKE_BUILD_TYPE MATCHES "^[Dd]eb" OR ${PROJECT_NAME}_STATIC)
|
||||||
|
message(FATAL_ERROR "** Python Bindings are disabled in debug or static builds.")
|
||||||
|
endif()
|
||||||
|
add_subdirectory(python)
|
||||||
|
endif()
|
||||||
|
|
||||||
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
|
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
|
||||||
|
|||||||
@@ -130,6 +130,11 @@ macro(CREATE_PYTHON_BINDINGS
|
|||||||
OUTPUT_NAME ${MODULE_NAME}
|
OUTPUT_NAME ${MODULE_NAME}
|
||||||
LIBRARY_OUTPUT_DIRECTORY ${MODULE_OUTPUT_DIR}
|
LIBRARY_OUTPUT_DIRECTORY ${MODULE_OUTPUT_DIR}
|
||||||
)
|
)
|
||||||
|
if(APPLE)
|
||||||
|
set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH "@loader_path")
|
||||||
|
elseif(NOT WIN32) #ie. linux
|
||||||
|
set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH "$ORIGIN")
|
||||||
|
endif()
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set_target_properties(${TARGET_NAME} PROPERTIES SUFFIX ".pyd")
|
set_target_properties(${TARGET_NAME} PROPERTIES SUFFIX ".pyd")
|
||||||
|
|||||||
@@ -130,6 +130,11 @@ macro(CREATE_PYTHON_BINDINGS
|
|||||||
OUTPUT_NAME ${MODULE_NAME}
|
OUTPUT_NAME ${MODULE_NAME}
|
||||||
LIBRARY_OUTPUT_DIRECTORY ${MODULE_OUTPUT_DIR}
|
LIBRARY_OUTPUT_DIRECTORY ${MODULE_OUTPUT_DIR}
|
||||||
)
|
)
|
||||||
|
if(APPLE)
|
||||||
|
set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH "@loader_path")
|
||||||
|
elseif(NOT WIN32) #ie. linux
|
||||||
|
set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH "$ORIGIN")
|
||||||
|
endif()
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set_target_properties(${TARGET_NAME} PROPERTIES SUFFIX ".pyd")
|
set_target_properties(${TARGET_NAME} PROPERTIES SUFFIX ".pyd")
|
||||||
|
|||||||
@@ -9,6 +9,11 @@
|
|||||||
Contact KDAB at <info@kdab.com> for commercial licensing options.
|
Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef EXAMPLETITLEBAR_CSS_H
|
||||||
|
#define EXAMPLETITLEBAR_CSS_H
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
#include <kddockwidgets/private/widgets/TitleBarWidget_p.h>
|
#include <kddockwidgets/private/widgets/TitleBarWidget_p.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -77,3 +82,5 @@ public:
|
|||||||
MyTitleBar_CSS::~MyTitleBar_CSS()
|
MyTitleBar_CSS::~MyTitleBar_CSS()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -39,3 +39,4 @@ set(${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX "${${PROJECT_NAME}_PYTHON_BIN
|
|||||||
|
|
||||||
include(PySide${PYSIDE_MAJOR_VERSION}ModuleBuild)
|
include(PySide${PYSIDE_MAJOR_VERSION}ModuleBuild)
|
||||||
add_subdirectory(PyKDDockWidgets)
|
add_subdirectory(PyKDDockWidgets)
|
||||||
|
add_subdirectory(tests)
|
||||||
|
|||||||
@@ -81,5 +81,19 @@ create_python_bindings(
|
|||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/__init__.py.cmake ${CMAKE_CURRENT_BINARY_DIR}/__init__.py @ONLY)
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/__init__.py.cmake ${CMAKE_CURRENT_BINARY_DIR}/__init__.py @ONLY)
|
||||||
|
|
||||||
# install
|
# install
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/__init__.py
|
install(
|
||||||
DESTINATION ${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX})
|
FILES
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/__init__.py
|
||||||
|
$<TARGET_FILE:KDAB::kddockwidgets>
|
||||||
|
DESTINATION
|
||||||
|
${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX}
|
||||||
|
)
|
||||||
|
if(NOT WIN32)
|
||||||
|
install(
|
||||||
|
FILES
|
||||||
|
$<TARGET_LINKER_FILE:KDAB::kddockwidgets>
|
||||||
|
$<TARGET_SONAME_FILE:KDAB::kddockwidgets>
|
||||||
|
DESTINATION
|
||||||
|
${${PROJECT_NAME}_PYTHON_BINDINGS_INSTALL_PREFIX}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|||||||
@@ -10,9 +10,31 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
import os
|
||||||
|
|
||||||
__all__ = ['KDDockWidgets']
|
__all__ = ['KDDockWidgets']
|
||||||
|
|
||||||
|
def setupLibraryPath():
|
||||||
|
if sys.platform != 'win32':
|
||||||
|
return
|
||||||
|
|
||||||
|
if "@PYSIDE_MAJOR_VERSION@" == "6":
|
||||||
|
from shiboken@PYSIDE_MAJOR_VERSION@ import Shiboken
|
||||||
|
else:
|
||||||
|
from shiboken@PYSIDE_MAJOR_VERSION@ import shiboken@PYSIDE_MAJOR_VERSION@ as Shiboken
|
||||||
|
|
||||||
|
from PySide@PYSIDE_MAJOR_VERSION@ import QtCore
|
||||||
|
extra_dll_dirs = [ os.path.abspath(os.path.dirname(Shiboken.__file__)),
|
||||||
|
os.path.abspath(os.path.dirname(QtCore.__file__)),
|
||||||
|
os.path.abspath(os.path.dirname(__file__)) ]
|
||||||
|
|
||||||
|
if sys.version_info[0] == 3 and sys.version_info[1] >= 8:
|
||||||
|
for dll_dir in extra_dll_dirs:
|
||||||
|
os.add_dll_directory(dll_dir)
|
||||||
|
|
||||||
|
for dll_dir in extra_dll_dirs:
|
||||||
|
os.environ['PATH'] = os.fspath(dll_dir) + os.pathsep + os.environ['PATH']
|
||||||
|
|
||||||
# Preload PySide libraries to avoid missing libraries while loading KDDockWidgets
|
# Preload PySide libraries to avoid missing libraries while loading KDDockWidgets
|
||||||
try:
|
try:
|
||||||
from PySide@PYSIDE_MAJOR_VERSION@ import QtCore
|
from PySide@PYSIDE_MAJOR_VERSION@ import QtCore
|
||||||
@@ -22,3 +44,5 @@ try:
|
|||||||
except Exception:
|
except Exception:
|
||||||
print("Failed to load PySide")
|
print("Failed to load PySide")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
setupLibraryPath()
|
||||||
|
|||||||
40
python/tests/CMakeLists.txt
Normal file
40
python/tests/CMakeLists.txt
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
#
|
||||||
|
# This file is part of KDDockWidgets.
|
||||||
|
#
|
||||||
|
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||||
|
# Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||||
|
#
|
||||||
|
# Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||||
|
#
|
||||||
|
|
||||||
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.py.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.py @ONLY)
|
||||||
|
|
||||||
|
set(TEST_PYTHONPATH
|
||||||
|
${CMAKE_BINARY_DIR}/python
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
)
|
||||||
|
set(TEST_LIBRARYPATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
set(TEST_LIBRARY_VAR "PATH")
|
||||||
|
string(REPLACE "\\" "/" TEST_PYTHONPATH "${TEST_PYTHONPATH}")
|
||||||
|
string(REPLACE "\\" "/" TEST_LIBRARYPATH "${TEST_LIBRARYPATH}")
|
||||||
|
list(JOIN TEST_PYTHONPATH "\\;" TEST_PYTHONPATH)
|
||||||
|
list(JOIN TEST_LIBRARYPATH "\\;" TEST_LIBRARYPATH)
|
||||||
|
else()
|
||||||
|
set(TEST_LIBRARY_VAR "LD_LIBRARY_PATH")
|
||||||
|
list(JOIN TEST_PYTHONPATH ":" TEST_PYTHONPATH)
|
||||||
|
list(JOIN TEST_LIBRARYPATH ":" TEST_LIBRARYPATH)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(PYTHON_ENV_COMMON "PYTHONPATH=${TEST_PYTHONPATH};${TEST_LIBRARY_VAR}=${TEST_LIBRARYPATH}")
|
||||||
|
|
||||||
|
file(GLOB TEST_FILES ${CMAKE_CURRENT_SOURCE_DIR}/tst_*.py)
|
||||||
|
foreach(test_file ${TEST_FILES})
|
||||||
|
get_filename_component(test_name ${test_file} NAME_WE)
|
||||||
|
add_test(${test_name} ${Python3_EXECUTABLE} ${test_file})
|
||||||
|
set_tests_properties(${test_name} PROPERTIES ENVIRONMENT "${PYTHON_ENV_COMMON}")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
19
python/tests/config.py.cmake
Normal file
19
python/tests/config.py.cmake
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# This file is part of KDDockWidgets.
|
||||||
|
#
|
||||||
|
# SPDX-FileCopyrightText: 2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||||
|
# Author: Renato Araujo <renato.araujo@kdab.com>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||||
|
#
|
||||||
|
# Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||||
|
#
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class TstConfig(object):
|
||||||
|
bindingsNamespace = "PyKDDockWidgets"
|
||||||
|
|
||||||
|
def initLibraryPath():
|
||||||
|
if sys.platform == 'win32' and sys.version_info[0] == 3 and sys.version_info[1] >= 8:
|
||||||
|
os.add_dll_directory("@CMAKE_RUNTIME_OUTPUT_DIRECTORY@")
|
||||||
30
python/tests/tst_importModule.py
Normal file
30
python/tests/tst_importModule.py
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
# This file is part of KDDockWidgets.
|
||||||
|
#
|
||||||
|
# SPDX-FileCopyrightText: 2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||||
|
# Author: Renato Araujo <renato.araujo@kdab.com>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||||
|
#
|
||||||
|
# Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||||
|
#
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import importlib
|
||||||
|
import inspect
|
||||||
|
|
||||||
|
from config import TstConfig
|
||||||
|
|
||||||
|
class TestImportModules(unittest.TestCase):
|
||||||
|
def test_importModules(self):
|
||||||
|
m = importlib.import_module(TstConfig.bindingsNamespace + '.KDDockWidgets')
|
||||||
|
moduleSymbols = []
|
||||||
|
for t in inspect.getmembers(m):
|
||||||
|
moduleSymbols.append(t[0])
|
||||||
|
|
||||||
|
symbols = ['MainWindow', 'DockWidget']
|
||||||
|
for symbol in symbols:
|
||||||
|
self.assertIn(symbol, moduleSymbols)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
TstConfig.initLibraryPath()
|
||||||
|
unittest.main()
|
||||||
@@ -205,7 +205,7 @@ public:
|
|||||||
|
|
||||||
///@brief By default equivalent to QWidget::normalGeometry()
|
///@brief By default equivalent to QWidget::normalGeometry()
|
||||||
/// Derived classes can implement something different here, to workaround window manager issues with Qt::Tool
|
/// Derived classes can implement something different here, to workaround window manager issues with Qt::Tool
|
||||||
/// Also useful for QtQuick to eventually perserve normal geometry uppon save/restore of a maximized window. As
|
/// Also useful for QtQuick to eventually preserve normal geometry upon save/restore of a maximized window. As
|
||||||
/// QWindow has no notion of normal geometry, so we need to implement it here.
|
/// QWindow has no notion of normal geometry, so we need to implement it here.
|
||||||
/// @sa QTBUG-95478
|
/// @sa QTBUG-95478
|
||||||
virtual QRect normalGeometry() const;
|
virtual QRect normalGeometry() const;
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ void TabWidgetWidget::showContextMenu(QPoint pos)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
QTabBar *tabBar = QTabWidget::tabBar();
|
QTabBar *tabBar = QTabWidget::tabBar();
|
||||||
// We dont want context menu if there is only one tab
|
// We don't want context menu if there is only one tab
|
||||||
if (tabBar->count() <= 1)
|
if (tabBar->count() <= 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -27,9 +27,9 @@ using namespace KDDockWidgets;
|
|||||||
using namespace KDDockWidgets::Testing;
|
using namespace KDDockWidgets::Testing;
|
||||||
using namespace KDDockWidgets::Testing::Operations;
|
using namespace KDDockWidgets::Testing::Operations;
|
||||||
|
|
||||||
static QString operationTypeStr(OperationType ot)
|
static QString operationTypeStr(OperationType optype)
|
||||||
{
|
{
|
||||||
return QMetaEnum::fromType<OperationType>().valueToKey(ot);
|
return QMetaEnum::fromType<OperationType>().valueToKey(optype);
|
||||||
}
|
}
|
||||||
|
|
||||||
OperationBase::OperationBase(KDDockWidgets::Testing::Operations::OperationType type, Fuzzer *fuzzer)
|
OperationBase::OperationBase(KDDockWidgets::Testing::Operations::OperationType type, Fuzzer *fuzzer)
|
||||||
|
|||||||
Reference in New Issue
Block a user