using RStudio as an pseudo shiny app - r

This is a rather general, and curious question.
I am working on a moderately complex shiny app, using custom HTML and Javascript code (with menus and independent dialogs), using shiny as a communication protocol with the base R. Everything looks very nice, until I realised that RStudio itself is a web page (or am I wrong?)
The main reason to design a GUI in a shiny app is it's cross-platform, but it still needs to be opened in a web browser. Conversely, RStudio is also a web page but opens just like any other installed software. To me, it looks like a self-contained web browser with different menus.
Now the question: is it possible to use parts of RStudio in a different "app"?
For example, I would love to separate the code editor and the console from RStudio and use them in conjunction with other HTML and Javascript code to produce a GUI similar to RStudio but with different purposes.
To better explain why: RStudio is fantastic, but it has the one big disadvantage (no flame intended, others think this is a feature) that everything must fit in the same page. In order to make the code editor larger, one needs to shrink other parts of the interface. I would like to make them separate dialogs, creating divs when a menu is selected.
Thanks in advance,
Adrian

engineer from RStudio here. You are correct about RStudio itself being "a web page"; the whole UI is effectively done in HTML. There's even a version of RStudio which already runs in a web browser called RStudio Server.
There are unfortunately no extensibility points to do what you want. RStudio internals are largely anonymized and insulated from external access, which make them difficult to separate, re-use, or connect to other services. Here are a few pointers that may be helpful, however:
As a commenter pointed out, it is now possible to pop out the editor window.
You can make an RStudio Add-in which runs in a separate browser window when invoked. Depending on what you want to do in your separate window, you may be able to accomplish it with an add-in.
If you can't use add-ins, the easiest thing to do is actually to just change RStudio itself. It's an open source project, so you're welcome to hack on it and make improvements in reusability or UI flexibility. We welcome pull requests. :-)

Related

In JavaFX, Is there a best practice or framework for creating program help files? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed last year.
Improve this question
I've been experimenting with using HTML as a structure for generating a help information area for a desktop program that I've finished writing and that seems to work ok, though I don't really like the way it is turning out and I began to wonder if perhaps there might be a better way to go about it. Perhaps a library that makes generating and linking content within Java a little easier in that context or some other means that I'm not aware of.
I did some Googling on the topic but found nothing specifically in reference to help menu / content creation.
Does anyone know of any libraries out there that would make it easier to create help info for end users?
Or, is there a "best practice" for doing this or any other method to that end?
Thank you,
Mike
What does Idea do?
Intellij is large java app that has decent help documentation. You could look and see how they did that, if that is something you wish to emulate. I think it is mostly good quality writing and organization rather than tool support, though I guess they use decent tooling too.
I did a quick check to see how idea create their doc. They write in markdown format. Here is the markdown style guide they use for creating the document, in generated html form and in markdown authoring form. A repository of docs used for one of their products is their open source sdk docs. The SDK docs project is an Idea project, so I guess they just use Idea for authoring. If it seems to be something that would help you, you could try cloning the project and generating documentation from it or contacting the project contributors for more info.
As far as tying the help content into your app, either you can display it in situ using a WebView or link to it externally using HostServices. You could study the help system used within Idea to see how they generally do that, e.g. help menus used, key commands responded to, icons used to link to the help system, etc.
Generally, the way it works is:
The document is written in markdown then processed and rendered to html.
The html documents have copious anchors throughout.
The help menu items link to the anchors directly.
Help menus and shortcut keys follow platform specific conventions and differ between Windows and Mac.
There is a single ? icon in dialogs which appears in a consistent place and it links to an anchor in the html for context sensitive help in the dialog.
The documentation itself is hosted on a website so it can be accessed independently of the application.
The app launches an external browser to view the help rather than using something like a WebView to show the help internally.
Additionally, Idea will use tooltips which show up on hover. Tooltips aren't used for every control or UI element, only certain ones. If there is a keyboard accelerator which can be used to trigger the control action, then there is a tooltip for it, and in the tooltip it lets you know what the keyboard shortcut to trigger it is.
The rendered HTML to which the app is linked is hosted at the jetbrains website.
Linking to HTML help
You could:
Link to your own hosted website, OR
Link to html files packaged with your app.
Both could be rendered by either WebView or a browser showing a document using HostServices, using the file: protocol to access html files packaged with your app or https: protocol for files hosted on your web server.
What does SceneBuilder do?
For a pure JavaFX application, SceneBuilder is quite large and complex. It has no reliance on internal help at all, just a single help menu item, accessible via an F1 shortcut. The help links to a website authored and hosted by Oracle (using the standard tool Oracle use for authoring most Java platform docs, which is likely a commercial tool). It is not as nicely integrated and context sensitive as the Idea example but it does demonstrate a simple approach to documenting an app via an external website.

Recommended Electron App configuration - iframe? webview? local server? other?

I am building my first electron desktop app. It creates a formatted document/book from spreadsheet data to either be printed or made into a PDF. I am trying to figure out the best way to prevent performance loss from reflow/repaint when having a large document(lots of divs). I have found that if I have the book in an iframe then I do not suffer reflows/repaints from UI changes and can control when to have it loaded. If I try to create a PDF however I will only get the amount of the iframe that is visible.
Simply, I'm looking for the best solution to prevent reflow in a complex HTML element while still being able to print it to PDF.
I've found a solution to the problem.
As far as I understand, for an electron desktop app, that is not running a server, you cannot directly access myIframe.contentDocument on elements for actions such as append, innerHTML, or offsetHeight etc. The only thing you can do is contentDocument.write(), however once you have used this method, you have access to all of the other regular DOM methods. The best I can understand is that when you use contentDocument.write() it essentially creates a virtual HTML document. This is my workaround at the moment which is working like a charm in giving me control over what elements reflow and what ones do not.
Hope this helps anyone dealing with the same issue.

CSS Grid Development Environment on Windows

I wish to upgrade my web site development environment. Currently using Adobe Dreamweaver (out of habit), but need to
Write HTML/CSS/PHP/MySQL code in an editor with syntax highlighting, code/tag completion, code hints.
have a browser window that reflects the code window results (on a save). So write HTML/CSS code, save it, and the browser window is updated
support for major browsers (choose the browser to be used in the display window)
allow adjust of browser window width to see responsiveness of my code
supports latest CSS, including CSS Grid and Flexbox
Windows 10 environment; not interested in adding Linux (WSL)
will consider an XAMP/WAMP environment for testing of PHP/MySQLi code locally
free or low-cost programs are preferred (I'm on a limited budget, but will spend the $ for what is needed)
An important part is things running in Windows 10 environment, and the side-by-side display of a code and browser windows in the editor.
I realize this might be an 'opinion' question (and will probably get some downvotes), but need to get some directions to look at. The googles haven't been helpful yet.
If I understand correctly you need a text editor that can help you to indent your code and highlight your errors ?
Try to take a look at https://code.visualstudio.com/. Vs Code Editor
You can find a lot of extension to help you write code and find errors

Automate existing web browser session

How can I programmatically interact with an existing web page in a web browser launched in a standard way? For example I navigate to a specific page and want to be able to run a Python script that fills some edits or clicks some elements.
This should be possible at least through IAccessible2 for main browsers, but I did not find any pointers. To put it in another way, how do screen readers do it? And bonus question, is there Python library for it?
EDIT: I am looking for something more than user input simulation. I would like to programmatically read the DOM at least, write if possible. So far I have looked at code in NVDA which is very low-level and complex. Is there anything easier?
How can I programmatically interact with an existing web page in a web browser launched in a standard way? For example I navigate to a specific page and want to be able to run a Python script that fills some edits or clicks some elements.
The answer is keyboard/mouse macros if you have to visually see the browser as it happens. You can google macro programs for your OS.
But you most likely are looking for a headless browser such as PhantomJS, HtmlUnit, TrifleJS, Splash, and SimpleBrowser
Check out - https://saucelabs.com/blog/headless-browser-testing-101
When you mention 'interact with an existing webpage in a web browser launched in the standard way' you are talking about the DOM (Document Object Model).
Many QA environments are running testing scripts on code that has not been rendered by the browser into a DOM (you see the DOM when you inspect a page using your browser tools). When you use a headless browser it creates the DOM and then runs all the tests as if a human were clicking without having to visually look at it happen.
see - https://css-tricks.com/dom/
To put it in another way, how do screen readers do it? And bonus question, is there Python library for it?
Screen readers are interacting with the DOM at a low level. I do not know if there is a Python library. Most likely this would be overkill though unless you are building a desktop app that interacts with browsers like a screen reader does.
edit...
I did some more digging and found this article that is a much more verbose explanation of how screen readers interact with the browser/dom.
Also, there is a python API for manipulating the DOM and this library seemed popular.

Automated functional testing qt apps in windows

I'm trying to create scripts that test if some GUI components exist inside a window (combo boxes, check boxes, the state of check boxes, etc.) The app I want to tests is written in QT and running on Windows 7. Its content is created dynamically.
I've tried with swapy/pywinauto, AutoHotkey and AutoIt. But as they rely on standard Windows API calls they are useless for this (need a solution that involves QT).
Any recommendation will be appreciated.
You can try QtTestLib for integrated solution, or, if you want (and can afford) commercial solutions, I am aware of squish and kdexecutor.
Are you aware that AutoHotKey Windows Spy allows you to see if certain GUI objects exist inside a window. In the example image you see that I held the mouse over a combo box named ComboBox5. Are you trying to test at this level?
The rest can be found here already:Check if a certain button is existing or not using autohotkey

Resources