Git Product home page Git Product logo

gwidgets2rgtk2's People

Contributors

jverzani avatar landroni avatar tmelliott avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gwidgets2rgtk2's Issues

Multiple drag-select in gtable

Hi @jverzani - any idea if it would be possible to encourage a gtable with multiple=TRUE to allow drag-and-drop on all selected options? i.e., use case is regression model, table contains list of explanatory variables; being able to select multiple and drag-and-drop to explanatory box would be useful (and intuitive).

Currently, it seems like the "click" behaviour is fixed on the button_press event (rather than button_release) so as soon as you click one of the values, any others you've already selected become unselected and you can only drag one at a time.

If you think this might be possible, can you point me in the direction of where to start hacking?

Cheers ๐Ÿ‘

set width for gtext

There seems to be an issue when the 'width' argument for the Gtext class is specified. The class method SetSizeRequest is invoked on an unknown object 'sw'
@jverzani

search

Hi John @jverzani ,
I am using gfile() in my project.
I found there is a search option on the left top hand side, but it is not working..
Something wrong or I have to build more in the ... argument?

Just a question not issue.
You can delete once you read.

Thank you,
Best Regards,
Junjie

gWidgets2RGtk2 fails because cannot load RGtk2

Hi,

I am trying to install gWidgets2RGtk2 with:
install_github("jverzani/gWidgets2RGtk2") (or from https://cran.r-project.org/src/contrib/Archive/gWidgets2RGtk2/)

However, it fails to load the RGtk2 dynamic library (even though it is already installed).

here is the code+session_info:

library(RGtk2)
install_github("jverzani/gWidgets2RGtk2")

Warning: Failed to load RGtk2 dynamic library, attempting to install it.
Please install GTK+ from http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.22/gtk+-bundle_2.22.1-20101227_win32.zip
If the package still does not load, please ensure that GTK+ is installed and that it is on your PATH environment variable
IN ANY CASE, RESTART R BEFORE TRYING TO LOAD THE PACKAGE AGAIN
Error: package or namespace load failed for 'RGtk2':
.onLoad failed in loadNamespace() for 'RGtk2', details:
call: NULL
error: node stack overflow
Error : package 'RGtk2' could not be loaded
Error: loading failed
Execution halted
*** arch - x64
Warning: package 'memoise' was built under R version 4.1.3
Warning: package 'RGtk2' was built under R version 4.1.1
Warning: package 'gWidgets2' was built under R version 4.1.3
Warning: package 'digest' was built under R version 4.1.3
ERROR: loading failed for 'i386'

  • removing 'C:/Users/.....'
    Warning message:
    In i.p(...) :
    installation of package โ€˜C:/Users/...../RtmpcRoNXu/file9fc19da318c/gWidgets2RGtk2_1.0-7.tar.gzโ€™ had non-zero exit status

session_info()

  • Session info --------------------------------------------------------------
    setting value
    version R version 4.1.0 (2021-05-18)
    os Windows 10 x64 (build 19044)
    system x86_64, mingw32
    ui RStudio
    language (EN)
    collate English_United States.1252
    ctype English_United States.1252
    tz America/Los_Angeles
    date 2022-06-15
    rstudio 2022.02.3+492 Prairie Trillium (desktop)
    pandoc NA

  • Packages ------------------------------------------------------------------
    package * version date (UTC) lib source
    brio 1.1.3 2021-11-30 [1] CRAN (R 4.1.3)
    cachem 1.0.6 2021-08-19 [1] CRAN (R 4.1.3)
    callr 3.7.0 2021-04-20 [1] CRAN (R 4.1.3)
    cli 3.3.0 2022-04-25 [1] CRAN (R 4.1.3)
    crayon 1.5.1 2022-03-26 [1] CRAN (R 4.1.3)
    curl 4.3.2 2021-06-23 [1] CRAN (R 4.1.3)
    desc 1.4.1 2022-03-06 [1] CRAN (R 4.1.3)
    devtools * 2.4.3 2021-11-30 [1] CRAN (R 4.1.3)
    ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.1.3)
    fastmap 1.1.0 2021-01-25 [1] CRAN (R 4.1.3)
    fs 1.5.2 2021-12-08 [1] CRAN (R 4.1.3)
    glue 1.6.2 2022-02-24 [1] CRAN (R 4.1.3)
    lifecycle 1.0.1 2021-09-24 [1] CRAN (R 4.1.3)
    magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.1.3)
    memoise 2.0.1 2021-11-26 [1] CRAN (R 4.1.3)
    pkgbuild 1.3.1 2021-12-20 [1] CRAN (R 4.1.3)
    pkgload 1.2.4 2021-11-30 [1] CRAN (R 4.1.3)
    prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.1.3)
    processx 3.6.0 2022-06-10 [1] CRAN (R 4.1.3)
    ps 1.7.0 2022-04-23 [1] CRAN (R 4.1.3)
    purrr 0.3.4 2020-04-17 [1] CRAN (R 4.1.3)
    R6 2.5.1 2021-08-19 [1] CRAN (R 4.1.3)
    remotes 2.4.2 2021-11-30 [1] CRAN (R 4.1.3)
    RGtk2 * 2.20.36.2 2021-10-14 [1] CRAN (R 4.1.1)
    rlang 1.0.2 2022-03-04 [1] CRAN (R 4.1.3)
    rprojroot 2.0.3 2022-04-02 [1] CRAN (R 4.1.3)
    rstudioapi 0.13 2020-11-12 [1] CRAN (R 4.1.3)
    sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.1.3)
    testthat 3.1.4 2022-04-26 [1] CRAN (R 4.1.3)
    usethis * 2.1.6 2022-05-25 [1] CRAN (R 4.1.3)
    withr 2.5.0 2022-03-03 [1] CRAN (R 4.1.3)

porting code

these issues came up:

I am porting the DataEntry package to gWidgets2 and so far I have
found three problems:

  • Changing the label of a button triggers its Click event.

  • Changing the selection in a GTable does not trigger the Select
    event.

  • The label of a GFrame remains visible after
    visible(GFrame)<-FALSE.

Release 1.0.4 to CRAN?

I was giving a very basic talk on gWidgets2 yesterday (https://github.com/davidcsterratt/edinbr-gWidgets), and got myself thoroughly confused when, on one Linux machine, the following code gave an error (Error in plot.new() : figure margins too large) and did not produce the expected plot:

library(gWidgets2)
options(guiToolkit="RGtk2")
library(cairoDevice) 
win <- gwindow("Hello World, the next generation")
group <- ggroup(horizontal=FALSE, container=win)
g.d <- ggraphics(container=group, width=600, height=600)
d <- dev.cur()
obj <- gbutton("Plot", container = group,
               handler=function(h, ...) {
                 x <- rnorm(50)
                 plot(density(x, adjust=1, kernel="gaussian"))
                 rug(x)
               })

It turns out that, in preparation fro the talk, I had installed gWidgets2RGtk 1.0.3 on this machine. On another machine with the latest github version there was no problem. Upgrading to the latest github version (1.0.4) on the problematic machine fixed the problem. I'd suggest pushing the github version to CRAN, unless there are good reasons not to.

Export classes request

Would it be possible to export the different classes so that a user can inherit from them? This would allow for easy modifications and adding of features.
@jverzani

edit factor levels bug

The revamped edit factor levels looks more intuitive. Thanks. I've spotted something that looks like a bug, though.

Load mtcars and edit factor levels of Type. Select Large, type in Huge, then without pressing enter select Small. You will notice that unexpectedly Small becomes Huge.

GLayout overrides old entry in child_positions

@jverzani
When removing a child from a GLayout object that is in the middle of the child_position list, adding a child after this will override the last entry of the child_position list instead of being added to the end of it. The following code should demonstrate that:

w <- gwindow("glayout example", width = 600, height = 400)
g <- gframe(cont = w, expand = TRUE)
lbl1 <- glabel("lbl1")
lbl2 <- glabel("lbl2")
lbl3 <- glabel("lbl3")
lbl4 <- glabel("lbl4")
tbl <- glayout(cont = g)
tbl[1, 1] <- lbl1
tbl[2, 1] <- lbl2
tbl[3,1] <- lbl3
tbl[3,2] <- lbl4

tbl$remove_child(tbl$child_positions[["3"]]$child)
tbl$child_positions ## list of length 3, last name "4"

tbl[3, 1] <- "lbl3"

tbl$child_positions ## list of length 3, last name "4", entry for tbl[3,2] disappeared

edit factor levels request

Would it be possible to have a way to select the reference category for a factor? This is often very useful.

Slider problem or not?

Hi @jverzani ,
I am wondering the following....

gtk_range_set_range: assertion `min < max' failed,
the reason is I set sth below...

wio <- gwindow()
go <- ggroup(cont = wio)
subslider <- gslider(from = 0, to = 1, by = 1, cont = go)
gbb <- gcombobox(c(" ", "A"), cont = go)
addHandlerChanged(gbb, handler = function(h, ...) {

(subslider[] <-
if (svalue(gbb) == "A")
0:3
else
0:0)

})

I know it is a problem of mine and it is obviously wrong here...But I think in other cases, the warnings message is misleading and also if 0:0 the latter 0 is binding in another variables user may found confused.,...
In my case, I have set dropdown list return " ", input value 0 to the slider....
Can you also give me a hint that why slider can't set 0:0 and work no problem? (In 0:0 case, the slider is showing 0 but can't be drag and draw....)
I have no real CS degree background before, so if you can give me some idea of why here is not possible to achieve 0:0, it would be appreciated...
Thanks

Funny behvaiour of glayout

@jverzani
The following code produces some weird behaviour of glayout, which I think is due to the handling and removing of children. The code is

w <- gwindow("gtable example", width = 600, height = 400)
g <- gframe(cont = w, expand = TRUE)
gt <- gtable(c("levels of a categorical variable",
"numeric condition", "row number"), cont = g)
tbl <- glayout(cont = g)
gl <- glabel("Drop here")
btn <- gbutton("btn",
handler = function(h, ...) {
svalue(gl) <- "Drop here"
})
btn3 <- gbutton("add",
handler = function(h, ...) {
try(tbl$remove_child(
tbl[3,1]))
instbl <- tbl
instbl[3,1:3] <- (mygrp <- ggroup())
slider <- gslider(cont = mygrp)
})
btn2 <- gbutton("remove",
handler = function(h, ...) {
try(tbl$remove_child(
tbl[3,1]))
})
tbl[1, 1] <- gl
tbl[2, 1] <- btn
tbl[4,1] <- btn3
tbl[4,2] <- btn2
addDropTarget(gl, handler = function(h, ...) {
svalue(h$obj) <- h$dropdata
})
addDropSource(gt, handler = function(h, ...) svalue(h$obj))

The 'add' and 'remove' buttons add and remove a group with a slider to/from the layout. After using everyting twice, the classes of all children of the glayout are "logical". Also the child_positions variable of the glayout has only the ggroup in it, even after removing it. The 'children' list seems to handle things correctly.

highlight gdf column

Is it possible to add a way for the user to highlight gdf columns? Currently one can highlight a row (or several), but no way to highlight columns. I was thinking that a press on the column header could trigger a similar selection as that for the rows.

Can this be implemented?

3rd MenuPopup problem??

Hi John,
how is going?
Here I found some problem of the selected and 3rd MenuPopup...
I found the problem when I am creating a gtable has selectionchanged and 3rdMenuPopup...
I made a easier case...and in this case...using select and 3rdMenuPopup...

TableMenulist <- list(
one = gaction("Numeric", tooltip = "switch to numeric type",icon = "numeric", handler = function(h,...) {
print("1")
}),
two = gaction("Category", tooltip = "switch to catergory type", icon = "factor", handler = function(h,...) {
"print2"
})
)

w <- gwindow("gtable example", visible=FALSE)
g <- gvbox(cont=w)
tbl <- gtable(mtcars, cont=g, expand=TRUE, fill=TRUE)
add3rdmousePopupMenu(tbl, TableMenulist)
addHandlerSelect(tbl, handler=function(h,...) print(sprintf("You selected %s", svalue(h$obj))))
visible(w) <- TRUE

If you tried this code, you found when you press 'Ctrl' and mouse to select the row in the table and I thought it should not also popup the menu....

@jverzani

Best,
Junjie

Problem with newest release of GTK?

Using the latest version of RGtk2 (2.20.33) for R 3.4.0 the following happens:

library(gWidgets2)
w = gwindow()
g = ggroup(cont=w)
gedit("hello", cont=g)
## Error in `[.enums`(GtkStateType, 1) : Enum values must be strings

Some traceback, if that helps:

> traceback()
16: stop("Enum values must be strings")
15: `[.enums`(GtkStateType, 1)
14: GtkStateType[1]
13: .RGtkCall("S_gtk_widget_modify_text", object, state, color, PACKAGE = "RGtk2")
12: method(obj, ...)
11: widget$modifyText(GtkStateType[1], NULL)
10: clear_init_txt()
9: set_value(text)
8: .Object$initialize(...)
7: initialize(value, ...)
6: initialize(value, ...)
5: methods::new(def, ...)
4: GEdit$new(toolkit, text = text, width = width, coerce.with = coerce.with, 
       initial.msg = initial.msg, handler = handler, action = action, 
       container = container, ...)
3: .gedit.guiWidgetsToolkitRGtk2(toolkit, text = text, width = width, 
       coerce.with = coerce.with, initial.msg = initial.msg, handler = handler, 
       action = action, container = container, ...)
2: .gedit(toolkit, text = text, width = width, coerce.with = coerce.with, 
       initial.msg = initial.msg, handler = handler, action = action, 
       container = container, ...)
1: gedit("hello", cont = g)

If I install the previous version of RGtk2 (2.20.31), it works.

Not yet sure if directly related to this package, or elsewhere, but I'm hoping you'll have a better idea of the source than me.

Not all stock icons appear in GActions in toolbar on Ubuntu 14.04

Hello again,

this is a really minor bug, not a showstopper at all, and perhaps is specific to my setup.

Not all the icons that should be available (according http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html) are showing up in GActions, as demonstrated below.

library(gWidgets2)
options(guiToolkit="RGtk2")

h.cb <- function(h, ...) {}

g.win <- gwindow("Test gtoolbar()")
g.open <- gaction("Open", icon="open", handler=h.cb) # Has icon
g.run <-   gaction("Run", icon="system-run", handler=h.cb) # Doesn't have icon
g.media <- gaction("Media", icon="media-record", handler=h.cb) # Has icon
g.toolbar <- gtoolbar(list(open=g.open, g.run, g.media),
                      container=g.win, style="both")

Retrieve index of cell changed in `gdf` change handler?

When a user changes a value inside a Gdf, is it possible to somehow fetch the index of the changed cell?

library(gWidgets2RGtk2)
w <- gwindow()
g <- gvbox(container = w)
d <- gdf(iris, container = g)
addHandlerChanged(d, 
  function(h, ...) message("Cell [", i, ",", j, "] changed")
)

where i and j are the row/column indices of a changed cell ...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.