[LatinaLUG] Latina LUG - situazione attuale

Gabriele Mambrini g.mambrini@caspur.it
Mar 9 Gen 2007 17:07:44 CET


Gabriele Mambrini wrote:
>> [...]  
>> Mmm...messaggio chiaro e diretto...chi è che crea una finestra stile
>> "Hello world" in C++??
> 
> Sui PC c'è installato TCL/TK o python-gtk?

Intanto vi mando un prototipo scemo ;-)

Gabriele
-------------- parte successiva --------------
#!/bin/sh
# the next line restarts using wish \
exec wish "$0" "$@"

eval destroy [winfo child .]
wm title . "Schermata di avvio Oralinux"
wm iconname . "Oralinux Info"

array set widgetFont {
    main   {Helvetica 12}
    bold   {Helvetica 12 bold}
    title  {Helvetica 18 bold}
}

set widgetDemo 1
set font $widgetFont(main)

#----------------------------------------------------------------------#
#                         create main window                           #
#----------------------------------------------------------------------#


# menubar
menu .menuBar -tearoff 0
.menuBar add cascade -menu .menuBar.file -label "File" -underline 0
menu .menuBar.file -tearoff 0
.menuBar.file add command -label "Informazioni..." -command "aboutBox" \
    -underline 0 -accelerator "<F1>"
.menuBar.file add sep
.menuBar.file add command -label "Esci" -command "exit" -underline 0 \
    -accelerator "Meta-E"
. configure -menu .menuBar
bind . <F1> aboutBox

frame .textFrame
scrollbar .s -orient vertical -command {.t yview} -highlightthickness 0 \
    -takefocus 1
pack .s -in .textFrame -side right -fill y
text .t -yscrollcommand {.s set}  -wrap word  -width 70  -height 30 \
	-font $widgetFont(main)  -setgrid 1  -highlightthickness 0 \
	-padx 4  -pady 2  -takefocus 0
pack .t -in .textFrame -expand y -fill both -padx 1
pack  .textFrame -expand yes -fill both

# Create a bunch of tags to use in the text widget, such as those for
# section titles and demo descriptions.  Also define the bindings for
# tags.

.t tag configure title -font $widgetFont(title)
.t tag configure bold  -font $widgetFont(bold)

# We put some "space" characters to the left and right 
# of each demo "hyperlink" to get mousehover working properly
.t tag configure hlspace -lmargin1 1c -lmargin2 1c
.t tag configure hl -lmargin1 1c -lmargin2 1c \
    -foreground blue -underline 1
.t tag configure visited -lmargin1 1c -lmargin2 1c \
    -foreground "#303080" -underline 1
.t tag configure hot -foreground red -underline 1

.t tag bind hl <ButtonRelease-1> {
    run-hyperlink [.t index {@%x,%y}]
}

.t tag bind hl <Enter> {
    set lastLine [.t index {@%x,%y linestart}]
    .t tag add hot "$lastLine +1 chars" "$lastLine lineend -1 chars"
    .t config -cursor hand2
}
.t tag bind hl <Leave> {
    .t tag remove hot 1.0 end
    .t config -cursor xterm
}

.t tag bind hl <Motion> {
    set newLine [.t index {@%x,%y linestart}]
    if {[string compare $newLine $lastLine] != 0} {
        .t tag remove hot 1.0 end
        set lastLine $newLine

        set tags [.t tag names {@%x,%y}]
        set i [lsearch -glob $tags hl-*]
        if {$i >= 0} {
            .t tag add hot "$lastLine +1 chars" "$lastLine lineend -1 chars"
        }
    }
}


proc addTitle {title} {
    .t insert end "\n" {} $title title " \n " hlspace
}

proc addCmd {name description} {
    .t insert end "- $description" [list hl hl-$name]
    .t insert end " \n " hlspace
}

addTitle "Progetto OraLinux\n"
.t insert end "
Benvenuto! Questo computer fa parte del progetto OraLinux, che si
occupa del recupero dei PC vecchi. Qui potrai trovare delle informazioni
molto utili.

Premessa: qualsiasi file salvato sul desktop o nella cartella home
verranno cancellati all'uscita!

Puoi usare Konqueror per navigare su internet in tutta sicurezza. Per
gli amanti di Mozilla, c'è anche Firefox.

OpenOffice.org è la suite (insieme di programmi) per scrivere, creare
presentazioni, lavorare su fogli elettronici e quant'altro

Puoi inoltre utilizzare programmi come Kopete, Gaim o XIrc per la
messaggistica immediata (MSN Messenger, Yahoo!, IRC, ecc.).

Per salvare o stampare un testo, rivolgiti allo staff di OraLinux!
"

addTitle "Avvio rapido\n"
addCmd firefox "Browser Firefox" 
addCmd ooffice "Suite OpenOffice"

.t configure -state disabled
focus .s

# positionWindow --
# This procedure is invoked by most of the demos to position a
# new demo window.
#
# Arguments:
# w -		The name of the window to position.

proc positionWindow w {
    wm geometry $w +300+300
}

proc run-hyperlink index {
    puts Ciao
    global tk_library
    set tags [.t tag names $index]
    set i [lsearch -glob $tags hl-*]
    if {$i < 0} {
	return
    }
    set cursor [.t cget -cursor]
    .t configure -cursor watch
    update
    set demo [ string range [lindex $tags $i] 3 end]
    tk_messageBox -icon info -type ok -title "Oralinux" -message "Dovrebbe eseguire $demo"
    update
    .t configure -cursor $cursor
}

# aboutBox --
#
#	Pops up a message box with an "about" message
#
proc aboutBox {} {
    tk_messageBox -icon info -type ok -title "Oralinux" -message \
"  This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   GNU tar is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with GNU tar; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA"
}

# Local Variables:
# mode: tcl
# End:


Maggiori informazioni sulla lista latina