Example #1
0
 def add_scale_widget(self, prop, enforce_range=True):
     # Create the widget:        
     inp = ScaleEntry(prop.minimum, prop.maximum, enforce_range=enforce_range)
     inp.set_tooltip_text(prop.title)
     self[self.widget_format % prop.label] = inp
         
     # Add & return the widget
     return self._add_widget_to_container(inp, self._get_widget_container(prop))
Example #2
0
    def add_scale_widget(self, prop, enforce_range=True):
        # Create the widget:
        inp = ScaleEntry(prop.minimum,
                         prop.maximum,
                         enforce_range=enforce_range)
        inp.set_tooltip_text(prop.title)
        self[self.widget_format % prop.label] = inp

        # Add & return the widget
        return self._add_widget_to_container(inp,
                                             self._get_widget_container(prop))
Example #3
0
 def add_scale_widget(self, intel, widget_format="default_%s", container=None, enforce_range=True):
     if not isinstance(container, gtk.Widget):
         container = self[(container or "container_%s") % intel.name]
         if container == None:
             warn("Scale widget container not found for '%s'!" % intel.name, Warning)
             return None
     name = widget_format % intel.name
     child = container.get_child()
     if child is not None:
         container.remove(child)
     inp = ScaleEntry(intel.minimum, intel.maximum, enforce_range=enforce_range)
     self[name] = inp
     container.add(inp)
     inp.show_all()
     return inp
Example #4
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
Example #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_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
Example #6
0
 def add_scale_widget(self,
                      intel,
                      widget_format="default_%s",
                      container=None,
                      enforce_range=True):
     if not isinstance(container, gtk.Widget):
         container = self[(container or "container_%s") % intel.name]
         if container == None:
             warn("Scale widget container not found for '%s'!" % intel.name,
                  Warning)
             return None
     name = widget_format % intel.name
     child = container.get_child()
     if child is not None:
         container.remove(child)
     inp = ScaleEntry(intel.minimum,
                      intel.maximum,
                      enforce_range=enforce_range)
     self[name] = inp
     container.add(inp)
     inp.show_all()
     return inp
Example #7
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
Example #8
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
Example #9
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