1
# -*- coding: iso-8859-1 -*-
3
#-------------------------------------------------------------------------------
5
# This file is part of the Code_Saturne User Interface, element of the
6
# Code_Saturne CFD tool.
8
# Copyright (C) 1998-2009 EDF S.A., France
10
# contact: saturne-support@edf.fr
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.
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.
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
28
#-------------------------------------------------------------------------------
31
This module contains the following classes and function:
35
#-------------------------------------------------------------------------------
37
#-------------------------------------------------------------------------------
41
#-------------------------------------------------------------------------------
43
#-------------------------------------------------------------------------------
45
from PyQt4.QtCore import *
46
from PyQt4.QtGui import *
48
#-------------------------------------------------------------------------------
49
# Application modules import
50
#-------------------------------------------------------------------------------
52
from Base.Toolbox import GuiParam
53
from MatisseNetworkForm import Ui_MatisseNetworkForm
54
import Base.QtPage as QtPage
55
import Pages.MatisseTypeModel as MatisseType
56
import Pages.MatisseGeomModel as MatisseGeom
57
from Pages.MatisseNetworkModel import MatisseNetworkModel
59
#-------------------------------------------------------------------------------
61
#-------------------------------------------------------------------------------
64
log = logging.getLogger("MatisseNetworkView")
65
log.setLevel(GuiParam.DEBUG)
67
#-------------------------------------------------------------------------------
69
#-------------------------------------------------------------------------------
71
class MatisseNetworkView(QWidget, Ui_MatisseNetworkForm):
75
def __init__(self, parent, case):
79
QWidget.__init__(self, parent)
81
Ui_MatisseNetworkForm.__init__(self)
86
self.model = MatisseNetworkModel(self.case)
88
model_geom = MatisseGeom.MatisseGeomModel(self.case)
89
## self.lineStep = model_geom.getMatisseGeomDoubleVar('ptrres')
90
## self.rowStep = model_geom.getMatisseGeomDoubleVar('plgres')
91
self.heightStep = model_geom.getMatisseGeomDoubleVar('epchel')
92
## self.lineMax = model_geom.getMatisseGeomDoubleVar('nptran')
93
## self.rowMax = model_geom.getMatisseGeomDoubleVar('nplgrs')
94
## self.heightMax = model_geom.getMatisseGeomDoubleVar('nchest')
96
model_mat_type = MatisseType.MatisseTypeModel(self.case)
97
self.alveoStat = model_mat_type.node_alveo['status']
100
# Create the Page layout.
101
self.widgetLine.initWidget(self.case, "network_line")
102
self.widgetRow.initWidget(self.case, "network_row")
104
self.connect(self.lineEdit_hreso1,
105
SIGNAL("textChanged(const QString &)"),
106
self.getMatisseNetworkVar_hreso1)
108
self.connect(self.lineEdit_hreso2,
109
SIGNAL("textChanged(const QString &)"),
110
self.getMatisseNetworkVar_hreso2)
112
self.connect(self.lineEdit_hplen,
113
SIGNAL("textChanged(const QString &)"),
114
self.getMatisseNetworkVar_hplen)
117
validator_hreso1 = QtPage.DoubleValidator(
118
self.lineEdit_hreso1, "validator_hreso1")
120
validator_hreso2 = QtPage.DoubleValidator(
121
self.lineEdit_hreso2, "validator_hreso2")
123
validator_hplen = QtPage.DoubleValidator(
124
self.lineEdit_hplen, "validator_hplen")
126
self.lineEdit_hreso1.setValidator(validator_hreso1)
127
self.lineEdit_hreso2.setValidator(validator_hreso2)
128
self.lineEdit_hplen.setValidator(validator_hplen)
133
if self.alveoStat == 'on' :
136
self.nbcellreso1 = self.model.getMatisseNetworkDoubleVar('nbcellreso1')
137
self.nbcellreso2 = self.model.getMatisseNetworkDoubleVar('nbcellreso2')
138
self.nbcellplen = self.model.getMatisseNetworkDoubleVar('nbcellplen')
140
self.lineEdit_hreso1.setText(QString(str(self.nbcellreso1)))
141
self.lineEdit_hreso2.setText(QString(str(self.nbcellreso2)))
142
self.lineEdit_hplen.setText(QString(str(self.nbcellplen)))
144
self.hreso1 = self.heightStep * self.nbcellreso1
145
self.hreso2 = self.heightStep * self.nbcellreso2
146
self.hplen = self.heightStep * self.nbcellplen
148
self.model.setMatisseNetworkVar('hreso1', self.hreso1)
149
self.model.setMatisseNetworkVar('hreso2', self.hreso2)
150
self.model.setMatisseNetworkVar('hplen', self.hplen)
152
self.lineEdit2_1.setText(QString(str(self.hreso1)))
153
self.lineEdit2_2.setText(QString(str(self.hreso2)))
154
self.lineEdit2_3.setText(QString(str(self.hplen)))
158
self.lineEdit_hreso1.setDisabled(True)
160
if self.alveoStat == "off":
161
self.lineEdit_hreso2.setDisabled(True)
162
self.lineEdit_hplen.setDisabled(True)
165
self.lineEdit2_1.setDisabled(True)
166
self.lineEdit2_2.setDisabled(True)
167
self.lineEdit2_3.setDisabled(True)
170
def getMatisseNetworkVar_hreso1(self):
172
Input thermiclic load variable.
174
self.nbcellreso1, ok = self.lineEdit_hreso1.text().toFloat()
175
self.model.setMatisseNetworkVar('nbcellreso1', self.nbcellreso1)
176
val = float(self.nbcellreso1) * self.heightStep
177
self.model.setMatisseNetworkVar('hreso1', val)
180
def getMatisseNetworkVar_hreso2(self):
182
Input thermiclic load variable.
184
self.nbcellreso2, ok = self.lineEdit_hreso2.text().toFloat()
185
self.model.setMatisseNetworkVar('nbcellreso2', self.nbcellreso2)
186
val = float(self.nbcellreso2) * self.heightStep
187
self.model.setMatisseNetworkVar('hreso2', val)
190
def getMatisseNetworkVar_hplen(self):
192
Input thermiclic load variable.
194
self.nbcellplen, ok = self.lineEdit_hplen.text().toFloat()
195
self.model.setMatisseNetworkVar('nbcellplen', self.nbcellplen)
196
val = float(self.nbcellplen) * self.heightStep
197
self.model.setMatisseNetworkVar('hplen', val)
207
#-------------------------------------------------------------------------------
209
#-------------------------------------------------------------------------------
212
if __name__ == "__main__":
216
#-------------------------------------------------------------------------------
218
#-------------------------------------------------------------------------------
b'\\ No newline at end of file'