[Pharo-project] Desktop application with Pharo

Schwab,Wilhelm K bschwab at anest.ufl.edu
Sat Apr 16 15:20:54 CEST 2011


Laurent,

I don't know that what I have done is better than anything else; the basic idea is adapted (aka shamelessly stolen<g> from a wiki entry.  Below is the class comment from something that I have successfully deployed as a "desktop app" using Pharo.  Using StandardWindow (thanks again to Pinesoft!!), it can #openInWorld (as part of the IDE) or #openFullScreen (when deployed), can be dragged only by the title bar, etc.

Is there a way to get an image to save a copy of itself and its change log in another folder?  Suppose the image is happily running in

   /home/me/Pharo-1.1.1/Pharo-dev-nnnn.image,changes
   /home/me/Pharo-1.1.1/Pharo-dev-nnnn.image,changes

and the goal is to do the steps below in

   /home/Software/CoolGizmo/programName.image
   /home/Software/CoolGizmo/programName.changes

Can the running image do that and continue to run in the Pharo-1.1.1 directory as though nothing happened?  That might make it possible to take the bumps out of the deployment process.  

Bill




"To test in the IDE"
Equalize new asMorph openInWorld.


"To deploy - copy the image somewhere, and then do all of the following."
Preferences disable:#showWorldTaskbar.

10-09 - one-shot do-it to deploy Equalize; copy the image somewhere first!!"
Preferences disable:#showWorldTaskbar.
SystemWindow allSubInstances do:[ :each | each delete. ].


"Then do this as one do-it"
SmalltalkImage current snapshot: true andQuit: false.
Equalize new asMorph openFullscreen.


________________________________________
From: pharo-project-bounces at lists.gforge.inria.fr [pharo-project-bounces at lists.gforge.inria.fr] On Behalf Of laurent laffont [laurent.laffont at gmail.com]
Sent: Saturday, April 16, 2011 5:55 AM
To: An open mailing list to discuss any topics related to an open-source Smalltalk
Subject: [Pharo-project] Desktop application with Pharo

I'm searching for a way to create desktop applications with Pharo (no multiple window).

Here's the current snippet that do what I want. Improvements / better code is really really welcome.

How I can change the title of the window ?


The snippet to evaluate in Workspace:

counter := Class new
              superclass: Object;
              addInstVarNamed: 'counter';
              compile: 'initialize
                           counter := 0';
              compile: 'counterString
                           ^ counter asString';
              compile: 'increment
                           counter := counter + 1.
                           self changed:#counterString';
              compile: 'decrement
                           counter := counter - 1.
                           self changed:#counterString';
              new.

panel := UITheme builder newPanel.
panel layoutPolicy: ProportionalLayout new.

panel
addMorph: (UITheme builder newLabelFor: counter getLabel: #counterString getEnabled: nil)
fullFrame:   (LayoutFrame fractions: (0 at 0 corner: 1 at 0.5)).
panel
addMorph: (UITheme builder newButtonFor: counter action: #increment label: '+' help: nil)
fullFrame:   (LayoutFrame fractions: (0 at 0.5 corner: 0.5 at 1)).
panel
addMorph: (UITheme builder newButtonFor: counter action: #decrement label: '-' help: nil)
fullFrame:   (LayoutFrame fractions: (0.5 at 0.5 corner: 1 at 1)).

World submorphs do: [:aMorph| aMorph delete].

World
layoutPolicy: ProportionalLayout new;
addMorph: panel fullFrame:  (LayoutFrame fractions: (0 at 0 corner: 1 at 1)).




Laurent Laffont - @lolgzs<http://twitter.com/#!/lolgzs>

Pharo Smalltalk Screencasts: http://www.pharocasts.com/
Blog: http://magaloma.blogspot.com/
Developer group: http://cara74.seasidehosting.st




More information about the Pharo-project mailing list