How to use the ase.gui.ui.Label function in ase

To help you get started, we’ve selected a few ase examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rosswhitfield / ase / ase / gui / crystal.py View on Github external
def add_basis_atom(self, *args):
        """ add an atom to the customizable basis """
        n = len(self.elements)
        self.elements += [[
            ui.Entry(max=3), ui.Entry(max=8), ui.Entry(max=8), ui.Entry(max=8),
            ui.Label('\t\t\t'), ui.Label('\tx: '), ui.Label('  y: '),
            ui.Label('  z: '), ui.Label(' '), ui.Button('Delete'), True
        ]]
        self.elements[n][-2].connect("clicked", self.delete_basis_atom,
                                     {'n': n})
        pack(self.vbox_basis, [
            self.elements[n][4], self.elements[n][0], self.elements[n][5],
            self.elements[n][1], self.elements[n][6], self.elements[n][2],
            self.elements[n][7], self.elements[n][3], self.elements[n][8],
            self.elements[n][9]
        ])
        self.update()
github rosswhitfield / ase / ase / gui / calculator.py View on Github external
def makematrix(self, present):
        nelem = len(present)
        adjdict = {}
        tbl = ui.Table(2 + nelem, 2 + nelem)
        for i in range(nelem):
            s = chemical_symbols[present[i]]
            tbl.attach(ui.Label(" " + str(present[i])), 0, 1, i, i + 1)
            tbl.attach(ui.Label("  " + s + " "), 1, 2, i, i + 1)
            tbl.attach(
                ui.Label(str(present[i])), i + 2, i + 3, 1 + nelem, 2 + nelem)
            tbl.attach(ui.Label(s), i + 2, i + 3, nelem, 1 + nelem)
            for j in range(i + 1):
                adj = ui.Adjustment(1.0, 0.0, 100.0, 0.1)
                spin = ui.SpinButton(adj, 0.1, 3)
                tbl.attach(spin, 2 + j, 3 + j, i, i + 1)
                adjdict[(i, j)] = adj
        tbl.show_all()
        return tbl, adjdict
github rosswhitfield / ase / ase / gui / scaling.py View on Github external
self.pull.connect('toggled', self.pull_toggled)

        # Atomic relaxations
        framerel = ui.Frame(_("Atomic relaxations:"))
        vbox2 = ui.VBox()
        vbox2.show()
        framerel.add(vbox2)
        self.radio_relax_on = ui.RadioButton(None, _("On   "))
        self.radio_relax_off = ui.RadioButton(self.radio_relax_on, _("Off"))
        self.radio_relax_off.set_active(True)
        pack(vbox2, [self.radio_relax_on, self.radio_relax_off])
        self.make_minimize_gui(vbox2)
        for r in (self.radio_relax_on, self.radio_relax_off):
            r.connect("toggled", self.relax_toggled)
        self.relax_toggled()
        pack(vbox, [framedef, ui.Label(" "), framerel])
        pack(vbox, ui.Label(""))

        # Results
        pack(vbox, [ui.Label(_("Results:"))])
        self.radio_results_keep = ui.RadioButton(
            None, _("Keep original configuration"))
        self.radio_results_optimal = ui.RadioButton(
            self.radio_results_keep, _("Load optimal configuration"))
        self.radio_results_all =  ui.RadioButton(
            self.radio_results_optimal, _("Load all configurations"))
        self.radio_results_keep.set_active(True)
        pack(vbox, [self.radio_results_keep])
        pack(vbox, [self.radio_results_optimal])
        pack(vbox, [self.radio_results_all])

        # Output field
github rosswhitfield / ase / ase / gui / calculator.py View on Github external
def expert_keyword_create(self, command):
        key = command[0]
        if command[1] == "=":
            command.remove("=")
        argument = command[1]
        if len(command) > 2:
            for a in command[2:]:
                argument += ' ' + a
        index = len(self.expert_keywords)
        self.expert_keywords += [[
            ui.Label("    " + key + " = "), ui.Entry(max=55),
            ExpertDeleteButton(index), True
        ]]
        self.expert_keywords[index][1].set_text(argument)
        self.expert_keywords[index][2].connect('clicked',
                                               self.expert_keyword_delete)
        if not self.expert_vbox.get_children():
            table = ui.Table(1, 3)
            table.attach(self.expert_keywords[index][0], 0, 1, 0, 1, 0)
            table.attach(self.expert_keywords[index][1], 1, 2, 0, 1, 0)
            table.attach(self.expert_keywords[index][2], 2, 3, 0, 1, 0)
            table.show_all()
            pack(self.expert_vbox, table)
        else:
            table = self.expert_vbox.get_children()[0]
            nrows = table.get_property('n-rows')
            table.resize(nrows + 1, 3)
github rosswhitfield / ase / ase / gui / progress.py View on Github external
self.scale_progress.modify_bg(ui.STATE_PRELIGHT, '#00AA00')
        pack(vbox, [self.scale_progress])

        vbox.show()
        self.scaleframe.show()
        self.globalbox.pack_start(self.scalebox)

        # Minimization progress frame
        self.minbox = ui.VBox()  # Box containing frame and spacing
        self.minframe = ui.Frame(_("Energy minimization:"))
        vbox = ui.VBox()  # Box containing the frames content.
        self.minframe.add(vbox)
        pack(self.minbox, [self.minframe])
        pack(self.minbox, ui.Label(""))

        self.label_min_stepno = ui.Label("-")
        pack(vbox, [ui.Label(_("Step number: ")), self.label_min_stepno])
        lbl = ui.Label()
        lbl.set_markup(_("F<sub>max</sub>: "))
        self.minimize_progress = ui.ProgressBar()
        pack(vbox, [lbl, self.minimize_progress])
        self.label_min_fmax = ui.Label("-")
        lbl = ui.Label()
        lbl.set_markup(_("Convergence criterion: F<sub>max</sub> = "))
        pack(vbox, [lbl, self.label_min_fmax])
        self.label_min_maxsteps = ui.Label("-")
        pack(vbox,
             [ui.Label(_("Max. number of steps: ")), self.label_min_maxsteps])

        vbox.show()
        self.minframe.show()
        self.globalbox.pack_start(self.minbox)
github rosswhitfield / ase / ase / gui / nanotube.py View on Github external
def __init__(self, gui):
        self.element = Element('C', self.make)
        self.bondlength = ui.SpinBox(1.42, 0.0, 10.0, 0.01, self.make)
        self.n = ui.SpinBox(5, 1, 100, 1, self.make)
        self.m = ui.SpinBox(5, 0, 100, 1, self.make)
        self.length = ui.SpinBox(1, 1, 100, 1, self.make)
        self.description = ui.Label('')

        win = self.win = ui.Window(_('Nanotube'))
        win.add(ui.Text(introtext))
        win.add(self.element)
        win.add([_('Bond length: '),
                 self.bondlength,
                 _(u'Å')])
        win.add(_('Select roll-up vector (n,m) and tube length:'))
        win.add(['n:', self.n,
                 'm:', self.m,
                 _('Length:'), self.length])
        win.add(self.description)
        win.add([pybutton(_('Creating a nanoparticle.'), self.make),
                 ui.Button(_('Apply'), self.apply),
                 ui.Button(_('OK'), self.ok)])
github rosswhitfield / ase / ase / gui / calculator.py View on Github external
def __init__(self, owner, param, attrname):
        ui.Window.__init__(self)
        self.set_title(_("Lennard-Jones parameters"))
        self.owner = owner
        self.attrname = attrname
        atoms = owner.atoms
        atnos = atoms.get_atomic_numbers()
        found = {}
        for z in atnos:
            found[z] = True
        self.present = found.keys()
        self.present.sort()  # Sorted list of atomic numbers
        nelem = len(self.present)
        vbox = ui.VBox()
        label = ui.Label(_("Specify the Lennard-Jones parameters here"))
        pack(vbox, [label])
        pack(vbox, ui.Label(""))
        pack(vbox, [ui.Label(_("Epsilon (eV):"))])
        tbl, self.epsilon_adj = self.makematrix(self.present)
        pack(vbox, [tbl])
        pack(vbox, ui.Label(""))
        pack(vbox, [ui.Label(_(u"Sigma (Å):"))])
        tbl, self.sigma_adj = self.makematrix(self.present)
        pack(vbox, [tbl])
        # TRANSLATORS: Shift roughly means adjust (about a potential)
        self.modif = ui.CheckButton(_("Shift to make smooth at cutoff"))
        self.modif.set_active(True)
        pack(vbox, ui.Label(""))
        pack(vbox, self.modif)
        pack(vbox, ui.Label(""))
        butbox = ui.HButtonBox()
github rosswhitfield / ase / ase / gui / progress.py View on Github external
def __init__(self):
        ui.Window.__init__(self)
        self.set_title(_("Progress"))
        self.globalbox = ui.VBox()
        self.nextupdate = 0
        self.fmax_max = 1.0

        # Scaling deformation progress frame
        self.scalebox = ui.VBox()
        self.scaleframe = ui.Frame(_("Scaling deformation:"))
        vbox = ui.VBox()
        self.scaleframe.add(vbox)
        pack(self.scalebox, [self.scaleframe])
        pack(self.scalebox, ui.Label(""))

        self.label_scale_stepno_format = _("Step number %s of %s.")
        self.label_scale_stepno = ui.Label(self.label_scale_stepno_format %
                                           ("-", "-"))
        pack(vbox, [self.label_scale_stepno])
        self.scale_progress = ui.ProgressBar()
        self.scale_progress.modify_bg(ui.STATE_PRELIGHT, '#00AA00')
        pack(vbox, [self.scale_progress])

        vbox.show()
        self.scaleframe.show()
        self.globalbox.pack_start(self.scalebox)

        # Minimization progress frame
        self.minbox = ui.VBox()  # Box containing frame and spacing
        self.minframe = ui.Frame(_("Energy minimization:"))
github rosswhitfield / ase / ase / gui / calculator.py View on Github external
if self.pbc[i] and self.orthogonal:
                default = np.ceil(20.0 / self.size[i])
            else:
                default = 1
            g = ui.Adjustment(default, 1, 100, 1)
            s = ui.SpinButton(g, 0, 0)
            self.kpts.append(g)
            self.kpts_spin.append(s)
            if not self.pbc[i]:
                s.set_sensitive(False)
            g.connect("value-changed", self.k_changed)
        pack(vbox, [
            ui.Label(_("k-points  k = (")), self.kpts_spin[0], ui.Label(", "),
            self.kpts_spin[1], ui.Label(", "), self.kpts_spin[2], ui.Label(")")
        ])
        self.kpts_label = ui.Label("")
        self.kpts_label_format = _(u"k-points x size:  (%.1f, %.1f, %.1f) Å")
        pack(vbox, [self.kpts_label])
        self.k_changed()

        # Spin polarized
        self.spinpol = ui.CheckButton(_("Spin polarized"))
        pack(vbox, [self.spinpol])
        pack(vbox, ui.Label(""))

        # Mode and basis functions
        self.mode = ui.combo_box_new_text()
        self.mode.append_text(_("FD - Finite Difference (grid) mode"))
        self.mode.append_text(
            _("LCAO - Linear Combination of Atomic "
              "Orbitals"))
        self.mode.set_active(0)