def update_highlighted_appointment(self): ''' the diary widget selected appointment has changed. ''' app = self.diary_widget.highlighted_appointment LOGGER.debug("appointment highlighted %s", app) if app is None: self.reset_browsing_webview() return if self.mode == self.NOTES_MODE: self.notes_label.setText( "<h3>%s</h3>%s<br />%s" % ( _("View/edit today's notes for "), app.name, app.serialno ) ) return self.notes_label.setText("") if self.mode != self.BROWSE_MODE: return feedback = FEEDBACK % ( app.name, app.serialno, localsettings.readableDate( self.diary_widget.selected_date().toPyDate()), "%02d:%02d" % (app.start // 100, app.start % 100), "%02d:%02d" % (app.end // 100, app.end % 100), '</li><li class="trt">'.join( [val for val in (app.trt1, app.trt2, app.trt3) if val != ""]) ) if app.memo != "": feedback += "<hr />%s<br /><i>%s</i>" % (_("Memo"), app.memo) try: datestamp = app.timestamp.date() feedback += \ "<hr />%s<br />%s (%s %s)" % ( _("Made"), localsettings.formatDate(datestamp), _("at"), localsettings.pyTimeToHumantime( app.timestamp)) except AttributeError: pass if app.mh_form_check_date or app.mh_form_required: feedback += "<hr />" if app.mh_form_check_date: feedback += "%s %s<br />" % ( _("last mh form"), localsettings.formatDate( app.mh_form_check_date) ) if app.mh_form_required: feedback += "%s" % _("MH CHECK REQUIRED") feedback = "%s<body></html>" % feedback self.browsing_webview.setHtml(feedback)
def update_highlighted_appointment(self): ''' the diary widget selected appointment has changed. ''' app = self.diary_widget.highlighted_appointment LOGGER.debug("appointment highlighted %s", app) if app is None: self.reset_browsing_webview() return if self.mode == self.NOTES_MODE: self.notes_label.setText( "<h3>%s</h3>%s<br />%s" % (_("View/edit today's notes for "), app.name, app.serialno)) return self.notes_label.setText("") if self.mode != self.BROWSE_MODE: return feedback = FEEDBACK % ( app.name, app.serialno, localsettings.readableDate( self.diary_widget.selected_date().toPyDate()), "%02d:%02d" % (app.start // 100, app.start % 100), "%02d:%02d" % (app.end // 100, app.end % 100), '</li><li class="trt">'.join( [val for val in (app.trt1, app.trt2, app.trt3) if val != ""])) if app.memo != "": feedback += "<hr />%s<br /><i>%s</i>" % (_("Memo"), app.memo) try: datestamp = app.timestamp.date() feedback += \ "<hr />%s<br />%s (%s %s)" % ( _("Made"), localsettings.formatDate(datestamp), _("at"), localsettings.pyTimeToHumantime( app.timestamp)) except AttributeError: pass if app.mh_form_check_date or app.mh_form_required: feedback += "<hr />" if app.mh_form_check_date: feedback += "%s %s<br />" % (_("last mh form"), localsettings.formatDate( app.mh_form_check_date)) if app.mh_form_required: feedback += "%s" % _("MH CHECK REQUIRED") feedback = "%s<body></html>" % feedback self.browsing_webview.setHtml(feedback)
def mouseMoveEvent(self, event): y = event.y() yOffset = self.height() / self.slotNo row = int(y // yOffset) if not (self.firstSlot - 1) < row < self.lastSlot: self.selected_rows = (0, 0) self.update() QtGui.QToolTip.showText(event.globalPos(), "") return if self.mouse_over_freeslot(event.pos()): startcell, endcell = self.mouse_freeslot feedback = ''' <html><div align="center"> <b>SLOT with %s</b><br /> <b>%s</b><br /> (%d mins) </div></html> ''' % ( self.pWidget.dentist, self.getTime_from_Cell(startcell).strftime("%H:%M"), (endcell - startcell) * self.slotDuration, ) x_pos = self.mapToGlobal(self.pos()).x() pos = QtCore.QPoint(x_pos, event.globalPos().y()) QtGui.QToolTip.showText(pos, feedback) elif row in self.rows: sno_list = self.rows[row] self.selected_rows = self.getApptBounds(row, sno_list) self.update() feedback = "<html>" for sno in sno_list: for app in self.appts + self.doubleAppts: if app.serialno == sno: feedback += '''%s %s (%s)<br /><b>%s - %s</b>''' % ( app.name, " " * 4, app.serialno, app.start, app.end) for val in (app.trt1, app.trt2, app.trt3): if val != "": feedback += ''' <br /><font color="red">%s</font>''' % val if app.memo != "": feedback += "<br /><i>%s</i>" % app.memo try: datestamp = app.timestamp.date() moddate = localsettings.readableDate(datestamp) if datestamp == localsettings.currentDay(): feedback += \ "<br /><i>%s %s %s %s</i><hr />" % ( _("Made"), moddate, _("at"), localsettings.pyTimeToHumantime( app.timestamp)) else: feedback += "<br /><i>%s<br />%s</i><hr />" % ( _("Made on"), moddate) except AttributeError: feedback += "<hr />" if app.mh_form_required: feedback += "%s<hr />" % _("MH CHECK REQUIRED") if feedback != "<html>": feedback = feedback[:feedback.rindex("<hr />")] + "</html>" x_pos = self.mapToGlobal(self.pos()).x() pos = QtCore.QPoint(x_pos, event.globalPos().y()) QtGui.QToolTip.showText(pos, feedback) else: QtGui.QToolTip.showText(event.globalPos(), "") else: newSelection = (self.getPrev(row), self.getNext(row)) if self.selected_rows != newSelection: self.selected_rows = newSelection self.update() start = int( self.dayStartTime + self.selected_rows[ 0] * self.slotDuration) finish = int( self.dayStartTime + self.selected_rows[ 1] * self.slotDuration) x_pos = self.mapToGlobal(self.pos()).x() pos = QtCore.QPoint(x_pos, event.globalPos().y()) QtGui.QToolTip.showText(pos, "SLOT %s minutes" % (finish - start))
def mouseMoveEvent(self, event): y = event.y() yOffset = self.height() / self.slotNo row = int(y // yOffset) if not (self.firstSlot - 1) < row < self.lastSlot: self.selected_rows = (0, 0) self.update() QtGui.QToolTip.showText(event.globalPos(), "") return if self.mouse_over_freeslot(event.pos()): startcell, endcell = self.mouse_freeslot feedback = ''' <html><div align="center"> <b>SLOT with %s</b><br /> <b>%s</b><br /> (%d mins) </div></html> ''' % ( self.pWidget.dentist, self.getTime_from_Cell(startcell).strftime("%H:%M"), (endcell - startcell) * self.slotDuration, ) x_pos = self.mapToGlobal(self.pos()).x() pos = QtCore.QPoint(x_pos, event.globalPos().y()) QtGui.QToolTip.showText(pos, feedback) elif row in self.rows: selectedPatients = self.rows[row] self.selected_rows = self.getApptBounds(row, selectedPatients) self.update() feedback = "<html>" for patient in selectedPatients: for appt in self.appts + self.doubleAppts: if appt[5] == patient: feedback += '''%s<br /><b>%s - %s</b>''' % ( appt[4], appt[2], appt[3]) for val in (appt[6], appt[7], appt[8]): if val != "": feedback += ''' <br /><font color="red">%s</font>''' % val if appt[9] != "": feedback += "<br /><i>%s</i>" % appt[9] try: timestamp = appt[12] datestamp = timestamp.date() moddate = localsettings.readableDate(datestamp) if datestamp == localsettings.currentDay(): feedback += "<br /><i>%s %s %s %s</i><hr />" % ( _("Made"), moddate, _("at"), localsettings.pyTimeToHumantime(timestamp)) else: feedback += "<br /><i>%s<br />%s</i><hr />" % ( _("Made on"), moddate) except AttributeError: feedback += "<hr />" pass if feedback != "<html>": feedback = feedback[:feedback.rindex("<hr />")] + "</html>" x_pos = self.mapToGlobal(self.pos()).x() pos = QtCore.QPoint(x_pos, event.globalPos().y()) QtGui.QToolTip.showText(pos, feedback) else: QtGui.QToolTip.showText(event.globalPos(), "") else: newSelection = (self.getPrev(row), self.getNext(row)) if self.selected_rows != newSelection: self.selected_rows = newSelection self.update() start = int(self.dayStartTime + self.selected_rows[0] * self.slotDuration) finish = int(self.dayStartTime + self.selected_rows[1] * self.slotDuration) x_pos = self.mapToGlobal(self.pos()).x() pos = QtCore.QPoint(x_pos, event.globalPos().y()) QtGui.QToolTip.showText(pos, "SLOT %s minutes" % (finish - start))
def mouseMoveEvent(self, event): y = event.y() yOffset = self.height() / self.slotNo row = int(y//yOffset) if not (self.firstSlot-1) < row < self.lastSlot: self.selected_rows = (0, 0) self.update() QtGui.QToolTip.showText(event.globalPos(), "") return if self.mouse_over_freeslot(event.pos()): startcell, endcell = self.mouse_freeslot feedback = ''' <html><div align="center"> <b>SLOT with %s</b><br /> <b>%s</b><br /> (%d mins) </div></html> '''% ( self.pWidget.dentist, self.getTime_from_Cell(startcell).strftime("%H:%M"), (endcell-startcell) * self.slotDuration, ) x_pos = self.mapToGlobal(self.pos()).x() pos = QtCore.QPoint(x_pos, event.globalPos().y()) QtGui.QToolTip.showText(pos, feedback) elif self.rows.has_key(row): selectedPatients = self.rows[row] self.selected_rows = self.getApptBounds(row, selectedPatients) self.update() feedback = "<html>" for patient in selectedPatients: for appt in self.appts + self.doubleAppts: if appt[5] == patient: feedback += '''%s<br /><b>%s - %s</b>'''%( appt[4], appt[2], appt[3]) for val in (appt[6], appt[7], appt[8]): if val != "": feedback += ''' <br /><font color="red">%s</font>'''% val if appt[9] != "": feedback += "<br /><i>%s</i>"% appt[9] try: timestamp = appt[12] datestamp = timestamp.date() moddate = localsettings.readableDate(datestamp) if datestamp == localsettings.currentDay(): feedback += "<br /><i>%s %s %s %s</i><hr />"% ( _("Made"), moddate, _("at"), localsettings.pyTimeToHumantime(timestamp)) else: feedback += "<br /><i>%s<br />%s</i><hr />"% ( _("Made on"), moddate) except AttributeError: feedback +="<hr />" pass if feedback != "<html>": feedback = feedback[:feedback.rindex("<hr />")] + "</html>" x_pos = self.mapToGlobal(self.pos()).x() pos = QtCore.QPoint(x_pos, event.globalPos().y()) QtGui.QToolTip.showText(pos, feedback) else: QtGui.QToolTip.showText(event.globalPos(), "") else: newSelection = (self.getPrev(row), self.getNext(row)) if self.selected_rows != newSelection: self.selected_rows = newSelection self.update() start = int(self.dayStartTime + self.selected_rows[0] * self.slotDuration) finish = int(self.dayStartTime + self.selected_rows[1] * self.slotDuration) x_pos = self.mapToGlobal(self.pos()).x() pos = QtCore.QPoint(x_pos, event.globalPos().y()) QtGui.QToolTip.showText(pos, "SLOT %s minutes"% (finish - start))