def renameProperty(self, *args):
     l = len(args)
     if l==0:
         item = self.mPropertyBrowser.currentItem()
         if (not item):
             return
         oldName = item.property().propertyName()
         dialog = QInputDialog(self.mPropertyBrowser)
         dialog.setInputMode(QInputDialog.TextInput)
         dialog.setLabelText(self.tr("Name:"))
         dialog.setTextValue(oldName)
         dialog.setWindowTitle(self.tr("Rename Property"))
         dialog.open(self.renameProperty)
     elif l==1:
         name = args[0]
         if (name.isEmpty()):
             return
         item = self.mPropertyBrowser.currentItem()
         if (not item):
             return
         oldName = item.property().propertyName()
         if (oldName == name):
             return
         undoStack = self.mMapDocument.undoStack()
         undoStack.push(RenameProperty(self.mMapDocument, self.mMapDocument.currentObjects(), oldName, name))
 def renameProperty(self, *args):
     l = len(args)
     if l == 0:
         item = self.mPropertyBrowser.currentItem()
         if (not item):
             return
         oldName = item.property().propertyName()
         dialog = QInputDialog(self.mPropertyBrowser)
         dialog.setInputMode(QInputDialog.TextInput)
         dialog.setLabelText(self.tr("Name:"))
         dialog.setTextValue(oldName)
         dialog.setWindowTitle(self.tr("Rename Property"))
         dialog.open(self.renameProperty)
     elif l == 1:
         name = args[0]
         if (name.isEmpty()):
             return
         item = self.mPropertyBrowser.currentItem()
         if (not item):
             return
         oldName = item.property().propertyName()
         if (oldName == name):
             return
         undoStack = self.mMapDocument.undoStack()
         undoStack.push(
             RenameProperty(self.mMapDocument,
                            self.mMapDocument.currentObjects(), oldName,
                            name))
Exemple #3
0
    def rename_tab_dialog(self):
        logger, index = self.current_logger_and_index()
        if not logger:
            return

        d = QInputDialog(self)
        d.setLabelText('Enter the new name for the "{}" tab:'.format(logger.name))
        d.setWindowTitle('Rename the "{}" tab'.format(logger.name))
        d.textValueSelected.connect(self.rename_current_tab)
        d.open()
Exemple #4
0
 def minimum_motor_voltage_button_clicked(self):
     qid = QInputDialog(self)
     qid.setInputMode(QInputDialog.IntInput)
     qid.setIntMinimum(0)
     qid.setIntMaximum(40000)
     qid.setIntStep(100)
     async_call(self.silent_stepper.get_minimum_voltage, None, qid.setIntValue, self.increase_error_count)
     qid.intValueSelected.connect(self.minimum_motor_voltage_selected)
     qid.setLabelText("Choose minimum motor voltage in mV.")
     qid.open()
Exemple #5
0
 def motor_current_button_clicked(self):
     qid = QInputDialog(self)
     qid.setInputMode(QInputDialog.IntInput)
     qid.setIntMinimum(360)
     qid.setIntMaximum(1640)
     qid.setIntStep(100)
     async_call(self.silent_stepper.get_motor_current, None, qid.setIntValue, self.increase_error_count)
     qid.intValueSelected.connect(self.motor_current_selected)
     qid.setLabelText("Choose motor current in mA.")
     qid.open()
Exemple #6
0
 def minimum_voltage_button_clicked(self):
     qid = QInputDialog(self)
     qid.setInputMode(QInputDialog.IntInput)
     qid.setIntMinimum(5000)
     qid.setIntMaximum(0xFFFF)
     qid.setIntStep(100)
     async_call(self.dc.get_minimum_voltage, None, qid.setIntValue, self.increase_error_count)
     qid.intValueSelected.connect(self.minimum_voltage_selected)
     qid.setLabelText("Choose minimum motor voltage in mV.")
     qid.open()
Exemple #7
0
    def rename_tab(self):
        tab, logger, index = self.get_current_tab_logger_index()
        if not tab or not logger:
            return

        d = QInputDialog(self)
        d.setLabelText(f'Enter the new name for the "{logger.name}" tab:')
        d.setWindowTitle(f'Rename the "{logger.name}" tab')
        d.textValueSelected.connect(self.change_current_tab_name)
        d.open()
Exemple #8
0
 def motor_current_button_clicked(self):
     qid = QInputDialog(self)
     qid.setInputMode(QInputDialog.IntInput)
     qid.setIntMinimum(360)
     qid.setIntMaximum(1640)
     qid.setIntStep(100)
     async_call(self.silent_stepper_v2.get_motor_current, None,
                qid.setIntValue, self.increase_error_count)
     qid.intValueSelected.connect(self.motor_current_selected)
     qid.setLabelText("Choose motor current in mA.")
     qid.open()
Exemple #9
0
 def output_voltage_button_clicked(self):
     qid = QInputDialog(self)
     qid.setWindowTitle('Servo Brick')
     qid.setInputMode(QInputDialog.IntInput)
     qid.setIntMinimum(2000)
     qid.setIntMaximum(9000)
     qid.setIntStep(100)
     async_call(self.servo.get_output_voltage, None, qid.setIntValue,
                self.increase_error_count)
     qid.intValueSelected.connect(self.output_voltage_selected)
     qid.setLabelText("Choose Output Voltage in mV:")
     qid.open()
Exemple #10
0
    def trim_records_dialog(self):
        logger, index = self.current_logger_and_index()
        if not logger:
            return

        d = QInputDialog(self)
        d.setInputMode(QInputDialog.IntInput)
        d.setIntRange(0, 100000000)  # because it sets intMaximum to 99 by default. why??
        d.setLabelText('Keep this many records out of {}:'.format(logger.record_model.rowCount()))
        d.setWindowTitle('Trim tab records of "{}" logger'.format(logger.name))
        d.intValueSelected.connect(self.trim_current_tab_records)
        d.open()
Exemple #11
0
    def max_capacity_dialog(self):
        logger, index = self.current_logger_and_index()
        if not logger:
            return

        d = QInputDialog(self)
        d.setInputMode(QInputDialog.IntInput)
        d.setIntRange(0, 100000000)  # because it sets intMaximum to 99 by default. why??
        max_now = logger.record_model.max_capacity
        max_now = "not set" if max_now is None else max_now
        label_str = 'Set max capacity for "{}" logger\nCurrently {}. Set to 0 to disable:'
        d.setLabelText(label_str.format(logger.name, max_now))
        d.setWindowTitle('Set max capacity')
        d.intValueSelected.connect(self.set_max_capacity)
        d.open()
Exemple #12
0
class AddPatientState(MyState):
    def __init__(self, name: str, parent=None):
        super().__init__(name=name, parent=parent)
        self.dialog = QInputDialog()
        self.dialog.setWindowTitle('Add patient')
        self.dialog.setLabelText('Enter patient id:')
        self.signal_cancel = self.dialog.rejected
        self.signal_ok = self.dialog.accepted

    def onEntry(self, event: QEvent):
        super().onEntry(event)
        self.dialog.open()

    def onExit(self, event: QEvent):
        super().onExit(event)
        self.dialog.close()
Exemple #13
0
    def max_capacity_dialog(self):
        tab, logger, index = self.get_current_tab_logger_index()
        if not tab or not logger:
            return

        d = QInputDialog(self)
        d.setInputMode(QInputDialog.IntInput)
        d.setIntRange(
            0, 100000000)  # because it sets intMaximum to 99 by default. why??
        max_now = logger.record_model.max_capacity
        max_now = "not set" if max_now is None else max_now
        d.setLabelText(f'Set max capacity for "{logger.name}" logger'
                       f'\nCurrently {max_now}. Set to 0 to disable:')
        d.setWindowTitle(f'Set max capacity')
        d.intValueSelected.connect(self.set_max_capacity)
        d.open()
Exemple #14
0
 def new_preset_dialog(self):
     d = QInputDialog(self)
     d.setLabelText('Enter the new name for the new preset:')
     d.setWindowTitle('Create new preset')
     d.textValueSelected.connect(self.create_new_preset)
     d.open()