How to close all inspector windows with a shortcut - smalltalk

Is there a shortcut to close all inspector windows ? and if not how I close the window of a selected inspector ?
Basically I accidentally opened over 1000 inspector windows and i want to close them all now because they have occupied the entire GUI and I cant do anything other than closing them on by one. I cant open the world menu or open a new window because they take not only the entire window but also they are always on top.

Bring up the halos [1] on the TaskBarMorph [2] and click the top left halo to delete it from the World.
If two-way halo cycling is enabled in the settings, Alt-click on Mac. Otherwise, Alt-Shift-Click to cycle to the TaskBarMorph through the morphs in front of it.
In your case, your problem is that it's covering the entire screen, so you should be able to click anywhere to bring up the halos.
Then, to actually close the windows, use something like:
World submorphs do: [ :e |
[ (e model model model isKindOf: InspectorNavigator) ifTrue: [ e delete ] ]
on: Error
do: [ ] ]

I tried the following in a Pharo 3.
UITheme inspect.
And then did a World inspect to come to the following.
(World submorphs select:
[ :each | each class = TickingSpecWindow ])
do:
[:insp | insp delete]
You should be more specific in your select if you only want the inspector windows,
explore uses the same class.

Related

Remove button faces

Hi all.
I want to know that how can I remove two button face with a button.
I tried this:
gui: [
en: button "English" remove [en es]
es: button "Spanih" remove [en es]
]
And than I have to append new buttons.
View engine models GUI interface as a tree of objects; each node in that tree is called a face, and each field of that face is called a facet.
Two facets, parent and pane, interlink a face with its parent node and its child nodes, respectively. So, by that theory, to remove a button is to remove a button face from a pane of its parent:
view [button "Poof!" [probe select take face/parent/pane 'text]]
This, however, is a bit limited approach. The removed face is detached from View tree and can no longer be used unless you reattach the face! object with the same specification back to the pane. It might be more useful to simply disable a button, or to render it invisible for the time being. enabled? and visible? facets can achieve just that:
view [
title "Face flags example"
below
toggle "Toggle" [foo/enabled?: not foo/enabled?]
foo: button "Switch" disabled [bar/visible?: not bar/visible?]
bar: base red
]
You can adapt this approach to the task at hand. As I understand, you want to offer mutually exclusive localization options; drop-list might be a good fit for that:
view [drop-list data ["en" "es"]]
You can try this:
Red [Needs: View]
view [
en: button "English" [remove find face/parent/pane en]
es: button "Spanish" [
remove find face/parent/pane en
remove find face/parent/pane es
]
]

Autoit script to automate the audacity track down menu with dynamic mouseclick

I am trying to automate some 600 mp3 files for church to combine instrument and voice into one track so I can use the mixer to do left or right channel. when I combined two sounds file, I need to select left channel for first track and right channel for second track.
the problem is that if audacity is fixed screen/location, the mouseclick is working fine. But I moved the script to laptop/Desktop, it won't work since mouse coordinates are not same.
Is there a way to select down track menu from audacity to select left or right channel? There are no shortcuts at current version. If someone can help, I appreciate for you opinion and times.
Br, Adnrew
This codes worked great for me. Thanks, guys.
Opt("MouseCoordMode", 0) ;1=absolute, 0=relative, 2=client
;set left channel
ControlClick($FileNameL, "","","Left",1,90,13)
Send("{SHIFTDOWN}l{SHIFTUP}")
Sleep(1000)
;set right channel
ControlClick($FileNameL, "","","Left",1,60,162)
Send("{SHIFTDOWN}r{SHIFTUP}")
Sleep(1000)
Send("{CTRLDOWN}a{CTRLUP}")
;MsgBox(0,"File Size","waiting")
Send("{ALTDOWN}tx{ALTUP}")
You just need
Opt("MouseCoordMode", 0) ;1=absolute, 0=relative, 2=client
This will make your clicks relative to the window you are working with.
Use window info Tool to find those coordinates.
Go to options and set Coord mode to Window.
You can also use
ControlClick ( "title", "text", controlID [, button [, clicks [, x [, y]]]] )
Any of these two methods are not dependant on your screen resolution.

Keyboard-free mouse gestures for XMonad

I'm setting up mouse gestures in my xmonad.hs, and I'd like to avoid using a modMask modifier to get keyboard-free gestures. Problem is, there are cases (e.g. empty gesture, just a simple click) where I'd like to let the mouse event go through to the application under the cursor, but I haven't found a way to do that in XMonad. Without that, if i add ((0, button3), mouseGesture gestures), i completely lose the "application-specific" functionality of button3.
I was thinking that, if the events cannot be easily forwarded, perhaps a new one can be created and dispatched. I thought about using spawn "xdotool click 3" but it doesn't seem to work. Has anybody ever tried something similar? Otherwise, I'd need a mouse with at least 4 buttons, since most apps actively use three...
To get xdotool to forward your mouse clicks, you need to make sure that it targets the correct window using the --window parameter. For example, if your window id is 79693135, then xdotool click --window 79693135 3 does exactly what you want.
The following basic xmonad.hs illustrates how to do this in order to get keyboardless mouse gestures working properly:
import XMonad
import qualified XMonad.Actions.CycleWS as Workspace
import XMonad.Actions.MouseGestures ( mouseGesture, Direction2D(..) )
import qualified XMonad.Util.EZConfig as EZ
import XMonad.Util.Run ( safeSpawn )
import qualified Data.Map as Map
mouseGestureButton :: Button
mouseGestureButton = button3 -- right click
sendMouseClickToWindow :: Window -> X ()
sendMouseClickToWindow win =
safeSpawn
"xdotool" ["click", "--window", show win, show mouseGestureButton]
myMouseGestures :: [([Direction2D], Window -> X ())]
myMouseGestures =
[ ([R], const Workspace.nextWS) -- move to the next workspace
, ([L], const Workspace.prevWS) -- move to the previous workspace
, ([], sendMouseClickToWindow)
]
addMouseGestures :: XConfig a -> XConfig a
addMouseGestures =
flip EZ.additionalMouseBindings
[((0, mouseGestureButton), mouseGesture $ Map.fromList myMouseGestures)]
main = xmonad $ addMouseGestures def
N.B.: It's not a good idea to use button 1 for this, because that will interfere with selecting text and other mouse-dragging functionality normally used with button 1. So using button 3 (as the OP did) is definitely the right idea.

Is it possible to chain key binding commands in sublime text 2?

There are times in Sublime Text when I want to reveal the current file in the side bar and then navigate around the folder structure.
This can be achieved using the commands reveal_in_side_bar and focus_side_bar however they have to be bound to two separate key combinations so I have to do 2 keyboard combinations to achieve my goal when ideally I'd like just one (I'm lazy).
Is there any way to bind multiple commands to a single key combination? e.g. something like this:
{
"keys": ["alt+shift+l"],
"commands": ["reveal_in_side_bar", "focus_side_bar"]
},
Solution
Based on #artem-ivanyk's and #d_rail's answers
1) Tools → New Plugin
import sublime, sublime_plugin
class RevealInSideBarAndFocusCommand(sublime_plugin.WindowCommand):
def run(self):
self.window.run_command("reveal_in_side_bar")
self.window.run_command("focus_side_bar")
Save as RevealInSideBarAndFocus.py
2) Sublime Text 2 → Preferences → Key Bindings — User
Bind it to shortcut:
{ "keys": ["alt+shift+l"], "command": "reveal_in_side_bar_and_focus" }
Although the question is a year old, this might help people that are still looking for an answer.
Recently, a new package was developed by jisaacks, called Chain of command. It has the primary task to do exactly what you request, to chain several commands at once.
The package can be found here:
https://github.com/jisaacks/ChainOfCommand
An example of the working can be found below.
Let's say you wanted a key binding to duplicate the current file. You could set this key binding:
{
"keys": ["super+shift+option+d"],
"command": "chain",
"args": {
"commands": [
["select_all"],
["copy"],
["new_file"],
["paste"],
["save"]
]
}
}
This would select all the text, copy it, create a new file, paste the text, then open the save file dialog.
Source: https://sublime.wbond.net/packages/Chain%20of%20Command.
Updating #Artem Ivanyk's answer. I do not know what changed in Sublime, but that solution did not work for me, but I got this to work:
import sublime, sublime_plugin
class RevealInSideBarAndFocusCommand(sublime_plugin.WindowCommand):
def run(self):
self.window.run_command("reveal_in_side_bar")
self.window.run_command("focus_side_bar")
.
{ "keys": ["ctrl+shift+8"], "command": "reveal_in_side_bar_and_focus" }
Btw, I'm using Build 2220
Stumbled upon similar problem. When trying to record macros, which involved „Save“ command, console threw at me „Unknown macros command save“ message.
Worked my way around with elementary plugin.
1) Tools → New Plugin
import sublime, sublime_plugin
class MyChainedActionsCommand():
def run(self):
self.view.run_command("reveal_in_side_bar")
self.view.run_command("focus_side_bar")
You need to use upper camel case notation for the class name. ST2 exposes this class for the command name with „Command“ suffix removed and the rest converted into the lowercase-underscore notation. I.e. in this example MyChainedActionsCommand could be run in sublime's console typing: view.run_command("my_chained_actions")
2) Sublime Text 2 → Preferences → Key Bindings — User
Bind it to shortcut:
{ "keys": ["alt+shift+l"], "command": "my_chained_actions" }
Heed commas.
Take a look at this gist.
I've been trying to implement this in a long time and found this by accident.
Don't forget to read the "documentation" provided. I kept trying to make this work, until I reallized I was not passing the "context" key.
You can create a macro to do this. For Sublime Text, macros are essentially just chained commands. You then create a keybinding for that macro. You can create a macro by using Tools > Record Macro, then executing your commands (beware that macros record keystrokes as well, so you'll want to use the commands from the menu bar to not cause conflicts), then Stop Recording, then Save Macro. After you save the macro, you can open it back up in Sublime Text to make sure that it recorded only what you want.
Building on Artem Ivanyk reply, here is a version of ChainedActions that works with arguments. It takes two arguments for actions and args. Both are lists and each command in the list gets executed with the corresponding arguments. This admittedly stupid example inserts two snippets: view.run_command("chained_actions", {"actions":["insert_snippet","insert_snippet"],"args":[{"contents": "($0)"},{"contents": "1($0)"}]})`
import sublime
import sublime_plugin
class ChainedActionsCommand(sublime_plugin.TextCommand):
def run(self, edit, actions, args):
for i, action in enumerate(actions):
self.view.run_command(action, args[i])
I've tried to use the same command but I ended up with a bug that when the file's folder was already unfolded sublime moved my focus sidebar's top, where I can see the open files. To improve this behavior I've wrote a new plugin that ensures it'll behave as I want to, here it is https://github.com/miguelgraz/FocusFileOnSidebar
I am using Sublime text3 build - 3083. It solves the problem just by 'Reveal it in side bar', the focus comes automatically.
I have added a custom keyboard shortcut for 'Reveal in sidebar' by adding the following statement under Preferences->Key Bindings-User :
[
{ "keys": ["ctrl+shift+r"], "command": "reveal_in_side_bar"}
]
The option - 'Reveal in sidebar' was missing for image file types, since the context menu doesn't appear with the right click of the mouse. The custom keyboard shortcut comes handy in this situation.
Starting from Sublime Text Build 4103 the feature is supported natively:
"Added the chain command, which accepts a list of commands to run in its "commands" argument. This allows binding a key to run multiple commands without having to use a macro"
See Changelog on https://www.sublimetext.com/dev

Rebol/View: How to assign images to layout already created?

Using Rebol/View 2.7.7, I'm trying to create a card game based on Nick's Rebol tutorial at: http://re-bol.com/rebol.html#section-10.18. What I want to do though is read the cards from the binary file Nick created, discard some of the data, and use it to layout a tableau of cards, 4 rows of 3 columns, with the 2 center card locations not used.
Here's my code:
protect-system
random/seed now
do %cards.r ;--include the binary card data
the-tableau: [
size 320x480 backdrop 0.170.0
style tabstyle image 80x100 teal
style holdplace box 80x100 coal
across
at 30x20 tc1: tabstyle
tc2: tabstyle
tc3: tabstyle return
at 30x130 tc4: tabstyle
tc100: holdplace
tc5: tabstyle return
at 30x240 tc6: tabstyle
tc200: holdplace
tc7: tabstyle return
at 30x350 tc8: tabstyle
tc9: tabstyle
tc10: tabstyle
]
lc: copy []
lc: [tc1 tc2 tc3 tc4 tc5 tc6 tc7 tc8 tc9 tc10]
deck-cards: copy [] ; The deck holds all of the cards from the binary file
deck-cards-num: copy []
deck-cards-color: copy []
lay: layout the-tableau
foreach [card label num color pos] cards [
dimg: load to-binary decompress (card)
append deck-cards dimg ;feel movestyle
throw-away-label: label
append deck-cards-num num
append deck-cards-color color
throw-away-pos: pos
]
random-card: does [pick deck-cards random length? deck-cards]
foreach c lc [set-face get c deck-cards]
view lay
do-events
But this doesn't show the cards at all. I'm not even sure it's reading the correctly? Where is the problem?
Actually you didn't use the random-card function in your for loop at the end... :-)
foreach c lc [get c set-face get c random-card ]
You note that you are not sure if data was loaded correctly...
here is a simple way to find out... just print/probe the TYPE? of that data
dimg: load to-binary decompress (card)
probe type? dimg
In this case it will print out image! in the console... so yep... that's working. :-)
As an added little detail, I noticed you didn't compensate your random for the "back face" image in the card data (which is at its end), so the random-card function should be fixed like so:
random-card: does [pick deck-cards random (length? deck-cards) - 1] ; - 1 since we don't want the back face to be picked.
You only need 'do-events if the event loop is not started.
View/new does not start the event loop .. but View does
I'm not addressing your actual problem though :(
to make the do-events note clear, I added a little answer here so I can add some inline code....
here is an example where you'd want your do-events to be used.
view/new lay ; display the interface right now. (with no cards)
random-card: does [pick deck-cards random (length? deck-cards) - 1] ; - 1 since we don't want the back face to be picked.
; deal cards with a half second delay.
foreach c lc [f: get c set-face get c random-card wait 0.5]
do-events
here, any code you put after 'DO-EVENTS will be executed once all view windows have closed.
which can be things like tmp file cleanup, save on exit, "save changes" dialogs, etc.
additional note:
While building graphics code, its a good habit to place this at the very start of you application:
print " "
It will open up the console, and then any view windows will show up in front of it.
When ready to share, just comment the line and remove any print statements in your code.
this is useful for 3 things:
1) Its usually highly annoying when the console always pops-up over your application while its tracing (print/probe/etc) some stuff after your window opens.
2) This also has the more useful side-effect of showing you if your application quit correctly since the console will ALSO quit when all waits have terminated correctly.
In your original example, if you add the above print, then you'll see that the console never closes, so this means the application is still running with no more application windows listening to events.
3) It also has the advantage that you can terminate the graphic app directly by closing the console window. This effectively closes all windows and waits immediately and shortcuts any "on application quit" code you might have (code after do-events).