Ejemplo n.º 1
0
 def _do_on_edit(self):
     r, form = a99.show_edit_form(self.row, self._get_edit_field_names(), "Edit Molecular State")
     if r == QDialog.Accepted:
         kwargs = form.get_kwargs()
         id_ = self.row["id"]
         s = "update state set {} where id = {}".format(
             ", ".join(["{} = '{}'".format(a, b) for a, b in kwargs.items()]), id_)
         conn = self._f.get_conn()
         conn.execute(s)
         conn.commit()
         self._populate()
         self._find_id(id_)
         return True
Ejemplo n.º 2
0
    def _show_traprb_parameters_form(self, r):
        # **Note** creates TRAPRBInputState() instance to get default input parameter values

        r, form = a99.show_edit_form(
            pyfant.TRAPRBInputState(),
            attrs=_TRAPRB_ATTRS,
            title="Modify selected TRAPRB input parameters",
            toolTips=[
                "minimum radius for calculation of wavefunctions (0.75 in most cases; 0.6 for OH A-X)",
                "maximum radius for calculation of wavefunctions",
                "radial interval for calculation of wavefunctions",
                "maximum quantum number for calculation of results"
            ],
        )
        return r, form
Ejemplo n.º 3
0
    def _do_on_edit(self):
        continuum = self._get_continuum()
        name = continuum["name"]
        while True:
            r, form = a99.show_edit_form({"name": name}, None, "Edit continuum name")
            if not (r == QDialog.Accepted):
                return

            newname = form.get_kwargs()["name"]
            if any([cuum_["name"] == newname for cuum_ in self._continua if cuum_ != continuum]):
                a99.show_error("Name already exists")
                continue

            continuum["name"] = newname
            self.tableWidget.item(self._get_continuum_index(), 0).setText(newname)

            return True
Ejemplo n.º 4
0
 def edit_sol(self):
     obj = self.sol
     if obj is None:
         return
     item = self.listWidgetSol.currentItem()
     r, form = a99.show_edit_form(self.sol, ["vl", "v2l", "qqv", "ggv", "bbv", "ddv", "fact"],
                                 item.text())
     flag_changed = False
     if r == QDialog.Accepted:
         kwargs = form.get_kwargs()
         for name, value in kwargs.items():
             orig = obj.__getattribute__(name)
             if orig != value:
                 obj.__setattr__(name, value)
                 flag_changed = True
     if flag_changed:
         self.flag_changed = True
         item.setText(self.get_sol_string(self.listWidgetSol.currentRow(), obj))
         # item.setTextColor(QColor(255, 0, 0))
         self.update_sol_info()
         self.update_window_title()
Ejemplo n.º 5
0
 def edit_mol(self):
     obj = self.mol
     if obj is None:
         return
     item = self.listWidgetMol.currentItem()
     r, form = a99.show_edit_form(obj,
         ["description", "symbols", "fe", "do", "mm", "am", "bm", "ua", "ub", "te", "cro", "s"],
         item.text())
     flag_changed = False
     if r == QDialog.Accepted:
         kwargs = form.get_kwargs()
         for name, value in kwargs.items():
             orig = obj.__getattribute__(name)
             if orig != value:
                 obj.__setattr__(name, value)
                 flag_changed = True
     if flag_changed:
         self.flag_changed = True
         item.setText(self.get_mol_string(obj))
         # item.setStyleSheet("selected:active{background: yellow}")
         # item.setTextColor(QColor(255, 0, 0))
         # item.setBackgroundColor(QColor(255, 0, 0))
         self.update_mol_info()
         self.update_window_title()