diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d313705..79735ab 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,11 +13,19 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 + # - name: Python version + # uses: actions/setup-python@v5 + # with: + # python-version: 3.13 + - name: Run script run: | chmod +x ./build_linux_gtk3.sh sudo apt update ./build_linux_gtk3.sh --dependencies --deploy --tests + cd HUI-linux-x86_64-webkit-gtk3 + python3 ../build_python.py + - name: Upload build artifacts uses: actions/upload-artifact@v4 @@ -34,10 +42,22 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 + - name: Python version + uses: actions/setup-python@v5 + with: + python-version: 3.13 + + - name: MSVC cmd + uses: TheMrMilchmann/setup-msvc-dev@v3 + with: + arch: x64 + - name: Run script run: | choco install 7zip -y ./build_win_cef.bat --dependencies --deploy --tests + cd HUI-win-AMD64-blink-cef + python ../build_python.py - name: Upload build artifacts uses: actions/upload-artifact@v4 diff --git a/build_python.py b/build_python.py index 7c43efd..edf3c0e 100644 --- a/build_python.py +++ b/build_python.py @@ -26,7 +26,8 @@ libpath = sys.base_prefix # C:\Program Files\Python312 pyname = "python"+str(sys.version_info.major)+str(sys.version_info.minor) # python312 suffix = sysconfig.get_config_var('EXT_SUFFIX') # .cp312-win_amd64.pyd - os.system("call \"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Auxiliary\\Build\\vcvars64.bat\" && cl /LD /EHsc /O2 /Fe:HUI"+suffix+" ../hui_python.cc "+includes+" /I\"..\" /link /LIBPATH:\""+libpath+"\\libs"+"\" "+pyname+".lib libHUI.lib") + #os.system("call \"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Auxiliary\\Build\\vcvars64.bat\" && cl /LD /EHsc /O2 /Fe:HUI"+suffix+" ../hui_python.cc "+includes+" /I\"..\" /link /LIBPATH:\""+libpath+"\\libs"+"\" "+pyname+".lib libHUI.lib") + os.system("cl /LD /EHsc /O2 /Fe:HUI"+suffix+" ../hui_python.cc "+includes+" /I\"..\" /link /LIBPATH:\""+libpath+"\\libs"+"\" "+pyname+".lib libHUI.lib") print("done") @@ -56,7 +57,7 @@ print("unsupported os, sorry") -input() + """ OLD NOTES: @@ -81,4 +82,4 @@ -""" \ No newline at end of file +""" diff --git a/hui_python.cc b/hui_python.cc index 3d553d3..634b0b5 100644 --- a/hui_python.cc +++ b/hui_python.cc @@ -42,7 +42,64 @@ PYBIND11_MODULE(HUI, m) { .def("exit", &WebView::exit) ; + + + py::class_(m, "WindowControls") + .def(py::init(), py::arg("backend"), py::arg("handle")) + + .def("set_type", &WindowControls::set_type, py::arg("type")) + .def("get_type", &WindowControls::get_type) + + .def("set_layer", &WindowControls::set_layer, py::arg("layer")) + .def("get_layer", &WindowControls::get_layer) + + .def("set_geometry", &WindowControls::set_geometry, py::arg("geometry")) + .def("get_geometry", &WindowControls::get_geometry) + + .def("set_opacity", &WindowControls::set_opacity, py::arg("opacity")) + .def("get_opacity", &WindowControls::get_opacity) + + .def("set_id", &WindowControls::set_id, py::arg("id")) + .def("get_id", &WindowControls::get_id) + + .def("set_title", &WindowControls::set_title, py::arg("title")) + .def("get_title", &WindowControls::get_title) + + .def("set_exclusive_zone", &WindowControls::set_exclusive_zone, py::arg("zone")) + .def("get_exclusive_zone", &WindowControls::get_exclusive_zone) - // TODO: WindowControls + .def("set_focused", &WindowControls::set_focused, py::arg("activated")) + .def("get_focused", &WindowControls::get_focused) + + .def("set_input_mode_keyboard", &WindowControls::set_input_mode_keyboard, py::arg("mode")) + .def("get_input_mode_keyboard", &WindowControls::get_input_mode_keyboard) + + ; + + m.attr("WT_TOPLEVEL_SSD") = WT_TOPLEVEL_SSD; + m.attr("WT_TOPLEVEL_CSD") = WT_TOPLEVEL_CSD; + m.attr("WT_DESKTOP_COMPONENT") = WT_DESKTOP_COMPONENT; + m.attr("WT_POPOVER") = WT_POPOVER; + + m.attr("WL_BACKGROUND") = WL_BACKGROUND; + m.attr("WL_BOTTOM") = WL_BOTTOM; + m.attr("WL_TOP") = WL_TOP; + m.attr("WL_OVERLAY") = WL_OVERLAY; + m.attr("WL_TOPLEAST") = WL_TOPLEAST; + m.attr("WL_TOPMOST") = WL_TOPMOST; + + m.attr("WS_HIDDEN") = WS_HIDDEN; + m.attr("WS_NOT_HIDDEN") = WS_NOT_HIDDEN; + m.attr("WS_MINIMIZED") = WS_MINIMIZED; + m.attr("WS_NOT_MINIMIZED") = WS_NOT_MINIMIZED; + m.attr("WS_FULLSCREEN") = WS_FULLSCREEN; + m.attr("WS_NOT_FULLSCREEN") = WS_NOT_FULLSCREEN; + m.attr("WS_MAXIMIZED") = WS_MAXIMIZED; + m.attr("WS_NOT_MAXIMIZED") = WS_NOT_MAXIMIZED; + + m.attr("WIM_ALWAYS") = WIM_ALWAYS; + m.attr("WIM_AUTO_WINDOW") = WIM_AUTO_WINDOW; + m.attr("WIM_NEVER") = WIM_NEVER; + }