Esempio n. 1
0
    def __init__(self, meta, **kwargs):
        assert (meta is not None), "IndependentsView needs a model's Meta class!"
        BaseView.__init__(self, **kwargs)

        self.props = [ prop for prop in meta.all_properties if getattr(prop, "is_independent", False) ]

        N = len(self.props)

        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
        self.i_box = self['i_box']

        num_rows = (N + 1) / 2
        if not num_rows == 0:
            self.i_table = gtk.Table((N + 1) / 2, 4, False)
            self.i_inputs, self.i_checks = create_inputs(self.i_table)
        else:
            self.i_inputs, self.i_checks = [], []
        if len(self.i_inputs) == 0:
            self[self.lbl_widget].set_no_show_all(True)
            self[self.sep_widget].set_no_show_all(True)
            self[self.lbl_widget].hide()
            self[self.sep_widget].hide()
        else:
            self._add_child_view(self.i_table, self.i_box)
Esempio n. 2
0
    def __init__(self, *args, **kwargs):
        BaseView.__init__(self, *args, **kwargs)

        self.graph_parent = self[self.graph_parent]

        self.get_toplevel().set_transient_for(self.parent.get_toplevel())

        self.setup_matplotlib_widget()
Esempio n. 3
0
    def __init__(self, *args, **kwargs):
        BaseView.__init__(self, *args, **kwargs)

        self.graph_parent = self[self.graph_parent]

        self.get_toplevel().set_transient_for(self.parent.get_toplevel())

        self.setup_matplotlib_widget()
Esempio n. 4
0
    def __init__(self, R, G, rank, **kwargs):
        """
            Eventhough only two of R,G and rank are required theoretically, 
            they are still required by the __init__ function as a validity
            check.
        """
        BaseView.__init__(self, **kwargs)

        # make sure valid params are passed:
        assert(rank == (G ** max(R, 1)))
        self.create_matrices(R, G, rank)
Esempio n. 5
0
    def __init__(self, R, G, rank, **kwargs):
        """
            Eventhough only two of R,G and rank are required theoretically, 
            they are still required by the __init__ function as a validity
            check.
        """
        BaseView.__init__(self, **kwargs)

        # make sure valid params are passed:
        assert (rank == (G**max(R, 1)))
        self.create_matrices(R, G, rank)
Esempio n. 6
0
    def __init__(self, *args, **kwargs):
        BaseView.__init__(self, *args, **kwargs)

        self.parent.set_title("Edit Mixtures")
        self.matrix = self[self.matrix_widget]
        self.wrapper = self[self.wrapper_widget]

        self.labels = [ self["lbl_scales"], self["lbl_fractions"], self["lbl_phases"], self["lbl_bgshifts"], self["lbl_specimens"] ]

        self["scolled_window"].set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
        self.matrix.connect("size-request", self.on_size_requested)

        self.reset_view()
Esempio n. 7
0
    def __init__(self, *args, **kwargs):
        BaseView.__init__(self, *args, **kwargs)

        self.parent.set_title("Edit In Situ Mixtures")
        self.matrix = self[self.matrix_widget]
        self.wrapper = self[self.wrapper_widget]

        self.labels = [ self["lbl_scales"], self["lbl_fractions"], self["lbl_phases"], self["lbl_bgshifts"], self["lbl_specimens"] ]

        self["scolled_window"].set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        self.matrix.connect("size-request", self.on_size_requested)

        self.reset_view()
    def __init__(self, meta, **kwargs):
        assert (meta is not None), "EditInSituBehaviourView needs a model's Meta class!"
        BaseView.__init__(self, **kwargs)

        self.props = [ prop for prop in meta.all_properties if getattr(prop, "visible", False) ]

        def create_label(prop):
            new_lbl = Gtk.Label(label=prop.text)
            new_lbl.set_use_markup(True)
            return new_lbl

        def create_input(prop):
            new_inp = self.add_widget(prop)
            new_inp.set_name(self.widget_format % prop.label)
            return new_inp

        self.create_input_table(
            self[self.parameter_table], self.props, 
            num_columns=1, widget_callbacks = [
                create_label,
                create_input
            ]
        )
Esempio n. 9
0
    def __init__(self, *args, **kwargs):
        BaseView.__init__(self, *args, **kwargs)

        self.graph_parent = self["view_graph"]
        self.setup_matplotlib_widget()
Esempio n. 10
0
    def __init__(self, *args, **kwargs):
        BaseView.__init__(self, *args, **kwargs)

        self.parent.set_title("Edit Markers")
Esempio n. 11
0
    def __init__(self, meta, **kwargs):
        assert (meta
                is not None), "IndependentsView needs a model's Meta class!"
        BaseView.__init__(self, **kwargs)

        self.props = [
            prop for prop in meta.all_properties
            if getattr(prop, "is_independent", False)
        ]

        N = len(self.props)

        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

        self.i_box = self['i_box']

        num_rows = (N + 1) / 2
        if not num_rows == 0:
            self.i_table = gtk.Table((N + 1) / 2, 4, False)
            self.i_inputs, self.i_checks = create_inputs(self.i_table)
        else:
            self.i_inputs, self.i_checks = [], []
        if len(self.i_inputs) == 0:
            self[self.lbl_widget].set_no_show_all(True)
            self[self.sep_widget].set_no_show_all(True)
            self[self.lbl_widget].hide()
            self[self.sep_widget].hide()
        else:
            self._add_child_view(self.i_table, self.i_box)
Esempio n. 12
0
    def __init__(self, meta, **kwargs):
        assert (meta
                is not None), "IndependentsView needs a model's Meta class!"
        BaseView.__init__(self, **kwargs)

        self.props = [
            prop for prop in meta.all_properties
            if getattr(prop, "is_independent", False)
        ]
        all_props = {prop.label: prop for prop in meta.all_properties}

        N = len(self.props)

        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

        self.i_box = self['i_box']

        num_rows = int((N + 1) / 2)
        if not num_rows == 0:
            self.i_table = Gtk.Table(num_rows, 4, False)
            self.i_inputs, self.i_checks = create_inputs(self.i_table)
        else:
            self.i_inputs, self.i_checks = [], []
        if len(self.i_inputs) == 0:
            self[self.lbl_widget].set_no_show_all(True)
            self[self.sep_widget].set_no_show_all(True)
            self[self.lbl_widget].hide()
            self[self.sep_widget].hide()
        else:
            self._add_child_view(self.i_table, self.i_box)
Esempio n. 13
0
 def show(self, *args, **kwargs):
     BaseView.show(self, *args, **kwargs)
Esempio n. 14
0
    def __init__(self, *args, **kwargs):
        BaseView.__init__(self, *args, **kwargs)

        self.parent.set_title("Edit Markers")
Esempio n. 15
0
    def __init__(self, meta, **kwargs):
        assert (meta is not None), "IndependentsView needs a model's Meta class!"
        BaseView.__init__(self, **kwargs)

        self.props = [ prop for prop in meta.all_properties if getattr(prop, "is_independent", False) ]
        all_props = { prop.label: prop for prop in meta.all_properties }

        N = len(self.props)

        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
        self.i_box = self['i_box']

        num_rows = int((N + 1) / 2)
        if not num_rows == 0:
            self.i_table = Gtk.Table(num_rows, 4, False)
            self.i_inputs, self.i_checks = create_inputs(self.i_table)
        else:
            self.i_inputs, self.i_checks = [], []
        if len(self.i_inputs) == 0:
            self[self.lbl_widget].set_no_show_all(True)
            self[self.sep_widget].set_no_show_all(True)
            self[self.lbl_widget].hide()
            self[self.sep_widget].hide()
        else:
            self._add_child_view(self.i_table, self.i_box)
Esempio n. 16
0
 def __init__(self, *args, **kwargs):
     BaseView.__init__(self, *args, **kwargs)
Esempio n. 17
0
    def __init__(self, *args, **kwargs):
        BaseView.__init__(self, *args, **kwargs)

        self.graph_parent = self["view_graph"]
        self.setup_matplotlib_widget()
Esempio n. 18
0
 def show(self, *args, **kwargs):
     BaseView.show(self, *args, **kwargs)
Esempio n. 19
0
    def __init__(self, *args, **kwargs):
        BaseView.__init__(self, *args, **kwargs)

        self.graph_parent = self["distr_plot_box"]
        self.setup_matplotlib_widget()
Esempio n. 20
0
 def __init__(self, *args, **kwargs):
     BaseView.__init__(self, *args, **kwargs)