# -*- coding: iso-8859-1 -*-
#
#-------------------------------------------------------------------------------
# Code_Saturne version 1.3
# ------------------------
#
#
# This file is part of the Code_Saturne User Interface, element of the
# Code_Saturne CFD tool.
#
# Copyright (C) 1998-2007 EDF S.A., France
#
# contact: saturne-support@edf.fr
#
# The Code_Saturne User Interface 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.
#
# The Code_Saturne User Interface 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 the Code_Saturne Kernel; if not, write to the
# Free Software Foundation, Inc.,
# 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA
#
#-------------------------------------------------------------------------------
"""
This module defines the welcome page.
"""
#-------------------------------------------------------------------------------
# Library modules import
#-------------------------------------------------------------------------------
import Tix
from Tkconstants import *
#-------------------------------------------------------------------------------
# Application modules import
#-------------------------------------------------------------------------------
from Base.Toolbox import *
#-------------------------------------------------------------------------------
# This class defines the welcome page
#-------------------------------------------------------------------------------
class WelcomePage(Tix.Frame):
"""
This class defines the welcome page at the opening.
"""
def __init__(self, master):
"""
This page is mainly a frame and a label.
"""
self.master = master
t = PageText()
self.rootbg = self.master.cget("bg")
self.page =Tix.Frame(self.master, bd=0, relief=FLAT, bg="#ffc692")
self.page.pack(fill=BOTH, expand=YES)
title = Tix.Frame(self.page, bd=2, relief=GROOVE)
title.pack(expand=1, padx=10, pady=10)
Tix.Label(title, font=fW,
text=t.WELCOME, bg="#e65c7c").pack(expand=1, fill=BOTH)
#self._displayIcon()
self._displayImage(title)
def _displayImage(self, fr):
"""
This method display an 'under construction' gif image.
Allways useful for the development versions.
"""
self.img1 = Tix.PhotoImage(file=PIC_PATH+'ihm.gif')
w, h = self.img1.width(), self.img1.height()
fr.cv1 = Tix.Canvas(fr, relief=FLAT,
width=w, height=h)
fr.cv1.pack(fill=BOTH, side=RIGHT)
x, y = w/2. , h/2.
fr.cv1.create_image(x, y, image=self.img1)
def _displayIcon(self):
"""
This method display an 'under construction' gif image.
Allways useful for the development versions.
"""
self.img1 = Tix.PhotoImage(file=PIC_PATH+'uc.gif')
w, h = self.img1.width(), self.img1.height()
self.page.cv1 = Tix.Canvas(self.page, relief=FLAT,
width=w, height=h, bg="#ffc692",
highlightbackground="#ffc692")
self.page.cv1.pack(fill=BOTH, side=RIGHT)
x, y = w/2. , h/2.
self.page.cv1.create_image(x, y, image=self.img1)
def setBgColor(self, rootbg):
"""
Change the background color.
"""
self.page.config(bg=rootbg)
self.page.cv1.config(bg=rootbg)
self.page.cv1.config(highlightbackground=rootbg)
#-------------------------------------------------------------------------------
# Text and messages for this page
#-------------------------------------------------------------------------------
class PageText:
"""
Storage of all texts for this page.
"""
def __init__(self):
# 1) Messages
#
if GuiParam.lang == 'fr':
self.WELCOME = "\nBienvenue dans la version " + VERSION +\
"\n de l'Interface Code_Saturne \n"
else:
self.WELCOME = "\nWelcome to SaturneGUI Version " +\
VERSION + " \n"
#-------------------------------------------------------------------------------
# End
#-------------------------------------------------------------------------------
syntax highlighted by Code2HTML, v. 0.9.1