First Commit

This commit is contained in:
2025-11-18 14:18:26 -07:00
parent 33eb6e3707
commit 27277ec342
6106 changed files with 3571167 additions and 0 deletions

View File

@@ -0,0 +1,83 @@
# This file is part of KDDockWidgets.
#
# SPDX-FileCopyrightText: 2020 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.
#
# Auto-Genereate files every class will have his cpp/h files
set(PyKDDockWidgets_SRC
# individual classes
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_config_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_config_wrapper.h
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_core_dockwidgetviewinterface_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_core_dockwidgetviewinterface_wrapper.h
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_core_mainwindowviewinterface_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_core_mainwindowviewinterface_wrapper.h
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_initialoption_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_initialoption_wrapper.h
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_layoutsaver_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_layoutsaver_wrapper.h
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_qtwidgets_dockwidget_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_qtwidgets_dockwidget_wrapper.h
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_qtwidgets_mainwindow_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_qtwidgets_mainwindow_wrapper.h
# global module wrapper
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_module_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/KDDockWidgets/kddockwidgets_python.h
)
# includes necessary to parse and build the classes specified on typesystem
set(PyKDDockWidgets_include_paths
$<JOIN:$<TARGET_PROPERTY:KDAB::kddockwidgets,INTERFACE_INCLUDE_DIRECTORIES>,${PATH_SEP}>
)
# A list of paths where shiboken should look for typesystem
set(PyKDDockWidgets_typesystem_paths # PySide path, this variable was exposed by
# FindPySide2.cmake
${PYSIDE_TYPESYSTEMS}
)
# Include flags/path that will be set in 'target_include_directories'
set(PyKDDockWidgets_target_include_directories ${CMAKE_SOURCE_DIR}/src)
# Libraries that will be necessary to link the target, this will used in the
# command 'target_link_libraries'
set(PyKDDockWidgets_target_link_libraries KDAB::kddockwidgets Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::Widgets ${Python3_LIBRARIES}
)
# changes on these files should trigger a new generation
set(PyKDDockWidgets_DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/kddockwidgets_global.h ${CMAKE_SOURCE_DIR}/src/qtwidgets/views/MainWindow.h
${CMAKE_SOURCE_DIR}/src/qtwidgets/views/DockWidget.h ${CMAKE_SOURCE_DIR}/src/Config.h
${CMAKE_SOURCE_DIR}/src/LayoutSaver.h
)
create_python_bindings(
"KDDockWidgets"
"${PyKDDockWidgets_typesystem_paths}"
"${PyKDDockWidgets_include_paths}"
"${PyKDDockWidgets_SRC}"
"${PyKDDockWidgets_target_include_directories}"
"${PyKDDockWidgets_target_link_libraries}"
${CMAKE_CURRENT_SOURCE_DIR}/kddockwidgets_global.h
${CMAKE_CURRENT_SOURCE_DIR}/typesystem_kddockwidgets.xml
"${PyKDDockWidgets_DEPENDS}"
${CMAKE_CURRENT_BINARY_DIR}
)
# Make module import from build dir work
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/__init__.py.cmake ${CMAKE_CURRENT_BINARY_DIR}/__init__.py @ONLY)
# install
install(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()

View File

@@ -0,0 +1,47 @@
# This file is part of KDDockWidgets.
#
# SPDX-FileCopyrightText: 2020 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.
#
import sys
import os
__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
try:
from PySide@PYSIDE_MAJOR_VERSION@ import QtCore
# Create a alias for PySide module so we can use a single import in source files
import PySide@PYSIDE_MAJOR_VERSION@
sys.modules["PySide"] = PySide@PYSIDE_MAJOR_VERSION@
except Exception:
print("Failed to load PySide")
raise
setupLibraryPath()

View File

@@ -0,0 +1,35 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020 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.
*/
#pragma once
// We only support Qt backend
#define KDDW_FRONTEND_QT 1
#define KDDW_FRONTEND_QTWIDGETS 1
// Make "signals:", "slots:" visible as access specifiers
#define QT_ANNOTATE_ACCESS_SPECIFIER(a) __attribute__((annotate(#a)))
// Define PYTHON_BINDINGS this will be used in some part of c++ to skip problematic parts
#define PYTHON_BINDINGS
#ifndef QT_WIDGETS_LIB
#define QT_WIDGETS_LIB
#endif
#include <kddockwidgets/KDDockWidgets.h>
#include <kddockwidgets/LayoutSaver.h>
#include <kddockwidgets/Config.h>
#include <kddockwidgets/core/views/MainWindowViewInterface.h>
#include <kddockwidgets/core/views/DockWidgetViewInterface.h>
#include <kddockwidgets/qtwidgets/views/MainWindow.h>
#include <kddockwidgets/qtwidgets/views/DockWidget.h>
#include <kddockwidgets/qtcommon/View.h>

View File

@@ -0,0 +1,88 @@
<?xml version="1.0"?>
<!-- The package name -->
<typesystem package="KDDockWidgets">
<!-- Pre-defined typesystem that contains types used by our class
PySide has one typesystem for each module, here we use only the widgets
typesystem because it already include gui and core typesystem -->
<load-typesystem name="typesystem_widgets.xml" generate="no" />
<rejection class="KDDockWidgets" function-name="qt_getEnumName" />
<rejection class="KDDockWidgets" function-name="qt_getEnumMetaObject" />
<rejection class="KDDockWidgets" function-name="qt_getEnumName" />
<!-- Our classes are declared in a namespace, so we should define this -->
<namespace-type name="KDDockWidgets" visible="no">
<!-- this is used in a public virtual pure function we need to declare it
otherwise shiboken will ignore the function and will fail to create a wrapper -->
<primitive-type name="DropArea" />
<primitive-type name="SideBar" />
<!-- Some plublic enum and flags -->
<enum-type name="Location"/>
<enum-type name="MainWindowOption" flags="MainWindowOptions" />
<enum-type name="DockWidgetOption" flags="DockWidgetOptions" />
<enum-type name="LayoutSaverOption" flags="LayoutSaverOptions" />
<enum-type name="IconPlace" flags="IconPlaces" />
<enum-type name="FrontendType" />
<enum-type name="InitialVisibilityOption" />
<enum-type name="RestoreOption" flags="RestoreOptions" />
<enum-type name="DropIndicatorType" />
<enum-type name="SizePolicy" />
<enum-type name="SideBarLocation" />
<enum-type name="TitleBarButtonType" />
<enum-type name="DropLocation" />
<enum-type name="DropIndicatorType" />
<enum-type name="AddingOption" />
<enum-type name="WindowState" flags="WindowStates" />
<!-- Internal - just to avoid generation warning -->
<enum-type name="SuggestedGeometryHint" flags="SuggestedGeometryHints" />
<enum-type name="CursorPosition" flags="CursorPositions" />
<enum-type name="FrameOption" flags="FrameOptions" />
<enum-type name="StackOption" flags="StackOptions" />
<enum-type name="FloatingWindowFlag" flags="FloatingWindowFlags" />
<enum-type name="FloatingWindowFlag" flags="FloatingWindowFlags" />
<enum-type name="DefaultSizeMode" />
<!-- our classes
For class we can use two types:
object-type: class that does not have a copy-contructor and can not be passed as value to functions;
value-type: class that can be passed as value for functions
Here we only use 'object-type' since all our classes are derived from QWidget
-->
<value-type name="InitialOption">
<include file-name="kddockwidgets/KDDockWidgets.h" location="global"/>
</value-type>
<object-type name="LayoutSaver">
<include file-name="kddockwidgets/LayoutSaver.h" location="global"/>
</object-type>
<object-type name="Config">
<include file-name="kddockwidgets/Config.h" location="global"/>
<enum-type name="Flag" flags="Flags" />
<enum-type name="CustomizableWidget" flags="CustomizableWidgets" />
<enum-type name="InternalFlag" flags="InternalFlags" />
</object-type>
<namespace-type name="Core" visible="no">
<enum-type name="ViewType" />
<object-type name="DockWidgetViewInterface" >
<include file-name="kddockwidgets/core/views/DockWidgetViewInterface.h" location="global"/>
</object-type>
<object-type name="MainWindowViewInterface">
<include file-name="kddockwidgets/core/views/MainWindowViewInterface.h" location="global"/>
<modify-function signature="addDockWidget(KDDockWidgets::Core::DockWidgetViewInterface*,KDDockWidgets::Location,KDDockWidgets::Core::DockWidgetViewInterface*,KDDockWidgets::InitialOption)" rename="addKDockWidget" />
</object-type>
</namespace-type>
<namespace-type name="QtWidgets" visible="no">
<object-type name="MainWindow">
<include file-name="kddockwidgets/qtwidgets/views/MainWindow.h" location="global"/>
</object-type>
<object-type name="DockWidget">
<include file-name="kddockwidgets/qtwidgets/views/DockWidget.h" location="global"/>
</object-type>
</namespace-type>
</namespace-type>
</typesystem>