Search code examples
smalltalksqueak

How to disable access to development environment when releasing a GUI application


I have made a GUI application using Squeak, which I want to make available to the public without them necessarily knowing that the program was made using Squeak. I want to disable all the Smalltalk development tools in the Squeak image that I release. How can I do this? Pharo has openWorldWithSpec. Is there something similar in Squeak 5.3?


Solution

  • There was once a package called Lockdown which is now impossible to download.

    However, it seems that it has been, at least partially, included in Squeak itself. To disable programming facilities you should run at Workspace or from the World menu (if you customize it):

    Preferences disableProgrammerFacilities

    Which does:

    disableProgrammerFacilities
        "Warning: do not call this lightly!  It disables all access to menus, debuggers, halos.  There is no guaranteed return from this, which is to say, you cannot necessarily reenable these things once they are disabled -- you can only use whatever the UI of the current project affords, and you cannot even snapshot -- you can only quit. 
    
         You can completely reverse the work of this method by calling the dual Preferences method enableProgrammerFacilities, provided you have left yourself leeway to bring about a call to that method.
    
        To set up a system that will come up in such a state, you have to request the snapshot in the same breath as you disable the programmer facilities.  To do this, put the following line into the 'do' menu and then evaluate it from that 'do' menu:
    
             Preferences disableProgrammerFacilities.
    
    You will be prompted for a new image name under which to save the resulting image."
    
        Beeper beep.
        (self 
            confirm: 'CAUTION!!
    This is a drastic step!
    Do you really want to do this?') 
                ifFalse: 
                    [Beeper beep.
                    ^self inform: 'whew!'].
        self disable: #cmdDotEnabled.   "No user-interrupt-into-debugger"
        self compileAccessorForPreferenceNamed: #cmdGesturesEnabled value: false.   "No halos, etc."
        self compileAccessorForPreferenceNamed: #cmdKeysInText value: false.    "No user commands invokable via cmd-key combos in text editor"
        self enable: #noviceMode.   "No control-menu"
        self disable: #warnIfNoSourcesFile.
        self disable: #warnIfNoChangesFile.
        Smalltalk saveAs