~ubuntu-branches/ubuntu/precise/code-saturne/precise

« back to all changes in this revision

Viewing changes to gui/Pages/UserArraysView.py

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2011-11-24 00:00:08 UTC
  • mfrom: (6.1.9 sid)
  • Revision ID: package-import@ubuntu.com-20111124000008-2vo99e38267942q5
Tags: 2.1.0-3
Install a missing file

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# -*- coding: iso-8859-1 -*-
2
 
#
3
 
#-------------------------------------------------------------------------------
4
 
#
5
 
#     This file is part of the Code_Saturne User Interface, element of the
6
 
#     Code_Saturne CFD tool.
7
 
#
8
 
#     Copyright (C) 1998-2009 EDF S.A., France
9
 
#
10
 
#     contact: saturne-support@edf.fr
11
 
#
12
 
#     The Code_Saturne User Interface is free software; you can redistribute it
13
 
#     and/or modify it under the terms of the GNU General Public License
14
 
#     as published by the Free Software Foundation; either version 2 of
15
 
#     the License, or (at your option) any later version.
16
 
#
17
 
#     The Code_Saturne User Interface is distributed in the hope that it will be
18
 
#     useful, but WITHOUT ANY WARRANTY; without even the implied warranty
19
 
#     of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
 
#     GNU General Public License for more details.
21
 
#
22
 
#     You should have received a copy of the GNU General Public License
23
 
#     along with the Code_Saturne Kernel; if not, write to the
24
 
#     Free Software Foundation, Inc.,
25
 
#     51 Franklin St, Fifth Floor,
26
 
#     Boston, MA  02110-1301  USA
27
 
#
28
 
#-------------------------------------------------------------------------------
29
 
 
30
 
"""
31
 
This module defines the values of reference.
32
 
 
33
 
This module contains the following classes and function:
34
 
- UserArraysView
35
 
"""
36
 
 
37
 
#-------------------------------------------------------------------------------
38
 
# Library modules import
39
 
#-------------------------------------------------------------------------------
40
 
 
41
 
import logging
42
 
 
43
 
#-------------------------------------------------------------------------------
44
 
# Third-party modules
45
 
#-------------------------------------------------------------------------------
46
 
 
47
 
from PyQt4.QtCore import *
48
 
from PyQt4.QtGui  import *
49
 
 
50
 
#-------------------------------------------------------------------------------
51
 
# Application modules import
52
 
#-------------------------------------------------------------------------------
53
 
 
54
 
from Base.Toolbox import GuiParam
55
 
from UserArraysForm import Ui_UserArraysForm
56
 
import Base.QtPage as QtPage
57
 
from Pages.UserArraysModel import UserArraysModel
58
 
 
59
 
#-------------------------------------------------------------------------------
60
 
# log config
61
 
#-------------------------------------------------------------------------------
62
 
 
63
 
logging.basicConfig()
64
 
log = logging.getLogger("UserArraysView")
65
 
log.setLevel(GuiParam.DEBUG)
66
 
 
67
 
#-------------------------------------------------------------------------------
68
 
# Main View class
69
 
#-------------------------------------------------------------------------------
70
 
 
71
 
class UserArraysView(QWidget, Ui_UserArraysForm):
72
 
    """
73
 
    Class to open User arrays Page.
74
 
    """
75
 
    def __init__(self, parent, case):
76
 
        """
77
 
        Constructor
78
 
        """
79
 
        QWidget.__init__(self, parent)
80
 
 
81
 
        Ui_UserArraysForm.__init__(self)
82
 
        self.setupUi(self)
83
 
 
84
 
        self.case = case
85
 
        self.mdl = UserArraysModel(self.case)
86
 
 
87
 
        # Connections
88
 
 
89
 
        self.connect(self.lineEditICEL, SIGNAL("textChanged(const QString &)"), self.slotICEL)
90
 
        self.connect(self.lineEditRCEL, SIGNAL("textChanged(const QString &)"), self.slotRCEL)
91
 
        self.connect(self.lineEditIFAC, SIGNAL("textChanged(const QString &)"), self.slotIFAC)
92
 
        self.connect(self.lineEditRFAC, SIGNAL("textChanged(const QString &)"), self.slotRFAC)
93
 
        self.connect(self.lineEditIFABOR, SIGNAL("textChanged(const QString &)"), self.slotIFABOR)
94
 
        self.connect(self.lineEditRFABOR, SIGNAL("textChanged(const QString &)"), self.slotRFABOR)
95
 
        self.connect(self.lineEditIDIMLS, SIGNAL("textChanged(const QString &)"), self.slotIDIMLS)
96
 
        self.connect(self.lineEditRDIMLS,   SIGNAL("textChanged(const QString &)"), self.slotRDIMLS)
97
 
 
98
 
        # Validators
99
 
 
100
 
        validatorICEL = QtPage.IntValidator(self.lineEditICEL, min=0)
101
 
        validatorRCEL = QtPage.IntValidator(self.lineEditRCEL, min=0)
102
 
        validatorIFAC = QtPage.IntValidator(self.lineEditIFAC, min=0)
103
 
        validatorRFAC = QtPage.IntValidator(self.lineEditRFAC, min=0)
104
 
        validatorIFABOR = QtPage.IntValidator(self.lineEditIFABOR, min=0)
105
 
        validatorRFABOR = QtPage.IntValidator(self.lineEditRFABOR, min=0)
106
 
        validatorIDIMLS = QtPage.IntValidator(self.lineEditIDIMLS, min=0)
107
 
        validatorRDIMLS = QtPage.IntValidator(self.lineEditRDIMLS, min=0)
108
 
 
109
 
        self.lineEditICEL.setValidator(validatorICEL)
110
 
        self.lineEditRCEL.setValidator(validatorRCEL)
111
 
        self.lineEditIFAC.setValidator(validatorIFAC)
112
 
        self.lineEditRFAC.setValidator(validatorRFAC)
113
 
        self.lineEditIFABOR.setValidator(validatorIFABOR)
114
 
        self.lineEditRFABOR.setValidator(validatorRFABOR)
115
 
        self.lineEditIDIMLS.setValidator(validatorIDIMLS)
116
 
        self.lineEditRDIMLS.setValidator(validatorRDIMLS)
117
 
 
118
 
        # Initialization
119
 
 
120
 
        icel   = self.mdl.getIntegerNcelet()
121
 
        ifac   = self.mdl.getIntegerNfac()
122
 
        ifabor = self.mdl.getIntegerNfabor()
123
 
        idimls = self.mdl.getIntegerDimless()
124
 
 
125
 
        rcel   = self.mdl.getRealNcelet()
126
 
        rfac   = self.mdl.getRealNfac()
127
 
        rfabor = self.mdl.getRealNfabor()
128
 
        rdimls = self.mdl.getRealDimless()
129
 
 
130
 
        self.lineEditICEL.setText(QString(str(icel)))
131
 
        self.lineEditIFAC.setText(QString(str(ifac)))
132
 
        self.lineEditIFABOR.setText(QString(str(ifabor)))
133
 
        self.lineEditIDIMLS.setText(QString(str(idimls)))
134
 
 
135
 
        self.lineEditRCEL.setText(QString(str(rcel)))
136
 
        self.lineEditRFAC.setText(QString(str(rfac)))
137
 
        self.lineEditRFABOR.setText(QString(str(rfabor)))
138
 
        self.lineEditRDIMLS.setText(QString(str(rdimls)))
139
 
 
140
 
 
141
 
    @pyqtSignature("const QString&")
142
 
    def slotICEL(self, text):
143
 
        """
144
 
        Input number of cells with halo for integer array.
145
 
        """
146
 
        icel, ok = text.toInt()
147
 
        if self.sender().validator().state == QValidator.Acceptable:
148
 
            self.mdl.setIntegerNcelet(icel)
149
 
 
150
 
 
151
 
    @pyqtSignature("const QString&")
152
 
    def slotRCEL(self, text):
153
 
        """
154
 
        Input number of cells with halo for real array.
155
 
        """
156
 
        rcel, ok = text.toInt()
157
 
        if self.sender().validator().state == QValidator.Acceptable:
158
 
            self.mdl.setRealNcelet(rcel)
159
 
 
160
 
 
161
 
    @pyqtSignature("const QString&")
162
 
    def slotIFAC(self, text):
163
 
        """
164
 
        Input number of internal faces for integer array.
165
 
        """
166
 
        ifac, ok = text.toInt()
167
 
        if self.sender().validator().state == QValidator.Acceptable:
168
 
            self.mdl.setIntegerNfac(ifac)
169
 
 
170
 
 
171
 
    @pyqtSignature("const QString&")
172
 
    def slotRFAC(self, text):
173
 
        """
174
 
        Input number of internal faces for real array.
175
 
        """
176
 
        rfac, ok = text.toInt()
177
 
        if self.sender().validator().state == QValidator.Acceptable:
178
 
            self.mdl.setRealNfac(rfac)
179
 
 
180
 
 
181
 
    @pyqtSignature("const QString&")
182
 
    def slotIFABOR(self, text):
183
 
        """
184
 
        Input number of boundary faces for integer array.
185
 
        """
186
 
        ifabor, ok = text.toInt()
187
 
        if self.sender().validator().state == QValidator.Acceptable:
188
 
            self.mdl.setIntegerNfabor(ifabor)
189
 
 
190
 
 
191
 
    @pyqtSignature("const QString&")
192
 
    def slotRFABOR(self, text):
193
 
        """
194
 
        Input number of boundary faces for real array.
195
 
        """
196
 
        rfabor, ok = text.toInt()
197
 
        if self.sender().validator().state == QValidator.Acceptable:
198
 
            self.mdl.setRealNfabor(rfabor)
199
 
 
200
 
 
201
 
    @pyqtSignature("const QString&")
202
 
    def slotIDIMLS(self, text):
203
 
        """
204
 
        Input integer value for integer array.
205
 
        """
206
 
        idimls, ok = text.toInt()
207
 
        if self.sender().validator().state == QValidator.Acceptable:
208
 
            self.mdl.setIntegerDimless(idimls)
209
 
 
210
 
 
211
 
    @pyqtSignature("const QString&")
212
 
    def slotRDIMLS(self, text):
213
 
        """
214
 
        Input integer value for real array.
215
 
        """
216
 
        rdimls, ok = text.toInt()
217
 
        if self.sender().validator().state == QValidator.Acceptable:
218
 
            self.mdl.setRealDimless(rdimls)
219
 
 
220
 
 
221
 
    def tr(self, text):
222
 
        """
223
 
        Translation
224
 
        """
225
 
        return text
226
 
 
227
 
#-------------------------------------------------------------------------------
228
 
# Testing part
229
 
#-------------------------------------------------------------------------------
230
 
 
231
 
if __name__ == "__main__":
232
 
    pass
233
 
 
234
 
#-------------------------------------------------------------------------------
235
 
# End
236
 
#-------------------------------------------------------------------------------
 
 
b'\\ No newline at end of file'