def fillProtectLayerTable(self): # 清空 self.ui.protect_layer_table.clearContents() # 查找矿井辖属的煤层 coal_lists = SQLClientHelper.GetCoalListByForeignKey( 'mine_id', self.mine_id) self.ui.protect_layer_table.setRowCount(len(coal_lists)) for i, coal in enumerate(coal_lists): self.ui.protect_layer_table.setItem( i, 0, QtGui.QTableWidgetItem(u'%d' % (i + 1))) self.ui.protect_layer_table.setItem( i, 1, QtGui.QTableWidgetItem(u'%s' % coal.name.decode('utf-8'))) self.ui.protect_layer_table.setItem( i, 2, QtGui.QTableWidgetItem(u'%.1f' % coal.dip_angle)) self.ui.protect_layer_table.setItem( i, 3, QtGui.QTableWidgetItem(u'%.1f' % coal.thick)) mine = SQLClientHelper.GetMineById(self.mine_id) if mine.id <= 0 or mine.protect_layer_condition == 0: self.ui.protect_layer_table.setItem( i, 4, QtGui.QTableWidgetItem(u'—')) else: protect_item = u'保护层' if coal.is_protectable != 0 else u'被保护层' self.ui.protect_layer_table.setItem( i, 4, QtGui.QTableWidgetItem(protect_item))
def decisionPermeabilityK(self): # 所有煤层渗透率均大于等于5mD时,判定该煤层为中高渗条件;否则,判定该煤层为低渗条件 # 查找矿井辖属的煤层 coal_lists = SQLClientHelper.GetCoalListByForeignKey( 'mine_id', self.mine_id) n = sum([int(float(coal.permeability_k) > 5) for coal in coal_lists]) return int(n == len(coal_lists))
def fillCoalCombox(self): # 清空煤层下拉列表 self.ui.coal.clear() # 查找矿井辖属的煤层 coal_lists = SQLClientHelper.GetCoalListByForeignKey( 'mine_id', self.mine_id) # 添加到煤层下拉列表 UiHelper.AddObjectListToCombobox(self.ui.coal, coal_lists)
def test_copy_obj(): # sql_coal = SQLClientHelper.GetCoalById(5) # print sql_coal # coal = Coal() # print coal # print CbmUtil.CopyAttribsOfCbmType("Coal", sql_coal, coal) # print coal coal_lists = SQLClientHelper.GetCoalListByForeignKey("mine_id", 1) # coal_lists = SQLClientHelper.GetCoalListByField1("mine_id", '1') print coal_lists[0].name.decode('utf-8')
def decisionCoalPopulation(self): # 当煤层数量为1层 # 或者虽然为多层,但任何两层间的层间距与下层面的比值均大于40时,判定为单一煤层条件;否则为煤层群条件。 # 当煤层为煤层群条件时,任何一个煤层的“与上覆煤层间距”均≤“煤层开采冒落带高度” # 且采动影响倍数均≤7.5时,判定为近距离煤层群条件;否则判定为中远距离煤层群条件。 # 查找矿井辖属的煤层 coal_lists = SQLClientHelper.GetCoalListByForeignKey( 'mine_id', self.mine_id) if len(coal_lists) == 0: return 0 # 单一煤层条件 else: # f = lambda coal:int(coal.layer_gap <= coal.czh and coal.influence_factor <= 7.5) f = lambda coal: int(coal.influence_factor <= 7.5) n = sum([f(coal) for coal in coal_lists]) if n == len(coal_lists): return 1 # 近距离煤层群条件 else: return 2 # 中远距离煤层群条件
def fillCoalPopulationTable(self): # 清空 self.ui.coal_population_table.clearContents() # 查找矿井辖属的煤层 coal_lists = SQLClientHelper.GetCoalListByForeignKey( 'mine_id', self.mine_id) self.ui.coal_population_table.setRowCount(len(coal_lists)) for i, coal in enumerate(coal_lists): self.ui.coal_population_table.setItem( i, 0, QtGui.QTableWidgetItem(u'%d' % (i + 1))) self.ui.coal_population_table.setItem( i, 1, QtGui.QTableWidgetItem(u'%s' % coal.name.decode('utf-8'))) self.ui.coal_population_table.setItem( i, 2, QtGui.QTableWidgetItem(u'%.1f' % coal.layer_gap)) self.ui.coal_population_table.setItem( i, 3, QtGui.QTableWidgetItem(u'%.1f' % coal.czh)) self.ui.coal_population_table.setItem( i, 4, QtGui.QTableWidgetItem(u'%.1f' % coal.influence_factor))
def fillPermeabilityKTable(self): # 清空 self.ui.permeability_k_table.clearContents() # 查找矿井辖属的煤层 coal_lists = SQLClientHelper.GetCoalListByForeignKey( 'mine_id', self.mine_id) self.ui.permeability_k_table.setRowCount(len(coal_lists)) for i, coal in enumerate(coal_lists): self.ui.permeability_k_table.setItem( i, 0, QtGui.QTableWidgetItem(u'%d' % (i + 1))) self.ui.permeability_k_table.setItem( i, 1, QtGui.QTableWidgetItem(u'%s' % coal.name.decode('utf-8'))) self.ui.permeability_k_table.setItem( i, 2, QtGui.QTableWidgetItem(u'%.2f' % coal.permeability_k)) item = QtGui.QTableWidgetItem() item.setFlags(QtCore.Qt.ItemIsEnabled) # 不这么设置,用户点击时,图片被选的状态不美观 if coal.permeability_k > 5: item.setIcon(QtGui.QIcon(':/images/yes.png')) else: item.setIcon(QtGui.QIcon(':/images/no.png')) self.ui.permeability_k_table.setItem(i, 3, item)