コード例 #1
0
ファイル: qmltodo.py プロジェクト: AmerGit/Examples
    def editNewTodo(self):
        """Sets the current todo to a newly created todo"""
        newTodo = QOrganizerTodo()
        newTodo.setPriority(QOrganizerItemPriority.HighPriority)
        newTodo.setStatus(QOrganizerTodoProgress.StatusNotStarted)
        currentDateTime = QDateTime(QDate.currentDate(), QTime.currentTime())
        newTodo.setStartDateTime(currentDateTime)
        newTodo.setDueDateTime(currentDateTime.addSecs(60*60))

        self._todo = newTodo
        self._todo.isNewTodo = True
        self.currentTodoChanged.emit()
コード例 #2
0
    def editNewTodo(self):
        """Sets the current todo to a newly created todo"""
        newTodo = QOrganizerTodo()
        newTodo.setPriority(QOrganizerItemPriority.HighPriority)
        newTodo.setStatus(QOrganizerTodoProgress.StatusNotStarted)
        currentDateTime = QDateTime(QDate.currentDate(), QTime.currentTime())
        newTodo.setStartDateTime(currentDateTime)
        newTodo.setDueDateTime(currentDateTime.addSecs(60 * 60))

        self._todo = newTodo
        self._todo.isNewTodo = True
        self.currentTodoChanged.emit()
コード例 #3
0
ファイル: ghost.py プロジェクト: 42cc/Ghost.py
 def toQtCookie(PyCookie):
     qc = QNetworkCookie(PyCookie.name, PyCookie.value)
     qc.setSecure(PyCookie.secure)
     if PyCookie.path_specified:
         qc.setPath(PyCookie.path)
     if PyCookie.domain != "":
         qc.setDomain(PyCookie.domain)
     if PyCookie.expires != 0:
         t = QDateTime()
         t.setTime_t(PyCookie.expires)
         qc.setExpirationDate(t)
     # not yet handled(maybe less useful):
     #   py cookie.rest / QNetworkCookie.setHttpOnly()
     return qc
コード例 #4
0
 def toQtCookie(PyCookie):
     qc = QNetworkCookie(PyCookie.name, PyCookie.value)
     qc.setSecure(PyCookie.secure)
     if PyCookie.path_specified:
         qc.setPath(PyCookie.path)
     if PyCookie.domain != "":
         qc.setDomain(PyCookie.domain)
     if PyCookie.expires != 0:
         t = QDateTime()
         t.setTime_t(PyCookie.expires)
         qc.setExpirationDate(t)
     # not yet handled(maybe less useful):
     #   py cookie.rest / QNetworkCookie.setHttpOnly()
     return qc
コード例 #5
0
ファイル: python_conversion.py プロジェクト: Hasimir/PySide
    def testQDateTime6arg(self):
        dateTime = datetime.datetime(2010, 4, 23, 11, 14, 7)
        other = QDateTime(dateTime)

        otherDate = other.date()
        self.assertEqual(dateTime.year, otherDate.year())
        self.assertEqual(dateTime.month, otherDate.month())
        self.assertEqual(dateTime.day, otherDate.day())

        otherTime = other.time()
        self.assertEqual(dateTime.hour, otherTime.hour())
        self.assertEqual(dateTime.minute, otherTime.minute())
        self.assertEqual(dateTime.second, otherTime.second())
        self.assertEqual(dateTime.microsecond/1000, otherTime.msec())

        self.assertEqual(dateTime, other.toPython())
コード例 #6
0
    def setTodoStartTime(self, hour, minute):
        orig_date = self._todo.startDateTime().date()
        time = QTime(hour, minute)
        datetime = QDateTime(orig_date, time)

        self._todo.setStartDateTime(datetime)
        self.currentTodoChanged.emit()
コード例 #7
0
    def testQDateTime6arg(self):
        dateTime = datetime.datetime(2010, 4, 23, 11, 14, 7)
        other = QDateTime(dateTime)

        otherDate = other.date()
        self.assertEqual(dateTime.year, otherDate.year())
        self.assertEqual(dateTime.month, otherDate.month())
        self.assertEqual(dateTime.day, otherDate.day())

        otherTime = other.time()
        self.assertEqual(dateTime.hour, otherTime.hour())
        self.assertEqual(dateTime.minute, otherTime.minute())
        self.assertEqual(dateTime.second, otherTime.second())
        self.assertEqual(dateTime.microsecond / 1000, otherTime.msec())

        self.assertEqual(dateTime, other.toPython())
コード例 #8
0
    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()
コード例 #9
0
    def setTodoStartDate(self, year, month, day):
        orig_time = self._todo.startDateTime().time()
        date = QDate(year, month, day)
        datetime = QDateTime(date, orig_time)

        self._todo.setStartDateTime(datetime)
        self.currentTodoChanged.emit()
コード例 #10
0
    def __readsettings(self):

        # 検索範囲時刻の初期値設定
        # とりあえず直近1カ月範囲?
        # 開始時刻は現在時刻より1カ月前
        defaultstartdate = QDateTime.currentDateTime()
        lastmonth = defaultstartdate.addMonths(-1)

        self.dateTimeEdit_start.setDateTime(lastmonth)
        #終了時刻はなう
        self.dateTimeEdit_end.setDateTime(defaultstartdate)
        self.reload_clicked()

        # iniから前回設定読み出して自動選択とかをこの辺にそのうち
        # とりあえず空にしとくか
        self.comboBox_UserName.clearEditText()
        self.comboBox_ProjectName.clearEditText()

        self.tableWidget_jobList.setRowCount(0)
        # Commentとか直接使用しない列もあるから、列増えるたびに要調整。。
        self.tableWidget_jobList.setColumnCount(16)
        #QDateTime to ISODate String....
        #print(defaultstartdate.toString(QtCore.Qt.ISODate))

        return
コード例 #11
0
ファイル: dialogs.py プロジェクト: jlehtoma/MaeBird
 def addRecord(self):
     row = self.model.rowCount()
     self.model.insertRow(row)
     
     now = QDateTime.currentDateTime()
     self.dateTimeEdit.setDateTime(now)
     self.sppLineEdit.setFocus()
     self.mapper.setCurrentIndex(row)
コード例 #12
0
ファイル: python_conversion.py プロジェクト: jkozera/PySide
    def testQDateTime(self):
        dateTime = datetime.datetime(2010, 4, 23, 11, 14, 0, 1000)
        other = QDateTime(dateTime)

        otherDate = other.date()
        self.assertEqual(dateTime.year, otherDate.year())
        self.assertEqual(dateTime.month, otherDate.month())
        self.assertEqual(dateTime.day, otherDate.day())

        otherTime = other.time()
        self.assertEqual(dateTime.hour, otherTime.hour())
        self.assertEqual(dateTime.minute, otherTime.minute())
        self.assertEqual(dateTime.second, otherTime.second())
        self.assertEqual(dateTime.microsecond/1000, otherTime.msec())

        self.assertEqual(dateTime, other.toPython())

        # with 6 arguments
        other = QDateTime(2010, 4, 23, 11, 14, 1)

        otherDate = other.date()
        self.assertEqual(2010, otherDate.year())
        self.assertEqual(4, otherDate.month())
        self.assertEqual(23, otherDate.day())

        otherTime = other.time()
        self.assertEqual(11, otherTime.hour())
        self.assertEqual(14, otherTime.minute())
        self.assertEqual(1, otherTime.second())
コード例 #13
0
ファイル: location_test.py プロジェクト: alal/Mobility
    def parse_position(self, line):
        timestamp, lat, lng = line.split()

        timestamp = QDateTime.fromString(timestamp, Qt.ISODate)
        lat = float(lat)
        lng = float(lng)

        coordinate = QGeoCoordinate(lat, lng)
        info = QGeoPositionInfo(coordinate, timestamp)

        return info
コード例 #14
0
ファイル: location_test.py プロジェクト: setanta/Mobility
    def parse_position(self, line):
        timestamp, lat, lng = line.split()

        timestamp = QDateTime.fromString(timestamp, Qt.ISODate)
        lat = float(lat)
        lng = float(lng)

        coordinate = QGeoCoordinate(lat, lng)
        info = QGeoPositionInfo(coordinate, timestamp)

        return info
コード例 #15
0
ファイル: editTeam.py プロジェクト: ldonjibson/FFL
    def __init__(self, playersOut, playersIn, parent=None):
        super(confirmSubsDialog, self).__init__(parent)

        self.now = QDateTime.currentDateTime()
        self.now.setTime(
            QTime(self.now.time().hour(),
                  self.now.time().minute()))

        self.setWindowTitle("Confirm Subs")
        mainVerticalLayout = QVBoxLayout(self)

        subsLayout = QGridLayout()
        mainVerticalLayout.addLayout(subsLayout)

        subsLayout.addWidget(QLabel("<b>Players Out</b>"), 0, 0)
        subsLayout.addWidget(QLabel("<b>Players In</b>"), 0, 1)

        for i, (playerOut, playerIn) in enumerate(zip(playersOut, playersIn)):
            playerOutLabel = QLabel()
            playerOutLabel.setText("<font color=red>{0}</font>".format(
                playerOut.name))
            subsLayout.addWidget(playerOutLabel, i + 1, 0)

            playerInLabel = QLabel()
            playerInLabel.setText("<font color=green>{0}</font>".format(
                playerIn.name))
            subsLayout.addWidget(playerInLabel, i + 1, 1)

        mainVerticalLayout.addItem(
            QSpacerItem(0, 15, QSizePolicy.Minimum, QSizePolicy.Expanding))

        dateTimeLayout = QHBoxLayout()
        mainVerticalLayout.addLayout(dateTimeLayout)
        dateTimeLayout.addWidget(QLabel("Date and time"))

        self.dateTimeEdit = QDateTimeEdit(self.now)
        self.dateTimeEdit.setMaximumDateTime(self.now)
        self.dateTimeEdit.setCalendarPopup(True)
        self.dateTimeEdit.setDisplayFormat("d MMM yy h:mm AP")

        dateTimeLayout.addWidget(self.dateTimeEdit)
        dateTimeLayout.addStretch()

        mainVerticalLayout.addItem(
            QSpacerItem(0, 10, QSizePolicy.Minimum, QSizePolicy.Expanding))

        buttonBox = QDialogButtonBox(self)
        buttonBox.setStandardButtons(QDialogButtonBox.Cancel
                                     | QDialogButtonBox.Ok)
        buttonBox.button(QDialogButtonBox.Ok).setText("&Accept")
        mainVerticalLayout.addWidget(buttonBox)

        buttonBox.accepted.connect(self.accept)
        buttonBox.rejected.connect(self.reject)
コード例 #16
0
 def handleHtmlPage(self, htmlPage):
         tup = ()
         self._gridList = []
         loto15rx = QRegExp("<option selected=\"selected\" value=\"(\\d+)\">")
         loto15DateRx = QRegExp("\\d*\\s*du\\s*(\\d*\/\\d*\/\\d*)<\/option>")
         posi_encours = loto15rx.indexIn(str(htmlPage))
         ngrille = loto15rx.cap(1)
         print "ngrille=%s" % ngrille
         posi = loto15DateRx.indexIn(str(htmlPage), posi_encours)
         date = loto15DateRx.cap(1)
         print "Date=%s" % date
         dmy = string.split(date, "/")
         print "dmy :%s" % str(dmy)
         qdatetime = QDateTime()
         qdatetime.setDate(QDate(int("20"+dmy[2]), int(dmy[1]), int(dmy[0])))
         qdatetime = qdatetime.addDays(1).addSecs(-1) # next day
         epochDate = qdatetime.toMSecsSinceEpoch()/1000
         print "epochDate=%d" % epochDate
         tup = (ngrille, epochDate, 0)
         self._gridList.append(tup)
         loto15rx = QRegExp("<option value=\"(\\d+)\">")
         posi = 0
         posi = loto15rx.indexIn(str(htmlPage), posi+1)
         while posi != -1 :#and posi < posi_encours:
                 ngrille = loto15rx.cap(1)
                 print "ngrille=%s" % ngrille
                 posi = loto15DateRx.indexIn(str(htmlPage), posi)
                 date = loto15DateRx.cap(1)
                 print "Date=%s" % date
                 dmy = string.split(date, "/")
                 qdatetime = QDateTime()
                 qdatetime.setDate(QDate(int("20"+dmy[2]), int(dmy[1]), int(dmy[0])))
                 qdatetime = qdatetime.addDays(1).addSecs(-1) # next day
                 epochDate = qdatetime.toMSecsSinceEpoch()/1000
                 print "epochDate=%d" % epochDate
                 tup = (ngrille, epochDate, 0)
                 self._gridList.append(tup)
                 posi = loto15rx.indexIn(str(htmlPage), posi+1)
コード例 #17
0
 def oddsUrl2(self, dayMore=0):
     url = self._oddsUrl2
     epochDate = self._gridList[self._index][1]
     date = QDateTime()
     date.setMSecsSinceEpoch(int(epochDate) * 1000)
     print "date = %s" % date
     date = date.addDays(dayMore)
     print "date + dayMore = %s" % date
     day = date.date().day()
     month = date.date().month()
     year = date.date().year()
     urlComplement = "{0}-{1}-{2}.html".format(day, month, year)
     return self._oddsUrl2 + urlComplement
コード例 #18
0
ファイル: CombinoGUI.py プロジェクト: poupou14/CombinoGen
 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
コード例 #19
0
ファイル: mainwindow.py プロジェクト: marchon/ifmon
    def updateTotal(self):
        stat = self.model.total
        total = BandwidthTableModel.smart_bytes(stat['total'])
        received = BandwidthTableModel.smart_bytes(stat['received'])
        transmitted = BandwidthTableModel.smart_bytes(stat['transmitted'])
        self.labelTotal.setText(total)
        self.labelTotalReceived.setText(received)
        self.labelTotalTransmitted.setText(transmitted)
        self.labelUptime.setText(BandwidthTableModel.formatUptime(stat['uptime']))

        tps = BandwidthTableModel.smart_bytes(self.model.tps)
        rps = BandwidthTableModel.smart_bytes(self.model.rps)
        self.labelRps.setText("%s/s" % rps)
        self.labelTps.setText("%s/s" % tps)
        now = QLocale().toString(QDateTime.currentDateTime(), u'dd MMMM, yyyy hh:mm:ss')
        self.labelTime.setText(now)
コード例 #20
0
ファイル: qtmobility-test.py プロジェクト: Cermit/DateEvent
    def __init__(self):
        QtCore.QObject.__init__(self)
        # Manager hat alle collections
        self.defaultManager = QOrganizerManager()
        self.collections = self.defaultManager.collections()
        # Kontrolle
        print len(self.collections)

        # Infos über collections mit metaData(), für alle Meta-Daten einfach nur metaData() aufrufen
        for collection in self.collections:
            print collection.metaData()
            print collection.metaData('Color'), collection.metaData('Name')

        # Filter erzeugen und mit ausgewählten Collections bestücken, hier über Namen
        self.collectionFilter = QOrganizerItemCollectionFilter()
        for collection in self.collections:
            if collection.metaData()['Name'] == u'Nokia N900':
                self.collectionFilter.setCollectionId(collection.id())
  
        now = QDateTime.currentDateTime()
        days_ahead = 150
        # ohne Filter liefert alle collection-einträge
        #self.items = self.defaultManager.items(now,now.addDays(days_ahead))

        # mit Filter nur die aus dem N900 Kalender
        self.items = self.defaultManager.items(now,now.addDays(days_ahead),self.collectionFilter)

        # Items je nach Typ umwandeln und Eigenschaften ausgeben lassen
        for item in self.items:
            if item.type() == 'Todo':
                todo = QOrganizerTodo(item)
                print (todo.dueDateTime().toString("dd.MM.yyyy hh:mm:ss"),
                       todo.displayLabel()) 
            if item.type() == 'EventOccurrence':
                occurrence = QOrganizerEventOccurrence(item)
                print (occurrence.startDateTime().toString("dd.MM.yyyy hh:mm:ss"),
                       occurrence.endDateTime().toString("dd.MM.yyyy hh:mm:ss"), 
                       occurrence.displayLabel(), 
                       occurrence.location()) 
            if item.type() == 'Event':
                event = QOrganizerEvent(item)
                print (event.startDateTime().toString("dd.MM.yyyy hh:mm:ss"), 
                       event.endDateTime().toString("dd.MM.yyyy hh:mm:ss"),
                       event.displayLabel(),
                       event.location(),
                       event.id())
        sys.exit(0)
コード例 #21
0
ファイル: editTeam.py プロジェクト: LS80/FFL
    def __init__(self, playersOut, playersIn, parent=None):
        super(confirmSubsDialog, self).__init__(parent)
        
        self.now = QDateTime.currentDateTime()
        self.now.setTime(QTime(self.now.time().hour(), self.now.time().minute()))
        
        self.setWindowTitle("Confirm Subs")
        mainVerticalLayout = QVBoxLayout(self)
        
        subsLayout = QGridLayout()
        mainVerticalLayout.addLayout(subsLayout)
        
        subsLayout.addWidget(QLabel("<b>Players Out</b>"), 0, 0)
        subsLayout.addWidget(QLabel("<b>Players In</b>"), 0, 1)

        for i, (playerOut, playerIn) in enumerate(zip(playersOut, playersIn)):
            playerOutLabel = QLabel()
            playerOutLabel.setText("<font color=red>{0}</font>".format(playerOut.name))
            subsLayout.addWidget(playerOutLabel, i+1, 0)
            
            playerInLabel = QLabel()
            playerInLabel.setText("<font color=green>{0}</font>".format(playerIn.name))
            subsLayout.addWidget(playerInLabel, i+1, 1)
            
        mainVerticalLayout.addItem(QSpacerItem(0, 15, QSizePolicy.Minimum, QSizePolicy.Expanding))
        
        dateTimeLayout = QHBoxLayout()
        mainVerticalLayout.addLayout(dateTimeLayout)
        dateTimeLayout.addWidget(QLabel("Date and time"))
        
        self.dateTimeEdit = QDateTimeEdit(self.now)
        self.dateTimeEdit.setMaximumDateTime(self.now)
        self.dateTimeEdit.setCalendarPopup(True)
        self.dateTimeEdit.setDisplayFormat("d MMM yy h:mm AP")
        
        dateTimeLayout.addWidget(self.dateTimeEdit)
        dateTimeLayout.addStretch()
        
        mainVerticalLayout.addItem(QSpacerItem(0, 10, QSizePolicy.Minimum, QSizePolicy.Expanding))
        
        buttonBox = QDialogButtonBox(self)
        buttonBox.setStandardButtons(QDialogButtonBox.Cancel|QDialogButtonBox.Ok)
        buttonBox.button(QDialogButtonBox.Ok).setText("&Accept")
        mainVerticalLayout.addWidget(buttonBox)

        buttonBox.accepted.connect(self.accept)
        buttonBox.rejected.connect(self.reject)
コード例 #22
0
    def testQDateTimeNull(self):
        '''QDataStream <<>> QDateTime - null'''

        self.stream << QDateTime()

        res = QDateTime()

        self.read_stream >> res
        self.assertEqual(res, QDateTime())
        self.assertFalse(res.isValid())
        self.assertTrue(res.isNull())
コード例 #23
0
    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()
コード例 #24
0
    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()
コード例 #25
0
ファイル: location_test.py プロジェクト: alal/Mobility
    def readNextPosition(self):
        line = self.logFile.readLine().trimmed()

        if not line.isEmpty():
            data = line.split(' ')
            hasLatitude = True
            hasLongitude = True
            timestamp = QDateTime.fromString(str(data[0]), Qt.ISODate)
            latitude = float(data[1])
            longitude = float(data[2])
            if timestamp.isValid():
                coordinate = QGeoCoordinate(latitude, longitude)
                info = QGeoPositionInfo(coordinate, timestamp)
                if info.isValid():
                    self.lastPosition = info
                    # Currently segfaulting. See Bug 657
                    # http://bugs.openbossa.org/show_bug.cgi?id=657
                    self.positionUpdated.emit(info)
コード例 #26
0
ファイル: location_test.py プロジェクト: setanta/Mobility
    def readNextPosition(self):
        line = self.logFile.readLine().trimmed()

        if not line.isEmpty():
            data = line.split(' ')
            hasLatitude = True
            hasLongitude = True
            timestamp = QDateTime.fromString(str(data[0]), Qt.ISODate)
            latitude = float(data[1])
            longitude = float(data[2])
            if timestamp.isValid():
                coordinate = QGeoCoordinate(latitude, longitude)
                info = QGeoPositionInfo(coordinate, timestamp)
                if info.isValid():
                    self.lastPosition = info
                    # Currently segfaulting. See Bug 657
                    # http://bugs.openbossa.org/show_bug.cgi?id=657
                    self.positionUpdated.emit(info)
コード例 #27
0
 def oddsUrl(self):
     url = self._oddsUrl
     epochDate = self._gridList[self._index][1]
     date = QDateTime()
     date.setMSecsSinceEpoch(int(epochDate) * 1000)
     day = date.date().day()
     month = date.date().month()
     year = date.date().year()
     urlComplement = "?year=%d" % year
     urlComplement = urlComplement + "&month=%d" % month
     urlComplement = urlComplement + "&day=%d" % day
     print "urlComplement"
     return self._oddsUrl + urlComplement
コード例 #28
0
    def testQDateTimeValid(self):
        '''QDataStream <<>> QDateTime - valid'''
        time = QTime(23, 23, 23)
        date = QDate(2009, 1, 1)

        self.stream << QDateTime(date, time)

        res = QDateTime()

        self.read_stream >> res
        self.assertEqual(res, QDateTime(date, time))
        self.assertTrue(res.isValid())
        self.assertFalse(res.isNull())
コード例 #29
0
ファイル: hash_test.py プロジェクト: holmeschiu/PySide
    def testInsert(self):
        myHash = {}
        qdate = QDate.currentDate()
        qdatetime = QDateTime.currentDateTime()
        qtime = QTime.currentTime()
        qurl = QUrl("http://www.pyside.org")
        qpoint = QPoint(12, 42)

        myHash[qdate] = "QDate"
        myHash[qdatetime] = "QDateTime"
        myHash[qtime] = "QTime"
        myHash[qurl] = "QUrl"
        myHash[qpoint] = "QPoint"

        self.assertEqual(myHash[qdate], "QDate")
        self.assertEqual(myHash[qdatetime], "QDateTime")
        self.assertEqual(myHash[qtime], "QTime")
        self.assertEqual(myHash[qurl], "QUrl")
        self.assertEqual(myHash[qpoint], "QPoint")
コード例 #30
0
ファイル: hash_test.py プロジェクト: msgfx/dependencies
    def testInsert(self):
        myHash = {}
        qdate = QDate.currentDate()
        qdatetime = QDateTime.currentDateTime()
        qtime = QTime.currentTime()
        qurl = QUrl("http://www.pyside.org")
        qpoint = QPoint(12, 42)

        myHash[qdate] = "QDate"
        myHash[qdatetime] = "QDateTime"
        myHash[qtime] = "QTime"
        myHash[qurl] = "QUrl"
        myHash[qpoint] = "QPoint"

        self.assertEqual(myHash[qdate], "QDate")
        self.assertEqual(myHash[qdatetime], "QDateTime")
        self.assertEqual(myHash[qtime], "QTime")
        self.assertEqual(myHash[qurl], "QUrl")
        self.assertEqual(myHash[qpoint], "QPoint")
コード例 #31
0
    def __init__(self):
        super(Mywindow, self).__init__()
        self.setupUi(self)
        self.result = []
        self.data1 = []
        self.data2 = []
        self.data3 = []
        self.data4 = []
        self.text = ""
        self.setTable2()
        self.clo = 0
        # self.dateTimeEdit = QDateTimeEdit(self)

        # self.dateEdit =  QDateTimeEdit(QDate.currentDate())
        # self.timeEdit =  QDateTimeEdit(QTime.currentTime())
        # self.dateTimeEdit = QtGui.QDateTimeEdit(QtCore.QDateTime.currentDateTime(), self)
        self.dateTimeEdit.setDateTime(QDateTime.currentDateTime())
        self.dateTimeEdit.setDisplayFormat("yyyy-MM-dd HH:mm:ss")
        # self.dateTimeEdit2.setDisplayFormat("yyyy/MM/dd HH-mm-ss")
        # self.dateEdit.setDisplayFormat("yyyy.M.d")
        # self.timeEdit.setDisplayFormat("H:mm")

        self.test1 = _matplot.Matplot()
        self.test1.set_diagram(1)
        self.horizontalLayout_8.addWidget(self.test1.canvas)
        self.test2 = _matplot.Matplot()
        self.test2.set_diagram(2)
        self.horizontalLayout_9.addWidget(self.test2.canvas)
        self.test3 = _matplot.Matplot()
        self.test3.set_diagram(3)
        self.horizontalLayout_10.addWidget(self.test3.canvas)
        self.test4 = _matplot.Matplot()
        self.test4.set_diagram(4)
        self.horizontalLayout_11.addWidget(self.test4.canvas)

        timer = QTimer(self)
        timer.timeout.connect(self.fresh1)
        timer.start(200)

        self.waitconnect()
コード例 #32
0
    def csvout_clicked(self):

        if self.tableWidget_jobList.rowCount() == 0:
            return

        dstdialog = QtGui.QFileDialog(self)
        dstdialog.setFileMode(QtGui.QFileDialog.AnyFile)
        dstdialog.setAcceptMode(QtGui.QFileDialog.AcceptSave)
        dt = QDateTime.currentDateTime()
        # prefix_name = self.appname
        # prefix_name += "_"
        prefix_name = dt.toString("yyyyMMddhhmmss")

        prefix_name += ".csv"

        writablepath = os.path.expanduser('~') + os.sep
        writablepath += prefix_name

        # print(writablepath)
        dststr = dstdialog.getSaveFileName(
            self,
            self.tr("input output filename."),
            writablepath
        )
        if not dststr[0]:
            return
        #print(dststr)
        self.__csvout(dststr)

        infostr = "CSV output finished."
        self.msgBox.setText(infostr)
        self.msgBox.setStandardButtons(QtGui.QMessageBox.Ok)
        self.msgBox.setIcon(QtGui.QMessageBox.Information)
        self.msgBox.exec_()

        self.msgBox.setIcon(QtGui.QMessageBox.Warning)
コード例 #33
0
ファイル: ConfigDialog.py プロジェクト: uheee/FCY
 def __init__(self, line_state, parent=None):
     super(ConfigDialog, self).__init__(parent)
     self.setupUi(self)
     self.setFixedSize(600, 480)
     self.line_state = line_state
     self.measureTime = 10
     self.yulei = 7
     self.youer = 0.48
     self.measureDistance = self.yulei
     self.threshold_press = 0.05
     #压力校准值
     self.calibration = [
         -0.1013, -0.1013, -0.1013, -0.1013, -0.1013, -0.1013
     ]
     #本次配置有效否
     self.passFlag = False
     self.testdate = QDateTime.currentDateTime().toString('yyyy-MM-dd')
     self.setupSignal()
     #设置相关标志属性
     self.setupGroup()
     self.time_edit.setText(self.testdate)
     self.time_edit.setReadOnly(True)
     self.defaultConfig(True)
     self.projectName_edit.setText("")
コード例 #34
0
ファイル: controller.py プロジェクト: xiphffff/Caerus
    def evaluate_employee(self):
        """
        Called whenever the user wishes to evaluate an employee.
        """

        # We need the employee ID so we may make an entry.
        employee_id = self.current_employee.text(0)

        # Check to see whether there is an existing evaluation.
        old = self.models["evaluation_results"].find_by_employee(employee_id)

        # Instantiate our evaluation wizard.
        self.views["evaluate"] = evaluate.Evaluate(self.views["caerus"])

        # Resize to 500x350.
        self.views["evaluate"].resize(500, 350)

        # Set our window title.
        self.views["evaluate"].setWindowTitle("Evaluate")

        # If there's an existing evaluation, we're editing. Therefore, we must
        # populate self.views["evaluate"] with our current data.
        if old:
            date = QDateTime()
            date.setTime_t(int(old["next_date"]))

            self.views["evaluate"].quality.comments.setPlainText(old["quality_comments"])
            self.views["evaluate"].quality.score.setCurrentIndex(int(old["quality_score"]) - 1)
            self.views["evaluate"].habits.comments.setPlainText(old["habits_comments"])
            self.views["evaluate"].habits.score.setCurrentIndex(int(old["habits_score"]) - 1)
            self.views["evaluate"].knowledge.comments.setPlainText(old["knowledge_comments"])
            self.views["evaluate"].knowledge.score.setCurrentIndex(int(old["knowledge_score"]) - 1)
            self.views["evaluate"].behavior.comments.setPlainText(old["behavior_comments"])
            self.views["evaluate"].behavior.score.setCurrentIndex(int(old["behavior_score"]) - 1)
            self.views["evaluate"].overall.comments.setPlainText(old["comments"])

            if old["recommended"]:
                self.views["evaluate"].recommend.yes.setChecked(True)
            else:
                self.views["evaluate"].recommend.no.setChecked(True)

            self.views["evaluate"].schedule.calendar.setSelectedDate(date.date())

        # The user clicked OK.
        if self.views["evaluate"].exec_():
            quality_score   = self.views["evaluate"].quality.score.currentIndex()   + 1
            habits_score    = self.views["evaluate"].habits.score.currentIndex()    + 1
            knowledge_score = self.views["evaluate"].knowledge.score.currentIndex() + 1
            behavior_score  = self.views["evaluate"].behavior.score.currentIndex()  + 1

            average_score = (quality_score   + \
                             habits_score    + \
                             knowledge_score + \
                             behavior_score) / 4

            overall_score = (quality_score   + \
                             habits_score    + \
                             knowledge_score + \
                             behavior_score)

            recommended = (True if self.views["evaluate"].recommend.yes.isChecked() \
                           else False)

            evaluation = {"employee"           : employee_id,
                          "employer"           : self.current_employer.text(0),
                          "date"               : QDateTime().currentDateTime().toTime_t(),
                          "next_date"          : QDateTime(self.views["evaluate"].schedule.calendar.selectedDate()).toTime_t(),
                          "quality_score"      : quality_score,
                          "quality_comments"   : self.views["evaluate"].quality.comments.toPlainText(),
                          "habits_score"       : habits_score,
                          "habits_comments"    : self.views["evaluate"].habits.comments.toPlainText(),
                          "knowledge_score"    : knowledge_score,
                          "knowledge_comments" : self.views["evaluate"].knowledge.comments.toPlainText(),
                          "behavior_score"     : behavior_score,
                          "behavior_comments"  : self.views["evaluate"].behavior.comments.toPlainText(),
                          "average_score"      : average_score,
                          "overall_score"      : overall_score,
                          "comments"           : self.views["evaluate"].overall.comments.toPlainText(),
                          "recommended"        : recommended}

            if old:
                self.models["evaluation_results"].edit(old, evaluation)
                return

            self.models["evaluation_results"].add(evaluation)
コード例 #35
0
ファイル: generate_data.py プロジェクト: jlehtoma/MaeBird
        print query.lastError().text()

def populate_observations(data):

    query.prepare("INSERT INTO observations (SPECIES, ABBR, COUNT, TIME, "
                  "LOCATION, NOTES) VALUES (?, ?, ?, ?, ?, ?)")
    for species, abbr, count, time, location, notes in data:
        query.addBindValue(species)
        query.addBindValue(abbr)
        query.addBindValue(count) # QDateTime
        query.addBindValue(time)   # QDateTime
        query.addBindValue(location)
        query.addBindValue(notes) # int
        query.exec_()

DATETIME_FORMAT = "dd.MM.yyyy hh:mm"
data = [[10,
         10,
         5, 
         QDateTime.currentDateTime(),
         "Herttoniemi",
         "Hieno!"],
         [4,
          4,
          100,
          QDateTime.currentDateTime(),
          "62.12414 38.214124",
          "Ei niin hieno"]
         ]
create_observations()
populate_observations(data)
コード例 #36
0
 def testDateConversion(self):
     dateTime = QDateTime(QDate(2011, 5, 17), QTime(11, 1, 14, 15))
     dateTimePy = QDateTime(datetime.date(2011, 5, 17),
                            datetime.time(11, 1, 14, 15000))
     self.assertEqual(dateTime, dateTimePy)
コード例 #37
0
 def testSetTimestampFunction(self):
     dt = QDateTime.currentDateTime()
     posinfo = QGeoPositionInfo()
     posinfo.setTimestamp(dt)
     self.assertEqual(dt, posinfo.timestamp())
コード例 #38
0
 def updtTime(self):
     """ Function to update current time
     """
     currentTime = QDateTime.currentDateTime().toString('hh:mm:ss')
     self.myTimeDisplay.display(currentTime)
コード例 #39
0
ファイル: BuglistModel.py プロジェクト: PySide/bugzilaQML
 def parseISODate(self, isoDate):
     return QDateTime.fromString(isoDate, Qt.ISODate).toString('dd/MM/yyyy hh:mm')
コード例 #40
0
    def fresh1(self):

        self.dateTimeEdit.setDateTime(QDateTime.currentDateTime())
        self.dateTimeEdit.setDisplayFormat("yyyy-MM-dd HH:mm:ss")
コード例 #41
0
ファイル: timers.py プロジェクト: BjaouiAya/Cours-Python
 def updtTime(self):
     """Update current Time"""
     currentTime = QDateTime.currentDateTime().toString('hh:mm:ss')
     self.myTimeDisplay.display(currentTime)
コード例 #42
0
ファイル: LCD_CLOCK_1.py プロジェクト: yafeile/Simple_Study
 def updtTime(self):
     currentTime=QDateTime.currentDateTime().toString("hh:mm:ss")
     self.myTimeDisplay.display(currentTime)
コード例 #43
0
ファイル: printer.py プロジェクト: xiphffff/Caerus
    def emit_evaluation(self, employer, employee, evaluation):
        eval_time = QDateTime()
        eval_time.setTime_t(int(evaluation["date"]))

        readable_evaluation = eval_time.date().toString("MM.dd.yyyy")

        next_eval_time = QDateTime()
        next_eval_time.setTime_t(int(evaluation["next_date"]))

        readable_next_evaluation = next_eval_time.date().toString("MM.dd.yyyy")

        recommend = ("Yes" if evaluation["recommended"] else "No")

        html = """
               <img
                   style="float: left;"
                   src=":/img/mmt.png"
                   width="200"
                   height="65">

               <h1 align="right">
                   Individual Employee Evaluation including Comments
               </h1>

               <hr />

               <p>
                   <b>Employee:</b><br />

                    &nbsp;&nbsp;&nbsp;&nbsp;%s %s (ID# %s)<br />
                    &nbsp;&nbsp;&nbsp;&nbsp;%s<br />
                    &nbsp;&nbsp;&nbsp;&nbsp;%s, %s %s<br />
                    &nbsp;&nbsp;&nbsp;&nbsp;%s
               </p>

               <p>
                   <b>Employment Site:</b><br />

                   &nbsp;&nbsp;&nbsp;&nbsp;%s<br />
                   &nbsp;&nbsp;&nbsp;&nbsp;%s<br />
                   &nbsp;&nbsp;&nbsp;&nbsp;%s, %s, %s
               </p>

               <table
                   align="center"
                   width="500">

                   <tr>
                       <th></th>
                       <td></td>
                   </tr>

                   <tr>
                       <td>Date Evaluated</td>
                       <td>%s</td>
                   </tr>

                   <tr>
                       <td>Next Evaluation Date</td>
                       <td>%s</td>
                   </tr>

                   <tr>
                       <th></th>
                       <td></td>
                   </tr>

                   <tr>
                       <td>Quality Score</td>
                       <td>%s</td>
                   </tr>

                   <tr>
                       <td>Quality Comments</td>
                       <td>%s</td>
                   </tr>

                   <tr>
                       <th></th>
                       <td></td>
                   </tr>

                   <tr>
                       <td>Habits Score</td>
                       <td>%s</td>
                   </tr>

                   <tr>
                       <td>Habits Comments</td>
                       <td>%s</td>
                   </tr>

                   <tr>
                       <th></th>
                       <td></td>
                   </tr>

                   <tr>
                       <td>Knowledge Score</td>
                       <td>%s</td>
                   </tr>

                   <tr>
                       <td>Knowledge Comments</td>
                       <td>%s</td>
                   </tr>

                   <tr>
                       <th></th>
                       <td></td>
                   </tr>

                   <tr>
                       <td>Behavior Score</td>
                       <td>%s</td>
                   </tr>

                   <tr>
                       <td>Behavior Comments</td>
                       <td>%s</td>
                   </tr>

                   <tr>
                       <th></th>
                       <td></td>
                   </tr>

                   <tr>
                       <td>Employee Score</td>
                       <td>%s</td>
                   </tr>

                   <tr>
                       <td>Overall Score</td>
                       <td>%s</td>
                   </tr>

                   <tr>
                       <th></th>
                       <td></td>
                   </tr>

                   <tr>
                       <td>Comments</td>
                       <td>%s</td>
                   </tr>

                   <tr>
                       <td>Recommended</td>
                       <td>%s</td>
                   </tr>
               </table>
               """ % (employee["first_name"],
                      employee["last_name"],
                      employee["id"],
                      employee["street_address"],
                      employee["city"],
                      employee["state"],
                      employee["zip_code"],
                      employee["phone_number"],
                      employer["name"],
                      employer["street_address"],
                      employer["city"],
                      employer["state"],
                      employer["zip_code"],
                      readable_evaluation,
                      readable_next_evaluation,
                      evaluation["quality_score"],
                      evaluation["quality_comments"],
                      evaluation["habits_score"],
                      evaluation["habits_comments"],
                      evaluation["knowledge_score"],
                      evaluation["knowledge_comments"],
                      evaluation["behavior_score"],
                      evaluation["behavior_comments"],
                      evaluation["average_score"],
                      evaluation["overall_score"],
                      evaluation["comments"],
                      recommend)

        self.make_page(html)
コード例 #44
0
 def updtTime(self):
     currentTime = QDateTime.currentDateTime().toString("hh:mm:ss")
     self.myTimeDisplay.display(currentTime)
コード例 #45
0
ファイル: Info.py プロジェクト: ra2003/xindex
    def initialize(self):
        locale = QLocale()
        model = self.state.model
        if not bool(model):
            self.browser.setHtml("<font color=red>Information can only "
                                 "be shown if an index is open</font>")
            return

        top, total, _ = self.state.indicatorCounts()
        fullname = QDir.toNativeSeparators(os.path.abspath(model.filename))
        creator = model.config(Gconf.Key.Creator)
        created = model.config("Created")
        created = locale.toString(
            QDateTime.fromString(created, "yyyy-MM-dd HH:mm:ss"))
        updated = locale.toString(QFileInfo(model.filename).lastModified())
        size = os.path.getsize(model.filename)
        KB = 1024
        MB = KB * KB
        if size < MB:
            size = "~{:,} KB ({:,} bytes)".format(round(size / KB), size)
        else:
            size = "~{:,} MB ({:,} bytes)".format(round(size / MB), size)
        filename = re.sub(r"\.xix$", "", os.path.basename(fullname),
                          re.IGNORECASE)
        version = str(model.version())
        secs = self.state.workTime + int(time.monotonic() -
                                         self.state.startTime)
        hours, secs = divmod(secs, 3600)
        if hours:
            worktime = "{:,}h{}'".format(hours, secs // 60)
        else:
            worktime = "{}'".format(secs // 60)
        uuid = model.config(UUID)
        LEFT_STYLE = """ style="
margin-right: 0;
padding-right: 0;
spacing-right: 0;
border-right: 0;
"
"""
        RIGHT_STYLE = """ style="
margin-left: 0;
padding-left: 0;
spacing-left: 0;
border-left: 0;
"
"""
        color1 = "#DDDDFF"
        color2 = "#EEEEFF"
        STYLE = ' style="background-color: {};"'
        texts = [
            """<html><table border=0 style="
background-color: {};
">""".format(color1)
        ]
        for i, (name, value, right, debug) in enumerate((
            ("Index", filename, False, False),
            ("Creator", creator, False, False),
            ("Filename", fullname, False, False),
            ("Size", size, False, False),
            ("Created", created, False, False),
            ("Updated", updated, False, False),
            ("Total Entries", "{:,}".format(total), True, False),
            ("Main Entries", "{:,}".format(top), True, False),
            ("Subentries", "{:,}".format(total - top), True, False),
            ("Worktime", worktime, True, False),
            (None, None, False, False),
            ("Index Format", version, True, False),
            ("Index UUID", uuid, True, True),
        )):
            if debug and not self.state.window.debug:
                continue
            if name is None:
                color1 = "#EEEEEE"
                color2 = "#DDDDDD"
                continue
            style = STYLE.format(color1 if i % 2 == 0 else color2)
            align = " align=right" if right else ""
            texts.append("""<tr{}><td{}>{}&nbsp;&nbsp;</td>
<td{}{}>{}</td></tr>""".format(style, LEFT_STYLE, html.escape(name), align,
                               RIGHT_STYLE, html.escape(value)))
        texts.append("</table></html>")
        self.browser.setHtml("".join(texts))
コード例 #46
0
ファイル: widget_plot.py プロジェクト: babyge/ES51922-Viewer
 def tickStrings(self, values, _scale, _spacing):
     return [QDateTime().fromMSecsSinceEpoch(value * 1000).toString('hh:mm:ss.z')
             for value in values]
コード例 #47
0
 def setUp(self):
     self.original = QDateTime(2010, 5, 18, 10, 24, 45, 223, Qt.LocalTime)
コード例 #48
0
    def handleOddsHtmlPage(self, htmlPage, source=BETEXPLORER_SOURCE):
        print "handleOddsHtmlPage source = %d" % source
        epochDate = self._gridList[self._index][1]
        date = QDateTime()
        date.setMSecsSinceEpoch(int(epochDate) * 1000)
        deprecated = QDateTime.currentDateTime() > date.addDays(+1)

        strHtml = str(htmlPage)
        if source == BETEXPLORER_SOURCE:
            oddsRx = QRegExp(
                "<a href=.*data-odd-max=\"(\\d*\.\\d*)\".*data-odd-max=\"(\\d*\.\\d*)\".*data-odd-max=\"(\\d*\.\\d*)\".*>")
        elif source == ZULUBET_SOURCE:
            oddsRx = QRegExp(
                "<td\\s*class=\"aver_odds_full\"\\s*align=\"center\">(\\d*\.\\d*)</td><td\\s*class=\"aver_odds_full\"\\s*align=\"center\">(\\d*\.\\d*)</td><td\\s*class=\"aver_odds_full\"\\s*align=\"center\">(\\d*\.\\d*)</td>")

        for match in self._grid.matches():
            if not match.cotesDisponibles():
                if source == BETEXPLORER_SOURCE and not deprecated:
                    team1Rx = QRegExp(
                        "><span>(\\w*[\\'\\.-]?\\s*)*(%s)(\\w*[\\'\\.-]?\\s*)*</span>\\s*-\\s*<span>\\s*((\\w*[\\'\\.-]?\\s*)*)</span><" % match.team1())
                    team1Rx.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
                    team2Rx = QRegExp(
                        "><span>\\s*(\\w*[\\'\\.-]?\\s*)*</span>\\s*-\\s*<span>(\\w*[\\'\\.-]?\\s*)*(%s)(\\w*[\\'\\.-]?\\s*)*</span><" % match.team2())
                    team2Rx.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
                elif source == ZULUBET_SOURCE:
                    team1Rx = QRegExp(
                        #"<img\\s*src=\"http://www\.zulubet\.com/flags/flag-\\w*\.png\"\\s*class=\"flags\\s*flag-\\w*\"\\s*title=\"(\\w*\\'?\\s*-?)*,(\\w*\\'?\\s*-?)*\"\\s*width=\"\\d*\"\\s*height=\"\\d*\">\\s*(%s)\\s*-\\s*(\\w*\\'?\\s*-?)*<\img>" % match.team1())
                        "width=\"\\d*\"\\s*height=\"\\d*\">\\s*(%s)\\s*-\\s*(\\w*[\\'\\.-]?\\s*)*</td>" % match.team1())
                    team1Rx.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
                    team2Rx = QRegExp(
                        "width=\"\\d*\"\\s*height=\"\\d*\">(\\w*[\\'\\.-]?\\s*)*-\\s*(%s)\\s*</td>" % match.team2())
                    team2Rx.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
                else:
                    team1Rx = QRegExp("---deprecated---")
                    team2Rx = QRegExp("---deprecated---")

                # team2Rx = QRegExp(match.team2())
                teamXRx = team1Rx
                posi = teamXRx.indexIn(strHtml)
                posi2 = team2Rx.indexIn(strHtml)
                #if posi < 0:
                    #print "-1-%s- not found" % match.team1()
                    #teamXRx = team2Rx
                    #posi = teamXRx.indexIn(strHtml)
                #if (posi >= 0) and (posi2 >= 0):
                if (posi >= 0) and (posi2 == posi):
                    print "-%s- found" % ''.join((match.team1(), " vs " + match.team2()))
                else:  # try in an other way
                    print "-%s- not found, try another way" % ''.join((match.team1(), " vs " + match.team2()))
                    # split team names
                    team1list = match.team1().split(" ")
                    team2list = match.team2().split(" ")
                    # find the longest
                    maxLen = 0
                    miniTeam1 = ""
                    for elt1 in team1list:
                        if len(elt1) > maxLen:
                            maxLen = len(elt1)
                            miniTeam1 = filter(onlyascii, elt1)
                    maxLen = 0
                    miniTeam2 = ""
                    for elt2 in team2list:
                        if len(elt2) > maxLen:
                            maxLen = len(elt2)
                            miniTeam2 = filter(onlyascii, elt2)
                    print "Try with {0} vs {1}".format(miniTeam1, miniTeam2)
                    if source == BETEXPLORER_SOURCE and not deprecated:
                        teamRx = QRegExp(
                            "><span>\\s*(\\w*\\'?\\s*-?)*{0}(\\w*\\'?\\s*-?)*</span>\\s*-\\s*<span>(\\w*\\'?\\s*-?)*{1}(\\w*\\'?\\s*-?)*</span><".format(
                                miniTeam1, miniTeam2))
                    elif source == ZULUBET_SOURCE:
                        #teamRx = QRegExp(
                            #"<img\\s*src=\"http://www\.zulubet\.com/flags/flag-\\w*\.png\"\\s*class=\"flags\\s*flag-\\w*\"\\s*title=\"(\\w*\\'?\\s*-?)*,(\\w*\\'?\\s*-?)*\"\\s*width=\"\\d*\"\\s*height=\"\\d*\">(\\w*\\'?\\s*-?)*{0}(\\w*\\'?\\s*-?)*-(\\w*\\'?\\s*-?)*{1}(\\w*\\'?\\s*-?)*<\img>".format(
                                #miniTeam1, miniTeam2))
                        teamRx = QRegExp("\">(\\w*\\'?\\s*-?)*{0}(\\w*\\'?\\s*-?)*-(\\w*\\'?\\s*-?)*{1}(\\w*\\'?\\s*-?)*</td>".format(miniTeam1, miniTeam2))
                    else:
                        teamRx = QRegExp("---deprecated---")
                        print "---GRID DEPRECATED---"

                    teamRx.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
                    posi = teamRx.indexIn(strHtml)
                    if posi >= 0:
                        print "found : {0} vs {1}".format(miniTeam1, miniTeam2)
                    else:
                        print "still not found :'("
                        # print "Odds handling KO %s not found" % str(match)
                if posi >= 0:
                    print "posi = %d" % posi
                    posi = oddsRx.indexIn(strHtml, posi)
                    oddStr1 = oddsRx.cap(1)
                    oddStr2 = oddsRx.cap(2)
                    oddStr3 = oddsRx.cap(3)
                    print "read odds1 = %s" % oddStr1
                    try:
                        match.setCotes(float(oddsRx.cap(1)), float(oddsRx.cap(2)), float(oddsRx.cap(3)))
                        team1 = filter(onlyascii, match.team1())
                        team2 = filter(onlyascii, match.team2())
                        print "Odds handling OK : %s" % team1 + " vs " + team2
                        print "Odds handling OK : "
                        match.setCotesDisponibles(True)
                    except:
                        team1 = filter(onlyascii, match.team1())
                        team2 = filter(onlyascii, match.team2())
                        print "Odds handling OK : cant read odds for %s" % team1 + " vs " + team2
        return
コード例 #49
0
ファイル: mass_graph.py プロジェクト: Ingener74/Mass-Graph
 def on_timeout(self):
     now = QDateTime.currentDateTime()
     self.dateTimeEdit.setDateTime(now)
コード例 #50
0
ファイル: BuglistModel.py プロジェクト: PySide/bugzilaQML
 def update(self):
     url = "http://bugs.pyside.org/buglist.cgi?bug_status=UNCONFIRMED&bug_status=NEW&bug_status=WAITING&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=RESOLVED&bug_status=VERIFIED&product=PySide&query_format=advanced&resolution=---&resolution=FIXED&ctype=csv"
     self._timeStamp = QDateTime.currentDateTime().toString("h:mm ap")
     self.manager.get(QNetworkRequest(QUrl(url)))
コード例 #51
0
 def testDateTimeNow(self):
     py = datetime.datetime.now()
     qt = QDateTime(py)
     self.assertEqual(qt, py)
コード例 #52
0
ファイル: __init__.py プロジェクト: p0i0/Hazama
def datetimeTrans(s, stripTime=False):
    """Localize datetime in database format."""
    dt = QDateTime.fromString(s, dbDatetimeFmtQt)
    return locale.toString(dt, dateFmt if stripTime else datetimeFmt)
コード例 #53
0
ファイル: Fourth.py プロジェクト: timmyMarion/Learning-QT
 def updtTime(self):
     """ Function to updte current time
     """
     currentTime = QDateTime.currentDateTime().toString('MM-dd-yyyy hh:mm:ss')
     self.myTimeDisplay.display(currentTime)