From 1e58ea91a5997d7ba098fe68973064f0c6d21dcd Mon Sep 17 00:00:00 2001 From: Kevin Kofler Date: Nov 15 2016 04:12:58 +0000 Subject: libyui-bindings: Enable libyui-mga bindings - add Mageia patches to enable libyui-mga bindings - add BuildRequires: libyui-mga-devel --- diff --git a/libyui-bindings/libyui-bindings-CMakeLists.patch b/libyui-bindings/libyui-bindings-CMakeLists.patch new file mode 100644 index 0000000..4c791b8 --- /dev/null +++ b/libyui-bindings/libyui-bindings-CMakeLists.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 59c94af..c2e6a88 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -28,7 +28,7 @@ ENDIF() + SET( CMAKE_INSTALL_PREFIX "${YPREFIX}" ) + + SET( LIBYUI_INCLUDE_DIR "${YPREFIX}/include" ) +-SET( LIBYUI_LIBRARY "yui" ) ++SET( LIBYUI_LIBRARY yui yui-mga ) + + SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Language Bindings for libyui") + SET(CPACK_PACKAGE_VENDOR "Novell Inc.") diff --git a/libyui-bindings/libyui-bindings-mga-example.patch b/libyui-bindings/libyui-bindings-mga-example.patch new file mode 100644 index 0000000..2ba3f61 --- /dev/null +++ b/libyui-bindings/libyui-bindings-mga-example.patch @@ -0,0 +1,101 @@ +From f655af5bac336e365c893ebdcc38194e1c47c2c9 Mon Sep 17 00:00:00 2001 +From: Angelo Naselli +Date: Sun, 8 Mar 2015 11:22:45 +0100 +Subject: Added an example for the mga plugin + + +diff --git a/swig/python/examples/mga-dialogs.py b/swig/python/examples/mga-dialogs.py +new file mode 100644 +index 0000000..285590c +--- /dev/null ++++ b/swig/python/examples/mga-dialogs.py +@@ -0,0 +1,89 @@ ++#!/usr/bin/env python ++# vim: set et ts=4 sw=4: ++#coding:utf-8 ++############################################################################# ++# ++# mga-dialogs.py - Show mga msg dialog and about dialog. ++# ++# License: GPLv3 ++# Author: Angelo Naselli ++############################################################################# ++ ++########### ++# imports # ++########### ++import sys ++sys.path.insert(0,'../../../build/swig/python') ++import os ++ ++import yui ++ ++log = yui.YUILog.instance() ++log.setLogFileName("/tmp/debug.log") ++log.enableDebugLogging( True ) ++appl = yui.YUI.application() ++appl.setApplicationTitle("Show dialogs example") ++ ++################# ++# class mainGui # ++################# ++class Info(object): ++ def __init__(self,title,richtext,text): ++ self.title=title ++ self.richtext=richtext ++ self.text=text ++ ++class mainGui(): ++ """ ++ Main class ++ """ ++ ++ def __init__(self): ++ self.factory = yui.YUI.widgetFactory() ++ self.dialog = self.factory.createPopupDialog() ++ mainvbox = self.factory.createVBox(self.dialog) ++ frame = self.factory.createFrame(mainvbox,"Test frame") ++ HBox = self.factory.createHBox(frame) ++ self.aboutbutton = self.factory.createPushButton(HBox,"&About") ++ self.closebutton = self.factory.createPushButton(self.factory.createRight(HBox), "&Close") ++ ++ ++ def ask_YesOrNo(self, info): ++ yui.YUI.widgetFactory ++ mgafactory = yui.YMGAWidgetFactory.getYMGAWidgetFactory(yui.YExternalWidgets.externalWidgetFactory("mga")) ++ dlg = mgafactory.createDialogBox(yui.YMGAMessageBox.B_TWO) ++ dlg.setTitle(info.title) ++ dlg.setText(info.text, info.richtext) ++ dlg.setButtonLabel("Yes", yui.YMGAMessageBox.B_ONE) ++ dlg.setButtonLabel("No", yui.YMGAMessageBox.B_TWO) ++ dlg.setMinSize(50, 5); ++ return dlg.show() == yui.YMGAMessageBox.B_ONE ++ ++ def aboutDialog(self): ++ yui.YUI.widgetFactory; ++ mgafactory = yui.YMGAWidgetFactory.getYMGAWidgetFactory(yui.YExternalWidgets.externalWidgetFactory("mga")) ++ dlg = mgafactory.createAboutDialog("About dialog title example", "1.0.0", "GPLv3", ++ "Angelo Naselli", "This beautiful test example shows how it is easy to play with libyui bindings", "") ++ dlg.show(); ++ ++ ++ def handleevent(self): ++ """ ++ Event-handler for the 'widgets' demo ++ """ ++ while True: ++ event = self.dialog.waitForEvent() ++ if event.eventType() == yui.YEvent.CancelEvent: ++ self.dialog.destroy() ++ break ++ if event.widget() == self.closebutton: ++ info = Info("Quit confirmation", 1, "Are you sure you want to quit?") ++ if self.ask_YesOrNo(info): ++ self.dialog.destroy() ++ break ++ if event.widget() == self.aboutbutton: ++ self.aboutDialog() ++ ++if __name__ == "__main__": ++ main_gui = mainGui() ++ main_gui.handleevent() diff --git a/libyui-bindings/libyui-bindings-mga-plugins.patch b/libyui-bindings/libyui-bindings-mga-plugins.patch new file mode 100644 index 0000000..e9115b2 --- /dev/null +++ b/libyui-bindings/libyui-bindings-mga-plugins.patch @@ -0,0 +1,27 @@ +diff --git a/swig/yui.i b/swig/yui.i +index 0a44d27..5dd5f82 100644 +--- a/swig/yui.i ++++ b/swig/yui.i +@@ -99,6 +99,11 @@ SWIGEXPORT void Init__yui(void) { + + #include "yui/YUILoader.h" + ++#include "yui/mga/YMGA_CBTable.h" ++#include "yui/mga/YMGAMsgBox.h" ++#include "yui/mga/YMGAAboutDialog.h" ++#include "yui/mga/YMGAWidgetExtensionFactory.h" ++ + using namespace std; + + extern void *start_ui_thread( void *ui_int ); +@@ -254,6 +259,10 @@ class Exception; + %include yui/YWidgetID.h + %include yui/YExternalWidgetFactory.h + %include yui/YExternalWidgets.h ++%include yui/mga/YMGA_CBTable.h ++%include yui/mga/YMGAAboutDialog.h ++%include yui/mga/YMGAMsgBox.h ++%include yui/mga/YMGAWidgetExtensionFactory.h + + #if defined(SWIGRUBY) + %extend YEvent { diff --git a/libyui-bindings/libyui-bindings.spec b/libyui-bindings/libyui-bindings.spec index 6d5d66f..465504d 100644 --- a/libyui-bindings/libyui-bindings.spec +++ b/libyui-bindings/libyui-bindings.spec @@ -12,12 +12,15 @@ %global with_py3 1 %endif #0%{?fedora} >= 13 || 0%{?rhel} >= 8 +# Do we build with libyui-mga bindings? (Comment out to disable.) +%global libyui_mga libyui-mga + # CMake-builds go out-of-tree. %global _cmake_build_subdir build-%{?_arch}%{?dist} Name: %{libname}-bindings Version: 1.1.1 -Release: 6%{?dist} +Release: 6%{?libyui_mga:.1.libyui_mga}%{?dist} Summary: Language bindings for %{libname} License: LGPLv2 or LGPLv3 @@ -28,10 +31,15 @@ Source0: %{url}/archive/%{name}/master/%{version}.tar.gz#/%{name}-%{version}.tar Patch0: %{name}-1.1.0-perlcmake.patch Patch1: %{name}-1.1.1-python-missing-constants.patch Patch2: %{name}-1.1.0-python3-YWidget-and-YItem.patch +# Patches from Mageia to enable libyui-mga bindings +Patch100: %{name}-CMakeLists.patch +Patch101: %{name}-mga-plugins.patch +Patch102: %{name}-mga-example.patch BuildRequires: boost-devel BuildRequires: cmake >= 2.8 BuildRequires: %{libname}-devel +%{?libyui_mga:BuildRequires: %{libyui_mga}-devel} BuildRequires: swig %description @@ -134,6 +142,12 @@ interfaces (ncurses). %patch0 -p1 %patch1 -p1 +%if 0%{?libyui_mga:1} +%patch100 -p1 +%patch101 -p1 +%patch102 -p1 +%endif + %if 0%{?with_py3} cp -a . %{py3dir} pushd %{py3dir} @@ -233,6 +247,10 @@ popd %changelog +* Tue Nov 15 2016 Kevin Kofler - 1.1.1-6.1.libyui-mga +- add Mageia patches to enable libyui-mga bindings +- add BuildRequires: libyui-mga-devel + * Tue Oct 25 2016 Philippe Makowski - 1.1.1-6 - fixed python 2 and 3 bindings - fixed python3 YWidget and YItem pointer comparison