ó
    ¯i  ã                   ó¸   • S r SSKJrJrJr  SrSrSrSrSr	Sr
\(       d  \(       a  S	rO\(       a  S
rOSrSrSr\(       d  \(       d  \(       a  SrOSrSrSS jrg)z-
Templates for the splash screen tcl script.
é    )Ú	is_cygwinÚ	is_darwinÚis_wina  
proc _ipc_server {channel clientaddr clientport} {
    # This function is called if a new client connects to
    # the server. This creates a channel, which calls
    # _ipc_caller if data was send through the connection
    set client_name [format <%s:%d> $clientaddr $clientport]

    chan configure $channel \
        -buffering none \
        -encoding utf-8 \
        -eofchar \x04 \
        -translation cr
    chan event $channel readable [list _ipc_caller $channel $client_name]
}

proc _ipc_caller {channel client_name} {
    # This function is called if a command was sent through
    # the tcp connection. The current implementation supports
    # two commands: update_text and exit, although exit
    # is implemented to be called if the connection gets
    # closed (from python) or the character 0x04 was received
    chan gets $channel cmd

    if {[chan eof $channel]} {
        # This is entered if either the connection was closed
        # or the char 0x04 was send
        chan close $channel
        exit

    } elseif {![chan blocked $channel]} {
        # RPC methods

        # update_text command
        if {[string match "update_text*" $cmd]} {
            global status_text
            set first [expr {[string first "(" $cmd] + 1}]
            set last [expr {[string last ")" $cmd] - 1}]

            set status_text [string range $cmd $first $last]
        }
        # Implement other procedures here
    }
}

# By setting the port to 0 the os will assign a free port
set server_socket [socket -server _ipc_server -myaddr localhost 0]
set server_port [fconfigure $server_socket -sockname]

# This environment variable is shared between the python and the tcl
# interpreter and publishes the port the tcp server socket is available
set env(_PYI_SPLASH_IPC) [lindex $server_port 2]
aí  
# The variable $_image_data, which holds the data for the splash
# image is created by the bootloader.
image create photo splash_image
splash_image put $_image_data
# delete the variable, because the image now holds the data
unset _image_data

proc canvas_text_update {canvas tag _var - -}  {
    # This function is rigged to be called if the a variable
    # status_text gets changed. This updates the text on
    # the canvas
    upvar $_var var
    $canvas itemconfigure $tag -text $var
}
aî  
package require Tk

set image_width [image width splash_image]
set image_height [image height splash_image]
set display_width [winfo screenwidth .]
set display_height [winfo screenheight .]

set x_position [expr {int(0.5*($display_width - $image_width))}]
set y_position [expr {int(0.5*($display_height - $image_height))}]

# Toplevel frame in which all widgets should be positioned
frame .root

# Configure the canvas on which the splash
# screen will be drawn
canvas .root.canvas \
    -width $image_width \
    -height $image_height \
    -borderwidth 0 \
    -highlightthickness 0

# Draw the image into the canvas, filling it.
.root.canvas create image \
    [expr {$image_width / 2}] \
    [expr {$image_height / 2}] \
    -image splash_image
a5  
# Create a text on the canvas, which tracks the local
# variable status_text. status_text is changed via C to
# update the progress on the splash screen.
# We cannot use the default label, because it has a
# default background, which cannot be turned transparent
.root.canvas create text \
        %(pad_x)d \
        %(pad_y)d \
        -fill %(color)s \
        -justify center \
        -font myFont \
        -tag vartext \
        -anchor sw
trace variable status_text w \
    [list canvas_text_update .root.canvas vartext]
set status_text "%(default_text)s"
z]
font create myFont {*}[font actual TkDefaultFont]
font configure myFont -size %(font_size)d
z9
font create myFont -family %(font)s -size %(font_size)d
aI  
# If the image is transparent, the background will be filled
# with magenta. The magenta background is later replaced with transparency.
# Here is the limitation of this implementation, that only
# sharp transparent image corners are possible
wm attributes . -transparentcolor magenta
.root.canvas configure -background magenta
z
wm attributes . -transparent 1
. configure -background systemTransparent
.root.canvas configure -background systemTransparent
Ú zo
# Position all widgets in the window
pack .root
grid .root.canvas   -column 0 -row 0 -columnspan 1 -rowspan 2
z¬
# Set position and mode of the window - always-on-top behavior
wm overrideredirect . 1
wm geometry         . +${x_position}+${y_position}
wm attributes       . -topmost 1
z“
# Set position and mode of the window
wm overrideredirect . 1
wm geometry         . +${x_position}+${y_position}
wm attributes       . -topmost 0
z}
# Set position and mode of the window
wm geometry         . +${x_position}+${y_position}
wm attributes       . -type splash
z	
raise .
Nc                 óº  • [         [        [        /nU (       aR  U S   S:X  a  UR                  [        U -  5        OUR                  [
        U -  5        UR                  [        U -  5        UR                  [        5        UR                  [        5        UR                  U(       a  [        O[        5        UR                  [        5        SR                  U5      $ )z<
This function builds the tcl script for the splash screen.
ÚfontÚTkDefaultFontÚ
)Ú
ipc_scriptÚimage_scriptÚsplash_canvas_setupÚappendÚsplash_canvas_default_fontÚsplash_canvas_custom_fontÚsplash_canvas_textÚtransparent_setupÚpack_widgetsÚposition_window_on_topÚposition_windowÚraise_windowÚjoin)Útext_optionsÚalways_on_topÚscripts      ÚRC:\des-py\RoboSAPF\venv\Lib\site-packages\PyInstaller\building\splash_templates.pyÚbuild_scriptr   Ì   s¡   € ô 	ÜÜð€Fö à˜Ñ ?Ó2ØM‰MÔ4°|ÑCÕDàM‰MÔ3°lÑBÔCØ‰Ô(¨<Ñ7Ô8à
‡MMÔ#Ô$à
‡MM”,ÔØ
‡MM®MÕ(¼ÔOØ
‡MM”,Ôà9‰9VÓÐó    )NF)Ú__doc__ÚPyInstaller.compatr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   © r   r   Ú<module>r!      s—   ðñ÷ <Ñ ;ð3€
ðj€ð"Ð ð:Ð ð&Ð ð
Ð ö 
ŽYðÑö ðÑð Ðð€ðÐ ö 
ŽYž)ðOð€Oð€õ
r   