Exemplo n.º 1
0
 def _create_folder(self):
     DEBUG("Creating a folder...")
     current_item = self.currentItem()
     qinput = QInputDialog(self)
     qinput.setInputMode(QInputDialog.TextInput)
     qinput.setWindowTitle(self.tr("Nueva Carpeta"))
     qinput.setLabelText(self.tr("Nombre:"))
     qinput.resize(400, 100)
     ok = qinput.exec_()
     folder_name = qinput.textValue()
     if ok:
         path = os.path.join(current_item.path, folder_name)
         if os.path.exists(path):
             QMessageBox.information(self, self.tr("Información"),
                                     self.tr("La carpeta ya existe"),
                                     QMessageBox.Yes)
             DEBUG("The folder already exists...")
             return
         # Creo la carpeta
         os.mkdir(path)
         # Agrego el ítem al árbol
         folder_item = TreeItem(current_item, [folder_name])
         folder_item.path = path
         folder_item.isFile = False
         folder_item.setExpanded(True)
Exemplo n.º 2
0
def ask_password_dialog(parent, title, prompt, timeout = None):
    if parent is None:
        app = qt4tools.create_qapplication()
        translator = qt4tools.get_translator()
        app.installTranslator(translator)

    import icon
    dialog = QInputDialog()

    timer = QTimer()
    if not timeout is None:
        dialog.connect(timer, SIGNAL("timeout()"), dialog.reject)
        timer.setInterval(timeout * 1000)
        timer.start()

    dialog.setWindowIcon(icon.BIT_LOGO)
    dialog.setWindowTitle(title)
    dialog.setLabelText(prompt)
    dialog.setTextEchoMode(QLineEdit.Password)
    QApplication.processEvents()

    ret = dialog.exec_()

    timer.stop()
    if ret:
        password = dialog.textValue()
    else:
        password = ''
    del(dialog)

    return(password)
Exemplo n.º 3
0
def ask_password_dialog(parent, title, prompt, timeout=None):
    if parent is None:
        qt4tools.create_qapplication()

    import icon
    dialog = QInputDialog()

    timer = QTimer()
    if not timeout is None:
        dialog.connect(timer, SIGNAL("timeout()"), dialog.reject)
        timer.setInterval(timeout * 1000)
        timer.start()

    dialog.setWindowIcon(icon.BIT_LOGO)
    dialog.setWindowTitle(title)
    dialog.setLabelText(prompt)
    dialog.setTextEchoMode(QLineEdit.Password)
    QApplication.processEvents()

    ret = dialog.exec_()

    timer.stop()
    if ret:
        password = dialog.textValue()
    else:
        password = ''
    del (dialog)

    return (password)
Exemplo n.º 4
0
    def __call__(self, val):
        dialog = QInputDialog(parent=self.parent)
#         dialog.setLabelText("")
        dialog.setLabelText("set label for minimum: " + str(self.minimum.energy))
        dialog.setInputMode(0)
        dialog.exec_()
        if dialog.result():
            label = dialog.textValue()
            self.parent._minima_labels[self.minimum] = label
Exemplo n.º 5
0
    def __call__(self, val):
        dialog = QInputDialog(parent=self.parent)
#         dialog.setLabelText("")
        dialog.setLabelText("set label for minimum: " + str(self.minimum.energy))
        dialog.setInputMode(0)
        dialog.exec_()
        if dialog.result():
            label = dialog.textValue()
            self.parent._minima_labels[self.minimum] = label
Exemplo n.º 6
0
 def __call__(self, val):
     dialog = QInputDialog(parent=self.parent)
     #         dialog.setLabelText("")
     dialog.setLabelText("Temperature for MFPT calculation")
     dialog.setInputMode(2)
     dialog.setDoubleValue(1.)
     dialog.exec_()
     if dialog.result():
         T = dialog.doubleValue()
         self.parent._color_by_mfpt(self.minimum1, T=T)
Exemplo n.º 7
0
 def motor_current_button_clicked(self):
     qid = QInputDialog(self)
     qid.setInputMode(QInputDialog.IntInput)
     qid.setIntMinimum(0)
     qid.setIntMaximum(2500)
     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()
Exemplo n.º 8
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.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()
Exemplo n.º 9
0
 def __call__(self, val):
     dialog = QInputDialog(parent=self.parent)
     #         dialog.setLabelText("")
     dialog.setLabelText("Temperature for committor calculation")
     dialog.setInputMode(2)
     dialog.setDoubleValue(1.)
     dialog.exec_()
     if dialog.result():
         T = dialog.doubleValue()
         self.parent._layout_by_committor(self.minimum1, self.minimum2, T=T)
Exemplo n.º 10
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()
Exemplo n.º 11
0
 def minimum_motor_voltage_button_pressed(self):
     qid = QInputDialog(self)
     qid.setInputMode(QInputDialog.IntInput)
     qid.setIntMinimum(0)
     qid.setIntMaximum(40000)
     qid.setIntStep(100)
     async_call(self.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()
Exemplo n.º 12
0
    def __call__(self, val):
        dialog = QInputDialog(parent=self.parent)
#         dialog.setLabelText("")
        dialog.setLabelText("Temperature for MFPT calculation")
        dialog.setInputMode(2)
        dialog.setDoubleValue(1.)
        dialog.exec_()
        if dialog.result():
            T = dialog.doubleValue()
            self.parent._color_by_mfpt(self.minimum1, T=T)
Exemplo n.º 13
0
    def __call__(self, val):
        dialog = QInputDialog(parent=self.parent)
#         dialog.setLabelText("")
        dialog.setLabelText("Temperature for committor calculation")
        dialog.setInputMode(2)
        dialog.setDoubleValue(1.)
        dialog.exec_()
        if dialog.result():
            T = dialog.doubleValue()
            self.parent._layout_by_committor(self.minimum1, self.minimum2, T=T)
Exemplo n.º 14
0
    def output_voltage_button_clicked(self):
        qid = QInputDialog(self)
        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.")
#                         "<font color=red>Setting this too high can destroy your servo.</font>")
        qid.open()
Exemplo n.º 15
0
    def motor_current_button_clicked(self):
        qid = QInputDialog(self)
        qid.setInputMode(QInputDialog.IntInput)
        qid.setIntMinimum(0)
        qid.setIntMaximum(2500)
        qid.setIntStep(100)
        async_call(self.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.")
#                         "<font color=red>Setting this too high can destroy your Motor.</font>")
        qid.open()
Exemplo n.º 16
0
    def motor_current_button_pressed(self):
        qid = QInputDialog(self)
        qid.setInputMode(QInputDialog.IntInput)
        qid.setIntMinimum(0)
        qid.setIntMaximum(2500)
        qid.setIntStep(100)
        async_call(self.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.")
#                         "<font color=red>Setting this too high can destroy your Motor.</font>")
        qid.open()
Exemplo n.º 17
0
 def output_voltage_button_clicked(self):
     qid = QInputDialog(self)
     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.")
     #                         "<font color=red>Setting this too high can destroy your servo.</font>")
     qid.open()
Exemplo n.º 18
0
 def minimum_voltage_button_pressed(self):
     qid = QInputDialog(self)
     qid.setInputMode(QInputDialog.IntInput)
     qid.setIntMinimum(5000)
     qid.setIntMaximum(0xFFFF)
     qid.setIntStep(100)
     try:
         qid.setIntValue(self.servo.get_minimum_voltage())
     except ip_connection.Error:
         return
     qid.intValueSelected.connect(self.minimum_voltage_selected)
     qid.setLabelText("Choose minimum servo voltage in mV.")
     qid.open()
Exemplo n.º 19
0
 def minimum_voltage_button_pressed(self):
     qid = QInputDialog(self)
     qid.setInputMode(QInputDialog.IntInput)
     qid.setIntMinimum(5000)
     qid.setIntMaximum(0xFFFF)
     qid.setIntStep(100)
     try:
         qid.setIntValue(self.servo.get_minimum_voltage())
     except ip_connection.Error:
         return
     qid.intValueSelected.connect(self.minimum_voltage_selected)
     qid.setLabelText("Choose minimum servo voltage in mV.")
     qid.open()
Exemplo n.º 20
0
    def motor_current_button_pressed(self):
        qid = QInputDialog(self)
        qid.setInputMode(QInputDialog.IntInput)
        qid.setIntMinimum(0)
        qid.setIntMaximum(2500)
        qid.setIntStep(100)
        try:
            qid.setIntValue(self.stepper.get_motor_current())
        except ip_connection.Error:
            return
        qid.intValueSelected.connect(self.motor_current_selected)
        qid.setLabelText("Choose motor current in mA.")
#                         "<font color=red>Setting this too high can destroy your Motor.</font>")
        qid.open()
Exemplo n.º 21
0
    def output_voltage_button_clicked(self):
        qid = QInputDialog(self)
        qid.setInputMode(QInputDialog.IntInput)
        qid.setIntMinimum(5000)
        qid.setIntMaximum(27000)
        qid.setIntStep(100)
        try:
            qid.setIntValue(self.servo.get_output_voltage())
        except ip_connection.Error:
            return
        qid.intValueSelected.connect(self.output_voltage_selected)
        qid.setLabelText("Choose Output Voltage in mV.")
#                         "<font color=red>Setting this too high can destroy your servo.</font>")
        qid.open()
Exemplo n.º 22
0
 def output_voltage_button_clicked(self):
     qid = QInputDialog(self)
     qid.setInputMode(QInputDialog.IntInput)
     qid.setIntMinimum(5000)
     qid.setIntMaximum(27000)
     qid.setIntStep(100)
     try:
         qid.setIntValue(self.servo.get_output_voltage())
     except ip_connection.Error:
         return
     qid.intValueSelected.connect(self.output_voltage_selected)
     qid.setLabelText("Choose Output Voltage in mV.")
     #                         "<font color=red>Setting this too high can destroy your servo.</font>")
     qid.open()
Exemplo n.º 23
0
 def motor_current_button_pressed(self):
     qid = QInputDialog(self)
     qid.setInputMode(QInputDialog.IntInput)
     qid.setIntMinimum(0)
     qid.setIntMaximum(2500)
     qid.setIntStep(100)
     try:
         qid.setIntValue(self.stepper.get_motor_current())
     except ip_connection.Error:
         return
     qid.intValueSelected.connect(self.motor_current_selected)
     qid.setLabelText("Choose motor current in mA.")
     #                         "<font color=red>Setting this too high can destroy your Motor.</font>")
     qid.open()
Exemplo n.º 24
0
def getFindMsg( parentWidget, prepText = None ):
    qd = QInputDialog(parentWidget)
    qd.setInputMode(QInputDialog.TextInput)
    qd.setOkButtonText(QString('Find'))
    qd.setLabelText(QString('Text to find'))
    if (prepText is not None):
        if prepText.size() > 40 :
            prepText.truncate(40)
        qd.setTextValue(prepText)
    b = (QDialog.Accepted == qd.exec_() )
    if b :
        return (True, qd.textValue())
    else:
        return (False, QString() )
Exemplo n.º 25
0
 def _create_folder(self):
     DEBUG("Creating a folder...")
     current_item = self.currentItem()
     qinput = QInputDialog(self)
     qinput.setInputMode(QInputDialog.TextInput)
     qinput.setWindowTitle(self.tr("Nueva Carpeta"))
     qinput.setLabelText(self.tr("Nombre:"))
     qinput.resize(400, 100)
     ok = qinput.exec_()
     folder_name = qinput.textValue()
     if ok:
         path = os.path.join(current_item.path, folder_name)
         if os.path.exists(path):
             QMessageBox.information(self, self.tr("Información"), self.tr("La carpeta ya existe"), QMessageBox.Yes)
             DEBUG("The folder already exists...")
             return
         # Creo la carpeta
         os.mkdir(path)
         # Agrego el ítem al árbol
         folder_item = TreeItem(current_item, [folder_name])
         folder_item.path = path
         folder_item.isFile = False
         folder_item.setExpanded(True)