예제 #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
    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
    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
    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
    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
 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
    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
    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
    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
    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
    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
    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
        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
 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
 def updtTime(self):
     """Update current Time"""
     currentTime = QDateTime.currentDateTime().toString('hh:mm:ss')
     self.myTimeDisplay.display(currentTime)
예제 #42
0
 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
 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
 def on_timeout(self):
     now = QDateTime.currentDateTime()
     self.dateTimeEdit.setDateTime(now)
예제 #50
0
 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
 def updtTime(self):
     """ Function to updte current time
     """
     currentTime = QDateTime.currentDateTime().toString('MM-dd-yyyy hh:mm:ss')
     self.myTimeDisplay.display(currentTime)