MATLAB - How do I automatically close the Import Wizard (command window)? - matlab

I am invoking the "uiimport" command within a program, opening the Import Wizard to display some data. I would like to be able to automatically close the Wizard within a function (equivalent to "close(gcf)" for a figure), as opposed to having to click "Finish" or "Cancel" or whatever. Is there a way to do this, or should I just find a different way to display the data?
TIA for your help.

I would find a better way to show the data. uiimport is modal, so execution is suspended until it closes, so the script that started it cannot close it.

Related

How can I close a property window in an application developed with RCP?

I'm having a bit of a trouble modifying an application that I have inherited from another party. The application is a Front End made with Eclipse RCP, and I have to modify one of its property windows so when I click a Save button it will not just save the data to my database, but also close that property window.
I can't find a way to reference the window itself so I can invoke a method like "window.close();", would anyone have a hint by any chance?
Thank you.

MATLAB GUI Stuck After Save Tool from Guide

I have been working on an gui developed using the GUIDE in Matlab. The current gui, I mean the general figure window contains all types of sliders, buttons, editboxes, etc...
After awhile, I added a toolbar to my gui which included the Save tool. I have not changed any specifications regarding the save tool. I used the one already in GUIDE toolbar editor.
After clicking it, my gui program is stuck at that very instance I pressed the save tool and I cannot do anything else with it. It also opens in the same situation even after restarting the PC. I do not get any errors.
I would appreciate any help. How to restore functionality to my gui?
Unfortunately the "Save" tool's default is not "Save As" with a prompt it is just the normal "save" which immediately overwrites. The tool saved your current figure (or GUI). Meaning it overwrote the fig file of your GUI with the current state.
So when you pressed "save" uicontrol visibility, values, slider positions, edit box text etc. all was written into the FIG file. So the next time you launch it is all still in there.
To Fix it you will probably have to edit in GUIDE and try to clear / reset everything to your desired initial state.

Why does a right click sent from pywinauto not change the state of the grayed out connect button in informatica, but a real mouse button click does?

I am trying to write a script using pywinauto to open a repository in Informatica powercenter workflow manager (v9.6.1)
After the below lines are executed, I get the context menu with the connect option as in the screenshot. Also notice the 'connect' button on the toolbar stays grayed out. If I use the actual mouse and click on the treeview item for the repository I want to connect to, the connect button turns green and enabled. But not when pywinauto sends the right click.
from pywinauto.application import Application
from pywinauto.keyboard import SendKeys
import time
app = Application().Start(cmd_line=r'C:\PowerCenterClient\client\bin\pmwflmgr.exe')
informaticaworkflowmanager = app[u'Informatica::WorkflowManager']
informaticaworkflowmanager.Wait('ready')
time.sleep(2)
systreeview = informaticaworkflowmanager[u'TreeView']
tree_item = systreeview.GetItem([u'Repositories', u'REP'])
tree_item.Select()
tree_item.Click(button='right',double=True,where='icon')
I tried using SendKeys to send 'c' followed by {ENTER} and it just returns without doing anything. Also if I use the actual keyboard on the right click context menu generated after the above pywinauto steps run- it selects the connect menu when i press c , but it just doesn't do anything when I press Enter. I think somehow the connect function is not enabled.
I am clueless if any other input is required by the application to enable it. I also tried using the informaticaworkflowmanager.MenuItem(u'&Repository->&Connect...') option but to no avail- it says it is disabled.
Any pointers to help get pywinauto to open a repository are welcome!
Just summarizing the comments...
First try running the script as Administrator. If it doesn't help, use method click_input(). It runs real click like a user does. Method click() sends WM_CLICK or BM_CLICK which is probably not handled by the app in grayed button state.
If you run the script as Administrator, it should inherit privileges for child process by default. There is no special flag in method start() because some functions may not work if target app process has higher privileges. Anyway elevation usually requires confirmation from user and this Security Confirmation dialog can't be automated by OS design (even click_input() with hard coded coordinates won't work while this dialog was shown, I checked it a while ago).

Add new window to OpeningFcn of MATLAB GUI goes to back of main window when running

I have a Main_window in MATLAB guide. I want open a New_window when I run Main_window, So I add this code in OpeningFcn of Main_window :
New_window();
When I run Main_window, New_window goes to back of Main_window. I want it in front of Main_window after running.
Any help?
This is happening because you are calling New_window before Main_window has finished executing.
Ideas:
You could simply call Main from new instead. I'm guessing that you already tried this and it doesn't work for your application
If you want the user to do something with new_window, then proceed to main_window, you could enable uiwait in the new_window opening fcn to keep it in focus until the user closes it.
Create a script that contains two lines
Main_window;
New_window;
Running that script will start both programs in sequence, and New_window will be on top.
Ultimately, if you want to maximize control, you should write your own gui instead of using GUIDE.

Finding event handlers in source trees

So, I'm trying to implement a looping mode in the totem movie player. I would like to do this by adding a checkbox under "Edit" that turns looping on.
I'm trying to figure out what code gets called when "Edit" and the "Shuffle Mode" option under it is clicked. Is there any easy way to find where the appropriate event handler is?
My usual method of code reading (stepping through it with the debugger) didn't work because this is a GUI program, and as soon as you get to the main loop it doesn't stop until there's a breakpoint, and where to put the breakpoints is basically what I'm trying to find out.
I've been using Netbeans for this, and I should note that I can't use Eclipse.
Thank you.
The UI for Totem and the callback names for each element defined in the GtkBuilder file, data/totem.ui.
http://git.gnome.org/browse/totem/tree/data/totem.ui
This file says that the handler for the "Shuffle Mode" action is shuffle_mode_action_callback. Then you can use grep:
grep -r shuffle_mode_action_callback totem-git/src
The result of this command indicates that this function is defined in src/totem-menu.c.