def __init__(self, parent=None): ExtendableDialog.__init__(self, parent) self.setWindowTitle(_("New Database")) label = QtGui.QLabel( "<b>%s %s %s</b>" % ( _("You are about to install a new database"), _("(correctly called a 'schema')"), _("onto your postgresql server"), ) ) label.setWordWrap(True) label1 = QtGui.QLabel(_("Please enter a name for this new database")) label1.setWordWrap(True) self.lineedit = QtGui.QLineEdit() self.insertWidget(label) self.insertWidget(label1) self.insertWidget(self.lineedit) advanced_label = QtGui.QLabel("no advanced options as yet") self.add_advanced_widget(advanced_label) self.enableApply()
def __init__(self, parent=None): ExtendableDialog.__init__(self, parent) self.setWindowTitle(_("New Database")) label = QtGui.QLabel("<b>%s %s %s</b>" % (_('You are about to install a new database'), _("(correctly called a 'schema')"), _("onto your postgresql server"))) label.setWordWrap(True) label1 = QtGui.QLabel(_("Please enter a name for this new database")) label1.setWordWrap(True) self.lineedit = QtGui.QLineEdit() self.insertWidget(label) self.insertWidget(label1) self.insertWidget(self.lineedit) advanced_label = QtGui.QLabel("no advanced options as yet") self.add_advanced_widget(advanced_label) self.enableApply()
def showExtension(self, extend): if extend: self.changes_list_widget.clear() self.changes_list_widget.addItem( _("The following items need to be resolved by this dialog")) self.changes_list_widget.addItems(self.treatment_item.errors) ExtendableDialog.showExtension(self, extend)
def __init__(self, parent=None): ExtendableDialog.__init__(self, parent) self.setWindowTitle(_("Import Data Wizard")) self.label = QtGui.QLabel() self.label.setWordWrap(True) self.label.setAlignment(QtCore.Qt.AlignCenter) self.insertWidget(self.label) self.work_thread = QtCore.QThread(self) self.work_thread.run = self.start_import self.enableApply()
def __init__(self, parent=None): ExtendableDialog.__init__(self, parent) self.setWindowTitle(_("Connect to Database")) self.enableApply() self.multiple_db_widg = MultipleDatabaseWidget(self) self.add_advanced_widget(self.multiple_db_widg) self.label = QtGui.QLabel() self.insertWidget(self.label) self.set_advanced_but_text(_("other databases"))
def exec_(self): while True: if ExtendableDialog.exec_(self): try: self.existing_address_widget.apply() except AttributeError: pass break else: return False return True
def exec_(self): if self.importer is None: return self.no_importer_message() message = u"%s <b>'%s'</b> ?" % ( _('Import data into the current database'), self.importer.om2_session.databaseName()) self.label.setText(message) if not ExtendableDialog.exec_(self): return False return self.start_()
def __init__(self, message, changes, parent=None): ''' offers a choiced of save discard cancel, but allows for examination of what has changed. changes should be a function, which returns a string list ''' ExtendableDialog.__init__(self, parent) self.set_advanced_but_text(_("What's changed?")) self.apply_but.setText("&Save") self.enableApply() self.save_on_exit = True label = QtGui.QLabel(message) label.setAlignment(QtCore.Qt.AlignCenter) self.insertWidget(label) self.discard_but = self.button_box.addButton( QtGui.QDialogButtonBox.Discard) self.changes = changes self.changes_list_widget = QtGui.QListWidget() self.add_advanced_widget(self.changes_list_widget)
def exec_(self): while True: if ExtendableDialog.exec_(self): if self.database_name == "": QtGui.QMessageBox.warning(self, _("Error"), _("Please enter a name for this new database")) elif " " in self.database_name: QtGui.QMessageBox.warning(self, _("Error"), _("Database names cannot contain spaces")) else: break else: return False return True
def __init__(self, connection, parent=None): ExtendableDialog.__init__(self, parent) self.connection = connection self.setWindowTitle(_("Demo Generator")) label = QtGui.QLabel(u"%s <b>'%s'</b> %s?"% ( _('Populate the current database'), self.connection.databaseName(), _('with a full set of demo data'))) label.setWordWrap(True) label.setAlignment(QtCore.Qt.AlignCenter) self.insertWidget(label) self.adv_widg = _AdvancedPanel(self.connection.admin_modules, self) self.add_advanced_widget(self.adv_widg) self.work_thread = QtCore.QThread(self) self.work_thread.run = self.call_populate self.enableApply()
def exec_(self): if self.importer is None: return self.no_importer_message() message = u"%s <b>'%s'</b> ?" % ( _("Import data into the current database"), self.importer.om2_session.databaseName(), ) self.label.setText(message) if not ExtendableDialog.exec_(self): return False return self.start_()
def __init__(self, parent=None): ExtendableDialog.__init__(self, parent) self.label = QtGui.QLabel() self.model = _directory_model() list_view = _TableView() self.insertWidget(self.label) self.insertWidget(list_view) self.apply_but.hide() self.set_reject_button_text(_("Close")) self._update() list_view.setModel(self.model) list_view.updated.connect(self._update) label = QtGui.QLabel(_("Naked Plugins management Enabled")) self.add_advanced_widget(label) self.more_but.toggled.connect(self.toggle_naked)
def exec_(self, check_first=True): if check_first and not ExtendableDialog.exec_(self): return (False, "") dbname = self.connection.databaseName() if QtGui.QMessageBox.warning(self.parent(), _("Populating Demo"), u"<b>%s '%s'</b><hr />%s"%( _("continuing may corrupt/overwrite any existing data in the database named"), dbname, _("do you wish to continue?")), QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel, QtGui.QMessageBox.Cancel) == QtGui.QMessageBox.Cancel: return ("", False) self.Advise(u"%s %s"% (_("Populating Database"), dbname)) return self.populate_demo()
def exec_(self): while True: if ExtendableDialog.exec_(self): if self.database_name == "": QtGui.QMessageBox.warning( self, _("Error"), _("Please enter a name for this new database")) elif " " in self.database_name: QtGui.QMessageBox.warning( self, _("Error"), _("Database names cannot contain spaces")) else: break else: return False return True
def exec_(self): ''' overwrite the dialog's exec call ''' while True: self.show() if ExtendableDialog.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.patient.insert_query q_query = QtSql.QSqlQuery(SETTINGS.psql_conn) q_query.prepare(query + " returning ix") for value in values: q_query.addBindValue(value) result = q_query.exec_() if result: if q_query.isActive(): q_query.next() id = q_query.record().value("ix").toInt()[0] self.emit(QtCore.SIGNAL("Load Serial Number"), id) return True else: self.Advise("Query Error" + q_query.lastError().text()) else: return False
def _clicked(self, but): if but == self.discard_but: self.discard() return ExtendableDialog._clicked(self, but)
def __init__(self, parent=None): ''' when a :doc:`TreatmentItem` is added, this dialog attempts to validate it. (ie.. is the item aware who prescribed it? if applicable - which tooth it relates to? etc. ) ''' ExtendableDialog.__init__(self, parent, remove_stretch=False) self.setWindowTitle(_("Additional Information is Required")) self.top_label = QtGui.QLabel(_("Additional Information is Required")) self.top_label.setAlignment(QtCore.Qt.AlignCenter) ## chart self.chart_frame = QtGui.QFrame() self.chart = ChartWidgetBase() #self.chart.setStyle(self.chart.CHART_STYLE_ROOTS) self.chart.setStyle(self.chart.CHART_STYLE_MIXED) teeth_needed_label = QtGui.QLabel() teeth_needed_label.setMinimumWidth(120) teeth_needed_label.setText(_("Which tooth is being treated?")) teeth_needed_label.setWordWrap(True) self.chosen_teeth_label = QtGui.QLabel("-") self.chosen_teeth_label.setAlignment(QtCore.Qt.AlignCenter) layout = QtGui.QGridLayout(self.chart_frame) layout.setMargin(0) layout.addWidget(teeth_needed_label) layout.addWidget(self.chosen_teeth_label, 1, 0) layout.addWidget(self.chart, 0, 1, 2, 1) ## tooth for selecting chosen surfaces self.surfaces_frame = QtGui.QFrame() self.tooth = ToothWidget() surfs_needed_label = QtGui.QLabel(_("Select surfaces")) self.chosen_surfaces_label = QtGui.QLabel("-") self.chosen_surfaces_label.setAlignment(QtCore.Qt.AlignCenter) layout = QtGui.QGridLayout(self.surfaces_frame) layout.setMargin(0) layout.addWidget(surfs_needed_label) layout.addWidget(self.chosen_surfaces_label, 1, 0) layout.addWidget(self.tooth, 0, 1, 2, 1) ## pontics chart self.pontics_frame = QtGui.QFrame() self.pontics_chart = ChartWidgetBase() #self.chart.setStyle(self.chart.CHART_STYLE_ROOTS) self.pontics_chart.setStyle(self.pontics_chart.CHART_STYLE_MIXED) teeth_needed_label = QtGui.QLabel() teeth_needed_label.setMinimumWidth(120) teeth_needed_label.setText(_("Replacing which Teeth?")) teeth_needed_label.setWordWrap(True) self.chosen_pontics_label = QtGui.QLabel("-") self.chosen_pontics_label.setAlignment(QtCore.Qt.AlignCenter) layout = QtGui.QGridLayout(self.pontics_frame) layout.setMargin(0) layout.addWidget(teeth_needed_label) layout.addWidget(self.chosen_pontics_label, 1, 0) layout.addWidget(self.pontics_chart, 0, 1, 2, 1) ## a combo box for prescribing clinician self.px_clinician_frame = ChooseClinicianFrame(completing=False) self.tx_clinician_frame = ChooseClinicianFrame(completing=True) ## a line edit for description self.description_frame = QtGui.QFrame() description_label = QtGui.QLabel(_("Description of item")) self.comment_line_edit = QtGui.QLineEdit() layout = QtGui.QHBoxLayout(self.description_frame) layout.setMargin(0) layout.addWidget(description_label) layout.addWidget(self.comment_line_edit) self.plan_completed_frame = QtGui.QFrame() layout = QtGui.QGridLayout(self.plan_completed_frame) self.completed_radiobutton = QtGui.QRadioButton(_("Completed Today")) self.planning_radiobutton = QtGui.QRadioButton(_("Planned Treatment")) self.planning_radiobutton.setChecked(True) layout.addWidget(self.planning_radiobutton, 0, 0) layout.addWidget(self.completed_radiobutton, 0, 1) layout.addWidget(self.tx_clinician_frame, 1, 0, 1, 2) self.insertWidget(self.top_label) self.insertWidget(self.px_clinician_frame) self.insertWidget(self.chart_frame) self.insertWidget(self.pontics_frame) self.insertWidget(self.surfaces_frame) self.insertWidget(self.description_frame) self.insertWidget(self.plan_completed_frame) self.changes_list_widget = QtGui.QListWidget() self.add_advanced_widget(self.changes_list_widget) self.dent_key = 281474976645120 #adult only self.connect_signals()
def __init__(self, parent=None): ''' when a :doc:`TreatmentItem` is added, this dialog attempts to validate it. (ie.. is the item aware who prescribed it? if applicable - which tooth it relates to? etc. ) ''' ExtendableDialog.__init__(self, parent, remove_stretch=False) self.setWindowTitle(_("Additional Information is Required")) self.top_label = QtGui.QLabel(_("Additional Information is Required")) self.top_label.setAlignment(QtCore.Qt.AlignCenter) ## chart self.chart_frame = QtGui.QFrame() self.chart = ChartWidgetBase() #self.chart.setStyle(self.chart.CHART_STYLE_ROOTS) self.chart.setStyle(self.chart.CHART_STYLE_MIXED) teeth_needed_label = QtGui.QLabel() teeth_needed_label.setMinimumWidth(120) teeth_needed_label.setText(_("Which tooth is being treated?")) teeth_needed_label.setWordWrap(True) self.chosen_teeth_label = QtGui.QLabel("-") self.chosen_teeth_label.setAlignment(QtCore.Qt.AlignCenter) layout = QtGui.QGridLayout(self.chart_frame) layout.setMargin(0) layout.addWidget(teeth_needed_label) layout.addWidget(self.chosen_teeth_label,1,0) layout.addWidget(self.chart,0,1,2,1) ## tooth for selecting chosen surfaces self.surfaces_frame = QtGui.QFrame() self.tooth = ToothWidget() surfs_needed_label = QtGui.QLabel(_("Select surfaces")) self.chosen_surfaces_label = QtGui.QLabel("-") self.chosen_surfaces_label.setAlignment(QtCore.Qt.AlignCenter) layout = QtGui.QGridLayout(self.surfaces_frame) layout.setMargin(0) layout.addWidget(surfs_needed_label) layout.addWidget(self.chosen_surfaces_label,1,0) layout.addWidget(self.tooth,0,1,2,1) ## pontics chart self.pontics_frame = QtGui.QFrame() self.pontics_chart = ChartWidgetBase() #self.chart.setStyle(self.chart.CHART_STYLE_ROOTS) self.pontics_chart.setStyle(self.pontics_chart.CHART_STYLE_MIXED) teeth_needed_label = QtGui.QLabel() teeth_needed_label.setMinimumWidth(120) teeth_needed_label.setText(_("Replacing which Teeth?")) teeth_needed_label.setWordWrap(True) self.chosen_pontics_label = QtGui.QLabel("-") self.chosen_pontics_label.setAlignment(QtCore.Qt.AlignCenter) layout = QtGui.QGridLayout(self.pontics_frame) layout.setMargin(0) layout.addWidget(teeth_needed_label) layout.addWidget(self.chosen_pontics_label,1,0) layout.addWidget(self.pontics_chart,0,1,2,1) ## a combo box for prescribing clinician self.px_clinician_frame = ChooseClinicianFrame(completing=False) self.tx_clinician_frame = ChooseClinicianFrame(completing=True) ## a line edit for description self.description_frame = QtGui.QFrame() description_label = QtGui.QLabel(_("Description of item")) self.comment_line_edit = QtGui.QLineEdit() layout = QtGui.QHBoxLayout(self.description_frame) layout.setMargin(0) layout.addWidget(description_label) layout.addWidget(self.comment_line_edit) self.plan_completed_frame = QtGui.QFrame() layout = QtGui.QGridLayout(self.plan_completed_frame) self.completed_radiobutton = QtGui.QRadioButton(_("Completed Today")) self.planning_radiobutton = QtGui.QRadioButton(_("Planned Treatment")) self.planning_radiobutton.setChecked(True) layout.addWidget(self.planning_radiobutton, 0, 0) layout.addWidget(self.completed_radiobutton, 0, 1) layout.addWidget(self.tx_clinician_frame, 1,0,1,2) self.insertWidget(self.top_label) self.insertWidget(self.px_clinician_frame) self.insertWidget(self.chart_frame) self.insertWidget(self.pontics_frame) self.insertWidget(self.surfaces_frame) self.insertWidget(self.description_frame) self.insertWidget(self.plan_completed_frame) self.changes_list_widget = QtGui.QListWidget() self.add_advanced_widget(self.changes_list_widget) self.dent_key = 281474976645120 #adult only self.connect_signals()
def _clicked(self, but): ''' Overwrite :doc:`ExtendableDialog` function to enable the active widget ''' self.multiple_db_widg.setEnabled(True) ExtendableDialog._clicked(self, but)
def __init__(self, parent=None): ''' 2 arguments 1. the database into which the new patient will go. 2. parent widget(optional) ''' ExtendableDialog.__init__(self, parent) self.setWindowTitle(_("New Patient")) self.set_advanced_but_text(_("optional fields")) label = QtGui.QLabel( _('The Following Fields are required to create a New Record')) label.setWordWrap(True) label.setAlignment(QtCore.Qt.AlignCenter) widget = QtGui.QWidget() self.form = QtGui.QFormLayout(widget) advanced_widget = QtGui.QWidget() self.advanced_form = QtGui.QFormLayout(advanced_widget) self.insertWidget(label) self.insertWidget(widget) self.add_advanced_widget(advanced_widget) self.set_check_on_cancel(True) self.enableApply() self.set_accept_button_text(_("Create New Record")) self.patient = NewPatientDB() self.patient.setValue("modified_by", SETTINGS.user) self.patient.setValue("status", "active") self.patient.remove(self.patient.indexOf("time_stamp")) self.value_store = {} palette = QtGui.QPalette(self.palette()) brush = QtGui.QBrush(SETTINGS.COLOURS.REQUIRED_FIELD) palette.setBrush(QtGui.QPalette.Base, brush) for editable_field in self.patient.editable_fields: field_name = editable_field.fieldname display_text = editable_field.readable_fieldname field = self.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("????") if editable_field.required: widg.setPalette(palette) if editable_field.advanced: self.advanced_form.addRow(display_text, widg) else: self.form.addRow(display_text, widg) self.value_store[field_name] = (widg, field_type) self.form.itemAt(1).widget().setFocus()
def exec_(self): self.set_label() self._connect_signals() return ExtendableDialog.exec_(self)
def __init__(self, dbname, proxy_client, parent=None): ExtendableDialog.__init__(self, parent) self.dbname = dbname self.proxy_client = proxy_client
def showExtension(self, extend): if extend: self.changes_list_widget.clear() self.changes_list_widget.addItems(self.changes()) ExtendableDialog.showExtension(self, extend)