SlideShare una empresa de Scribd logo
1 de 36
3 UIs for the price of one code with YaST's libyui  Katarína Machálková Software Engineer (YaST) [email_address]
 
Talk outline Introduction – why libyui (Hello World!) Brief Tour de Libyui internals My first libyui application Introducing different language bindings Sample non-C++ libyui application Documentation, useful links Questions, answers, ...
Intro & Motivation
The most famous app of all times  ☺
Hello World in Qt ... int main(int argc, char *argv[]) { QApplication app(argc, argv); QPushButton hw("Hello World!"); hw.resize(75, 30); QObject::connect(&hw, SIGNAL(clicked()), &app, SLOT(quit())); hw.show(); return app.exec(); }
…  in Gtk ... int main (int argc, char *argv[]) { GtkWidget *window; GtkWidget *button; gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC (destroy), NULL); gtk_container_border_width (GTK_CONTAINER (window), 10); button = gtk_button_new_with_label ("Hello World"); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (hello), NULL); gtk_signal_connect_object (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_OBJECT (window)); gtk_container_add (GTK_CONTAINER (window), button); gtk_widget_show (button); gtk_widget_show (window); gtk_main (); return 0; }
… and in ncurses ... int main(void) { WINDOW * mainwin; if ( (mainwin = initscr()) == NULL ) { exit(EXIT_FAILURE); } mvaddstr(13, 33, "Hello, world!"); refresh(); sleep(3); delwin(mainwin); endwin(); refresh(); return EXIT_SUCCESS; }
One code, three user interfaces! #include "YUI.h" #include "YWidgetFactory.h" #include "YDialog.h" #include "YLayoutBox.h" #include "YEvent.h" int main( int argc, char **argv ) { YDialog *dialog = YUI::widgetFactory()->createPopupDialog(); YLayoutBox *vbox = YUI::widgetFactory()->createVBox( dialog); YUI::widgetFactory()->createLabel( vbox, "Hello, World!" ); YUI::widgetFactory()->createPushButton( vbox, "&OK" ); dialog->waitForEvent(); dialog->destroy(); }
Libyui from the inside
Introducing libyui ,[object Object]
Provides abstraction from GUI and TUI toolkits (Qt, Gtk, ncurses) in terms of widgets (UI elements) and events
YaST user interface engine
Independent of YCP (after major rewrite in 2006)
Independent of YaST core libraries and libzypp (dtto)
Dialogs, widgets + event handling
YaST UI Architecture
Widgets (dialog building blocks) ,[object Object]
Properties (get/set) ,[object Object]
Items
Label
Current item
… ,[object Object]
Types of widgets ,[object Object]
Events (user input results) ,[object Object]
{
YEvent *ev = dialog->waitForEvent();
do_something (ev);
} ,[object Object]
Each event has ,[object Object]
Reason (selection changed, widget was activated,...)
Pointer (or id) of the widget that broke the event loop
What libyui does not support ,[object Object]
Signals, slots, callbacks,...
Advanced graphics (3D, animations,...)
Non-blocking event handling

Más contenido relacionado

La actualidad más candente

JavaScript Survival Guide
JavaScript Survival GuideJavaScript Survival Guide
JavaScript Survival GuideGiordano Scalzo
 
The Beauty Of Java Script V5a
The Beauty Of Java Script V5aThe Beauty Of Java Script V5a
The Beauty Of Java Script V5arajivmordani
 
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6Dmitry Soshnikov
 
C++ game development with oxygine
C++ game development with oxygineC++ game development with oxygine
C++ game development with oxyginecorehard_by
 
Better Software: introduction to good code
Better Software: introduction to good codeBetter Software: introduction to good code
Better Software: introduction to good codeGiordano Scalzo
 
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]Eleanor McHugh
 
Test driven game development silly, stupid or inspired?
Test driven game development   silly, stupid or inspired?Test driven game development   silly, stupid or inspired?
Test driven game development silly, stupid or inspired?Eric Smith
 
Non stop random2b
Non stop random2bNon stop random2b
Non stop random2bphanhung20
 
Test Driven Cocos2d
Test Driven Cocos2dTest Driven Cocos2d
Test Driven Cocos2dEric Smith
 
【Unite 2017 Tokyo】もっと気軽に、動的なコンテンツ配信を ~アセットバンドルの未来と開発ロードマップ
【Unite 2017 Tokyo】もっと気軽に、動的なコンテンツ配信を ~アセットバンドルの未来と開発ロードマップ【Unite 2017 Tokyo】もっと気軽に、動的なコンテンツ配信を ~アセットバンドルの未来と開発ロードマップ
【Unite 2017 Tokyo】もっと気軽に、動的なコンテンツ配信を ~アセットバンドルの未来と開発ロードマップUnite2017Tokyo
 
Introdução ao Desenvolvimento Android com Kotlin
Introdução ao Desenvolvimento Android com KotlinIntrodução ao Desenvolvimento Android com Kotlin
Introdução ao Desenvolvimento Android com KotlinNelson Glauber Leal
 
5. Ввод-вывод, доступ к файловой системе
5. Ввод-вывод, доступ к файловой системе5. Ввод-вывод, доступ к файловой системе
5. Ввод-вывод, доступ к файловой системеDEVTYPE
 
Descripción Software libre
Descripción Software libreDescripción Software libre
Descripción Software libregrupocisnerino
 
How to Clone Flappy Bird in Swift
How to Clone Flappy Bird in SwiftHow to Clone Flappy Bird in Swift
How to Clone Flappy Bird in SwiftGiordano Scalzo
 
JNI - Java & C in the same project
JNI - Java & C in the same projectJNI - Java & C in the same project
JNI - Java & C in the same projectKarol Wrótniak
 

La actualidad más candente (20)

The Beauty of Java Script
The Beauty of Java ScriptThe Beauty of Java Script
The Beauty of Java Script
 
JavaScript Survival Guide
JavaScript Survival GuideJavaScript Survival Guide
JavaScript Survival Guide
 
The Beauty Of Java Script V5a
The Beauty Of Java Script V5aThe Beauty Of Java Script V5a
The Beauty Of Java Script V5a
 
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
 
C++ game development with oxygine
C++ game development with oxygineC++ game development with oxygine
C++ game development with oxygine
 
Better Software: introduction to good code
Better Software: introduction to good codeBetter Software: introduction to good code
Better Software: introduction to good code
 
JavaScript Patterns
JavaScript PatternsJavaScript Patterns
JavaScript Patterns
 
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
 
Test driven game development silly, stupid or inspired?
Test driven game development   silly, stupid or inspired?Test driven game development   silly, stupid or inspired?
Test driven game development silly, stupid or inspired?
 
JavaScript on the Desktop
JavaScript on the DesktopJavaScript on the Desktop
JavaScript on the Desktop
 
Non stop random2b
Non stop random2bNon stop random2b
Non stop random2b
 
Test Driven Cocos2d
Test Driven Cocos2dTest Driven Cocos2d
Test Driven Cocos2d
 
ES6 is Nigh
ES6 is NighES6 is Nigh
ES6 is Nigh
 
【Unite 2017 Tokyo】もっと気軽に、動的なコンテンツ配信を ~アセットバンドルの未来と開発ロードマップ
【Unite 2017 Tokyo】もっと気軽に、動的なコンテンツ配信を ~アセットバンドルの未来と開発ロードマップ【Unite 2017 Tokyo】もっと気軽に、動的なコンテンツ配信を ~アセットバンドルの未来と開発ロードマップ
【Unite 2017 Tokyo】もっと気軽に、動的なコンテンツ配信を ~アセットバンドルの未来と開発ロードマップ
 
Introdução ao Desenvolvimento Android com Kotlin
Introdução ao Desenvolvimento Android com KotlinIntrodução ao Desenvolvimento Android com Kotlin
Introdução ao Desenvolvimento Android com Kotlin
 
The jsdom
The jsdomThe jsdom
The jsdom
 
5. Ввод-вывод, доступ к файловой системе
5. Ввод-вывод, доступ к файловой системе5. Ввод-вывод, доступ к файловой системе
5. Ввод-вывод, доступ к файловой системе
 
Descripción Software libre
Descripción Software libreDescripción Software libre
Descripción Software libre
 
How to Clone Flappy Bird in Swift
How to Clone Flappy Bird in SwiftHow to Clone Flappy Bird in Swift
How to Clone Flappy Bird in Swift
 
JNI - Java & C in the same project
JNI - Java & C in the same projectJNI - Java & C in the same project
JNI - Java & C in the same project
 

Similar a 3 UIs for the price of one code

Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Guillaume Laforge
 
JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?Doug Hawkins
 
Building Dojo in the Cloud
Building Dojo in the CloudBuilding Dojo in the Cloud
Building Dojo in the CloudJames Thomas
 
Writing a slack chatbot DrupalCampLA
Writing a slack chatbot DrupalCampLAWriting a slack chatbot DrupalCampLA
Writing a slack chatbot DrupalCampLAJesus Manuel Olivas
 
Introduction to Griffon
Introduction to GriffonIntroduction to Griffon
Introduction to GriffonJames Williams
 
Silicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM MechanicsSilicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM MechanicsAzul Systems, Inc.
 
Google Web Toolkits
Google Web ToolkitsGoogle Web Toolkits
Google Web ToolkitsYiguang Hu
 
jQuery in the [Aol.] Enterprise
jQuery in the [Aol.] EnterprisejQuery in the [Aol.] Enterprise
jQuery in the [Aol.] EnterpriseDave Artz
 
Developing Useful APIs
Developing Useful APIsDeveloping Useful APIs
Developing Useful APIsDmitry Buzdin
 
Developing and Benchmarking Qt applications on Hawkboard with Xgxperf
Developing and Benchmarking Qt applications on Hawkboard with XgxperfDeveloping and Benchmarking Qt applications on Hawkboard with Xgxperf
Developing and Benchmarking Qt applications on Hawkboard with XgxperfPrabindh Sundareson
 
Playing With Fire - An Introduction to Node.js
Playing With Fire - An Introduction to Node.jsPlaying With Fire - An Introduction to Node.js
Playing With Fire - An Introduction to Node.jsMike Hagedorn
 
Your Library Sucks, and why you should use it.
Your Library Sucks, and why you should use it.Your Library Sucks, and why you should use it.
Your Library Sucks, and why you should use it.Peter Higgins
 
DIY: Computer Vision with GWT.
DIY: Computer Vision with GWT.DIY: Computer Vision with GWT.
DIY: Computer Vision with GWT.JooinK
 

Similar a 3 UIs for the price of one code (20)

Qt Workshop
Qt WorkshopQt Workshop
Qt Workshop
 
Google Web Toolkit
Google Web ToolkitGoogle Web Toolkit
Google Web Toolkit
 
Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008
 
Introduzione a Gwt
Introduzione a GwtIntroduzione a Gwt
Introduzione a Gwt
 
Writing a slack chatbot seattle
Writing a slack chatbot seattleWriting a slack chatbot seattle
Writing a slack chatbot seattle
 
GWT Extreme!
GWT Extreme!GWT Extreme!
GWT Extreme!
 
JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?
 
Building Dojo in the Cloud
Building Dojo in the CloudBuilding Dojo in the Cloud
Building Dojo in the Cloud
 
Writing a slack chatbot DrupalCampLA
Writing a slack chatbot DrupalCampLAWriting a slack chatbot DrupalCampLA
Writing a slack chatbot DrupalCampLA
 
mobl
moblmobl
mobl
 
Introduction to Griffon
Introduction to GriffonIntroduction to Griffon
Introduction to Griffon
 
Silicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM MechanicsSilicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM Mechanics
 
Google Web Toolkits
Google Web ToolkitsGoogle Web Toolkits
Google Web Toolkits
 
jQuery in the [Aol.] Enterprise
jQuery in the [Aol.] EnterprisejQuery in the [Aol.] Enterprise
jQuery in the [Aol.] Enterprise
 
Developing Useful APIs
Developing Useful APIsDeveloping Useful APIs
Developing Useful APIs
 
Developing and Benchmarking Qt applications on Hawkboard with Xgxperf
Developing and Benchmarking Qt applications on Hawkboard with XgxperfDeveloping and Benchmarking Qt applications on Hawkboard with Xgxperf
Developing and Benchmarking Qt applications on Hawkboard with Xgxperf
 
Annotation processing tool
Annotation processing toolAnnotation processing tool
Annotation processing tool
 
Playing With Fire - An Introduction to Node.js
Playing With Fire - An Introduction to Node.jsPlaying With Fire - An Introduction to Node.js
Playing With Fire - An Introduction to Node.js
 
Your Library Sucks, and why you should use it.
Your Library Sucks, and why you should use it.Your Library Sucks, and why you should use it.
Your Library Sucks, and why you should use it.
 
DIY: Computer Vision with GWT.
DIY: Computer Vision with GWT.DIY: Computer Vision with GWT.
DIY: Computer Vision with GWT.
 

Último

What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 

Último (20)

What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 

3 UIs for the price of one code

  • 1. 3 UIs for the price of one code with YaST's libyui Katarína Machálková Software Engineer (YaST) [email_address]
  • 2.  
  • 3. Talk outline Introduction – why libyui (Hello World!) Brief Tour de Libyui internals My first libyui application Introducing different language bindings Sample non-C++ libyui application Documentation, useful links Questions, answers, ...
  • 5. The most famous app of all times ☺
  • 6. Hello World in Qt ... int main(int argc, char *argv[]) { QApplication app(argc, argv); QPushButton hw("Hello World!"); hw.resize(75, 30); QObject::connect(&hw, SIGNAL(clicked()), &app, SLOT(quit())); hw.show(); return app.exec(); }
  • 7. … in Gtk ... int main (int argc, char *argv[]) { GtkWidget *window; GtkWidget *button; gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC (destroy), NULL); gtk_container_border_width (GTK_CONTAINER (window), 10); button = gtk_button_new_with_label ("Hello World"); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (hello), NULL); gtk_signal_connect_object (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_OBJECT (window)); gtk_container_add (GTK_CONTAINER (window), button); gtk_widget_show (button); gtk_widget_show (window); gtk_main (); return 0; }
  • 8. … and in ncurses ... int main(void) { WINDOW * mainwin; if ( (mainwin = initscr()) == NULL ) { exit(EXIT_FAILURE); } mvaddstr(13, 33, "Hello, world!"); refresh(); sleep(3); delwin(mainwin); endwin(); refresh(); return EXIT_SUCCESS; }
  • 9. One code, three user interfaces! #include "YUI.h" #include "YWidgetFactory.h" #include "YDialog.h" #include "YLayoutBox.h" #include "YEvent.h" int main( int argc, char **argv ) { YDialog *dialog = YUI::widgetFactory()->createPopupDialog(); YLayoutBox *vbox = YUI::widgetFactory()->createVBox( dialog); YUI::widgetFactory()->createLabel( vbox, "Hello, World!" ); YUI::widgetFactory()->createPushButton( vbox, "&OK" ); dialog->waitForEvent(); dialog->destroy(); }
  • 10. Libyui from the inside
  • 11.
  • 12. Provides abstraction from GUI and TUI toolkits (Qt, Gtk, ncurses) in terms of widgets (UI elements) and events
  • 14. Independent of YCP (after major rewrite in 2006)
  • 15. Independent of YaST core libraries and libzypp (dtto)
  • 16. Dialogs, widgets + event handling
  • 18.
  • 19.
  • 20. Items
  • 21. Label
  • 23.
  • 24.
  • 25.
  • 26. {
  • 27. YEvent *ev = dialog->waitForEvent();
  • 29.
  • 30.
  • 31. Reason (selection changed, widget was activated,...)
  • 32. Pointer (or id) of the widget that broke the event loop
  • 33.
  • 35. Advanced graphics (3D, animations,...)
  • 37. My first libyui application
  • 38.
  • 40. YaST UI package ( yast2-[qt|gtk|ncurses] )
  • 42. Code it ... #include "YUI.h" #include "YWidgetFactory.h" #include "YDialog.h" #include "YLayoutBox.h" #include "YEvent.h" int main( int argc, char **argv ) { YDialog *dialog = YUI::widgetFactory()->createPopupDialog(); YLayoutBox *vbox = YUI::widgetFactory()->createVBox( dialog); YUI::widgetFactory()->createLabel( vbox, "Hello, World!" ); YUI::widgetFactory()->createPushButton( vbox, "&OK" ); dialog->waitForEvent(); dialog->destroy(); }
  • 43.
  • 45.
  • 46. Hello World dissected, part I int main( int argc, char **argv ) { YDialog *dialog = YUI::widgetFactory()->createPopupDialog(); YLayoutBox *vbox = YUI::widgetFactory()->createVBox( dialog); 1 st call creates UI instance and w.factory instance Get widget pointer from w.factory Widget container (layout aid) Child of the main dialog
  • 47. Hello World dissected, part II YUI::widgetFactory()->createLabel( vbox, "Hello, World!" ); YUI::widgetFactory()->createPushButton( vbox, "&OK" ); Create new widget, specify parent + property (string) Vert. container can have many children
  • 48. Hello World dissected, part III dialog->waitForEvent(); dialog->destroy(); } Wait for user input Use this in event loops Close the dialog, do the final cleanup
  • 49. But I don't speak C++ … ?
  • 50. Other scripting language bindings Python Ruby Perl C++ bindings
  • 51.
  • 52. Standard C++ (STL) data types (std::string, std::list,...)
  • 53. Easy way to swig-generated language bindings
  • 54. Currently for perl, python and ruby
  • 55. ' zypper in [perl|python|ruby]-yui ' (that's it ☺ )
  • 56. Hello World with perl-yui !/usr/bin/perl # # Trivial read-write (not write-only :) # example of libyui used from Perl # use yui; my $factory = yui::YUI::widgetFactory; my $dialog = $factory->createPopupDialog; my $vbox = $factory->createVBox( $dialog ); $factory->createLabel( $vbox, "Hello,World!"); $factory->createPushButton( $vbox, "&OK" ); my $event = $dialog->waitForEvent(); $dialog->destroy();
  • 57. Hello World with python-yui # Trivial usage of libyui # in pretty the same way # in python # #!/usr/bin/python import sys import yui factory = yui.YUI.widgetFactory() dialog = factory.createPopupDialog() vbox = factory.createVBox( dialog ) factory.createLabel( vbox, "Hello, World!" ) factory.createPushButton( vbox, "&OK" ) event = dialog.waitForEvent() dialog.destroy()
  • 58. More complex non-C++ application
  • 59. Simple zypp.conf editor with perl-yui (live demonstration)
  • 60. When things don't work ...
  • 61.
  • 62.
  • 64. Where to get more information? On line dokumentace: http://www.suse.de/~ug/ On line dokumentace: http://www.suse.de/~ug/ On line dokumentace: http://www.suse.de/~ug/ On line dokumentace: http://www.suse.de/~ug/ On line dokumentace: http://www.suse.de/~ug/ *-yui package doc with examples: /usr/share/doc/packages/*-yui On line dokumentace: http://www.suse.de/~ug/ On line dokumentace: http://www.suse.de/~ug/ On line dokumentace: http://www.suse.de/~ug/ On line dokumentace: http://www.suse.de/~ug/ On line dokumentace: http://www.suse.de/~ug/ YaST development mailing list: [email_address] General YaST doc (incl. widget reference): http://forgeftp.novell.com/yast/doc/SL11 .1

Notas del editor

  1. Now we'll move onto the different scripts you can run at different times. Followed by some example of the kind of thing that can be done in the scripts.
  2. Trouble shooting an Aytoyast seutp can be tricky. There are several places where things can go wrong, and debugging post install scripts can require a reinstall each time. However, there are some places to find information.