当前位置: 首页>>代码示例>>Python>>正文


Python QTime.fromString方法代码示例

本文整理汇总了Python中PyQt4.QtCore.QTime.fromString方法的典型用法代码示例。如果您正苦于以下问题:Python QTime.fromString方法的具体用法?Python QTime.fromString怎么用?Python QTime.fromString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt4.QtCore.QTime的用法示例。


在下文中一共展示了QTime.fromString方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: addX

# 需要导入模块: from PyQt4.QtCore import QTime [as 别名]
# 或者: from PyQt4.QtCore.QTime import fromString [as 别名]
	def addX(self,a):
		self.Xresult = []
		self.Xindex = a
		if self.isProcess==False:
			self.dlineEdit_X.setText("X : " + str(self.df.columns[self.Xindex + 6]))
			self.Xresult = np.array(self.df[self.df.columns[self.Xindex + 6]])
			if self.df.columns[self.Xindex + 6] == "Date":
				for tab in range(len(self.Xresult)):
					tempdate=QDate.fromString(self.Xresult[tab],"yy-MM-dd")
					tempdate.setYMD(tempdate.year()+100,tempdate.month(),tempdate.day())
					self.Xresult[tab] =tempdate.toPyDate()
			elif self.df.columns[self.Xindex + 6] == "Time":
				for tab in range(len(self.Xresult)):
					self.Xresult[tab] = QTime.fromString(self.Xresult[tab]).toPyTime()
					#self.Xresult[tab]=np.datetime_as_string(self.Xresult[tab])
			else:
				pass
		else:
			self.dlineEdit_X.setText("X : " + str(self.ts1.columns[0]))
			tempx=[]
			for tab in xrange(len(self.ts1[self.ts1.columns[0]])):
				#print self.ts1[self.ts1.columns[0]][0]
				#print type(self.ts1[self.ts1.columns[0]][0])
				(val1,val2)=str(self.ts1[self.ts1.columns[0]][tab]).split(' ',1)
				tempx.append( QTime.fromString(val2).toPyTime())
			self.Xresult = np.array(tempx)
开发者ID:designer357,项目名称:AOPAS,代码行数:28,代码来源:MainWindow.py

示例2: _initInputUI

# 需要导入模块: from PyQt4.QtCore import QTime [as 别名]
# 或者: from PyQt4.QtCore.QTime import fromString [as 别名]
    def _initInputUI(self, layout):
        self.setWindowTitle(self._title)
        messageLabel = QLabel(self._message, self)
        messageLabel.setWordWrap(True)
        layout.addWidget(messageLabel)

        inputWidget = QWidget(self)
        inputLayout = QHBoxLayout(inputWidget)
        inputLayout.setContentsMargins(0, 0, 0, 0)
                
        if type(self._initialBegin) != QTime:
            initialBegin = QTime.fromString(self._initialBegin, lunch_settings.LUNCH_TIME_FORMAT_QT)
        if type(self._initialEnd) != QTime:
            initialEnd = QTime.fromString(self._initialEnd, lunch_settings.LUNCH_TIME_FORMAT_QT)
                
        inputLayout.addWidget(QLabel("From", self))
        self.beginEdit = QTimeEdit(self)
        self.beginEdit.setDisplayFormat("HH:mm")
        self.beginEdit.setTime(initialBegin)
        inputLayout.addWidget(self.beginEdit)
        
        inputLayout.addWidget(QLabel("to", self))
        self.endEdit = QTimeEdit(self)
        self.endEdit.setDisplayFormat("HH:mm")
        self.endEdit.setTime(initialEnd)
        inputLayout.addWidget(self.endEdit)
        
        layout.addWidget(inputWidget, 0, Qt.AlignLeft)
开发者ID:hannesrauhe,项目名称:lunchinator,代码行数:30,代码来源:timespan_input_dialog.py

示例3: __init__

# 需要导入模块: from PyQt4.QtCore import QTime [as 别名]
# 或者: from PyQt4.QtCore.QTime import fromString [as 别名]
    def __init__(self, parent=None, testing=False, participantId=None):
        # Initialize object using ui_addParticipant
        super(EditParticipantDialog, self).__init__(parent)
        self.ui = Ui_AddParticipantDialog()
        self.ui.setupUi(self)

        # Initialize class variables
        self.testing = testing
        if participantId is None:
            QMessageBox.critical(self, 'Invalid Participant', "An invalid participant was chosen.", QMessageBox.Ok)
            self.reject()
        # if participantId[0] == 's':
        #     self.participantId = participantId[1:]
        # else:
        #     self.participantId = participantId
        self.participantId = participantId
        self.participant = dbInteractionInstance.getParticipantFromId(participantId)

        # Set up the contact
        self.contactId = self.participant.contact
        if self.contactId:
            c = dbInteractionInstance.getTeacherFromId(self.contactId)
            if c is not None:
                self.ui.contactPersonLineEdit.setText("{0} {1}".format(c.first, c.last))

        # Initialize ui with variables
        self.ui.addParticipantBtn.setText("&Update Participant")
        self.setWindowTitle("Edit Participant")
        self.ui.firstNameLineEdit.setText(self.participant.first)
        self.ui.lastNameLineEdit.setText(self.participant.last)
        self.ui.addressLineEdit.setText(self.participant.address)
        self.ui.cityLineEdit.setText(self.participant.city)
        self.ui.postalCodeLineEdit.setText(humanPostalCodeFormat(self.participant.postal))
        self.ui.homePhoneLineEdit.setText(humanPhoneNumberFormat(self.participant.home))
        self.ui.cellPhoneLineEdit.setText(humanPhoneNumberFormat(self.participant.cell))
        self.ui.emailLineEdit.setText(self.participant.email)
        self.ui.dateOfBirthDateEdit.setDate(QDate.fromString(self.participant.dob, "yyyy-MM-dd"))
        self.ui.ageLabel.setText("Age as of Jan. 1 {0}".format(QDate.currentDate().year()))
        self.ui.schoolAttendingLineEdit.setText(self.participant.schoolAttending)
        self.ui.parentLineEdit.setText(self.participant.parent)
        self.ui.schoolGradeLineEdit.setText(self.participant.schoolGrade)
        self.ui.groupNameLineEdit.setText(self.participant.groupName)
        self.ui.numberParticipantsLineEdit.setText(self.participant.numberParticipants)
        self.ui.schoolGradeLineEdit.setText(self.participant.schoolGrade)
        self.ui.averageAgeLineEdit.setText(self.participant.averageAge)
        if self.participant.earliestPerformanceTime != "":
            self.ui.timeConstraintsGroupBox.setChecked(True)
            self.ui.earliestPerformanceTimeTimeEdit.setTime(QTime.fromString(self.participant.earliestPerformanceTime, "h:mm A"))
            self.ui.latestPerformanceTimeTimeEdit.setTime(QTime.fromString(self.participant.latestPerformanceTime, "h:mm A"))
        self.ui.participantsTextEdit.setText(self.participant.participants)

        # Set the age display
        self.dob_changed()

        # Make the buttons do things
        self.connectSlots()
开发者ID:diana134,项目名称:afs,代码行数:58,代码来源:editParticipantDialog.py

示例4: tablevote_clicked

# 需要导入模块: from PyQt4.QtCore import QTime [as 别名]
# 或者: from PyQt4.QtCore.QTime import fromString [as 别名]
 def tablevote_clicked(self, row, column):
     vote_place = self.ui.tableWidget.item(row, 0).text()
     vote_time = self.ui.tableWidget.item(row, 1).text()
     self.ui.comboBox.setCurrentIndex(self.ui.comboBox.findText(vote_place))
     self.ui.timeEdit.setTime(QTime.fromString(vote_time, "HH:mm"))
     
     self.send_vote(vote_place, vote_time)
开发者ID:hannesrauhe,项目名称:lunchinator,代码行数:9,代码来源:voter_widget.py

示例5: __init__

# 需要导入模块: from PyQt4.QtCore import QTime [as 别名]
# 或者: from PyQt4.QtCore.QTime import fromString [as 别名]
    def __init__(self, parent=None, piece=None):
        # Initialize object
        super(PieceWidget, self).__init__(parent)
        self.ui = Ui_PieceWidget()
        self.ui.setupUi(self)
        self.dance() # Slightly cheater way to start the ui properly
        # Initialize class variables
        self.disciplines = {'Dance' : self.dance,   # For Pythonic switch-case
                                'Piano' : self.piano,
                                'Choral' : self.choral,
                                'Vocal' : self.vocal,
                                'Instrumental' : self.instrumental,
                                'Band' : self.band,
                                'Speech' : self.speech
                            }

        # Initialize ui if piece was given
        if piece is not None:
            self.ui.titleLineEdit.setText(piece['title'])
            self.ui.titleOfMusicalLineEdit.setText(piece['titleOfMusical'])
            self.ui.composerLineEdit.setText(piece['composerArranger'])
            time = piece['performanceTime']
            if len(piece['performanceTime']) < 5:
                # pad with leading 0 
                time = '0' + time
            self.ui.performanceTimeEdit.setTime(QTime.fromString(time, "mm:ss"))
开发者ID:diana134,项目名称:afs,代码行数:28,代码来源:pieceWidget.py

示例6: time_from_string

# 需要导入模块: from PyQt4.QtCore import QTime [as 别名]
# 或者: from PyQt4.QtCore.QTime import fromString [as 别名]
def time_from_string(s):
    s = s.strip()
    if not s:
        return None
    from PyQt4.QtCore import QTime
    f = local_time_format()
    tm = QTime.fromString(s, f)
    if not tm.isValid():
        raise ParsingError()
    return time( tm.hour(), tm.minute(), tm.second() )
开发者ID:maurodoglio,项目名称:Camelot,代码行数:12,代码来源:utils.py

示例7: getSelectedTime

# 需要导入模块: from PyQt4.QtCore import QTime [as 别名]
# 或者: from PyQt4.QtCore.QTime import fromString [as 别名]
    def getSelectedTime(self):
        """
        Returns the currently selected data and time
        """
        try:
            hour = self.hourpicker.currentItem().text()
        except AttributeError:
            hour = ""

        try:
            minute = self.minutepicker.currentItem().text()
        except AttributeError:
            minute = ""

        zone = self.ambutton.isChecked() and "AM" or "PM"
        return QTime.fromString("%s%s%s" % (hour, minute, zone), "hmAP")
开发者ID:HeatherHillers,项目名称:Roam,代码行数:18,代码来源:datatimerpickerwidget.py

示例8: setDefaults

# 需要导入模块: from PyQt4.QtCore import QTime [as 别名]
# 或者: from PyQt4.QtCore.QTime import fromString [as 别名]
 def setDefaults(self):
     #set initial values
     self.duedateEdit.setDate(QDate.currentDate().addDays(30))
     self.xres_spinBox.setValue(1280)
     self.yres_spinBox.setValue(720)
     
     for myPhase in sharedDB.myPhases:        
         if myPhase._name != "DUE":
             item = QtGui.QListWidgetItem(myPhase._name)
             self.phaseListWidget.addItem(item)
             self.phaseListWidget.setItemSelected(item,True)
     
     
     self.descriptionTextEdit.setText("Enter Description Here")
     self.durationEdit.setTime(QTime.fromString("00:01:00"))
     self.projectNameQLineEdit.setText("Project Name")
     self.fps.setValue(25)
开发者ID:satishgoda,项目名称:DPS_PIPELINE,代码行数:19,代码来源:userswidget.py

示例9: populateInfo

# 需要导入模块: from PyQt4.QtCore import QTime [as 别名]
# 或者: from PyQt4.QtCore.QTime import fromString [as 别名]
 def populateInfo(self):
     self.nameEdit.setText(self.model.racename)
     setCombo(self.courseCombo, self.model.course)
     setCombo(self.classCombo, self.model.raceclass)
     self.prizeSpinner.setValue(self.model.prize)
     if self.model.date is None:
         self.dateEdit.setDate(QDate.currentDate())
     else:
         self.dateEdit.setDate(QDate.fromString(self.model.date, QString("dd/MM/yyyy")))
     if self.model.time is None:
         self.timeEdit.setTime(QTime(12, 0))
     else:
         self.timeEdit.setTime(QTime.fromString(self.model.time, QString("hh:mm")))
     miles = self.model.distance / 8
     furlongs = self.model.distance % 8
     self.milesSpinner.setValue(miles)
     self.furlongCombo.setCurrentIndex(furlongs)
     self.__setNumRunners()
开发者ID:Whatang,项目名称:QBetty,代码行数:20,代码来源:BettyGUI.py

示例10: setEditorValue

# 需要导入模块: from PyQt4.QtCore import QTime [as 别名]
# 或者: from PyQt4.QtCore.QTime import fromString [as 别名]
 def setEditorValue(self, editor, value):
     editor.setTime(QTime.fromString(value, "HH:mm:ss"))
开发者ID:mtorromeo,项目名称:sqlantaresia,代码行数:4,代码来源:delegates.py

示例11: getSelectedTime

# 需要导入模块: from PyQt4.QtCore import QTime [as 别名]
# 或者: from PyQt4.QtCore.QTime import fromString [as 别名]
 def getSelectedTime(self):
     hour = self.ui.hourpicker.currentItem().text()
     minute = self.ui.minutepicker.currentItem().text()
     ampm = self.ui.ampmbutton.text()
     return QTime.fromString("%s%s%s" % (hour, minute, ampm), "hmAP")
开发者ID:spanc29,项目名称:qmap,代码行数:7,代码来源:datatimerpickerwidget.py


注:本文中的PyQt4.QtCore.QTime.fromString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。