Re: [R-pkg-devel] tinyfiledialogs - The bindings are ready, but I need help to make of package of it
Thanks to everybody for the help and input. I happens that Paul was already working on preparing a tinyfiledialogs package for R ! As he seems to know what is doing much more than I do, I will let him go ahead with the .Call version he is preparing and will provide assistance when needed. thanks again. guillaume On 9/22/23 10:55, Paul Smith wrote: > Hi Guillaume > > As Ivan says there is a fair bit to packaging but not to much when you > get used to it. > > Since your email I've put a mostly untested package wrapping > tingfiledialogs via Rcpp on github > > https://github.com/waternumbers/tinyfiledialogR > > It is far from fully tested but might help. > > cheers > > Paul > [[alternative HTML version deleted]] __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
Re: [R-pkg-devel] R interface to tinyfiledialog
I did my bindings using the easy .C interface did you use the morecomplete .CALL ? On 9/22/23 00:08, Paul Smith wrote: > Hi, > > Following your email to the r-package-dev list I tidied up some > previous work I did with an R wrapper for the tinyfiledialog C code > into a package which can be found here > > https://github.com/waternumbers/tinyfiledialogR > > It is largely untested (except on my linux machine - KDE, openSUSE > tumbleweed) and not ready for CRAN but shows one way of interfacing to > the code. > > Feel free to fork or submit pull requests as you see fit. > > cheers > > Paul > [[alternative HTML version deleted]] __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
Re: [R-pkg-devel] tinyfiledialogs - The bindings are ready, but I need help to make of package of it
Hi, There are no dependencies and everything is considered/treated as UTF-8. On windows, I internally do all the conversions between UTF-8 and UTF-16. I also offer functions to convert between UTF-8 , UTF-16 and MBCS. I don't know what UCRT is, but tinyfiledialogs is compatible with all versions of windows from XP to 11, all the versions of mac since osx 10.2 and all the unix versions I have ever came accross. I was hoping to find a tldr version of the "how to write an extension". The source code is just one C file (+ header) and one R file for the interface. What files are supposed to be in my package ? the C file or the compiled shared libraries ? What else ? a documentation file ? is there a model to follow ? thanks for your help guillaume On 9/21/23 11:33, Ivan Krylov wrote: > Dear Guillaume Vareille, > > В Wed, 20 Sep 2023 12:30:53 +0200 > tinyfiledial...@ysengrin.com пишет: > >> I've been pointed to the documentation link on how to write a package, >> but it would really help if someone who knows what to do could direct >> me. > There's potentially a lot to tell. Converting the entire Writing R > Extensions [*] into e-mails is a poor use of one's time. Do you have > more specific questions? If you don't know where to start, try > utils::package.skeleton or the pkgKitten package (which aims to pass R > CMD check right from the start). There's also books like R Packages by > Hadley Wickham and Jennifer Bryan, but they mention a lot of techniques > and third-party dependencies that you don't have to use. > >> # first load the included library (it could easily be compiled >> on the target machine) >> dyn.load("tinyfiledialogsLinux64.so") > You will need to put your source files into the src/ subdirectory of > the package and arrange for them to get compiled (see WRE 1.1.5 and > 1.2.1). It's best to write a special entry point in order to let R know > about the functions you intend to call (see WRE 5.4). > > Does your code have third-party dependencies? If you'd like to put the > package on CRAN, you will need to bundle your own code with the package > (since it's probably not available yet in major GNU/Linux > distributions, macOS recipes and MXE) but set up a ./configure script > to locate the third-party dependencies while the package is being > installed:https://cran.r-project.org/web/packages/external_libs.html > >> result <- .C("tfd_openFileDialog", >> charToRaw(aTitle), > In R, strings have encodings. A string can be stored in UTF-8, Latin-1, > the native locale encoding (which may include anything from > Windows-936 to KOI8-R) or even as arbitrary bytes, which admittedly > makes it less of a string (see ?Encoding). > > x1 <- `Encoding<-`('fran\xe7ais', 'latin1') > x2 <- `Encoding<-`('fran\xc3\xa7ais', 'UTF-8') > x1 == x2 # TRUE, they encode the same characters > identical(charToRaw(x1), charToRaw(x2)) # not even the same length > > Which encoding does tfd_openFileDialog() use for the file names and > paths? Does it work with UCRT on Windows in UTF-8 locale mode? (Can you > return a filename that is not representable in the ANSI codepage?) You > will probably need to convert the strings into a certain encoding before > passing them to tfd_openFileDialog(...) (e.g. enc2utf8(.)). > >> if ( result$lOpenFile == "NULL" ) return() > What happens if I create a file named NULL on my system and try to open > it? > > Good luck, and I hope that your effort results in a good R package! > [[alternative HTML version deleted]] __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
[R-pkg-devel] tinyfiledialogs - The bindings are ready, but I need help to make of package of it
https://tinyfiledialogs.sourceforge.net Hi, I am the author of tinyfiledialogs a cross-platform C C++ library (windows, Mac, Unix) which offers many modal dialogs and popup notifications (both for graphic and console modes). It aims to be extremely easy to use. There is no init, no main loop, and no external dependencies. It is used by hundreds projects on GitHub. The following github call returns almost 15000 files (you need to be logged on github) https://github.com/search?q=tinyfd+OR+tinyfiledialogs=code With the latest version v3.14, I've just released the bindings for R. I've been pointed to the documentation link on how to write a package, but it would really help if someone who knows what to do could direct me. Thanks in advance Guillaume Vareille # first load the included library (it could easily be compiled on the target machine) dyn.load("tinyfiledialogsLinux64.so") # then load the included R interface tinyfd_openFileDialog <- function(aTitle, aDefaultPathAndFile , aNumOfFilterPatterns, aFilterPatterns, aSingleFilterDescription , aAllowMultipleSelects) { result <- .C("tfd_openFileDialog", charToRaw(aTitle), lOpenFile = aDefaultPathAndFile , as.integer(aNumOfFilterPatterns) , aFilterPatterns , charToRaw(aSingleFilterDescription) , as.integer(aAllowMultipleSelects) ) if ( result$lOpenFile == "NULL" ) return() else return(result$lOpenFile) } # now, you can call the dialog lFilename <- tinyfd_openFileDialog( "a title" , "/Users/bardos/Documents/" , 1 , c ("*.txt","*.jpg") , "some files" , 0 ) __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel