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

« back to all changes in this revision

Viewing changes to gui/Pages/LocalizationView.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
 
#
 
1
# -*- coding: utf-8 -*-
 
2
 
3
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
 
#
 
4
 
 
5
# This file is part of Code_Saturne, a general-purpose CFD tool.
 
6
#
 
7
# Copyright (C) 1998-2011 EDF S.A.
 
8
#
 
9
# This program is free software; you can redistribute it and/or modify it under
 
10
# the terms of the GNU General Public License as published by the Free Software
 
11
# Foundation; either version 2 of the License, or (at your option) any later
 
12
# version.
 
13
#
 
14
# This program is distributed in the hope that it will be useful, but WITHOUT
 
15
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 
16
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 
17
# details.
 
18
#
 
19
# You should have received a copy of the GNU General Public License along with
 
20
# this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
 
21
# Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
22
 
28
23
#-------------------------------------------------------------------------------
29
24
 
30
25
"""
60
55
#-------------------------------------------------------------------------------
61
56
 
62
57
from Base.Toolbox import GuiParam
63
 
from LocalizationForm import Ui_LocalizationForm
 
58
from Pages.LocalizationForm import Ui_LocalizationForm
64
59
from Base.Common import LABEL_LENGTH_MAX
65
60
from Base.QtPage import IntValidator, RegExpValidator
66
61
from Pages.PreProcessingInformationsView import Informations, preprocessorFile
117
112
                default['regexp'] = self.regExp
118
113
                log.debug("setModelData-> default = %s" % default)
119
114
 
120
 
                from VerifyExistenceLabelDialogView import VerifyExistenceLabelDialogView
 
115
                from Pages.VerifyExistenceLabelDialogView import VerifyExistenceLabelDialogView
121
116
                dialog = VerifyExistenceLabelDialogView(self.parent, default)
122
117
                if dialog.exec_():
123
118
                    result = dialog.get_result()
469
464
                    item = string.join([self.dicoM2V[key] for key in self.dicoM2V.keys() if data[key] == "on"], "\n")
470
465
#                    item = ""
471
466
#                    for key in dico.keys():
472
 
#                        print key
 
467
#                        print(key)
473
468
#                        if dico[key] == "on":
474
469
#                            item += key + "\n"
475
470
                    return QVariant(item)
572
567
        self.setRowCount(row+1)
573
568
 
574
569
        # Warning: the Volume region 'all_cells' is mandatory, and can not be modified.
575
 
        if self.zoneType == "VolumicZone" and zone.getLabel() == "all_cells":
576
 
            for c in range(self.columnCount()):
577
 
                self._disable.append((row, c))
 
570
        if self.zoneType == "VolumicZone":
 
571
            if zone.getLabel() == "all_cells":
 
572
                for c in range(self.columnCount()):
 
573
                    self._disable.append((row, c))
 
574
            self._disable.append((row, 1))
578
575
 
579
576
 
580
577
    def getItem(self, row):
581
578
        return self._data[row]
582
579
 
583
580
 
 
581
    def updateItem(self):
 
582
        # update zone Id
 
583
        for id in self.mdl.getCodeNumbersList():
 
584
            self._data[int(id)-1][1] = id
 
585
 
 
586
 
584
587
    def deleteItem(self, irow):
585
588
        del self._data[irow]
586
589
        nb_rows = self.rowCount()
587
590
        self.setRowCount(nb_rows-1)
 
591
        self.updateItem()
588
592
 
589
593
 
590
594
    def getData(self, row, column):
771
775
        graphical selection in the VTK viwver, or in the ObjectBrowser.
772
776
        """
773
777
        if self.case['salome']:
774
 
            from SalomeHandler import BoundaryGroup, VolumeGroup
 
778
            from Pages.SalomeHandler import BoundaryGroup, VolumeGroup
775
779
 
776
780
            log.debug("slotAddFromSalome: zoneType -> %s" % self.zoneType)
777
781
            if self.zoneType == 'VolumicZone':