def __init__(self, parent=None): """ Default class constructor. :param `parent`: Pointer to a parent widget instance. :type `parent`: `QGraphicsItem`_ """ super(BaseObject, self).__init__(parent) qDebug("BaseObject Constructor()") self.objPen = QPen() # QPen objPen; self.lwtPen = QPen() # QPen lwtPen; self.objLine = QLineF() # QLineF objLine; self.objRubberMode = int() # int objRubberMode; self.objRubberPoints = {} # QHash<QString, QPointF> objRubberPoints; self.objRubberTexts = {} # QHash<QString, QString> objRubberTexts; self.objID = int() # qint64 objID; self.objPen.setCapStyle(Qt.RoundCap) self.objPen.setJoinStyle(Qt.RoundJoin) self.lwtPen.setCapStyle(Qt.RoundCap) self.lwtPen.setJoinStyle(Qt.RoundJoin) self.objID = QDateTime.currentMSecsSinceEpoch()
def __init__(self, parent=None): """ Default class constructor. :param `parent`: Pointer to a parent widget instance. :type `parent`: `QGraphicsItem`_ """ super(BaseObject, self).__init__(parent) qDebug("BaseObject Constructor()") objPen.setCapStyle(Qt.RoundCap) objPen.setJoinStyle(Qt.RoundJoin) lwtPen.setCapStyle(Qt.RoundCap) lwtPen.setJoinStyle(Qt.RoundJoin) objID = QDateTime.currentMSecsSinceEpoch()
def updateConfigTab(self): # clean the comboGridBox index = self.ui.comboGridBox.count() while index != 0: print "remove index %d" % index self.ui.comboGridBox.removeItem(index - 1) index = self.ui.comboGridBox.count() # fill the comboGridBox with new values index = 0 selected = False now = QDateTime.currentMSecsSinceEpoch() / 1000 # in sec print "now=%d" % now for gridNumber in self.__gridHandler.gridList(): print "add grid n %s" % gridNumber[0] try: gridDateTime = QDateTime.fromMSecsSinceEpoch(int(gridNumber[1]) * 1000) itemText = gridNumber[0] itemText = ''.join((itemText, " ")) itemText = ''.join((itemText, gridDateTime.toString())) except ValueError: itemText = '' # itemText = "{} {}".format(gridNumber[0], gridDateTime.toString()) # self.ui.comboGridBox.addItem(gridNumber[0]) self.ui.comboGridBox.addItem(itemText) try: if int(now) >= (int(gridNumber[1]) + (3600 * 24)): print "disabled because date : %s" % gridNumber[1] # self.ui.comboGridBox.model().item(index).setEnabled(False) # self.ui.comboGridBox.model().item(index).setBackground(QBrush(Qt.grey)) elif not selected: self.ui.comboGridBox.setCurrentIndex(index) self.do_changeGrid(index) selected = True except ValueError: pass index += 1