Does anyone know of a way to stop an SWT Browser widget from printing its contents?
In my app, this widget will display confidential files. I cannot block everything, but want to make it as difficult as possible to get information out.
I easily hide the context menu when a user right-clicks, so Print cannot be gotten to in that fashion. I overwrite the clipboard to handle print screen, Ctrl-C and Ctrl-V. But if i hit Ctrl-P, I do not want the print dialog to come up either. Any ideas?
I found a way around my situation. In this app, the admin chooses if the user can print the files or not. There is a menu bar in the app, so if printing is allowed, I add a print item in the menu with Ctrl-P as its hot key.
If printing is not allowed, I set the hot key for one of the menu options to be Ctrl-P and dont add the print option at all in the menu bar. This way it disables the print dialog from ever appearing because Ctrl-P executes a menu item function instead.
Related
If I have multiple views open in a window in Sublime Text 3, is there a way for me to hide the tab bar in only one of the views, rather than View > Hide Tabs, which hides the tab bar in all views?
Except for Justin's workaround, there is not a way to do this in a single window. The toggle_tabs command is associated with the window, not an individual view, so it operates on all views within a particular window.
Hypothetically, you could write a Python plugin to execute toggle_tabs every time you switched to a particular view, but it would have to be file- or file type-specific.
If its just one view just drag it to make it a new window that way you will have two windows, one with the tabs you wish to see and other with ones you dont want to see
When I start up my PyQt GUI, the focus immediately goes to the text box.
I want there to be no focus on any of the buttons at the start of the program, especially not the text box.
Is there a way to remove the focus entirely or at least move the focus to a button or something?
Thanks
clearFocus() seems to work after a certain amount of delay after the window is visible. I also used setFocus() on the QMainWindow and then the textedit field lost focus.
Create a button with dimensions 0 wide by 0 high.
Set it as the default button and also early in the tab order before the other controlls that except focus; but note that it will be triggered if the user presses ENTER in some edit controls.
Call self.ui.yourbutton.setFocus() if desired for example after restore from minimized
This is probably really simple, but it's frustrating me so much. I'm using Sublime Text 3. Sometimes my plugins output code to a little window at the bottom like this:
And I can't hide it no matter what I try. The only way I can get rid of it is by closing the program and opening it again. Does anyone know how to close this?
Just have to click in the console and simply press esc.
Or to show and hide the console use ctrl + `
Or toggle menu View > Show/Hide Console
In my case, Esc button is working to remove the side bar(terminal/console bar).
I working on Dialog based applications once i right click on the Dialog Title bar a drop down list is coming with two options 1. Move and 2. Alt+F4 close. Once the User Press Move and he can able to drag the window as he desired and I add the On NC Hits Test to stop dragging its stopping normal dragging but it is not working in this particular context can any body help me in fixing this Bug.
When the user use the keyboard interface, he can move a windows with the arrow keys, without using the mouse.
If you want to limit the position of your dialog, process the WM_MOVING message.
If I instantiate a popup button, I can dismiss it by selecting one of the options or by clicking somewhere else. Is there a good way to dismiss it from a script? I tried setting the menuHistory, but it doesn't seem to have any effect.
Mark - if you check the openStacks is the first line empty while the popup menu is displayed? I think it is and then you could test that way.
Answering my own question:
I haven't found a good way to determine whether a popup menu button is displayed yet - none of the usual property checks seem to work. But I sidestepped the issue thusly:
in my scrollwheel handler I
dispatch "menuPick" to button "PluginMenu"
Then in the menuPick handler of the PluginMenu button I have
if pItemName is empty then
lock screen
put word 2 of the selectedline of field "xyzzy" into tLine
select after line tLine of field "xyzzy"
click at the selectedloc
unlock screen
end if
where pItemName is the normal menuPick parameter.
If I could determine when the popup was visible I could limit the menuPick call to just the times when it's on screen, but otherwise the effect is just to click at the end of the line, deselecting the popup if it's on top.
Edit: the scrollwheel handler mentioned above is in the rawKeyUp handler of field "xyzzy".
Edit 2: as mentioned, that should be "rawKeyDown" instead of "rawKeyUp".
And as Trevor mentioned, checking line 1 of the openStacks makes it even better:
if line 1 of the openStacks is empty then
dispatch "menuPick" to button "PluginMenu"
end if
It may be that you need to fake your popup menu with a palette stack which closes on suspendStack. That way there's no blocking involved and you can close it whenever you like. You would need to mess with the focus of the field I think after opening the palette so it still has the focus.
I just tried clicking a button containing the following script then clicking on a popup button.
on mouseUp
set the uActive of me to not the uActive of me
if the uActive of me then send "test" to me in 2000 millisecs
end mouseUp
on test
put the millisecs
if the uActive of me then send "test" to me in 2000 millisecs
end test
The popup seems to be modal and blocks the timed routine in the button script. I'm thinking that Monte's idea of faking the popup might be a good one ;)
You can't access already open menus by script. However, on Windows, if you open the popup menu with the popup command in a mouseDown handler, the mouseDown handler will run till the end instantly. If you use a stack panel instead of a regular popup menu, you might be able to close the stack panel by script (I haven't tried this). I don't think that this is possible on Mac OS X because menus block any currently running scripts until the menu closes.