def __init__(self, tablemodel, parent=None): BaseDialog.__init__(self, parent) self.model = tablemodel self.setWindowTitle(_("New Row")) label = QtGui.QLabel(u"%s %s"% ( _("New Row for table"), self.model.tableName())) self.insertWidget(label) frame = QtGui.QFrame() layout = QtGui.QFormLayout(frame) record = self.model.record() self.inputs = [] for i in range(record.count()): input_ = DefaultLineEdit() self.inputs.append(input_) layout.addRow(record.fieldName(i), input_) self.enableApply() self.scroll_area = QtGui.QScrollArea(self) self.scroll_area.setWidget(frame) self.scroll_area.setWidgetResizable(True) self.insertWidget(self.scroll_area) self.dirty = True self.set_check_on_cancel(True)
def __init__(self, parent): ''' 2 arguments 1. the database into which the new bpe will go. 2. parent widget(optional) ''' BaseDialog.__init__(self, parent) self.setWindowTitle(_("BPE history")) text_browser = QtGui.QTextBrowser() bpes = parent.pt["perio_bpe"].records html = u"<body>" for date, clinician, values, comment in bpes: html += '''<h3>%s</h3> %s <table width='100%%' border='1'> <tr><td>%s</td><td>%s</td><td>%s</td></tr> <tr><td>%s</td><td>%s</td><td>%s</td></tr> </table>%s <hr />''' % ( (date.toString(QtCore.Qt.DefaultLocaleShortDate), clinician) + tuple(values) + (comment, )) text_browser.setText(html + "</body>") self.insertWidget(text_browser) self.remove_spacer()
def __init__(self, functions, parent=None): BaseDialog.__init__(self, parent) self.setWindowTitle(_("Import")) label = QtGui.QLabel(_("Importing Data")) self.insertWidget(label) frame = QtGui.QFrame() layout = QtGui.QVBoxLayout(frame) self.progress_widgets = {} for att in functions: pw = ProgressWidget(self) pw.setText(att.__name__) layout.addWidget(pw) self.progress_widgets[att.__name__] = pw self.scroll_area = QtGui.QScrollArea(self) self.scroll_area.setWidget(frame) self.scroll_area.setWidgetResizable(True) self.insertWidget(self.scroll_area) self.apply_but.hide() self.dirty = False self.set_check_on_cancel(True) self.connect(QtCore.QCoreApplication.instance(), QtCore.SIGNAL("Import Finished"), self.finished) self.connect(QtGui.QApplication.instance(), QtCore.SIGNAL("import progress"), self.progress)
def __init__(self, parent): ''' 2 arguments 1. the database into which the new bpe will go. 2. parent widget(optional) ''' BaseDialog.__init__(self, parent) self.setWindowTitle(_("New BPE")) self.patient_id = parent.pt.patient_id frame = QtGui.QFrame() layout = QtGui.QGridLayout(frame) self.cbs = [] for i in range(6): cb = BPE_ComboBox() self.cbs.append(cb) row, col = i // 3, i % 3 #alter addition order to set desired keyboard focus if row == 1: if col == 2: col = 0 elif col == 0: col = 2 layout.addWidget(cb, row, col) cb.currentIndexChanged.connect(self.check_applyable) label = QtGui.QLabel(_("Note")) self.comment_line = QtGui.QLineEdit() self.comment_line.setMaxLength(80) self.insertWidget(frame) self.insertWidget(label) self.insertWidget(self.comment_line) self.cbs[0].setFocus(True)
def __init__(self, parent): ''' 2 arguments 1. the database into which the new bpe will go. 2. parent widget(optional) ''' BaseDialog.__init__(self, parent) self.setWindowTitle(_("BPE history")) text_browser = QtGui.QTextBrowser() bpes = parent.pt["perio_bpe"].records html = u"<body>" for date, clinician, values, comment in bpes: html += '''<h3>%s</h3> %s <table width='100%%' border='1'> <tr><td>%s</td><td>%s</td><td>%s</td></tr> <tr><td>%s</td><td>%s</td><td>%s</td></tr> </table>%s <hr />'''% ((date.toString(QtCore.Qt.DefaultLocaleShortDate), clinician)+ tuple(values)+ (comment,)) text_browser.setText(html+"</body>") self.insertWidget(text_browser) self.remove_spacer()
def __init__(self, parent=None): BaseDialog.__init__(self, parent) self.setWindowTitle(_("User choice")) label = QtGui.QLabel(_("Set the Appointment Viewing Mode")) self.insertWidget(label) for mode, description, value in ( (_("Browsing"), "", self.VIEW_MODE), (_("Scheduling"), _("make appointments for a patient"), self.SCHEDULING_MODE), (_("Blocking"), _("block time periods. eg. lunch times etc."), self.BLOCKING_MODE), (_("Note Checking"), _("check notes for today's patients"), self.NOTES_MODE), ): but = QtGui.QPushButton(mode) but.setToolTip(description) but.appt_mode = value but.clicked.connect(self.but_clicked) self.insertWidget(but) self.apply_but.hide()
def __init__(self, parent): ''' 2 arguments 1. the database into which the new bpe will go. 2. parent widget(optional) ''' BaseDialog.__init__(self, parent) self.setWindowTitle(_("New BPE")) self.patient_id = parent.pt.patient_id frame = QtGui.QFrame() layout = QtGui.QGridLayout(frame) self.cbs = [] for i in range(6): cb = BPE_ComboBox() self.cbs.append(cb) row, col = i//3, i%3 #alter addition order to set desired keyboard focus if row == 1: if col ==2: col = 0 elif col == 0: col = 2 layout.addWidget(cb, row, col) cb.currentIndexChanged.connect(self.check_applyable) label = QtGui.QLabel(_("Note")) self.comment_line = QtGui.QLineEdit() self.comment_line.setMaxLength(80) self.insertWidget(frame) self.insertWidget(label) self.insertWidget(self.comment_line) self.cbs[0].setFocus(True)
def __init__(self, parent=None): BaseDialog.__init__(self, parent) self.setWindowTitle(_("Add a User")) self.setMinimumSize(300,200) self.label = QtGui.QLabel() self.label.setAlignment(QtCore.Qt.AlignCenter) self.label.setWordWrap(True) self.set_label_text(_("Add a user")) frame = QtGui.QFrame() form = QtGui.QFormLayout(frame) self.name_lineEdit = QtGui.QLineEdit() self.pass_lineEdit = QtGui.QLineEdit() self.repeat_pass_lineEdit = QtGui.QLineEdit() self.name_lineEdit.setMaxLength(30) self.pass_lineEdit.setMaxLength(30) self.repeat_pass_lineEdit.setMaxLength(30) self.pass_lineEdit.setEchoMode(QtGui.QLineEdit.Password) self.repeat_pass_lineEdit.setEchoMode(QtGui.QLineEdit.Password) form.addRow(_("UserName"),self.name_lineEdit) form.addRow(_("Password"),self.pass_lineEdit) form.addRow(_("Confirm Password"),self.repeat_pass_lineEdit) self.insertWidget(self.label) self.insertWidget(frame) self.name_lineEdit.cursorPositionChanged.connect(self._check) self.pass_lineEdit.cursorPositionChanged.connect(self._check) self.repeat_pass_lineEdit.cursorPositionChanged.connect(self._check)
def __init__(self, tablemodel, parent=None): BaseDialog.__init__(self, parent) self.model = tablemodel self.setWindowTitle(_("New Row")) label = QtGui.QLabel(u"%s %s" % (_("New Row for table"), self.model.tableName())) self.insertWidget(label) frame = QtGui.QFrame() layout = QtGui.QFormLayout(frame) record = self.model.record() self.inputs = [] for i in range(record.count()): input_ = DefaultLineEdit() self.inputs.append(input_) layout.addRow(record.fieldName(i), input_) self.enableApply() self.scroll_area = QtGui.QScrollArea(self) self.scroll_area.setWidget(frame) self.scroll_area.setWidgetResizable(True) self.insertWidget(self.scroll_area) self.dirty = True self.set_check_on_cancel(True)
def __init__(self, connection, ommisions, parent=None): BaseDialog.__init__(self, parent) self.setWindowTitle(_("Progress")) label = QtGui.QLabel(_("Populating Tables with demo data")) self.insertWidget(label) frame = QtGui.QFrame() layout = QtGui.QVBoxLayout(frame) self.module_dict = {} for module in connection.admin_modules: if module in ommisions: continue pw = ProgressWidget(self) pw.setText(module.TABLENAME) layout.addWidget(pw) self.module_dict[module] = pw self.scroll_area = QtGui.QScrollArea(self) self.scroll_area.setWidget(frame) self.scroll_area.setWidgetResizable(True) self.insertWidget(self.scroll_area) self.apply_but.hide() self.dirty = True self.set_check_on_cancel(True) self.connect_signals()
def __init__(self, parent=None): BaseDialog.__init__(self, parent) self.setWindowTitle(_("Add a User")) self.setMinimumSize(300, 200) self.label = QtGui.QLabel() self.label.setAlignment(QtCore.Qt.AlignCenter) self.label.setWordWrap(True) self.set_label_text(_("Add a user")) frame = QtGui.QFrame() form = QtGui.QFormLayout(frame) self.name_lineEdit = QtGui.QLineEdit() self.pass_lineEdit = QtGui.QLineEdit() self.repeat_pass_lineEdit = QtGui.QLineEdit() self.name_lineEdit.setMaxLength(30) self.pass_lineEdit.setMaxLength(30) self.repeat_pass_lineEdit.setMaxLength(30) self.pass_lineEdit.setEchoMode(QtGui.QLineEdit.Password) self.repeat_pass_lineEdit.setEchoMode(QtGui.QLineEdit.Password) form.addRow(_("UserName"), self.name_lineEdit) form.addRow(_("Password"), self.pass_lineEdit) form.addRow(_("Confirm Password"), self.repeat_pass_lineEdit) self.insertWidget(self.label) self.insertWidget(frame) self.name_lineEdit.cursorPositionChanged.connect(self._check) self.pass_lineEdit.cursorPositionChanged.connect(self._check) self.repeat_pass_lineEdit.cursorPositionChanged.connect(self._check)
def _clicked(self, but): ''' overwrite :doc:`BaseDialog` _clicked checking to see if addvanced panel is to be displayed. ''' if but == self.more_but: self.showExtension(but.isChecked()) return BaseDialog._clicked(self, but)
def __init__(self, patient, parent=None): ''' 2 arguments 1. a patientDB instance 2. parent widget(optional) ''' BaseDialog.__init__(self, parent) self.setWindowTitle(_("Edit Patient")) self.patient = patient label = QtGui.QLabel(_('Edit the following fields')) label.setWordWrap(True) label.setAlignment(QtCore.Qt.AlignCenter) widget = QtGui.QWidget() self.value_store = {} form = QtGui.QFormLayout(widget) for editable_field in self.patient.editable_fields: field_name = editable_field.fieldname display_text = editable_field.readable_fieldname field = patient.field(field_name) if editable_field.type == None: field_type = field.type() else: field_type = editable_field.type if field_type == QtCore.QVariant.Date: widg = QtGui.QDateEdit(self) widg.setDate(field.value().toDate()) elif field_type == QtCore.QVariant.String: widg = UpperCaseLineEdit(self) widg.setText(field.value().toString()) elif type(field_type) == OMType: widg = QtGui.QComboBox(self) for val in field_type.allowed_values: widg.addItem(field_type.readable_dict[val], val) index = widg.findData(field.value()) widg.setCurrentIndex(index) else: widg = QtGui.QLabel("????") form.addRow(display_text, widg) self.value_store[field_name] = (widg, field_type) self.insertWidget(label) self.insertWidget(widget) form.itemAt(1).widget().setFocus() self.set_accept_button_text(_("Apply Changes")) self.enableApply()
def __init__(self, address_id, addressDB, parent=None): BaseDialog.__init__(self, parent) self.address_id = address_id self.addressDB = addressDB self.setWindowTitle("Family Members") present_patients_label = QtGui.QLabel() present_patients_label.setAlignment(QtCore.Qt.AlignCenter) past_patients_label = QtGui.QLabel() past_patients_label.setAlignment(QtCore.Qt.AlignCenter) present_label = QtGui.QLabel( _("The following patients are currently linked to this address")) past_label = QtGui.QLabel( _("The following patients are historically linked to this address")) sa1 = QtGui.QScrollArea() sa1.setWidget(present_patients_label) sa1.setWidgetResizable(True) sa2 = QtGui.QScrollArea() sa2.setWidget(past_patients_label) sa2.setWidgetResizable(True) self.insertWidget(present_label) self.insertWidget(sa1) self.insertWidget(past_label) self.insertWidget(sa2) present_list, past_list = \ self.addressDB.who_else_lives_here(self.address_id) lab_text = "" for patient in present_list: lab_text += u"%s<br />"% patient present_patients_label.setText(lab_text) if lab_text == "": present_label.hide() sa1.hide() lab_text = "" for patient in past_list: lab_text += u"%s<br />"% patient past_patients_label.setText(lab_text) if lab_text == "": past_label.hide() sa2.hide()
def __init__(self, parent=None): BaseDialog.__init__(self, parent) self.setWindowTitle(_("Perform an Examination")) gb1 = QtGui.QGroupBox(_("Type")) layout = QtGui.QVBoxLayout(gb1) self.radio_buttons = [] for exam_code in SETTINGS.PROCEDURE_CODES.exam_codes: rb = QtGui.QRadioButton(exam_code.description) rb.proc_code = exam_code self.radio_buttons.append(rb) layout.addWidget(rb) try: self.radio_buttons[0].setChecked(True) except IndexError: #shouldn't happen! pass self.date_edit = QtGui.QDateEdit() self.date_edit.setDate(QtCore.QDate.currentDate()) self.date_edit.setCalendarPopup(True) self.dent_cb = QtGui.QComboBox() practitioners = SETTINGS.practitioners try: index = practitioners.index( SETTINGS.current_practitioner) except ValueError: index = -1 self.dent_cb.setModel(practitioners.dentists_model) self.dent_cb.setCurrentIndex(index) gb2 = QtGui.QGroupBox(_("Date")) layout = QtGui.QVBoxLayout(gb2) layout.addWidget(self.date_edit) gb3 = QtGui.QGroupBox(_("Dentist")) layout = QtGui.QVBoxLayout(gb3) layout.addWidget(self.dent_cb) self.insertWidget(gb1) self.insertWidget(gb2) self.insertWidget(gb3) self.enableApply(True)
def __init__(self, parent=None): BaseDialog.__init__(self, parent) self.setWindowTitle(_("Perform an Examination")) gb1 = QtGui.QGroupBox(_("Type")) layout = QtGui.QVBoxLayout(gb1) self.radio_buttons = [] for exam_code in SETTINGS.PROCEDURE_CODES.exam_codes: rb = QtGui.QRadioButton(exam_code.description) rb.proc_code = exam_code self.radio_buttons.append(rb) layout.addWidget(rb) try: self.radio_buttons[0].setChecked(True) except IndexError: #shouldn't happen! pass self.date_edit = QtGui.QDateEdit() self.date_edit.setDate(QtCore.QDate.currentDate()) self.date_edit.setCalendarPopup(True) self.dent_cb = QtGui.QComboBox() practitioners = SETTINGS.practitioners try: index = practitioners.index(SETTINGS.current_practitioner) except ValueError: index = -1 self.dent_cb.setModel(practitioners.dentists_model) self.dent_cb.setCurrentIndex(index) gb2 = QtGui.QGroupBox(_("Date")) layout = QtGui.QVBoxLayout(gb2) layout.addWidget(self.date_edit) gb3 = QtGui.QGroupBox(_("Dentist")) layout = QtGui.QVBoxLayout(gb3) layout.addWidget(self.dent_cb) self.insertWidget(gb1) self.insertWidget(gb2) self.insertWidget(gb3) self.enableApply(True)
def __init__(self, parent=None): self.schedule_now_button = QtGui.QPushButton(_("Schedule Now")) BaseDialog.__init__(self, parent) patient = SETTINGS.current_patient try: name = patient.full_name self.enableApply() except AttributeError: LOGGER.warning("NewApptDialog - called with no patient loaded") name = _("NO PATIENT LOADED") self.patient_label = QtGui.QLabel("%s<br /><b>%s</b>" % (_("Appointment for Patient"), name)) self.patient_label.setAlignment(QtCore.Qt.AlignCenter) frame = QtGui.QFrame() layout = QtGui.QFormLayout(frame) self.clinician_combobox = QtGui.QComboBox() self.clinician_combobox.setModel(SETTINGS.practitioners.model) self.length_combobox = QtGui.QComboBox() self.populate_length_combobox() self.trt1_combobox = QtGui.QComboBox() self.trt1_combobox.setEditable(True) self.populate_trt1_combobox() self.trt2_combobox = QtGui.QComboBox() self.populate_trt2_combobox() self.trt2_combobox.setCurrentIndex(-1) self.memo_lineedit = QtGui.QLineEdit() layout.addRow(_("Appointment with"), self.clinician_combobox) layout.addRow(_("Length"), self.length_combobox) layout.addRow(_("Reason 1"), self.trt1_combobox) layout.addRow(_("Reason 2 (optional)"), self.trt2_combobox) layout.addRow(_("Memo (optional)"), self.memo_lineedit) self.insertWidget(self.patient_label) self.insertWidget(frame) self.button_box.addButton(self.schedule_now_button, self.button_box.HelpRole) self.schedule_now_button.clicked.connect(self._schedule_now) self.length_combobox.currentIndexChanged.connect(self.check_length)
def __init__(self, parent=None): self.schedule_now_button = QtGui.QPushButton(_("Schedule Now")) BaseDialog.__init__(self, parent) patient = SETTINGS.current_patient try: name = patient.full_name self.enableApply() except AttributeError: LOGGER.warning("NewApptDialog - called with no patient loaded") name = _("NO PATIENT LOADED") self.patient_label = QtGui.QLabel("%s<br /><b>%s</b>"% ( _("Appointment for Patient"), name)) self.patient_label.setAlignment(QtCore.Qt.AlignCenter) frame = QtGui.QFrame() layout = QtGui.QFormLayout(frame) self.clinician_combobox = QtGui.QComboBox() self.clinician_combobox.setModel(SETTINGS.practitioners.model) self.length_combobox = QtGui.QComboBox() self.populate_length_combobox() self.trt1_combobox = QtGui.QComboBox() self.trt1_combobox.setEditable(True) self.populate_trt1_combobox() self.trt2_combobox = QtGui.QComboBox() self.populate_trt2_combobox() self.trt2_combobox.setCurrentIndex(-1) self.memo_lineedit = QtGui.QLineEdit() layout.addRow(_("Appointment with"), self.clinician_combobox) layout.addRow(_("Length"), self.length_combobox) layout.addRow(_("Reason 1"), self.trt1_combobox) layout.addRow(_("Reason 2 (optional)"), self.trt2_combobox) layout.addRow(_("Memo (optional)"), self.memo_lineedit) self.insertWidget(self.patient_label) self.insertWidget(frame) self.button_box.addButton(self.schedule_now_button, self.button_box.HelpRole) self.schedule_now_button.clicked.connect(self._schedule_now) self.length_combobox.currentIndexChanged.connect(self.check_length)
def exec_(self): self.clear() if BaseDialog.exec_(self): self.apply() if self.result_record: return (self.result_record, True) else: return (None, False)
def exec_(self): if BaseDialog.exec_(self): new_record = NewPerioBPERecord() new_record.setValue("values", self.values) new_record.setValue("patient_id", self.patient_id) new_record.setValue("checked_by", "TODO - set cli") new_record.setValue("comment", self.comment_line.text()) new_record.commit() return True return False
def __init__(self, parent=None, remove_stretch=True): BaseDialog.__init__(self, parent, remove_stretch) self.button_box.setCenterButtons(False) icon = QtGui.QIcon.fromTheme("go-down") #: a pointer to the Advanced button self.more_but = QtGui.QPushButton(icon, "&Advanced") self.more_but.setFlat(True) self.more_but.setCheckable(True) self.more_but.setFocusPolicy(QtCore.Qt.NoFocus) self.button_box.addButton(self.more_but, self.button_box.HelpRole) self.setOrientation(QtCore.Qt.Vertical) frame = QtGui.QFrame(self) layout = QtGui.QVBoxLayout(frame) self.setExtension(frame)
def __init__(self, parent=None): BaseDialog.__init__(self, parent) self.setWindowTitle(_("Radiographic Treatments")) frame = QtGui.QFrame() layout = QtGui.QFormLayout(frame) self.spin_boxes = [] for code in SETTINGS.PROCEDURE_CODES.xray_codes: sb = QtGui.QSpinBox() sb.proc_code = code self.spin_boxes.append(sb) layout.addRow(code.description, sb) self.insertWidget(frame) self.enableApply(True)
def __init__(self, parent=None): BaseDialog.__init__(self, parent) frame = QtGui.QFrame() layout = QtGui.QFormLayout(frame) self.hours_spinbox = QtGui.QSpinBox() self.hours_spinbox.setRange(0, 24) self.minutes_spinbox = QtGui.QSpinBox() self.minutes_spinbox.setRange(0, 55) self.minutes_spinbox.setSingleStep(5) layout.addRow(_("Hours"), self.hours_spinbox) layout.addRow(_("Minutes"), self.minutes_spinbox) message = _("Please specify the appointment length") self.setWindowTitle(message) self.insertWidget(QtGui.QLabel(message)) self.insertWidget(frame) self.enableApply()
def __init__(self, parent=None): BaseDialog.__init__(self, parent) frame = QtGui.QFrame() layout = QtGui.QFormLayout(frame) self.hours_spinbox = QtGui.QSpinBox() self.hours_spinbox.setRange(0,24) self.minutes_spinbox = QtGui.QSpinBox() self.minutes_spinbox.setRange(0,55) self.minutes_spinbox.setSingleStep(5) layout.addRow(_("Hours"), self.hours_spinbox) layout.addRow(_("Minutes"), self.minutes_spinbox) message = _("Please specify the appointment length") self.setWindowTitle(message) self.insertWidget(QtGui.QLabel(message)) self.insertWidget(frame) self.enableApply()
def exec_(self): if BaseDialog.exec_(self): if self.dent_cb.currentIndex() == -1: QtGui.QMessageBox.warning(self, _("error"), _("no dentist selected")) return self.exec_() else: QtGui.QApplication.instance().emit( QtCore.SIGNAL("treatment item generated"), self.treatment_item) return True return False
def __init__(self, parent=None): BaseDialog.__init__(self, parent) self.setWindowTitle(_("Input Required")) frame = QtGui.QFrame() form = QtGui.QFormLayout(frame) self.label = QtGui.QLabel(_("Please enter a username and Password")) self.label.setAlignment(QtCore.Qt.AlignCenter) self.name_lineEdit = QtGui.QLineEdit() self.pass_lineEdit = QtGui.QLineEdit() self.name_lineEdit.setMaxLength(30) self.pass_lineEdit.setMaxLength(30) self.pass_lineEdit.setEchoMode(QtGui.QLineEdit.Password) form.addRow(_("Name"),self.name_lineEdit) form.addRow(_("Password"),self.pass_lineEdit) self.insertWidget(self.label) self.insertWidget(frame) self.name_lineEdit.cursorPositionChanged.connect(self._check)
def exec_(self): ''' overwrite the dialog's exec call ''' while True: self.show() if BaseDialog.exec_(self): if not self.apply(): list_of_ommisions = "" for ommision in self.ommisions: list_of_ommisions += u"<li>%s</li>" % ommision QtGui.QMessageBox.warning( self, _("error"), u"%s<ul>%s</ul>" % (_("incomplete form - the following are required"), list_of_ommisions)) continue id, result = self.check_is_duplicate() if result: self.emit(QtCore.SIGNAL("Load Serial Number"), id) return False query, values = self.address_record.insert_query query += '''\n returning ix, addr1, addr2, addr3, city, county, country, postal_cd ''' print query q_query = QtSql.QSqlQuery(SETTINGS.psql_conn) q_query.prepare(query) for value in values: q_query.addBindValue(value) result = q_query.exec_() if result: if q_query.isActive(): q_query.next() self.result = q_query.record() return True else: self.Advise("unknown error") #shouldn't happen else: self.Advise( u"Error Executing query<hr />%s<hr />%s" % (query, q_query.lastError().text()), 1) else: return False
def exec_(self): ''' overwrite the dialog's exec call ''' while True: self.show() if BaseDialog.exec_(self): if not self.apply(): list_of_ommisions = "" for ommision in self.ommisions: list_of_ommisions += u"<li>%s</li>"% ommision QtGui.QMessageBox.warning(self, _("error"), u"%s<ul>%s</ul>" %( _("incomplete form - the following are required"), list_of_ommisions)) continue id, result = self.check_is_duplicate() if result: self.emit(QtCore.SIGNAL("Load Serial Number"), id) return False query, values = self.address_record.insert_query query += '''\n returning ix, addr1, addr2, addr3, city, county, country, postal_cd ''' print query q_query = QtSql.QSqlQuery(SETTINGS.psql_conn) q_query.prepare(query) for value in values: q_query.addBindValue(value) result = q_query.exec_() if result: if q_query.isActive(): q_query.next() self.result = q_query.record() return True else: self.Advise("unknown error") #shouldn't happen else: self.Advise(u"Error Executing query<hr />%s<hr />%s"% ( query, q_query.lastError().text()), 1) else: return False
def __init__(self, parent=None): BaseDialog.__init__(self, parent) patient = SETTINGS.current_patient try: name = patient.full_name except AttributeError: name = _("NO PATIENT LOADED") self.patient_label = QtGui.QLabel( "%s<br /><b>%s</b>" % (_("Appointment Preferences for Patient"), name)) self.patient_label.setAlignment(QtCore.Qt.AlignCenter) self.recall_groupbox = QtGui.QGroupBox( _("Recall Patient Periodically")) self.recall_groupbox.setCheckable(True) self.recdent_groupbox = QtGui.QGroupBox(_("Dentist Recall")) self.recdent_groupbox.setCheckable(True) self.recdent_groupbox.setChecked(False) self.recdent_period_spinbox = QtGui.QSpinBox() self.recdent_period_spinbox.setMinimum(1) self.recdent_period_spinbox.setMaximum(24) self.recdent_date_edit = QtGui.QDateEdit() self.recdent_date_edit.setCalendarPopup(True) self.recdent_date_edit.setDate(QtCore.QDate.currentDate()) layout = QtGui.QFormLayout(self.recdent_groupbox) layout.addRow(_("dentist recall period (months)"), self.recdent_period_spinbox) layout.addRow(_("Next Recall"), self.recdent_date_edit) self.rechyg_groupbox = QtGui.QGroupBox(_("Hygienist Recall")) self.rechyg_groupbox.setCheckable(True) self.rechyg_groupbox.setChecked(False) self.rechyg_period_spinbox = QtGui.QSpinBox() self.rechyg_period_spinbox.setMinimum(1) self.rechyg_period_spinbox.setMaximum(24) self.rechyg_date_edit = QtGui.QDateEdit() self.rechyg_date_edit.setCalendarPopup(True) self.rechyg_date_edit.setDate(QtCore.QDate.currentDate()) layout = QtGui.QFormLayout(self.rechyg_groupbox) layout.addRow(_("hygienist recall period (months)"), self.rechyg_period_spinbox) layout.addRow(_("Next Recall"), self.rechyg_date_edit) self.recall_method_combobox = QtGui.QComboBox() self.recall_method_combobox.addItems([_("Post"), _("email"), _("sms")]) #self.sms_reminders_checkbox = QtGui.QCheckBox( # _("sms reminders for appointments?")) #self.combined_appointment_checkbox = QtGui.QCheckBox( # _("Don't offer joint appointments")) layout = QtGui.QGridLayout(self.recall_groupbox) layout.addWidget(self.recdent_groupbox, 0, 0, 1, 2) layout.addWidget(self.rechyg_groupbox, 1, 0, 1, 2) layout.addWidget(QtGui.QLabel(_("Recall method")), 2, 0) layout.addWidget(self.recall_method_combobox, 2, 1) self.insertWidget(self.patient_label) self.insertWidget(self.recall_groupbox) #self.insertWidget(self.sms_reminders_checkbox) #self.insertWidget(self.combined_appointment_checkbox) QtCore.QTimer.singleShot(0, self.get_appt_prefs)
def __init__(self, parent=None): ''' 2 arguments 1. the database into which the new address will go. 2. parent widget(optional) ''' BaseDialog.__init__(self, parent) self.setWindowTitle(_("New address")) label = QtGui.QLabel(_('Enter a New Address')) label.setWordWrap(True) label.setAlignment(QtCore.Qt.AlignCenter) widget = QtGui.QWidget() self.form = QtGui.QFormLayout(widget) self.insertWidget(label) self.insertWidget(widget) self.enableApply() self.set_accept_button_text(_("Create New Record")) self.address_record = AddressRecord() # A blank record ''' A pointer to the dialog's :doc:`AddressRecord` ''' self.address_record.setValue("modified_by", SETTINGS.user) self.address_record.setValue("status", "active") self.value_store = {} # keep a list of required values the user hasn't completed self.ommissions = [] palette = QtGui.QPalette(self.palette()) brush = QtGui.QBrush(SETTINGS.COLOURS.REQUIRED_FIELD) palette.setBrush(QtGui.QPalette.Base, brush) standard_fields, advanced_fields = self.address_record.editable_fields for editable_field in standard_fields: field_name = editable_field.fieldname display_text = editable_field.readable_fieldname field = self.address_record.field(field_name) if editable_field.type is None: field_type = field.type() else: field_type = editable_field.type if field_type == QtCore.QVariant.Date: widg = QtGui.QDateEdit(self) widg.setDate(field.value().toDate()) elif field_type == QtCore.QVariant.String: widg = UpperCaseLineEdit(self) widg.setText(field.value().toString()) elif type(field_type) == OMType: widg = QtGui.QComboBox(self) for val in field_type.allowed_values: widg.addItem(field_type.readable_dict[val], val) index = widg.findData(field.value()) widg.setCurrentIndex(index) else: widg = QtGui.QLabel("????") if editable_field.required: widg.setPalette(palette) self.form.addRow(display_text, widg) self.value_store[field_name] = (widg, field_type) self.form.itemAt(1).widget().setFocus() self.result = None
def enableApply(self, enable=True): ''' call this to enable the apply button (which is disabled by default) ''' BaseDialog.enableApply(self, enable) self.schedule_now_button.setEnabled(enable)
def __init__(self, parent=None): BaseDialog.__init__(self, parent) patient = SETTINGS.current_patient try: name = patient.full_name except AttributeError: name = _("NO PATIENT LOADED") self.patient_label = QtGui.QLabel("%s<br /><b>%s</b>"% ( _("Appointment Preferences for Patient"), name)) self.patient_label.setAlignment(QtCore.Qt.AlignCenter) self.recall_groupbox = QtGui.QGroupBox( _("Recall Patient Periodically")) self.recall_groupbox.setCheckable(True) self.recdent_groupbox = QtGui.QGroupBox( _("Dentist Recall")) self.recdent_groupbox.setCheckable(True) self.recdent_groupbox.setChecked(False) self.recdent_period_spinbox = QtGui.QSpinBox() self.recdent_period_spinbox.setMinimum(1) self.recdent_period_spinbox.setMaximum(24) self.recdent_date_edit = QtGui.QDateEdit() self.recdent_date_edit.setCalendarPopup(True) self.recdent_date_edit.setDate(QtCore.QDate.currentDate()) layout = QtGui.QFormLayout(self.recdent_groupbox) layout.addRow(_("dentist recall period (months)"), self.recdent_period_spinbox) layout.addRow(_("Next Recall"), self.recdent_date_edit) self.rechyg_groupbox = QtGui.QGroupBox( _("Hygienist Recall")) self.rechyg_groupbox.setCheckable(True) self.rechyg_groupbox.setChecked(False) self.rechyg_period_spinbox = QtGui.QSpinBox() self.rechyg_period_spinbox.setMinimum(1) self.rechyg_period_spinbox.setMaximum(24) self.rechyg_date_edit = QtGui.QDateEdit() self.rechyg_date_edit.setCalendarPopup(True) self.rechyg_date_edit.setDate(QtCore.QDate.currentDate()) layout = QtGui.QFormLayout(self.rechyg_groupbox) layout.addRow(_("hygienist recall period (months)"), self.rechyg_period_spinbox) layout.addRow(_("Next Recall"), self.rechyg_date_edit) self.recall_method_combobox = QtGui.QComboBox() self.recall_method_combobox.addItems( [_("Post"), _("email"), _("sms")]) #self.sms_reminders_checkbox = QtGui.QCheckBox( # _("sms reminders for appointments?")) #self.combined_appointment_checkbox = QtGui.QCheckBox( # _("Don't offer joint appointments")) layout = QtGui.QGridLayout(self.recall_groupbox) layout.addWidget(self.recdent_groupbox,0,0,1,2) layout.addWidget(self.rechyg_groupbox,1,0,1,2) layout.addWidget(QtGui.QLabel(_("Recall method")), 2,0) layout.addWidget(self.recall_method_combobox, 2,1) self.insertWidget(self.patient_label) self.insertWidget(self.recall_groupbox) #self.insertWidget(self.sms_reminders_checkbox) #self.insertWidget(self.combined_appointment_checkbox) QtCore.QTimer.singleShot(0, self.get_appt_prefs)
def view_html(self): ''' view the displayed html in plain text ''' html = self.browser.page().currentFrame().toHtml() text_browser = QtGui.QTextEdit() text_browser.setReadOnly(True) text_browser.setFont(QtGui.QFont("courier", 10)) text_browser.setLineWrapMode(QtGui.QTextEdit.NoWrap) text_browser.setPlainText(html) dl = BaseDialog(self, remove_stretch=True) dl.setWindowTitle("html source view") dl.insertWidget(text_browser) dl.setMinimumWidth(600) dl.cancel_but.hide() dl.set_accept_button_text(_("Ok")) dl.enableApply() dl.exec_()
def exec_(self): if BaseDialog.exec_(self): self.apply_changed() return True
def exec_(self): if BaseDialog.exec_(self): cat = self.cat_combo_box.currentText() address_id = self.address_record.value("ix").toInt()[0] self.result = (address_id, cat) return True
def exec_(self): self.clear() if not self._has_completers: self.populate_completers() return BaseDialog.exec_(self)