Esempio n. 1
0
    def valid_by_group(self):
        if(self._data.grouptypesel != 0):
            self._conds = self._data.degrees_conds
            cexp = self._data.exp_store
            exp = cexp.give_exp("pressure")
            mesh = self._data.mesh
            log_gui.debug("valid_by_group by group type %s, mesh %s", self._data.grouptypesel,mesh)
            grp_names = exp.find_groups(mesh)
            self._grp_names = grp_names
            self._valided = True
            
            dim = self._data.get_dim()
            if (len(grp_names)>0):
               if self._condition_type==0:
                  head_names =[u"Group", u"DX", u"DY"]
                  if (dim == WCD.Dim_Type.Three_Dim):
                     head_names.append(u"DZ")

            checklist = [qtc.Qt.Checked]*len(head_names)
            val_list = [.0]*(len(head_names)-1)
            self._default_cond = [grp_names[0]] + val_list
            self._default_check = checklist
            self._default_flag = [qtc.Qt.ItemIsEditable | qtc.Qt.ItemIsEnabled] + [qtc.Qt.ItemIsEditable | qtc.Qt.ItemIsEnabled | qtc.Qt.ItemIsUserCheckable] * (len(head_names) - 1) #第一列的数据不需要check 
            #self._default_flag = [qtc.Qt.ItemIsEditable | qtc.Qt.ItemIsEnabled] + [qtc.Qt.ItemIsEnabled | qtc.Qt.ItemIsUserCheckable] * (len(head_names) - 1) #第一列的数据不需要check 
            model = Ast_D_of_F_Model(self, head_names)
            self._tab.setModel(model)
            self._tab.setEnabled(True)
            self._tab.horizontalHeader().setClickable(True)
            self._tab.setItemDelegate(WC.ValueDelegate(self))
            self._tab.setItemDelegateForColumn(0,WC.AstGroupDelegate(self,self._grp_names))
            self.add_cond()
            
            icolumn = 0
            for iname in head_names:
                width = 80
                if icolumn > 0:
                   width = 60
                self._tab.setColumnWidth(icolumn,width) 
                icolumn += 1
            self.is_reseted = False
        else:
            self._build()
Esempio n. 2
0
    def valid_by_group(self):
        self._conds = self._data.pair_conds
        if(self._data.grouptypesel != 0):
            cexp = self._data.exp_store
            exp = cexp.give_exp("pressure")
            mesh = self._data.mesh
            log_gui.debug("Ast_Pair_Selector valid_by_group by group type %s, mesh %s", self._data.grouptypesel,mesh)
            grp_names = exp.find_groups(mesh)
            self._grp_names = grp_names
            self._grp_names.reverse()
            self._valided = True
            
            dim = self._data.get_dim()
            head_names =[u"Type", u"Mater group", u"Slave group", u"Friction Coefficient"]
            type_name = [u"bond", u"Frictionless", u"Friction"]

            self._default_cond = [type_name[0]] + [self._grp_names[0]] + [self._grp_names[0]] + [0]
            
            for i in self._default_cond:
              log_gui.debug("Ast_Pair_Selector _default_cond %s", i)

            model = Ast_Pair_Model(self, head_names)
            self._tab.setModel(model)
            self._tab.setEnabled(True)
            self._tab.horizontalHeader().setClickable(True)
            self._tab.setItemDelegate(WC.ValueDelegate(self))
            self._tab.setItemDelegateForColumn(0,WC.AstGroupDelegate(self,type_name))
            self._tab.setItemDelegateForColumn(1,WC.AstGroupDelegate(self,self._grp_names))
            self._tab.setItemDelegateForColumn(2,WC.AstGroupDelegate(self,self._grp_names))
            self.add_cond()
            
            width = [75,80,80,115,60,60,50,50]
            icolumn = 0
            for iname in head_names:
                self._tab.setColumnWidth(icolumn,width[icolumn]) 
                icolumn += 1
            self.is_reseted = False
        else:
            self._build()
Esempio n. 3
0
    def valid_by_group(self):
        self._conds = self._data.pressure_conds
        if(self._data.grouptypesel != 0):
            cexp = self._data.exp_store
            exp = cexp.give_exp("pressure")
            mesh = self._data.mesh
            log_gui.debug("valid_by_group by group type %s, mesh %s", self._data.grouptypesel,mesh)
            grp_names = exp.find_groups(mesh)
            self._grp_names = grp_names
            self._valided = True
            
            dim = self._data.get_dim()
            if (len(grp_names)>0):
               if self._condition_type==0:
                  head_names = copy.copy(self.head_name)
                  if (dim == WCD.Dim_Type.Three_Dim):
                     head_names.append(u"")
            log_gui.debug("valid_by_group head_names: %d",len(head_names))

            val_list = [.0]*(len(head_names) - 2)
            self._default_cond = [grp_names[0], u"Pressure"] + val_list
            model = Ast_Pressure_Model(self, head_names)
            self._tab.setModel(model)
            self._tab.setEnabled(True)
            self._tab.horizontalHeader().setClickable(True)
            self._tab.setItemDelegate(WC.ValueDelegate(self))
            self._tab.setItemDelegateForColumn(0, WC.AstGroupDelegate(self, self._grp_names)) 
            self._tab.setItemDelegateForColumn(1, WC.AstGroupDelegate(self, self._pressure_types)) 
            self.add_cond()
            
            width = [80,90,60,60,60,60,60,60,60,60,60,60]
            icolumn = 0
            for iname in head_names:
                self._tab.setColumnWidth(icolumn,width[icolumn]) 
                icolumn += 1
            self.is_reseted = False
        else:
            self._build()