Ejemplo n.º 1
0
        def create_inputs(table):
            input_widgets = [None] * N
            check_widgets = [None] * N

            num_columns = 2
            column_width = 3

            for i, prop in enumerate(self.props):

                new_lbl = self.create_mathtext_widget(prop.math_title,
                                                      prop.label)

                new_inp = ScaleEntry(lower=prop.minimum,
                                     upper=prop.maximum,
                                     enforce_range=True)
                new_inp.set_tooltip_text(prop.title)
                new_inp.set_name(self.widget_format % prop.label)
                self[self.widget_format % prop.label] = new_inp
                input_widgets[i] = new_inp

                j = (i % num_columns) * column_width
                table.attach(new_lbl,
                             0 + j,
                             1 + j,
                             i / num_columns, (i / num_columns) + 1,
                             xpadding=2,
                             ypadding=2)
                table.attach(new_inp,
                             2 + j,
                             3 + j,
                             i / num_columns, (i / num_columns) + 1,
                             xpadding=2,
                             ypadding=2)

                if prop.inheritable is not None:
                    inh_prop = all_props.get(prop.inherit_flag, None)
                    if inh_prop is None:
                        raise ValueError(
                            "The inherit flag property `%s` is missing for `%s` on meta model with store id `%s`"
                            % (prop.inherit_flag, prop.label, meta.store_id))

                    new_check = Gtk.CheckButton(label="")
                    new_check.set_tooltip_text(inh_prop.title)
                    new_check.set_name(self.widget_format % inh_prop.label)
                    new_check.set_sensitive(False)
                    self[self.widget_format % inh_prop.label] = new_check
                    check_widgets[i] = new_check
                    table.attach(new_check,
                                 1 + j,
                                 2 + j,
                                 i / num_columns, (i / num_columns) + 1,
                                 xpadding=2,
                                 ypadding=2,
                                 xoptions=Gtk.AttachOptions.FILL)

                del new_inp, new_lbl
            return input_widgets, check_widgets
Ejemplo n.º 2
0
        def create_inputs(table):
            input_widgets = [None] * N
            check_widgets = [None] * N

            num_columns = 2
            column_width = 3

            for i, prop in enumerate(self.props):

                new_lbl = self.create_mathtext_widget(prop.math_label,
                                                      prop.label)

                new_inp = ScaleEntry(lower=prop.minimum,
                                     upper=prop.maximum,
                                     enforce_range=True)
                new_inp.set_tooltip_text(prop.label)
                new_inp.set_name(self.widget_format % prop.name)
                self[self.widget_format % prop.name] = new_inp
                input_widgets[i] = new_inp

                j = (i % num_columns) * column_width
                table.attach(new_lbl,
                             0 + j,
                             1 + j,
                             i / num_columns, (i / num_columns) + 1,
                             xpadding=2,
                             ypadding=2)
                table.attach(new_inp,
                             2 + j,
                             3 + j,
                             i / num_columns, (i / num_columns) + 1,
                             xpadding=2,
                             ypadding=2)

                if prop.inh_name is not None:
                    inh_prop = meta.get_prop_intel_by_name(prop.inh_name)

                    new_check = gtk.CheckButton(label="")
                    new_check.set_tooltip_text(inh_prop.label)
                    new_check.set_name(self.widget_format % inh_prop.name)
                    new_check.set_sensitive(False)
                    self[self.widget_format % inh_prop.name] = new_check
                    check_widgets[i] = new_check
                    table.attach(new_check,
                                 1 + j,
                                 2 + j,
                                 i / num_columns, (i / num_columns) + 1,
                                 xpadding=2,
                                 ypadding=2,
                                 xoptions=gtk.FILL)

                del new_inp, new_lbl
            return input_widgets, check_widgets
Ejemplo n.º 3
0
    def add_param_widget(self, name, label, minimum, maximum):
        tbl = self["tbl_params"]
        rows = tbl.get_property("n-rows") + 1
        tbl.resize(rows, 2)

        lbl = gtk.Label(label)
        lbl.set_alignment(1.0, 0.5)
        tbl.attach(lbl, 0, 1, rows - 1, rows, gtk.FILL, gtk.FILL)

        inp = ScaleEntry(minimum, maximum, enforce_range=True)
        tbl.attach(inp, 1, 2, rows - 1, rows, gtk.FILL, gtk.FILL)

        tbl.show_all()

        self[name] = inp
        inp.set_name(name)

        return inp
Ejemplo n.º 4
0
        def create_inputs(table):
            input_widgets = [None] * N
            check_widgets = [None] * N


            num_columns = 2
            column_width = 3

            for i, prop in enumerate(self.props):

                new_lbl = self.create_mathtext_widget(prop.math_title, prop.label)

                new_inp = ScaleEntry(lower=prop.minimum, upper=prop.maximum, enforce_range=True)
                new_inp.set_tooltip_text(prop.title)
                new_inp.set_name(self.widget_format % prop.label)
                self[self.widget_format % prop.label] = new_inp
                input_widgets[i] = new_inp

                j = (i % num_columns) * column_width
                table.attach(new_lbl, 0 + j, 1 + j, i / num_columns, (i / num_columns) + 1, xpadding=2, ypadding=2)
                table.attach(new_inp, 2 + j, 3 + j, i / num_columns, (i / num_columns) + 1, xpadding=2, ypadding=2)

                if prop.inheritable is not None:
                    inh_prop = all_props.get(prop.inherit_flag, None)
                    if inh_prop is None:
                        raise ValueError("The inherit flag property `%s` is missing for `%s` on meta model with store id `%s`" % (
                            prop.inherit_flag,
                            prop.label,
                            meta.store_id
                        ))

                    new_check = Gtk.CheckButton(label="")
                    new_check.set_tooltip_text(inh_prop.title)
                    new_check.set_name(self.widget_format % inh_prop.label)
                    new_check.set_sensitive(False)
                    self[self.widget_format % inh_prop.label] = new_check
                    check_widgets[i] = new_check
                    table.attach(new_check, 1 + j, 2 + j, i / num_columns, (i / num_columns) + 1, xpadding=2, ypadding=2, xoptions=Gtk.AttachOptions.FILL)


                del new_inp, new_lbl
            return input_widgets, check_widgets
Ejemplo n.º 5
0
        def create_inputs(table):
            input_widgets = [None] * N
            check_widgets = [None] * N


            num_columns = 2
            column_width = 3

            for i, prop in enumerate(self.props):

                new_lbl = self.create_mathtext_widget(prop.math_label, prop.label)

                new_inp = ScaleEntry(lower=prop.minimum, upper=prop.maximum, enforce_range=True)
                new_inp.set_tooltip_text(prop.label)
                new_inp.set_name(self.widget_format % prop.name)
                self[self.widget_format % prop.name] = new_inp
                input_widgets[i] = new_inp

                j = (i % num_columns) * column_width
                table.attach(new_lbl, 0 + j, 1 + j, i / num_columns, (i / num_columns) + 1, xpadding=2, ypadding=2)
                table.attach(new_inp, 2 + j, 3 + j, i / num_columns, (i / num_columns) + 1, xpadding=2, ypadding=2)

                if prop.inh_name is not None:
                    inh_prop = meta.get_prop_intel_by_name(prop.inh_name)

                    new_check = gtk.CheckButton(label="")
                    new_check.set_tooltip_text(inh_prop.label)
                    new_check.set_name(self.widget_format % inh_prop.name)
                    new_check.set_sensitive(False)
                    self[self.widget_format % inh_prop.name] = new_check
                    check_widgets[i] = new_check
                    table.attach(new_check, 1 + j, 2 + j, i / num_columns, (i / num_columns) + 1, xpadding=2, ypadding=2, xoptions=gtk.FILL)


                del new_inp, new_lbl
            return input_widgets, check_widgets