This document summarizes a presentation on the sexy.rgtk package for building GUIs in R. It introduces sexy.rgtk as a layer on top of RGtk2 that aims to make GUI creation more natural and readable. Key features highlighted include unified constructors for widgets, natural getter/setter syntax, and functions for common patterns like labeling input widgets. The document provides examples comparing RGtk2 and sexy.rgtk code.
Czym się różnie JMS od AMQP? Co to jest queue? Co to jest topic? Jak zlecać zadania w przyszłości używając kolejek? Jak się do tego podpiąć z Javy? Na te i inne pytania postaram się odpowiedzieć na mojej prezentacji.
4Developers: Michał Szczepanik- Kotlin - Let’s ketchup itPROIDEA
Niektóre rzeczy trzeba dobrze przyprawić żeby były lepsze ... tak samo jest z pisaniem aplikacji na Androida. Jako programiści zaczynamy mieć czasami dość Javy i chcielibyśmy się przerzucić na coś lepszego i czytelniejszego. Takim rozwiązaniem może okazać się Kotlin. O zaletach języka i o tym jak może ułatwić pracę z Androidem dowiecie się podczas tego wykładu.
GDG DevFest 2017 - Inspections of Kotlin implementations by Bytecode.
세션 이후 "Kotlin은 Java의 wrapper인가요?" 라는 질문을 몇번 받았습니다.
—
답변: 그렇지 않습니다.
특정한 언어로 구현된 코드는 파싱을 거쳐 추상화된 형태(AST)와 추가 정보들을 가지는 1차적인 결과물로 처리됩니다. 보통 이런 역할을 하는 것은 컴파일러에서 전단부(frontend)라고 호칭하며 이러한 AST 등의 결과물은 대상 머신이나 플랫폼에 맞추어 처리됩니다.
이를 바로 실행하면 인터프리터라고 하지만, 실행 가능한 형태(Executable)로 생성하는 경우라면 컴파일러 후단부(Backend)가 이를 수행합니다.
백엔드의 타겟 코드는 충분히 다양한 대상을 다룰 수 있으므로, 우리가 다양한 백엔드 구현을 통해 동일 코드를 멀티 플랫폼을 대상으로 실행할 수 있도록 할 수 있는 것입니다.
코틀린 역시 대상으로 하는 플랫폼(과 머신)은 현재 다음과 같은 실행 가능한 형태를 지원하고 있습니다. (물론 아직 모든 타겟이 완벽하지는 않겠죠.)
1. Bytecode 포맷에 따른 JVM(안드로이드 포함)
2. JavaScript에 의한 브라우저나 Node.js
3. llvm을 이용하여 여러 타겟의 네이티브 코드
이 자료는 이 중 1번을 기반으로 디컴파일된 코드를 살펴보고 코틀린의 코드 생성 목적이나 언어 설계의 원인(어떤 painpoint)를 찾아보는 과정의 일부였을 뿐입니다.
언어는 항상 요구되는 표현을 위해 가장 적합한 형태로 변화해나갑니다. 프로그래밍 언어는 비교적 단기간에 만들어지는 언어이고, 그에 따라 특정 사람과 집단의 목적에 충실합니다. 다만, 이 관점에서 봤을 때도 Kotlin이 Java의 wrapper로써 설계되었을 것보다는 다양한 타겟 플랫폼이 고려되고 있는 하나의 프로그래밍 언어로 받아들여 주시기를 바랍니다. :)
Poche chiacchiere e tanto codice per cercare rendere la nostra vita di
sviluppatori più divertente.
Parleremo di JAX-RS, le annotazioni, l'MVC che mette a disposizione e
l'integrazione di Jersey con Guice.
Useremo AOP per gestire log, transazioni e con l'aiuto di Infinispan
limiteremo le chamate concorrenti sul nostro cluster.
Auto-GWT : Better GWT Programming with XtendSven Efftinge
Presentation from GWT.create 2015 EU
Auto-GWT (auto-gwt.org) is a library for the Google Web Toolkit, that frees your code from unneccessary and complicated boilerplate and at the same time pushes the IDE capabilities to a new level. Auto-GWT is based on Xtend (xtendlang.org).
Xtend is a modern programming language that is 100% compatibly with existing Java libraries and even translates to readable Java source code. With it's slick syntax and powerful features such as lambdas, operator overloading and compile-time macros you can turn any verbose piece of Java code into a small and elegant piece of expressive Xtend code.
In this session we will show how Xtend can be used to program GWT applications and how well the typical GWT idioms are supported by the language.
Everybody knows : Web is the platform of the future. Developing for the browser unfortunately requires us to learn and write JavaScript. Not only that but we also have to integrate the JavaScript client code with the server side, which often runs on the JVM (i.e. is written in Java). So we have to work in two different languages with completely different tools and APIs, and cannot share code between the client and the server.
The Google Web Toolkit (GWT) provides a way to write your client side web application entirely in Java and have it automatically translated to fast and compact JavaScript. It allows you to access all the browser functionality through a statically typed API. You only have to learn and use one language and you can use your code on the client as well as on the server.
The downside : Java is a bad match for the asynchronous programming model required on the browser and generally forces us to write and read a lot of boilerplate code.
In this session you'll see how programming GWT applications with Eclipse Xtend provides the best of both worlds:
Static typing with advanced IDE support meets a powerful and expressive language - right at your finger tips.
Czym się różnie JMS od AMQP? Co to jest queue? Co to jest topic? Jak zlecać zadania w przyszłości używając kolejek? Jak się do tego podpiąć z Javy? Na te i inne pytania postaram się odpowiedzieć na mojej prezentacji.
4Developers: Michał Szczepanik- Kotlin - Let’s ketchup itPROIDEA
Niektóre rzeczy trzeba dobrze przyprawić żeby były lepsze ... tak samo jest z pisaniem aplikacji na Androida. Jako programiści zaczynamy mieć czasami dość Javy i chcielibyśmy się przerzucić na coś lepszego i czytelniejszego. Takim rozwiązaniem może okazać się Kotlin. O zaletach języka i o tym jak może ułatwić pracę z Androidem dowiecie się podczas tego wykładu.
GDG DevFest 2017 - Inspections of Kotlin implementations by Bytecode.
세션 이후 "Kotlin은 Java의 wrapper인가요?" 라는 질문을 몇번 받았습니다.
—
답변: 그렇지 않습니다.
특정한 언어로 구현된 코드는 파싱을 거쳐 추상화된 형태(AST)와 추가 정보들을 가지는 1차적인 결과물로 처리됩니다. 보통 이런 역할을 하는 것은 컴파일러에서 전단부(frontend)라고 호칭하며 이러한 AST 등의 결과물은 대상 머신이나 플랫폼에 맞추어 처리됩니다.
이를 바로 실행하면 인터프리터라고 하지만, 실행 가능한 형태(Executable)로 생성하는 경우라면 컴파일러 후단부(Backend)가 이를 수행합니다.
백엔드의 타겟 코드는 충분히 다양한 대상을 다룰 수 있으므로, 우리가 다양한 백엔드 구현을 통해 동일 코드를 멀티 플랫폼을 대상으로 실행할 수 있도록 할 수 있는 것입니다.
코틀린 역시 대상으로 하는 플랫폼(과 머신)은 현재 다음과 같은 실행 가능한 형태를 지원하고 있습니다. (물론 아직 모든 타겟이 완벽하지는 않겠죠.)
1. Bytecode 포맷에 따른 JVM(안드로이드 포함)
2. JavaScript에 의한 브라우저나 Node.js
3. llvm을 이용하여 여러 타겟의 네이티브 코드
이 자료는 이 중 1번을 기반으로 디컴파일된 코드를 살펴보고 코틀린의 코드 생성 목적이나 언어 설계의 원인(어떤 painpoint)를 찾아보는 과정의 일부였을 뿐입니다.
언어는 항상 요구되는 표현을 위해 가장 적합한 형태로 변화해나갑니다. 프로그래밍 언어는 비교적 단기간에 만들어지는 언어이고, 그에 따라 특정 사람과 집단의 목적에 충실합니다. 다만, 이 관점에서 봤을 때도 Kotlin이 Java의 wrapper로써 설계되었을 것보다는 다양한 타겟 플랫폼이 고려되고 있는 하나의 프로그래밍 언어로 받아들여 주시기를 바랍니다. :)
Poche chiacchiere e tanto codice per cercare rendere la nostra vita di
sviluppatori più divertente.
Parleremo di JAX-RS, le annotazioni, l'MVC che mette a disposizione e
l'integrazione di Jersey con Guice.
Useremo AOP per gestire log, transazioni e con l'aiuto di Infinispan
limiteremo le chamate concorrenti sul nostro cluster.
Auto-GWT : Better GWT Programming with XtendSven Efftinge
Presentation from GWT.create 2015 EU
Auto-GWT (auto-gwt.org) is a library for the Google Web Toolkit, that frees your code from unneccessary and complicated boilerplate and at the same time pushes the IDE capabilities to a new level. Auto-GWT is based on Xtend (xtendlang.org).
Xtend is a modern programming language that is 100% compatibly with existing Java libraries and even translates to readable Java source code. With it's slick syntax and powerful features such as lambdas, operator overloading and compile-time macros you can turn any verbose piece of Java code into a small and elegant piece of expressive Xtend code.
In this session we will show how Xtend can be used to program GWT applications and how well the typical GWT idioms are supported by the language.
Everybody knows : Web is the platform of the future. Developing for the browser unfortunately requires us to learn and write JavaScript. Not only that but we also have to integrate the JavaScript client code with the server side, which often runs on the JVM (i.e. is written in Java). So we have to work in two different languages with completely different tools and APIs, and cannot share code between the client and the server.
The Google Web Toolkit (GWT) provides a way to write your client side web application entirely in Java and have it automatically translated to fast and compact JavaScript. It allows you to access all the browser functionality through a statically typed API. You only have to learn and use one language and you can use your code on the client as well as on the server.
The downside : Java is a bad match for the asynchronous programming model required on the browser and generally forces us to write and read a lot of boilerplate code.
In this session you'll see how programming GWT applications with Eclipse Xtend provides the best of both worlds:
Static typing with advanced IDE support meets a powerful and expressive language - right at your finger tips.
Short (45 min) version of my 'Pragmatic Real-World Scala' talk. Discussing patterns and idioms discovered during 1.5 years of building a production system for finance; portfolio management and simulation.
Groovy is a great language with extremely powerful capabilities about compile time meta-programming. Do you know that provides more than 40 AST transformations out-of-the box just to make your life as a developer easier?
In this talk you will learn the most important transformations provided by Groovy. I'll use a lot of code examples to explain all the concepts.
Writing Domain-Specific Languages for BeepBeepSylvain Hallé
This paper describes a plug-in extension of the BeepBeep 3 event stream processing engine. The extension allows one to write a custom grammar defining a particular specification language on event traces. A built-in interpreter can then convert expressions of the language into chains of BeepBeep processors through just a few lines of code, making it easy for users to create their own domain-specific languages.
If you thought Monads are a mystery, then this demonstration would show you how to evolve your code towards a Monad without knowing about it. This demo will neither go into any Category Theory nor begin with monadic laws. Instead, we will start with typical code that you see in your daily life as a developer, attempt to DRY (Don't Repeat Yourself) it up and eventually use Monad to remove duplication and verbosity. You'll also see how Monads make your code more declarative and succinct by sequencing the steps in your domain logic.
Also, we know in Java8 Checked Exceptions + λ == Pain! To be more precise, we will evolve a Try<t> (exception handling monad) which is missing in Java8, similar to one found in Scala.
Everyone knows Python's basic datatypes and their most common containers (list, tuple, dict and set).
However, few people know that they should use a deque to implement a queue, that using defaultdict their code would be cleaner and that they could be a bit more efficient using namedtuples instead of creating new classes.
This talk will review the data structures of Python's "collections" module of the standard library (namedtuple, deque, Counter, defaultdict and OrderedDict) and we will also compare them with the built-in basic datatypes.
Currying and Partial Function Application (PFA)Dhaval Dalal
We look at Currying and Partial Function Application (PFA) in Functional Programming. Languages like Clojure don't have currying, but PFA, where has Haskell currying and not PFA, whereas Scala has both, Groovy wants you to call methods like curry() and rcurry(). In OO paradigm, we use DI (dependency Injection) and we will see how this is automatically subsumed using Currying and PFA.
Description:
This project is an online Chat Room System which is built in Java Swing. The system adopts 3 tier architecture in which the client request server to register itself to the room, server register’s the user to the room and finally the client can share content with other registered client via server.
The system allows the user to connect from different location in a common chat-room where they can broadcast text messages and share drawing with other registered users.
Features:
• Apart from sharing content, the server broadcast entry and exist of the user.
• The chat window of every user is registered with client specific Title.
• Messages from client are pre-pend with their name.
• Cosmetic color change is implemented on-hover, on-active on the chat window, its borders and buttons.
• System allows tracking the user who is currently present in the chat room.
• System has the feature to save text messages/history in a text file from the chat window to the client local system.
Short (45 min) version of my 'Pragmatic Real-World Scala' talk. Discussing patterns and idioms discovered during 1.5 years of building a production system for finance; portfolio management and simulation.
Groovy is a great language with extremely powerful capabilities about compile time meta-programming. Do you know that provides more than 40 AST transformations out-of-the box just to make your life as a developer easier?
In this talk you will learn the most important transformations provided by Groovy. I'll use a lot of code examples to explain all the concepts.
Writing Domain-Specific Languages for BeepBeepSylvain Hallé
This paper describes a plug-in extension of the BeepBeep 3 event stream processing engine. The extension allows one to write a custom grammar defining a particular specification language on event traces. A built-in interpreter can then convert expressions of the language into chains of BeepBeep processors through just a few lines of code, making it easy for users to create their own domain-specific languages.
If you thought Monads are a mystery, then this demonstration would show you how to evolve your code towards a Monad without knowing about it. This demo will neither go into any Category Theory nor begin with monadic laws. Instead, we will start with typical code that you see in your daily life as a developer, attempt to DRY (Don't Repeat Yourself) it up and eventually use Monad to remove duplication and verbosity. You'll also see how Monads make your code more declarative and succinct by sequencing the steps in your domain logic.
Also, we know in Java8 Checked Exceptions + λ == Pain! To be more precise, we will evolve a Try<t> (exception handling monad) which is missing in Java8, similar to one found in Scala.
Everyone knows Python's basic datatypes and their most common containers (list, tuple, dict and set).
However, few people know that they should use a deque to implement a queue, that using defaultdict their code would be cleaner and that they could be a bit more efficient using namedtuples instead of creating new classes.
This talk will review the data structures of Python's "collections" module of the standard library (namedtuple, deque, Counter, defaultdict and OrderedDict) and we will also compare them with the built-in basic datatypes.
Currying and Partial Function Application (PFA)Dhaval Dalal
We look at Currying and Partial Function Application (PFA) in Functional Programming. Languages like Clojure don't have currying, but PFA, where has Haskell currying and not PFA, whereas Scala has both, Groovy wants you to call methods like curry() and rcurry(). In OO paradigm, we use DI (dependency Injection) and we will see how this is automatically subsumed using Currying and PFA.
Description:
This project is an online Chat Room System which is built in Java Swing. The system adopts 3 tier architecture in which the client request server to register itself to the room, server register’s the user to the room and finally the client can share content with other registered client via server.
The system allows the user to connect from different location in a common chat-room where they can broadcast text messages and share drawing with other registered users.
Features:
• Apart from sharing content, the server broadcast entry and exist of the user.
• The chat window of every user is registered with client specific Title.
• Messages from client are pre-pend with their name.
• Cosmetic color change is implemented on-hover, on-active on the chat window, its borders and buttons.
• System allows tracking the user who is currently present in the chat room.
• System has the feature to save text messages/history in a text file from the chat window to the client local system.
There has been a heap of talk about web frameworks recently, React is one which is particularly interesting.
React takes a very different approach to how you build and compose your javascript applications. After this session you will have a good understanding what React is, how it is different to other frameworks like Angular and Ember and the reasons you might want to give it a go.
«Продакшн в Kotlin DSL» Сергей РыбалкинMail.ru Group
- Как пришли к использованию и разработки своих DSL
- Посмотрим примеры используемых в экосистеме DSL - gradle, spek, spring
- Рассмотрим базис для конструирования DSL на примере kohttp
At Affordable Garage Door Repair, we specialize in both residential and commercial garage door services, ensuring your property is secure and your doors are running smoothly.
La transidentité, un sujet qui fractionne les FrançaisIpsos France
Ipsos, l’une des principales sociétés mondiales d’études de marché dévoile les résultats de son étude Ipsos Global Advisor “Pride 2024”. De ses débuts aux Etats-Unis et désormais dans de très nombreux pays, le mois de juin est traditionnellement consacré aux « Marches des Fiertés » et à des événements festifs autour du concept de Pride. A cette occasion, Ipsos a réalisé une enquête dans vingt-six pays dressant plusieurs constats. Les clivages des opinions entre générations s’accentuent tandis que le soutien à des mesures sociétales et d’inclusion en faveur des LGBT+ notamment transgenres continue de s’effriter.
Care Instructions for Activewear & Swim Suits.pdfsundazesurf80
SunDaze Surf offers top swimwear tips: choose high-quality, UV-protective fabrics to shield your skin. Opt for secure fits that withstand waves and active movement. Bright colors enhance visibility, while adjustable straps ensure comfort. Prioritize styles with good support, like racerbacks or underwire tops, for active beach days. Always rinse swimwear after use to maintain fabric integrity.
Understanding the Mahadasha of Shukra (Venus): Effects and RemediesAstro Pathshala
The Mahadasha of Shukra (Venus) is one of the most significant periods in Vedic astrology. Shukra is known as the planet of love, beauty, wealth, and luxury. Its Mahadasha can bring about profound changes in an individual's life, both positive and negative, depending on its placement and condition in the natal chart.
What is Shukra Mahadasha?
Mahadasha is a planetary period in Vedic astrology that affects various aspects of an individual's life for a specific number of years. The Mahadasha of Shukra lasts for 20 years and is known to bring a period of significant transformation. Shukra is associated with pleasures, creativity, relationships, and material comforts. During its Mahadasha, these areas of life tend to get highlighted.
MRS PUNE 2024 - WINNER AMRUTHAA UTTAM JAGDHANEDK PAGEANT
Amruthaa Uttam Jagdhane, a stunning woman from Pune, has won the esteemed title of Mrs. India 2024, which is given out by the Dk Exhibition. Her journey to this prestigious accomplishment is a confirmation of her faithful assurance, extraordinary gifts, and profound commitment to enabling women.
The Fascinating World of Bats: Unveiling the Secrets of the Nightthomasard1122
The Fascinating World of Bats: Unveiling the Secrets of the Night
Bats, the mysterious creatures of the night, have long been a source of fascination and fear for humans. With their eerie squeaks and fluttering wings, they have captured our imagination and sparked our curiosity. Yet, beyond the myths and legends, bats are fascinating creatures that play a vital role in our ecosystem.
There are over 1,300 species of bats, ranging from the tiny Kitti's hog-nosed bat to the majestic flying foxes. These winged mammals are found in almost every corner of the globe, from the scorching deserts to the lush rainforests. Their diversity is a testament to their adaptability and resilience.
Bats are insectivores, feeding on a vast array of insects, from mosquitoes to beetles. A single bat can consume up to 1,200 insects in an hour, making them a crucial part of our pest control system. By preying on insects that damage crops, bats save the agricultural industry billions of dollars each year.
But bats are not just useful; they are also fascinating creatures. Their ability to fly in complete darkness, using echolocation to navigate and hunt, is a remarkable feat of evolution. They are also social animals, living in colonies and communicating with each other through a complex system of calls and body language.
Despite their importance, bats face numerous threats, from habitat destruction to climate change. Many species are endangered, and conservation efforts are necessary to protect these magnificent creatures.
In conclusion, bats are more than just creatures of the night; they are a vital part of our ecosystem, playing a crucial role in maintaining the balance of nature. By learning more about these fascinating animals, we can appreciate their importance and work to protect them for generations to come. So, let us embrace the beauty and mystery of bats, and celebrate their unique place in our world.
The Fascinating World of Bats: Unveiling the Secrets of the Night
Presentation of sexy.rgtk
1. sexy.rgtk: a package for programming RGtk2
GUI in a user-friendly manner
Damien Leroux1
, Nathalie Villa-Vialaneix1,2
Rencontres R 2013, June 28th
1 2
Damien Leroux sexy.rgtk
5. Conceptual GUI structure
@|
@|
@|
Label text:"A word of advice"
Separator
@|
Label text:"My two cents"
Text input
Horizontal container
Button label:"Send!" click:sendData()
Vertical container
Frame
Window title:"All your input are belong to us"
Damien Leroux sexy.rgtk
6. RGtk2 Actual code (simple version)
library(RGtk2)
vc <- gtkVBoxNew()
vc$packStart(gtkLabelNew("A word of advice"))
vc$packStart(gtkHSeparatorNew())
hc <- gtkHBoxNew()
hc$packStart(gtkLabelNew("My two cents"))
entry <- gtkEntryNew()
hc$packStart(entry)
vc$packStart(hc)
but <- gtkButtonNew()
gtkButtonSetLabel(but, "Send!")
vc$packStart(but)
w <- gtkWindowNew()
gtkWindowSetTitle(w,
"All your input are belong to us")
w$add(vc)
sendData <- function(...) {
print(gtkEntryGetText(entry))
}
gSignalConnect(but, "clicked", sendData)
Damien Leroux sexy.rgtk
7. RGtk2 Actual code (simple version)
library(RGtk2)
vc <- gtkVBoxNew()
vc$packStart( gtkLabelNew("A word of advice") )
vc$packStart( gtkHSeparatorNew() )
hc <- gtkHBoxNew()
hc$packStart( gtkLabelNew("My two cents") )
entry <- gtkEntryNew()
hc$packStart(entry)
vc$packStart(hc)
but <- gtkButtonNew()
gtkButtonSetLabel(but, "Send!")
vc$packStart(but)
w <- gtkWindowNew()
gtkWindowSetTitle(w,
"All your input are belong to us")
w$add(vc)
sendData <- function(...) {
print(gtkEntryGetText(entry))
}
gSignalConnect(but, "clicked", sendData)
Widget construction
Damien Leroux sexy.rgtk
8. RGtk2 Actual code (simple version)
library(RGtk2)
vc <- gtkVBoxNew()
vc$packStart(gtkLabelNew("A word of advice"))
vc$packStart(gtkHSeparatorNew())
hc <- gtkHBoxNew()
hc$packStart(gtkLabelNew("My two cents"))
entry <- gtkEntryNew()
hc$packStart(entry)
vc$packStart(hc)
but <- gtkButtonNew()
gtkButtonSetLabel(but, "Send!")
vc$packStart(but)
w <- gtkWindowNew()
gtkWindowSetTitle(w, "All your input are belong to us")
w$add(vc)
sendData <- function(...) {
print(gtkEntryGetText(entry))
}
gSignalConnect(but, "clicked", sendData)
Widget configuration
Damien Leroux sexy.rgtk
9. RGtk2 Actual code (simple version)
library(RGtk2)
vc <- gtkVBoxNew()
vc$packStart(gtkLabelNew("A word of advice"))
vc$packStart(gtkHSeparatorNew())
hc <- gtkHBoxNew()
hc$packStart(gtkLabelNew("My two cents"))
entry <- gtkEntryNew()
hc$packStart(entry)
vc$packStart(hc)
but <- gtkButtonNew()
gtkButtonSetLabel(but, "Send!")
vc$packStart(but)
w <- gtkWindowNew()
gtkWindowSetTitle(w,
"All your input are belong to us")
w$add(vc)
sendData <- function(...) {
print(gtkEntryGetText(entry))
}
gSignalConnect(but, "clicked", sendData)
Widget tree creation
Damien Leroux sexy.rgtk
10. RGtk2 Actual code (simple version)
library(RGtk2)
vc <- gtkVBoxNew()
vc$packStart(gtkLabelNew("A word of advice"))
vc$packStart(gtkHSeparatorNew())
hc <- gtkHBoxNew()
hc$packStart(gtkLabelNew("My two cents"))
entry <- gtkEntryNew()
hc$packStart(entry)
vc$packStart(hc)
but <- gtkButtonNew()
gtkButtonSetLabel(but, "Send!")
vc$packStart(but)
w <- gtkWindowNew()
gtkWindowSetTitle(w,
"All your input are belong to us")
w$add(vc)
sendData <- function(...) {
print(gtkEntryGetText(entry))
}
gSignalConnect(but, "clicked", sendData)
Assign behaviour to events
Damien Leroux sexy.rgtk
11. sexy.rgtk manifesto
sexy.rgtk aims at
Make the widget tree creation more natural
Make the code more readable
Make the basic and common operations easier and more
concise
While retaining the full power of RGtk2
sexy.rgtk is a layer on top of RGtk2
plain RGtk2 code can be mixed with sexy.rgtk code
Damien Leroux sexy.rgtk
12. sexy.rgtk equivalent code
library(sexy.rgtk)
sendData <- function(...) {
print(ws$entry$text)
}
ws <- Window(
title="All your input are belong to us",
contents=
VBox(contents=list(
Label("A word of advice"),
HSeparator(),
HBox(contents=list(
Label("My two cents"),
Entry(use.name="entry"))),
Button(label="Send!",
on("clicked", sendData)))))
Damien Leroux sexy.rgtk
13. sexy.rgtk equivalent code (comparison)
library(sexy.rgtk)
sendData <- function(...) {
print(ws$entry$text)
}
ws <- Window(
title="All your input are belong to us",
contents=
VBox(contents=list(
Label("A word of advice"),
HSeparator(),
HBox(contents=list(
Label("My two cents"),
Entry(use.name="entry"))),
Button(label="Send!",
on("clicked", sendData)))))
library(RGtk2)
sendData <- function(...) {
print(gtkEntryGetText(entry))
}
vc <- gtkVBoxNew()
vc$packStart(gtkLabelNew("A word of advice"))
vc$packStart(gtkHSeparatorNew())
hc <- gtkHBoxNew()
hc$packStart(gtkLabelNew("My two cents"))
entry <- gtkEntryNew()
hc$packStart(entry)
vc$packStart(hc)
but <- gtkButtonNew()
gtkButtonSetLabel(but, "Send!")
vc$packStart(but)
w <- gtkWindowNew()
gtkWindowSetTitle(w,
"All your input are belong to us")
w$add(vc)
gSignalConnect(but, "clicked", sendData)
Damien Leroux sexy.rgtk
14. How does it work ?
Using RGtk2 (almost consistent) semantics
Constructors
gtkLabelNew
section class action (simple constructor)
gtkLabelNewWithMnemonic
section class action (fancy constructor)
Modificators
gtkLabelSetText
section class ! property
Accessors
gtkLabelGetText
section class ! property
Damien Leroux sexy.rgtk
15. How does it work ?
sexy.rgtk covers all classes, getters, and setters in the gtk section
library(RGtk2)
l <- gtkLabelNew()
gtkLabelSetText(l, "pouet")
print(gtkLabelGetText(l))
library(sexy.rgtk)
l <- Label()
l$text <- "pouet"
print(l$text)
sexy.rgtk combines the construction and configuration steps
library(RGtk2)
l <- gtkLabelNew()
gtkLabelSetText(l, "pouet")
gtkLabelSetAngle(l, 23)
library(sexy.rgtk)
l <- Label(text="pouet", angle=23)
Damien Leroux sexy.rgtk
16. How does it work ?
sexy.rgtk makes the widget hierarchy more explicit
library(RGtk2)
l <- gtkLabelNew()
w <- gtkWindowNew()
gtkLabelSetText(l, "Foobar")
gtkWindowSetTitle(w, "Wibble")
w$add(l)
library(sexy.rgtk)
w <- Window(
title="Wibble",
contents=Label(text="Foobar"))
Signal connections are also more better (sic) with sexy.rgtk
library(RGtk2)
callback <- function(widget, data) {
cat("Pouet.n")
}
b <- gtkButtonNew()
gtkButtonSetLabel(b, "Fire")
gSignalConnect(b, "clicked", callback)
# or
connectSignal(b, "clicked", callback)
# Oh wait, this breaks the naming rules
library(sexy.rgtk)
callback <- function(widget , data) {
cat("Pouet.n")
}
b <- Button(label="Fire",
on("clicked",
run=cat("Pouet.n")))
# or
b <- Button(label="Fire",
on("clicked", callback))
Damien Leroux sexy.rgtk
17. Feature summary
All the gtk* functions are wrapped in an easier interface.
library(RGtk2) library(sexy.rgtk)
Unified constructors
bu <- gtkButtonNew()
bu <- gtkButtonNewFromStock(...)
bu <- Button()
bu <- Button(from.stock=list(...))
Natural getters and setters
gtkButtonSetFocusOnClick(bu, T)
gtkButtonGetLabel(bu, "...")
bu$focus.on.click <- T
bu$label
Coherent use of names() to include getters and setters
Damien Leroux sexy.rgtk
18. Feature summary
All the gtk* functions are wrapped in an easier interface.
library(RGtk2) library(sexy.rgtk)
Everything can be actually done via the constructors
w <- gtkWindowNew()
l <- gtkLabelNew()
gtkLabelSetText(l, "1234567890")
gtkLabelSelectRegion(l, 2, 5)
w$add(l)
w <- Window(contents=
Label(use.name="lab",
text="1234567890",
apply=list(
SelectRegion=
list(2, 5)
))
Widget access through the hierarchy with use.name=
gtkLabelSetText(l, "toto pouet") w$lab$text <- "toto pouet"
Damien Leroux sexy.rgtk
19. There’s more!
sexy.rgtk also tries to address some common patterns
Associate a label to an input widget
library(RGtk2)
l <- gtkLabelNew()
gtkLabelSetText(l, "Input")
i <- gtkEntryNew()
hbox <- gtkHBoxNew()
hbox$packStart(l)
hbox$packStart(i)
# to use a mnemonic:
l <- gtkLabelNewWithMnemonic()
gtkLabelSetText(l, "_Input")
gtkLabelSetMnemonicWidget(l, i)
library(sexy.rgtk)
# also supports vertical alignment
# and label on either side of the
# widget
x <- LabeledWidget("Input",
Entry())
# to use a mnemonic:
x <- LabeledWidget("_Input",
Entry(),
mnemonic=T)
Rows or columns of widgets (VBoxes inside HBox or vice versa)
library(RGtk2)
vb <- gtkVBoxNew()
hb <- gtkHBoxNew()
hb$packStart(gtkLabelNew())
hb$packStart(gtkLabelNew())
vb$packStart(hb)
hb <- gtkHBoxNew()
hb$packStart(gtkEntryNew())
vb$packStart(hb)
library(sexy.rgtk)
# of course it can also become
# very verbose when you actually
# configure the widgets
vb <- Rows(Label(), Label(), br,
Entry())
Damien Leroux sexy.rgtk
20. There’s more!
Last but not least: displaying a data.frame
library(RGtk2)
# I’m sorry this is way too gory.
# In short:
# - create an rGtkDataFrame(
# my.data.frame)
# (this is the datastore)
# - create renderer function(s)
# function(col, colrenderer ,
# model, iter, data)
# - create a GtkTreeView
# - associate the datastore with the
# tree view
# - declare each column to display
# and assign a renderer to each
# of them
library(sexy.rgtk)
# Supports specific renderers only if
# required , with a default to
# plaintext as seen in the demo.
# By default , all columns are to be
# displayed.
# The interface to the renderers is
# simplified.
# Also supports row names.
df.widget <- DataFrame(my.data.frame)
# et voila!
Damien Leroux sexy.rgtk
21. References
Build a simple GUI with RGtk2
http://tuxette.nathalievilla.org/?p=866&lang=en
RGtk2: R bindings for Gtk 2.8.0 and above
http://cran.r-project.org/web/packages/RGtk2/
index.html
Mulcyber: sexy.rgtk: Project home https:
//mulcyber.toulouse.inra.fr/projects/sexy-rgtk/
Damien Leroux sexy.rgtk