Example #1
0
    def _new_action(self, number):
        def programs_get():
            return self.e.programs

        popup_hide_cb_list = [(self.e.signal, "program.unselected"), (self.e.signal, "program.changed")]

        prop = Property(self._parent, "action " + str(number))
        wid = WidgetActionsList(self, "Animations", programs_get, None, popup_hide_cb_list)
        wid.tooltip_set("Animation to be started.<br>Click to select it.")
        prop.widget_add("a", wid)
        self["actions"].property_add(prop)
Example #2
0
    def _new_action(self, number):
        def programs_get():
            return self.e.programs

        popup_hide_cb_list = [(self.e.signal, "program.unselected"),
                              (self.e.signal, "program.changed")]

        prop = Property(self._parent, "action " + str(number))
        wid = WidgetActionsList(self, "Animations", programs_get, None,
                                popup_hide_cb_list)
        wid.tooltip_set("Animation to be started.<br>Click to select it.")
        prop.widget_add("a", wid)
        self["actions"].property_add(prop)
Example #3
0
    def _header_init(self, parent):
        self.title = "part state"

        self._header_table = PropertyTable(parent, "state name")

        prop = Property(parent, "state")
        wid = WidgetStates(self, self.e, self._operation_stack_cb)
        wid.tooltip_set("Unique state name for part.<br>"
                        "'default 0.0' is immutable.")
        prop.widget_add("s", wid)
        self._header_table.property_add(prop)
        # FIXME: ugly and dangerous: overriding property_add's behavior on
        # widget's changed callback
        wid.changed = self._state_entry_changed_cb

        self.content_set("part_state.swallow", self._header_table)
Example #4
0
    def _header_init(self, parent):
        self.title = "part state"

        self._header_table = PropertyTable(parent, "state name")

        prop = Property(parent, "state")
        wid = WidgetStates(self, self.e, self._operation_stack_cb)
        wid.tooltip_set("Unique state name for part.<br>"
                        "'default 0.0' is immutable.")
        prop.widget_add("s", wid)
        self._header_table.property_add(prop)
        # FIXME: ugly and dangerous: overriding property_add's behavior on
        # widget's changed callback
        wid.changed = self._state_entry_changed_cb

        self.content_set("part_state.swallow", self._header_table)
Example #5
0
    def _header_init(self, parent):
        self.title = "part frame properties"

        self._header_table = PropertyTable(parent, "part name/type")
        self.content_set("part_state.swallow", self._header_table)

        prop = Property(parent, "name")
        wid = WidgetEntry(self)
        wid.disabled_set(True)
        prop.widget_add("n", wid)
        self._header_table.property_add(prop)

        prop = Property(parent, "type")
        wid = WidgetEntry(self)
        wid.disabled_set(True)
        prop.widget_add("t", wid)
        self._header_table.property_add(prop)

        self._source_prop = Property(parent, "source widget")
        wid = WidgetEntry(self)
        wid.disabled_set(True)
        self._source_prop.widget_add("s", wid)
        self._header_table.property_add(self._source_prop)
        self._source_prop.hide()

        self._module_prop = Property(parent, "module")
        wid = WidgetEntry(self)
        wid.disabled_set(True)
        self._module_prop.widget_add("m", wid)
        self._header_table.property_add(self._module_prop)
        self._module_prop.hide()

        self.content_set("part_name.swallow", self._header_table)
        self.e.animation.callback_add("animation.changed", self._anim_selected)
        self.e.animation.callback_add("animation.unselected",
                                      self._anim_unselected)
        self.e.animation.callback_add("part.added", self._anim_parts_changed)
        self.e.animation.callback_add("part.removed", self._anim_parts_changed)

        self._state_copy_button = StateCopyButton(self.e)

        self.edje_get().signal_callback_add(
            "cl,option,clicked", "editje/collapsable",
            self._state_copy_button._floater_open)
Example #6
0
    def _header_init(self, parent):
        self.title = "part frame properties"

        self._header_table = PropertyTable(parent, "part name/type")
        self.content_set("part_state.swallow", self._header_table)

        prop = Property(parent, "name")
        wid = WidgetEntry(self)
        wid.disabled_set(True)
        prop.widget_add("n", wid)
        self._header_table.property_add(prop)

        prop = Property(parent, "type")
        wid = WidgetEntry(self)
        wid.disabled_set(True)
        prop.widget_add("t", wid)
        self._header_table.property_add(prop)

        self._source_prop = Property(parent, "source widget")
        wid = WidgetEntry(self)
        wid.disabled_set(True)
        self._source_prop.widget_add("s", wid)
        self._header_table.property_add(self._source_prop)
        self._source_prop.hide()

        self._module_prop = Property(parent, "module")
        wid = WidgetEntry(self)
        wid.disabled_set(True)
        self._module_prop.widget_add("m", wid)
        self._header_table.property_add(self._module_prop)
        self._module_prop.hide()

        self.content_set("part_name.swallow", self._header_table)
        self.e.animation.callback_add("animation.changed", self._anim_selected)
        self.e.animation.callback_add("animation.unselected",
                                      self._anim_unselected)
        self.e.animation.callback_add("part.added", self._anim_parts_changed)
        self.e.animation.callback_add("part.removed", self._anim_parts_changed)

        self._state_copy_button = StateCopyButton(self.e)

        self.edje_get().signal_callback_add(
            "cl,option,clicked", "editje/collapsable",
            self._state_copy_button._floater_open)
Example #7
0
 def _create_props_by_type(self, edje_type):
     edje_type = edje.external_type_get(edje_type)
     self._params_info = edje_type.parameters_info_get()
     for p in self._params_info:
         prop = Property(self._parent, p.name)
         if p.type == edje.EDJE_EXTERNAL_PARAM_TYPE_BOOL:
             wid = WidgetBoolean(self)
             wid.states_set(p.true_string, p.false_string)
         elif p.type == edje.EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
             wid = WidgetCombo(self._parent)
             for choice in p.choices:
                 wid.item_add(choice)
         else:
             wid = WidgetEntry(self)
             if p.type == edje.EDJE_EXTERNAL_PARAM_TYPE_INT:
                 wid.type_int()
             elif p.type == edje.EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
                 wid.type_float()
         prop.widget_add("v", wid)
         self["external"].property_add(prop)
Example #8
0
 def _create_props_by_type(self, edje_type):
     edje_type = edje.external_type_get(edje_type)
     self._params_info = edje_type.parameters_info_get()
     for p in self._params_info:
         prop = Property(self._parent, p.name)
         if p.type == edje.EDJE_EXTERNAL_PARAM_TYPE_BOOL:
             wid = WidgetBoolean(self)
             wid.states_set(p.true_string, p.false_string)
         elif p.type == edje.EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
             wid = WidgetCombo(self._parent)
             for choice in p.choices:
                 wid.item_add(choice)
         else:
             wid = WidgetEntry(self)
             if p.type == edje.EDJE_EXTERNAL_PARAM_TYPE_INT:
                 wid.type_int()
             elif p.type == edje.EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
                 wid.type_float()
         prop.widget_add("v", wid)
         self["external"].property_add(prop)
Example #9
0
    def _common_props_create(self):
        prop = Property(self._parent, "min")
        wid = WidgetEntry(self)
        wid.type_int()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: int(x)
        wid.tooltip_set("Minimum part<br>width in pixels.")
        prop.widget_add("w", wid)
        wid = WidgetEntry(self)
        wid.type_int()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: int(x)
        wid.tooltip_set("Minimum part<br>height in pixels.")
        prop.widget_add("h", wid)
        self["main"].property_add(prop)

        prop = Property(self._parent, "max")
        wid = WidgetEntry(self)
        wid.type_int()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: int(x)
        wid.tooltip_set("Maximum part<br>width in pixels.<br>0 = disabled")
        prop.widget_add("w", wid)
        wid = WidgetEntry(self)
        wid.type_int()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: int(x)
        wid.tooltip_set("Maximum part<br>height in pixels.<br>0 = disabled")
        prop.widget_add("h", wid)
        self["main"].property_add(prop)

        # 'step' not implemented in edje_edit

        prop = Property(self._parent, "current")
        wid = WidgetEntry(self)
        wid.disabled_set(True)
        wid.type_int()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: int(x)
        wid.tooltip_set("Current part<br>height in pixels.")
        prop.widget_add("w", wid)
        wid = WidgetEntry(self)
        wid.disabled_set(True)
        wid.type_int()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: int(x)
        wid.tooltip_set("Current part<br>width in pixels.")
        prop.widget_add("h", wid)
        self["main"].property_add(prop)

        prop = Property(self._parent, "visible")
        wid = WidgetBoolean(self)
        wid.tooltip_set("Change part's visibility.")
        prop.widget_add("v", wid)
        self["main"].property_add(prop)

        prop = Property(self._parent, "align")
        wid = WidgetEntry(self)
        wid.type_float()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: float(x)
        wid.tooltip_set("Part horizontal align.<br>0.0 = left  1.0 = right")
        prop.widget_add("x", wid)
        wid = WidgetEntry(self)
        wid.type_float()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: float(x)
        wid.tooltip_set("Part vertical align.<br>0.0 = top  1.0 = bottom")
        prop.widget_add("y", wid)
        self["main"].property_add(prop)

        # 'fixed' not implemented in edje_edit
        # 'aspect' and 'aspect_preference' missing

        prop = Property(self._parent, "color")
        wid = WidgetColor(self, self.e)
        wid.tooltip_set("Part main color.<br>"
                        "Enter color in integers or<br>"
                        "in Hexa notation.",
                        "Preview of main color.<br>"
                        "Click to edit it.")
        prop.widget_add("c", wid)
        self["main"].property_add(prop)
Example #10
0
class PartAnimStateDetails(PartStateDetails):
    def __init__(self,
                 parent,
                 operation_stack_cb,
                 img_new_img_cb=None,
                 img_list_get_cb=None,
                 img_id_get_cb=None,
                 fnt_new_fnt_cb=None,
                 fnt_list_get_cb=None,
                 workfile_name_get_cb=None,
                 part_object_get_cb=None,
                 group="editje/collapsable/part_properties"):
        PartStateDetails.__init__(self, parent, operation_stack_cb,
                                  img_new_img_cb, img_list_get_cb,
                                  img_id_get_cb, fnt_new_fnt_cb,
                                  fnt_list_get_cb, workfile_name_get_cb,
                                  part_object_get_cb, group)

    def _context_recall(self, **kargs):
        self.e.animation.name = kargs["animation"]
        self.e.animation.state = kargs["time"]
        self.e.part.name = kargs["part"]
        self.e.part.state.name = kargs["state"]

    def _header_init(self, parent):
        self.title = "part frame properties"

        self._header_table = PropertyTable(parent, "part name/type")
        self.content_set("part_state.swallow", self._header_table)

        prop = Property(parent, "name")
        wid = WidgetEntry(self)
        wid.disabled_set(True)
        prop.widget_add("n", wid)
        self._header_table.property_add(prop)

        prop = Property(parent, "type")
        wid = WidgetEntry(self)
        wid.disabled_set(True)
        prop.widget_add("t", wid)
        self._header_table.property_add(prop)

        self._source_prop = Property(parent, "source widget")
        wid = WidgetEntry(self)
        wid.disabled_set(True)
        self._source_prop.widget_add("s", wid)
        self._header_table.property_add(self._source_prop)
        self._source_prop.hide()

        self._module_prop = Property(parent, "module")
        wid = WidgetEntry(self)
        wid.disabled_set(True)
        self._module_prop.widget_add("m", wid)
        self._header_table.property_add(self._module_prop)
        self._module_prop.hide()

        self.content_set("part_name.swallow", self._header_table)
        self.e.animation.callback_add("animation.changed", self._anim_selected)
        self.e.animation.callback_add("animation.unselected",
                                      self._anim_unselected)
        self.e.animation.callback_add("part.added", self._anim_parts_changed)
        self.e.animation.callback_add("part.removed", self._anim_parts_changed)

        self._state_copy_button = StateCopyButton(self.e)

        self.edje_get().signal_callback_add(
            "cl,option,clicked", "editje/collapsable",
            self._state_copy_button._floater_open)

    def _show(self):
        state = self.part_edje.state_selected_get()
        self._header_table["name"].value = self.part_edje.name
        self._header_table["name"].show_value()
        self._header_table["type"].value = \
            part_type_to_text(self.part_edje.type)
        self._header_table["type"].show_value()

        if self.e.part.type == edje.EDJE_PART_TYPE_EXTERNAL:
            source = self.e.part.source
            if source.startswith("elm/"):
                source = source[4:]
                module = "Elementary"
            else:
                module = "Emotion"

            self.edje_get().signal_emit("cl,extra,activate", "")
            if "source widget" not in self._header_table:
                self._header_table.property_add(self._source_prop)
            if "module" not in self._header_table:
                self._header_table.property_add(self._module_prop)

            self._header_table["source widget"].value = source
            self._header_table["source widget"].show_value()
            self._header_table["module"].value = module
            self._header_table["module"].show_value()
        else:
            self._header_extra_hide()

        self.edje_get().signal_emit("cl,option,enable", "editje")
        self.state = self.part_edje.state_get(*state)
        self._update()
        self.show()

    def _header_extra_hide(self):
        self.edje_get().signal_emit("cl,extra,deactivate", "")
        for p in ["source widget", "module"]:
            if p in self._header_table:
                self._header_table.property_del(p)

    def _hide(self):
        self._header_table["name"].value = None
        self._header_table["name"].hide_value()
        self._header_table["type"].value = None
        self._header_table["type"].hide_value()
        self._header_extra_hide()

        self.edje_get().signal_emit("cl,option,disable", "editje")
        self._hide_all()
        self.hide()

    def _check_and_show(self):
        anim = self.e.animation
        part = self.e.part
        ret = anim.name and anim.part_belongs(part.name)
        if ret:
            self._show()
        else:
            self._hide()
        return ret

    def _part_update(self, emissor, data):
        if self.part_evas:
            self.part_evas.on_resize_del(self._size_changed)
        self.part_edje = self.e.part._part
        self.part_evas = self._part_object_get_cb(self.part_edje.name)
        self.part_evas.on_resize_add(self._size_changed)
        self._size_changed(self.part_evas)

        self._check_and_show()

    def _part_unselected(self, emissor, data):
        if self.part_evas:
            self.part_evas.on_resize_del(self._size_changed)

        self.part_evas = None
        self.part_edje = None
        self._hide()

    def _anim_selected(self, emissor, data):
        self._check_and_show()

    def _anim_unselected(self, emissor, data):
        self._hide()

    def _anim_parts_changed(self, emissor, data):
        self._check_and_show()

    def _state_changed_cb(self, emissor, data):
        if not data:
            return
        self.part_edje.state_selected_set(*data)
        self.state = self.e.part.state._state
        if self._check_and_show():
            self._update()
Example #11
0
    def _rel_props_create(self):
        rel_to_box_title = "Placement reference"

        self.group_add("rel1")
        self.group_title_set("rel1", "top-left")

        def parts_get():
            return self.e.parts

        def sel_part_get():
            return self.e.part.name

        popup_hide_cb_list = [(self.e.part, "part.unselected"),
                              (self.e.part, "part.changed")]

        prop = Property(self._parent, "to")
        wid = WidgetButtonList(self, rel_to_box_title, parts_get, sel_part_get,
                               popup_hide_cb_list)
        wid.tooltip_set("Left reference part.")
        prop.widget_add("x", wid)
        wid = WidgetButtonList(self, rel_to_box_title, parts_get, sel_part_get,
                               popup_hide_cb_list)
        wid.tooltip_set("Top reference part.")
        prop.widget_add("y", wid)
        self["rel1"].property_add(prop)

        prop = Property(self._parent, "relative")
        wid = WidgetEntry(self)
        wid.type_float()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: float(x)
        wid.tooltip_set("Left relative position to<br>"
                        "reference part.<br>"
                        "0.0 = 0%/begining  1.0 = 100%/end")
        prop.widget_add("x", wid)
        wid = WidgetEntry(self)
        wid.type_float()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: float(x)
        wid.tooltip_set("Top relative position to<br>"
                        "reference part.<br>"
                        "0.0 = 0%/begining  1.0 = 100%/end")
        prop.widget_add("y", wid)
        self["rel1"].property_add(prop)

        prop = Property(self._parent, "offset")
        wid = WidgetEntry(self)
        wid.type_int()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: int(x)
        wid.tooltip_set("Left offset from relative<br>" "position in pixels.")
        prop.widget_add("x", wid)
        wid = WidgetEntry(self)
        wid.type_int()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: int(x)
        wid.tooltip_set("Top offset from relative<br>" "position in pixels.")
        prop.widget_add("y", wid)
        self["rel1"].property_add(prop)

        self.group_add("rel2")
        self.group_title_set("rel2", "bottom-right")

        prop = Property(self._parent, "to")
        wid = WidgetButtonList(self, rel_to_box_title, parts_get, sel_part_get,
                               popup_hide_cb_list)
        wid.tooltip_set("Right reference part.")
        prop.widget_add("x", wid)
        wid = WidgetButtonList(self, rel_to_box_title, parts_get, sel_part_get,
                               popup_hide_cb_list)
        wid.tooltip_set("Bottom reference part.")
        prop.widget_add("y", wid)
        self["rel2"].property_add(prop)

        prop = Property(self._parent, "relative")
        wid = WidgetEntry(self)
        wid.type_float()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: float(x)
        wid.tooltip_set("Right relative position to<br>"
                        "reference part.<br>"
                        "0.0 = 0%/begining  1.0 = 100%/end")
        prop.widget_add("x", wid)
        wid = WidgetEntry(self)
        wid.type_float()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: float(x)
        wid.tooltip_set("Bottom relative position to<br>"
                        "reference part.<br>"
                        "0.0 = 0%/begining  1.0 = 100%/end")
        prop.widget_add("y", wid)
        self["rel2"].property_add(prop)

        prop = Property(self._parent, "offset")
        wid = WidgetEntry(self)
        wid.type_int()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: int(x)
        prop.widget_add("x", wid)
        wid.tooltip_set("Right offset from relative<br>"
                        "position in pixels.<br>"
                        "default = -1 (see docs)")
        wid = WidgetEntry(self)
        wid.type_int()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: int(x)
        wid.tooltip_set("Bottom offset from relative<br>"
                        "position in pixels.<br>"
                        "default = -1 (see docs)")
        prop.widget_add("y", wid)
        self["rel2"].property_add(prop)
Example #12
0
    def _image_props_create(self):
        self.group_add("image")

        prop = Property(self._parent, "normal")
        wid = WidgetButton(self)
        wid.clicked = self._image_btn_clicked
        wid.tooltip_set("Actual image.<br>Click to change it.")
        prop.widget_add("n", wid)
        self["image"].property_add(prop)

        prop = Property(self._parent, "border")
        wid = WidgetEntry(self)
        wid.type_int()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: int(x)
        wid.tooltip_set("Lenght of left border in pixels.<br>"
                        "Left border isn't horizontal scalable.")
        prop.widget_add("l", wid)
        wid = WidgetEntry(self)
        wid.type_int()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: int(x)
        wid.tooltip_set("Lenght of right border in pixels.<br>"
                        "Right border isn't horizontal scalable.")
        prop.widget_add("r", wid)
        wid = WidgetEntry(self)
        wid.type_int()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: int(x)
        wid.tooltip_set("Lenght of top border in pixels.<br>"
                        "Top border isn't vertical scalable.")
        prop.widget_add("t", wid)
        wid = WidgetEntry(self)
        wid.type_int()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: int(x)
        wid.tooltip_set("Lenght of bottom border in pixels.<br>"
                        "Bottom border isn't vertical scalable.")
        prop.widget_add("b", wid)
        self["image"].property_add(prop)

        prop = Property(self._parent, "middle")
        wid = WidgetBoolean(self)
        wid.states_set("Solid", "None")
        wid.tooltip_set("Enables painting of image middle.<br>"
                        "If 'None', the image middle is hidden.")
        prop.widget_add("m", wid)
        self["image"].property_add(prop)

        prop = Property(self._parent, "aspect_pref")
        wid = WidgetCombo(self)
        for null, i in enumerate(self._aspect_prefs):
            wid.item_add(i)
        #FIXME: the 'aspect' property is not yet exposed ;)
        wid.tooltip_set("Sets the scope of the \"aspect\" property to " +
                        "a given dimension")
        prop.widget_add("a", wid)
        self["image"].property_add(prop)
Example #13
0
    def _text_props_create(self):
        self.group_add("text")
        # missing: text_class
        # not implemented in edje_edit: min, max

        prop = Property(self._parent, "text")
        wid = WidgetEntry(self)
        wid.tooltip_set("Set the text of part.")
        prop.widget_add("t", wid)
        self["text"].property_add(prop)

        prop = Property(self._parent, "font")
        wid = WidgetFont(self._parent, \
                         self._fnt_new_fnt_cb, self._fnt_list_get_cb, \
                         self._workfile_name_get_cb)
        wid.tooltip_set("Change the text's font.")
        prop.widget_add("f", wid)
        self["text"].property_add(prop)

        prop = Property(self._parent, "size")
        wid = WidgetEntry(self)
        wid.type_int()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: int(x)
        wid.tooltip_set("Change text font's size.")
        prop.widget_add("s", wid)
        self["text"].property_add(prop)

        prop = Property(self._parent, "fit")
        prop.widget_add("x", WidgetBoolean(self))
        prop.widget_add("y", WidgetBoolean(self))
        self["text"].property_add(prop)

        prop = Property(self._parent, "align")
        wid = WidgetEntry(self)
        wid.type_float()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: float(x)
        wid.tooltip_set("Text horizontal align.<br>0.0 = left  1.0 = right")
        prop.widget_add("x", wid)
        wid = WidgetEntry(self)
        wid.type_float()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: float(x)
        wid.tooltip_set("Text vertical align.<br>0.0 = top  1.0 = bottom")
        prop.widget_add("y", wid)
        self["text"].property_add(prop)

        prop = Property(self._parent, "elipsis")
        wid = WidgetEntry(self)
        wid.type_float()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: float(x)
        wid.tooltip_set("Cut text if biggest then part's area.<br>"
                        "0.0 = fix the left side  1.0 = right side")
        prop.widget_add("e", wid)
        self["text"].property_add(prop)

        prop = Property(self._parent, "color2")
        wid = WidgetColor(self, self.e)
        wid.tooltip_set(
            "Text shadow color.<br>"
            "Enter color in integers or<br>"
            "in Hexa notation.", "Preview of text shadow color.<br>"
            "Click to edit it.")
        prop.widget_add("c", wid)
        self["text"].property_add(prop)

        prop = Property(self._parent, "color3")
        wid = WidgetColor(self, self.e)
        wid.tooltip_set(
            "Text outline color.<br>"
            "Enter color in integers or<br>"
            "in Hexa notation.", "Preview of text outline color.<br>"
            "Click to edit it.")
        prop.widget_add("c", wid)
        self["text"].property_add(prop)
Example #14
0
    def _image_props_create(self):
        self.group_add("image")

        prop = Property(self._parent, "normal")
        wid = WidgetButton(self)
        wid.clicked = self._image_btn_clicked
        wid.tooltip_set("Actual image.<br>Click to change it.")
        prop.widget_add("n", wid)
        self["image"].property_add(prop)

        prop = Property(self._parent, "border")
        wid = WidgetEntry(self)
        wid.type_int()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: int(x)
        wid.tooltip_set("Lenght of left border in pixels.<br>"
                        "Left border isn't horizontal scalable.")
        prop.widget_add("l", wid)
        wid = WidgetEntry(self)
        wid.type_int()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: int(x)
        wid.tooltip_set("Lenght of right border in pixels.<br>"
                        "Right border isn't horizontal scalable.")
        prop.widget_add("r", wid)
        wid = WidgetEntry(self)
        wid.type_int()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: int(x)
        wid.tooltip_set("Lenght of top border in pixels.<br>"
                        "Top border isn't vertical scalable.")
        prop.widget_add("t", wid)
        wid = WidgetEntry(self)
        wid.type_int()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: int(x)
        wid.tooltip_set("Lenght of bottom border in pixels.<br>"
                        "Bottom border isn't vertical scalable.")
        prop.widget_add("b", wid)
        self["image"].property_add(prop)

        prop = Property(self._parent, "middle")
        wid = WidgetBoolean(self)
        wid.states_set("Solid", "None")
        wid.tooltip_set("Enables painting of image middle.<br>"
                        "If 'None', the image middle is hidden.")
        prop.widget_add("m", wid)
        self["image"].property_add(prop)
Example #15
0
    def __init__(self, parent, operation_stack_cb):
        EditjeDetails.__init__(
            self, parent, operation_stack_cb,
            group="editje/collapsable/part_properties")

        self.title = "animation"

        self._transitions = ['None', 'Linear', 'Sinusoidal', 'Accelerate',
                             'Decelerate']

        self._header_table = PropertyTable(
            parent, "animation name", self.header_prop_value_changed)
        self.content_set("part_name.swallow", self._header_table)
        self.focus_custom_chain_set([self._header_table, self._box])

        prop = Property(parent, "name")
        wid = WidgetEntry(self)
        wid.tooltip_set("Unique animation name.")
        prop.widget_add("n", wid)
        self._header_table.property_add(prop)

        prop = Property(parent, "length")
        wid = WidgetEntry(self)
        wid.disabled_set(True)
        wid.type_float()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: float(x)
        wid.tooltip_set("Time lenght of animation<br>in seconds.")
        prop.widget_add("l", wid)
        self._header_table.property_add(prop)

        prop = Property(parent, "current")
        wid = WidgetEntry(self)
        wid.disabled_set(True)
        wid.tooltip_set("Time of current keyframe<br>in seconds.")
        prop.widget_add("c", wid)
        self["main"].property_add(prop)

        prop = Property(parent, "previous")
        wid = WidgetEntry(self)
        wid.disabled_set(True)
        wid.tooltip_set("Time of previous keyframe<br>in seconds.")
        prop.widget_add("p", wid)
        self["main"].property_add(prop)

        prop = Property(parent, "next")
        wid = WidgetEntry(self)
        wid.disabled_set(True)
        wid.tooltip_set("Time of next keyframe<br>in seconds.")
        prop.widget_add("n", wid)
        self["main"].property_add(prop)

        prop = Property(parent, "transition")
        wid = WidgetCombo(parent)
        for null, i in enumerate(self._transitions):
            wid.item_add(i)
        wid.tooltip_set("Transition effect to interpolation<br>"
                        "between the previous keyframe<br>and this.")
        prop.widget_add("type", wid)
        wid = WidgetEntry(self)
        wid.disabled_set(True)
        wid.type_float()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: float(x)
        wid.tooltip_set("Transition time between the<br>"
                        "previous keyframe and this,<br>in seconds.")
        prop.widget_add("length", wid)
        self["main"].property_add(prop)

        self._parent.main_edje.signal_callback_add("timestop", "*",
                                                   self._timeline_cb)
        self._parent.main_edje.signal_callback_add("timeremove", "*",
                                                   self._timeremove_cb)
        self.e.callback_add("animation.removed", self._removed)
        self.e.animation.callback_add("animation.changed", self._update)
        self.e.animation.callback_add("animation.unselected", self._removed)
        self.e.animation.callback_add("state.added", self._timestop_add)
        self.e.animation.callback_add("frame.changed", self._update_states)
Example #16
0
    def __init__(self, parent, operation_stack_cb):
        EditjeDetails.__init__(self,
                               parent,
                               operation_stack_cb,
                               group="editje/collapsable/part_properties")

        self.title = "animation"

        self._transitions = [
            'None', 'Linear', 'Sinusoidal', 'Accelerate', 'Decelerate'
        ]

        self._header_table = PropertyTable(parent, "animation name",
                                           self.header_prop_value_changed)
        self.content_set("part_name.swallow", self._header_table)
        self.focus_custom_chain_set([self._header_table, self._box])

        prop = Property(parent, "name")
        wid = WidgetEntry(self)
        wid.tooltip_set("Unique animation name.")
        prop.widget_add("n", wid)
        self._header_table.property_add(prop)

        prop = Property(parent, "length")
        wid = WidgetEntry(self)
        wid.disabled_set(True)
        wid.type_float()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: float(x)
        wid.tooltip_set("Time lenght of animation<br>in seconds.")
        prop.widget_add("l", wid)
        self._header_table.property_add(prop)

        prop = Property(parent, "current")
        wid = WidgetEntry(self)
        wid.disabled_set(True)
        wid.tooltip_set("Time of current keyframe<br>in seconds.")
        prop.widget_add("c", wid)
        self["main"].property_add(prop)

        prop = Property(parent, "previous")
        wid = WidgetEntry(self)
        wid.disabled_set(True)
        wid.tooltip_set("Time of previous keyframe<br>in seconds.")
        prop.widget_add("p", wid)
        self["main"].property_add(prop)

        prop = Property(parent, "next")
        wid = WidgetEntry(self)
        wid.disabled_set(True)
        wid.tooltip_set("Time of next keyframe<br>in seconds.")
        prop.widget_add("n", wid)
        self["main"].property_add(prop)

        prop = Property(parent, "transition")
        wid = WidgetCombo(parent)
        for null, i in enumerate(self._transitions):
            wid.item_add(i)
        wid.tooltip_set("Transition effect to interpolation<br>"
                        "between the previous keyframe<br>and this.")
        prop.widget_add("type", wid)
        wid = WidgetEntry(self)
        wid.disabled_set(True)
        wid.type_float()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: float(x)
        wid.tooltip_set("Transition time between the<br>"
                        "previous keyframe and this,<br>in seconds.")
        prop.widget_add("length", wid)
        self["main"].property_add(prop)

        self._parent.main_edje.signal_callback_add("timestop", "*",
                                                   self._timeline_cb)
        self._parent.main_edje.signal_callback_add("timeremove", "*",
                                                   self._timeremove_cb)
        self.e.callback_add("animation.removed", self._removed)
        self.e.animation.callback_add("animation.changed", self._update)
        self.e.animation.callback_add("animation.unselected", self._removed)
        self.e.animation.callback_add("state.added", self._timestop_add)
        self.e.animation.callback_add("frame.changed", self._update_states)
Example #17
0
    def __init__(self, parent, operation_stack_cb):
        EditjeDetails.__init__(self, parent, operation_stack_cb, group="editje/collapsable/part_state")

        self.title = "signal"

        self._parent = parent
        self._actions_added = 0

        self._header_table = PropertyTable(parent, "signal name", self._header_prop_value_changed)
        self.content_set("part_state.swallow", self._header_table)
        self.focus_custom_chain_set([self._header_table, self._box])

        prop = Property(parent, "name")
        wid = WidgetEntry(self)
        wid.tooltip_set("Unique signal name.")
        prop.widget_add("n", wid)
        self._header_table.property_add(prop)

        popup_hide_cb_list = [(self.e.signal, "program.unselected"), (self.e.signal, "program.changed")]

        prop = Property(parent, "signal")
        wid = WidgetSignal(self, popup_hide_object_signal_list=popup_hide_cb_list)
        wid.tooltip_set("Signal to be received.", "Click to select one common" "<br>signal to be received.")
        prop.widget_add("s", wid)
        self["main"].property_add(prop)

        def parts_get():
            return self.e.parts

        def animations_get():
            return self.e.animations

        self._prop_source_animations = Property(parent, "source")
        wid = WidgetSource(self, "Animation list", animations_get, popup_hide_cb_list)
        wid.tooltip_set("Accepted signal source.", "Click to select one " "existent<br>animation as source.")
        self._prop_source_animations.widget_add("s", wid)
        self["main"].property_add(self._prop_source_animations)
        self["main"].property_del("source")

        self._prop_source_parts = Property(parent, "source")
        wid = WidgetSource(self, "Parts list", parts_get, popup_hide_cb_list)
        wid.tooltip_set("Accepted signal source.", "Click to select one " "existent<br>part as source.")
        self._prop_source_parts.widget_add("s", wid)
        self["main"].property_add(self._prop_source_parts)

        prop = Property(parent, "delay")
        wid = WidgetEntry(self)
        wid.parser_in = lambda x: str(x)
        wid.parser_out = lambda x: float(x)
        wid.tooltip_set(
            "Fixed delay to do the action in seconds. The<br>total " "delay is sum off fixed and variable delays."
        )
        prop.widget_add("delay", wid)
        wid = WidgetEntry(self)
        wid.parser_in = lambda x: str(x)
        wid.parser_out = lambda x: float(x)
        wid.tooltip_set(
            "Variable delay to do the action in seconds. Will<br>be" " selected one random value between 0 and this."
        )
        prop.widget_add("range", wid)
        self["main"].property_add(prop)

        self.group_add("api")
        prop = Property(parent, "export")
        wid = WidgetBoolean(self)
        wid.tooltip_set("Add this part to exported signals.")
        prop.widget_add("export", wid)
        self["api"].property_add(prop)
        self._prop_api_name = Property(parent, "name")
        wid = WidgetEntry(self)
        wid.tooltip_set("Export name of signal.")
        self._prop_api_name.widget_add("name", wid)
        self["api"].property_add(self._prop_api_name)
        self._prop_api_description = Property(parent, "description")
        wid = WidgetEntry(self)
        wid.tooltip_set("Description of exported signal.")
        self._prop_api_description.widget_add("description", wid)
        self["api"].property_add(self._prop_api_description)

        self.group_add("actions")

        self.group_add("out")

        prop = Property(parent, "signal")
        wid = WidgetSignal(self, popup_hide_object_signal_list=popup_hide_cb_list)
        wid.tooltip_set("Signal to be emmited.", "Click to select one common " "signal to be emmited.")
        prop.widget_add("s", wid)
        self["out"].property_add(prop)

        prop = Property(parent, "source")
        wid = WidgetSource(self, "Parts list", parts_get, popup_hide_cb_list)
        wid.tooltip_set("Name registered as signal source.", "Click to select " "one existent<br>part as source.")
        prop.widget_add("s", wid)
        self["out"].property_add(prop)

        self.e.callback_add("signal.added", self._update)
        self.e.callback_add("signal.removed", self._removed)
        self.e.callback_add("group.changed", self._removed)
        self.e.signal.callback_add("program.changed", self._update)
        self.e.signal.callback_add("program.name.changed", self._update)
        self.e.signal.callback_add("program.unselected", self._removed)

        self.open = True
        self.open_disable = True
        self.show()
        self.__notification = None
Example #18
0
class SignalDetails(EditjeDetails):
    def __init__(self, parent, operation_stack_cb):
        EditjeDetails.__init__(self, parent, operation_stack_cb, group="editje/collapsable/part_state")

        self.title = "signal"

        self._parent = parent
        self._actions_added = 0

        self._header_table = PropertyTable(parent, "signal name", self._header_prop_value_changed)
        self.content_set("part_state.swallow", self._header_table)
        self.focus_custom_chain_set([self._header_table, self._box])

        prop = Property(parent, "name")
        wid = WidgetEntry(self)
        wid.tooltip_set("Unique signal name.")
        prop.widget_add("n", wid)
        self._header_table.property_add(prop)

        popup_hide_cb_list = [(self.e.signal, "program.unselected"), (self.e.signal, "program.changed")]

        prop = Property(parent, "signal")
        wid = WidgetSignal(self, popup_hide_object_signal_list=popup_hide_cb_list)
        wid.tooltip_set("Signal to be received.", "Click to select one common" "<br>signal to be received.")
        prop.widget_add("s", wid)
        self["main"].property_add(prop)

        def parts_get():
            return self.e.parts

        def animations_get():
            return self.e.animations

        self._prop_source_animations = Property(parent, "source")
        wid = WidgetSource(self, "Animation list", animations_get, popup_hide_cb_list)
        wid.tooltip_set("Accepted signal source.", "Click to select one " "existent<br>animation as source.")
        self._prop_source_animations.widget_add("s", wid)
        self["main"].property_add(self._prop_source_animations)
        self["main"].property_del("source")

        self._prop_source_parts = Property(parent, "source")
        wid = WidgetSource(self, "Parts list", parts_get, popup_hide_cb_list)
        wid.tooltip_set("Accepted signal source.", "Click to select one " "existent<br>part as source.")
        self._prop_source_parts.widget_add("s", wid)
        self["main"].property_add(self._prop_source_parts)

        prop = Property(parent, "delay")
        wid = WidgetEntry(self)
        wid.parser_in = lambda x: str(x)
        wid.parser_out = lambda x: float(x)
        wid.tooltip_set(
            "Fixed delay to do the action in seconds. The<br>total " "delay is sum off fixed and variable delays."
        )
        prop.widget_add("delay", wid)
        wid = WidgetEntry(self)
        wid.parser_in = lambda x: str(x)
        wid.parser_out = lambda x: float(x)
        wid.tooltip_set(
            "Variable delay to do the action in seconds. Will<br>be" " selected one random value between 0 and this."
        )
        prop.widget_add("range", wid)
        self["main"].property_add(prop)

        self.group_add("api")
        prop = Property(parent, "export")
        wid = WidgetBoolean(self)
        wid.tooltip_set("Add this part to exported signals.")
        prop.widget_add("export", wid)
        self["api"].property_add(prop)
        self._prop_api_name = Property(parent, "name")
        wid = WidgetEntry(self)
        wid.tooltip_set("Export name of signal.")
        self._prop_api_name.widget_add("name", wid)
        self["api"].property_add(self._prop_api_name)
        self._prop_api_description = Property(parent, "description")
        wid = WidgetEntry(self)
        wid.tooltip_set("Description of exported signal.")
        self._prop_api_description.widget_add("description", wid)
        self["api"].property_add(self._prop_api_description)

        self.group_add("actions")

        self.group_add("out")

        prop = Property(parent, "signal")
        wid = WidgetSignal(self, popup_hide_object_signal_list=popup_hide_cb_list)
        wid.tooltip_set("Signal to be emmited.", "Click to select one common " "signal to be emmited.")
        prop.widget_add("s", wid)
        self["out"].property_add(prop)

        prop = Property(parent, "source")
        wid = WidgetSource(self, "Parts list", parts_get, popup_hide_cb_list)
        wid.tooltip_set("Name registered as signal source.", "Click to select " "one existent<br>part as source.")
        prop.widget_add("s", wid)
        self["out"].property_add(prop)

        self.e.callback_add("signal.added", self._update)
        self.e.callback_add("signal.removed", self._removed)
        self.e.callback_add("group.changed", self._removed)
        self.e.signal.callback_add("program.changed", self._update)
        self.e.signal.callback_add("program.name.changed", self._update)
        self.e.signal.callback_add("program.unselected", self._removed)

        self.open = True
        self.open_disable = True
        self.show()
        self.__notification = None

    def _header_prop_value_changed(self, prop_name, prop_value, group_name):
        def signal_rename(old_name, new_name):
            # select 1st
            self._context_recall(signal=old_name)

            # rename later
            return self.e.signal.rename(new_name)

        if prop_name != "name":
            return

        old_name = self.e.signal.name
        if signal_rename(old_name, prop_value):
            op = Operation("signal renaming")

            op.redo_callback_add(signal_rename, old_name, prop_value)
            op.undo_callback_add(signal_rename, prop_value, old_name)
            self._operation_stack_cb(op)
        else:
            # TODO: notify the user of renaming failure
            self._header_table["name"].value = old_name

    def _new_action(self, number):
        def programs_get():
            return self.e.programs

        popup_hide_cb_list = [(self.e.signal, "program.unselected"), (self.e.signal, "program.changed")]

        prop = Property(self._parent, "action " + str(number))
        wid = WidgetActionsList(self, "Animations", programs_get, None, popup_hide_cb_list)
        wid.tooltip_set("Animation to be started.<br>Click to select it.")
        prop.widget_add("a", wid)
        self["actions"].property_add(prop)

    def _removed(self, emissor, data):
        self._header_table["name"].value = "Unselected"
        self._header_table["name"].value_obj._values_dict["n"].disabled_set(True)

        self["main"]["signal"].value = ""
        self["main"]["signal"].hide_value()

        self["main"]["source"].value = ""
        self["main"]["source"].hide_value()

        self["main"]["delay"].value = (None, None)
        self["main"]["delay"].hide_value()

        self.group_hide("api")
        self.group_show("api")

        if "name" in self["api"]:
            self["api"]["name"].value = None
            self["api"]["description"].value = None

        self.group_hide("actions")
        self.group_show("actions")

        for i in range(self._actions_added):
            self["actions"]["action " + str(i + 1)].value = ""
            self["actions"]["action " + str(i + 1)].hide_value()

        self.group_hide("out")
        self.group_show("out")

        self["out"]["signal"].value = ""
        self["out"]["signal"].hide_value()

        self["out"]["source"].value = ""
        self["out"]["source"].hide_value()

        self.open_set(False)

    def _update(self, emissor, data):
        self._emissor = emissor
        self._data = data

        self._header_table["name"].value = self.e.signal.name
        self._header_table["name"].show_value()
        self._header_table["name"].value_obj._values_dict["n"].disabled_set(False)

        signal = self.e.signal.signal
        self["main"]["signal"].show_value()
        if signal:
            self["main"]["signal"].value = signal
        else:
            self.e.signal.signal = ""
            self["main"]["signal"].value = ""

        source = self.e.signal.source
        self["main"]["source"].show_value()
        if source:
            self["main"]["source"].value = source
        else:
            self.e.signal.source = ""
            self["main"]["source"].value = ""

        self["main"]["delay"].show_value()
        self["main"]["delay"].value = self.e.signal.in_time

        action = self.e.signal.action

        self._update_api_props(self.e.signal.api_export, self.e.signal.api)
        self.group_hide("api")
        self.group_show("api")

        if action == edje.EDJE_ACTION_TYPE_NONE:
            afters = self.e.signal.afters

            while self._actions_added < len(afters) + 1:
                self._actions_added = self._actions_added + 1
                self._new_action(self._actions_added)

            for i in range(self._actions_added):
                self["actions"]["action " + str(i + 1)].hide()

            for i in range(len(afters)):
                self["actions"]["action " + str(i + 1)].show_value()
                self["actions"]["action " + str(i + 1)].show()
                fixedname = re_anim_program.match(afters[i]).groups()[0]
                self["actions"]["action " + str(i + 1)].value = fixedname
            # The last action with none value
            self["actions"]["action " + str(len(afters) + 1)].show_value()
            self["actions"]["action " + str(len(afters) + 1)].show()
            self["actions"]["action " + str(len(afters) + 1)].value = ""

            self.group_hide("out")
            self.group_hide("actions")
            self.group_show("actions")

        elif action == edje.EDJE_ACTION_TYPE_SIGNAL_EMIT:
            self.group_hide("actions")
            self.group_hide("out")
            self.group_show("out")

            state = self.e.signal.state_get()
            self["out"]["signal"].show_value()
            if state:
                self["out"]["signal"].value = state
            else:
                self["out"]["signal"].value = ""

            state = self.e.signal._program.state2_get()
            self["out"]["source"].show_value()
            if state:
                self["out"]["source"].value = state
            else:
                self["out"]["source"].value = ""

        self.open_set(True)
        self.show()

    def _context_recall(self, **kargs):
        self.e.signal.name = kargs["signal"]

    def _prop_object_get(self):
        return self.e.signal

    def _notify(self, message):
        if self.__notification:
            self.__notification.hide()
            self.__notification.delete()
            self.__notification = None
        self.__notification = Notify(self._parent)
        self.__notification.timeout_set(4)
        self.__notification.orient_set(ELM_NOTIFY_ORIENT_BOTTOM)

        bx = Box(self)
        bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
        bx.horizontal_set(True)
        self.__notification.content_set(bx)
        bx.show()

        lb = Label(self)
        lb.text_set(message)
        bx.pack_end(lb)
        lb.show()

        self.__notification.show()

    def _conflicting_animation_get(self, afters_list, anim):
        if not afters_list or not anim:
            return None
        anim_targets_list = self.e.edje.program_get(anim).targets_get()
        for after in afters_list:
            after_targets_list = self.e.edje.program_get(after).targets_get()
            for target in anim_targets_list:
                if target in after_targets_list:
                    return after
        return None

    def prop_value_changed(self, prop, value, group):
        if group == "main":
            if prop == "signal":
                args = [["main"], [prop], [value], [None], [False], [None]]
                self._prop_change_do("signal's triggering action change", *args)
                self["main"].property_del("source")
                if value == "animation,end":
                    self["main"].property_add(self._prop_source_animations, 1)
                else:
                    self["main"].property_add(self._prop_source_parts, 1)

            elif prop == "source":
                args = [["main"], [prop], [value], [None], [False], [None]]
                self._prop_change_do("signal's source part change", *args)

            elif prop == "delay":
                args = [["main"], [prop], [value], ["in_time"], [False], [None]]
                self._prop_change_do("signal's source delay time change", *args)

        elif group == "actions":

            def afters_change(afters, sig_name):
                self._context_recall(signal=sig_name)

                self.e.signal.afters_clear()
                for i in range(len(afters)):
                    self.e.signal.after_add(afters[i])
                self._update(self._emissor, self._data)

            old_afters = self.e.signal._afters_get()
            new_afters = self.e.signal._afters_get()

            if value in old_afters:
                value = re_anim_program.match(value).groups()[0]
                self._notify("Error: " + value + " is already in the list")
                self._update(self._emissor, self._data)
                return

            action_number = int(re.match("action (\d+)", prop).group(1))

            if value:
                if action_number <= len(new_afters):
                    new_afters[action_number - 1] = value
                else:
                    new_afters.append(value)
            elif action_number <= len(new_afters):
                new_afters.pop(action_number - 1)

            conflicting_after = self._conflicting_animation_get(new_afters, value)
            if conflicting_after and conflicting_after != value:
                conflicting_after = re_anim_program.match(conflicting_after).groups()[0]
                self._notify(
                    "Error: this animation conflicts with " + conflicting_after + ".<br>"
                    "There are parts in common being animated."
                )
                self._update(self._emissor, self._data)
                return

            op = Operation('signal\'s "after" action change')
            op.redo_callback_add(afters_change, new_afters, self.e.signal.name)
            op.undo_callback_add(afters_change, old_afters, self.e.signal.name)
            self._operation_stack_cb(op)
            op.redo()

        elif group == "out":
            if prop == "signal":

                def signal_change(value, sig_name):
                    self._context_recall(signal=sig_name)

                    self.e.signal.signal_emit_action_set(value)
                    self["out"]["signal"].value = value[0]

                val = [value, self["out"]["source"].value]
                old_val = [self.e.signal.state_get() or "", val[1]]

                op = Operation('signal\'s "out" emission change')
                op.redo_callback_add(signal_change, val, self.e.signal.name)
                op.undo_callback_add(signal_change, old_val, self.e.signal.name)
                self._operation_stack_cb(op)
                op.redo()

            elif prop == "source":

                def source_change(value, sig_name):
                    self._context_recall(signal=sig_name)

                    self.e.signal.signal_emit_action_set(value)
                    self["out"]["source"].value = value[1]

                val = [self["out"]["signal"].value, value]
                old_val = [val[0], self.e.signal.state2_get() or ""]

                op = Operation('signal\'s "out" source change')
                op.redo_callback_add(source_change, val, self.e.signal.name)
                op.undo_callback_add(source_change, old_val, self.e.signal.name)
                self._operation_stack_cb(op)
                op.redo()

        elif group == "api":
            if prop == "name":

                def api_name_change(value, sig_name):
                    self._context_recall(signal=sig_name)
                    self.e.signal.api = value
                    self["api"]["name"].value = value[0]

                val = [value, self.e.signal.api[1]]
                old_val = [self.e.signal.api[0], val[1]]

                op = Operation("program's api name change")
                op.redo_callback_add(api_name_change, val, self.e.signal.name)
                op.undo_callback_add(api_name_change, old_val, self.e.signal.name)
                self._operation_stack_cb(op)
                op.redo()

            if prop == "description":

                def api_description_change(value, sig_name):
                    self._context_recall(signal=sig_name)
                    self.e.signal.api = value
                    self["api"]["description"].value = value[1]

                val = [self.e.signal.api[0], value]
                old_val = [val[0], self.e.signal.api[1]]

                op = Operation("program's api description change")
                op.redo_callback_add(api_description_change, val, self.e.signal.name)
                op.undo_callback_add(api_description_change, old_val, self.e.signal.name)
                self._operation_stack_cb(op)
                op.redo()

            if prop == "export":

                def api_export_change(value, sig_name, export):
                    self._context_recall(signal=sig_name)
                    self.e.signal.api_export = export
                    self.e.signal.api = value
                    self._update_api_props(export, value)

                export = value
                old_export = self.e.signal.api_export
                old_val = [self.e.signal.api[0], self.e.signal.api[1]]
                val = [None, None]

                op = Operation("program's api description change")
                op.redo_callback_add(api_export_change, val, self.e.signal.name, export)
                op.undo_callback_add(api_export_change, old_val, self.e.signal.name, old_export)
                self._operation_stack_cb(op)
                op.redo()

    def _update_api_props(self, export, api):
        self["api"]["export"].value = export
        if self["api"]["export"].value:
            if "name" not in self["api"]:
                self["api"].property_add(self._prop_api_name)
                self["api"].property_add(self._prop_api_description)
            self["api"]["name"].value = api[0]
            self["api"]["description"].value = api[1]
        elif "name" in self["api"]:
            self["api"].property_del("name")
            self["api"].property_del("description")
Example #19
0
class PartAnimStateDetails(PartStateDetails):
    def __init__(
        self, parent, operation_stack_cb, img_new_img_cb=None,
        img_list_get_cb=None, img_id_get_cb=None, fnt_new_fnt_cb=None,
        fnt_list_get_cb=None, workfile_name_get_cb=None,
        part_object_get_cb=None, group="editje/collapsable/part_properties"):
        PartStateDetails.__init__(
            self, parent, operation_stack_cb, img_new_img_cb, img_list_get_cb,
            img_id_get_cb, fnt_new_fnt_cb, fnt_list_get_cb,
            workfile_name_get_cb, part_object_get_cb, group)

    def _context_recall(self, **kargs):
        self.e.animation.name = kargs["animation"]
        self.e.animation.state = kargs["time"]
        self.e.part.name = kargs["part"]
        self.e.part.state.name = kargs["state"]

    def _header_init(self, parent):
        self.title = "part frame properties"

        self._header_table = PropertyTable(parent, "part name/type")
        self.content_set("part_state.swallow", self._header_table)

        prop = Property(parent, "name")
        wid = WidgetEntry(self)
        wid.disabled_set(True)
        prop.widget_add("n", wid)
        self._header_table.property_add(prop)

        prop = Property(parent, "type")
        wid = WidgetEntry(self)
        wid.disabled_set(True)
        prop.widget_add("t", wid)
        self._header_table.property_add(prop)

        self._source_prop = Property(parent, "source widget")
        wid = WidgetEntry(self)
        wid.disabled_set(True)
        self._source_prop.widget_add("s", wid)
        self._header_table.property_add(self._source_prop)
        self._source_prop.hide()

        self._module_prop = Property(parent, "module")
        wid = WidgetEntry(self)
        wid.disabled_set(True)
        self._module_prop.widget_add("m", wid)
        self._header_table.property_add(self._module_prop)
        self._module_prop.hide()

        self.content_set("part_name.swallow", self._header_table)
        self.e.animation.callback_add("animation.changed", self._anim_selected)
        self.e.animation.callback_add("animation.unselected",
                                      self._anim_unselected)
        self.e.animation.callback_add("part.added", self._anim_parts_changed)
        self.e.animation.callback_add("part.removed", self._anim_parts_changed)

        self._state_copy_button = StateCopyButton(self.e)

        self.edje_get().signal_callback_add(
            "cl,option,clicked", "editje/collapsable",
            self._state_copy_button._floater_open)

    def _show(self):
        state = self.part_edje.state_selected_get()
        self._header_table["name"].value = self.part_edje.name
        self._header_table["name"].show_value()
        self._header_table["type"].value = \
            part_type_to_text(self.part_edje.type)
        self._header_table["type"].show_value()

        if self.e.part.type == edje.EDJE_PART_TYPE_EXTERNAL:
            source = self.e.part.source
            if source.startswith("elm/"):
                source = source[4:]
                module = "Elementary"
            else:
                module = "Emotion"

            self.edje_get().signal_emit("cl,extra,activate", "")
            if "source widget" not in self._header_table:
                self._header_table.property_add(self._source_prop)
            if "module" not in self._header_table:
                self._header_table.property_add(self._module_prop)

            self._header_table["source widget"].value = source
            self._header_table["source widget"].show_value()
            self._header_table["module"].value = module
            self._header_table["module"].show_value()
        else:
            self._header_extra_hide()

        self.edje_get().signal_emit("cl,option,enable", "editje")
        self.state = self.part_edje.state_get(*state)
        self._update()
        self.show()

    def _header_extra_hide(self):
        self.edje_get().signal_emit("cl,extra,deactivate", "")
        for p in ["source widget", "module"]:
            if p in self._header_table:
                self._header_table.property_del(p)

    def _hide(self):
        self._header_table["name"].value = None
        self._header_table["name"].hide_value()
        self._header_table["type"].value = None
        self._header_table["type"].hide_value()
        self._header_extra_hide()

        self.edje_get().signal_emit("cl,option,disable", "editje")
        self._hide_all()
        self.hide()

    def _check_and_show(self):
        anim = self.e.animation
        part = self.e.part
        ret = anim.name and anim.part_belongs(part.name)
        if ret:
            self._show()
        else:
            self._hide()
        return ret

    def _part_update(self, emissor, data):
        if self.part_evas:
            self.part_evas.on_resize_del(self._size_changed)
        self.part_edje = self.e.part._part
        self.part_evas = self._part_object_get_cb(self.part_edje.name)
        self.part_evas.on_resize_add(self._size_changed)
        self._size_changed(self.part_evas)

        self._check_and_show()

    def _part_unselected(self, emissor, data):
        if self.part_evas:
            self.part_evas.on_resize_del(self._size_changed)

        self.part_evas = None
        self.part_edje = None
        self._hide()

    def _anim_selected(self, emissor, data):
        self._check_and_show()

    def _anim_unselected(self, emissor, data):
        self._hide()

    def _anim_parts_changed(self, emissor, data):
        self._check_and_show()

    def _state_changed_cb(self, emissor, data):
        if not data:
            return
        self.part_edje.state_selected_set(*data)
        self.state = self.e.part.state._state
        if self._check_and_show():
            self._update()
Example #20
0
    def _rel_props_create(self):
        rel_to_box_title = "Placement reference"

        self.group_add("rel1")
        self.group_title_set("rel1", "top-left")

        def parts_get():
            return self.e.parts

        def sel_part_get():
            return self.e.part.name

        popup_hide_cb_list = [(self.e.part, "part.unselected"),
                              (self.e.part, "part.changed")]

        prop = Property(self._parent, "to")
        wid = WidgetButtonList(self, rel_to_box_title, parts_get, sel_part_get,
                               popup_hide_cb_list)
        wid.tooltip_set("Left reference part.")
        prop.widget_add("x", wid)
        wid = WidgetButtonList(
                self, rel_to_box_title, parts_get, sel_part_get,
                popup_hide_cb_list)
        wid.tooltip_set("Top reference part.")
        prop.widget_add("y", wid)
        self["rel1"].property_add(prop)

        prop = Property(self._parent, "relative")
        wid = WidgetEntry(self)
        wid.type_float()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: float(x)
        wid.tooltip_set("Left relative position to<br>"
                        "reference part.<br>"
                        "0.0 = 0%/begining  1.0 = 100%/end")
        prop.widget_add("x", wid)
        wid = WidgetEntry(self)
        wid.type_float()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: float(x)
        wid.tooltip_set("Top relative position to<br>"
                        "reference part.<br>"
                        "0.0 = 0%/begining  1.0 = 100%/end")
        prop.widget_add("y", wid)
        self["rel1"].property_add(prop)

        prop = Property(self._parent, "offset")
        wid = WidgetEntry(self)
        wid.type_int()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: int(x)
        wid.tooltip_set("Left offset from relative<br>"
                        "position in pixels.")
        prop.widget_add("x", wid)
        wid = WidgetEntry(self)
        wid.type_int()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: int(x)
        wid.tooltip_set("Top offset from relative<br>"
                        "position in pixels.")
        prop.widget_add("y", wid)
        self["rel1"].property_add(prop)

        self.group_add("rel2")
        self.group_title_set("rel2", "bottom-right")

        prop = Property(self._parent, "to")
        wid = WidgetButtonList(
                self, rel_to_box_title, parts_get, sel_part_get,
                popup_hide_cb_list)
        wid.tooltip_set("Right reference part.")
        prop.widget_add("x", wid)
        wid = WidgetButtonList(
                self, rel_to_box_title, parts_get, sel_part_get,
                popup_hide_cb_list)
        wid.tooltip_set("Bottom reference part.")
        prop.widget_add("y", wid)
        self["rel2"].property_add(prop)

        prop = Property(self._parent, "relative")
        wid = WidgetEntry(self)
        wid.type_float()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: float(x)
        wid.tooltip_set("Right relative position to<br>"
                        "reference part.<br>"
                        "0.0 = 0%/begining  1.0 = 100%/end")
        prop.widget_add("x", wid)
        wid = WidgetEntry(self)
        wid.type_float()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: float(x)
        wid.tooltip_set("Bottom relative position to<br>"
                        "reference part.<br>"
                        "0.0 = 0%/begining  1.0 = 100%/end")
        prop.widget_add("y", wid)
        self["rel2"].property_add(prop)

        prop = Property(self._parent, "offset")
        wid = WidgetEntry(self)
        wid.type_int()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: int(x)
        prop.widget_add("x", wid)
        wid.tooltip_set("Right offset from relative<br>"
                        "position in pixels.<br>"
                        "default = -1 (see docs)")
        wid = WidgetEntry(self)
        wid.type_int()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: int(x)
        wid.tooltip_set("Bottom offset from relative<br>"
                        "position in pixels.<br>"
                        "default = -1 (see docs)")
        prop.widget_add("y", wid)
        self["rel2"].property_add(prop)
Example #21
0
    def __init__(self, parent, operation_stack_cb):
        EditjeDetails.__init__(self, parent, operation_stack_cb)

        self.title = "group"
        self.open_disable = True

        prop = Property(parent, "min")
        wid = WidgetEntry(self)
        wid.type_int()
        wid.tooltip_set("Minimum group<br>width in pixels.")
        prop.widget_add("w", wid)
        wid = WidgetEntry(self)
        wid.type_int()
        wid.tooltip_set("Minimum group<br>height in pixels.")
        prop.widget_add("h", wid)
        self["main"].property_add(prop)
        self.e.callback_add("group.min.changed", self._min_update)

        prop = Property(parent, "max")
        wid = WidgetEntry(self)
        wid.type_int()
        wid.tooltip_set("Maximum group<br>width in pixels.<br>0 = disabled")
        prop.widget_add("w", wid)
        wid = WidgetEntry(self)
        wid.type_int()
        wid.tooltip_set("Maximum group<br>height in pixels.<br>0 = disabled")
        prop.widget_add("h", wid)
        self["main"].property_add(prop)
        self.e.callback_add("group.max.changed", self._max_update)

        prop = Property(parent, "current")
        wid = WidgetEntry(self)
        wid.type_int()
        wid.tooltip_set("Actual group<br>width in pixels.")
        prop.widget_add("w", wid)
        wid = WidgetEntry(self)
        wid.type_int()
        wid.tooltip_set("Actual group<br>height in pixels.")
        prop.widget_add("h", wid)
        self["main"].property_add(prop)
        self.e.callback_add("group.size.changed", self._group_update)
Example #22
0
    def __init__(self, parent, operation_stack_cb):
        EditjeDetails.__init__(self,
                               parent,
                               operation_stack_cb,
                               group="editje/collapsable/part_state")

        self.title = "signal"

        self._parent = parent
        self._actions_added = 0

        self._header_table = PropertyTable(parent, "signal name",
                                           self._header_prop_value_changed)
        self.content_set("part_state.swallow", self._header_table)
        self.focus_custom_chain_set([self._header_table, self._box])

        prop = Property(parent, "name")
        wid = WidgetEntry(self)
        wid.tooltip_set("Unique signal name.")
        prop.widget_add("n", wid)
        self._header_table.property_add(prop)

        popup_hide_cb_list = [(self.e.signal, "program.unselected"),
                              (self.e.signal, "program.changed")]

        prop = Property(parent, "signal")
        wid = WidgetSignal(self,
                           popup_hide_object_signal_list=popup_hide_cb_list)
        wid.tooltip_set(
            "Signal to be received.", "Click to select one common"
            "<br>signal to be received.")
        prop.widget_add("s", wid)
        self["main"].property_add(prop)

        def parts_get():
            return self.e.parts

        def animations_get():
            return self.e.animations

        self._prop_source_animations = Property(parent, "source")
        wid = WidgetSource(self, "Animation list", animations_get,
                           popup_hide_cb_list)
        wid.tooltip_set(
            "Accepted signal source.", "Click to select one "
            "existent<br>animation as source.")
        self._prop_source_animations.widget_add("s", wid)
        self["main"].property_add(self._prop_source_animations)
        self["main"].property_del("source")

        self._prop_source_parts = Property(parent, "source")
        wid = WidgetSource(self, "Parts list", parts_get, popup_hide_cb_list)
        wid.tooltip_set("Accepted signal source.", "Click to select one "
                        "existent<br>part as source.")
        self._prop_source_parts.widget_add("s", wid)
        self["main"].property_add(self._prop_source_parts)

        prop = Property(parent, "delay")
        wid = WidgetEntry(self)
        wid.parser_in = lambda x: str(x)
        wid.parser_out = lambda x: float(x)
        wid.tooltip_set(
            "Fixed delay to do the action in seconds. The<br>total "
            "delay is sum off fixed and variable delays.")
        prop.widget_add("delay", wid)
        wid = WidgetEntry(self)
        wid.parser_in = lambda x: str(x)
        wid.parser_out = lambda x: float(x)
        wid.tooltip_set(
            "Variable delay to do the action in seconds. Will<br>be"
            " selected one random value between 0 and this.")
        prop.widget_add("range", wid)
        self["main"].property_add(prop)

        self.group_add("api")
        prop = Property(parent, "export")
        wid = WidgetBoolean(self)
        wid.tooltip_set("Add this part to exported signals.")
        prop.widget_add("export", wid)
        self["api"].property_add(prop)
        self._prop_api_name = Property(parent, "name")
        wid = WidgetEntry(self)
        wid.tooltip_set("Export name of signal.")
        self._prop_api_name.widget_add("name", wid)
        self["api"].property_add(self._prop_api_name)
        self._prop_api_description = Property(parent, "description")
        wid = WidgetEntry(self)
        wid.tooltip_set("Description of exported signal.")
        self._prop_api_description.widget_add("description", wid)
        self["api"].property_add(self._prop_api_description)

        self.group_add("actions")

        self.group_add("out")

        prop = Property(parent, "signal")
        wid = WidgetSignal(self,
                           popup_hide_object_signal_list=popup_hide_cb_list)
        wid.tooltip_set("Signal to be emmited.", "Click to select one common "
                        "signal to be emmited.")
        prop.widget_add("s", wid)
        self["out"].property_add(prop)

        prop = Property(parent, "source")
        wid = WidgetSource(self, "Parts list", parts_get, popup_hide_cb_list)
        wid.tooltip_set("Name registered as signal source.", "Click to select "
                        "one existent<br>part as source.")
        prop.widget_add("s", wid)
        self["out"].property_add(prop)

        self.e.callback_add("signal.added", self._update)
        self.e.callback_add("signal.removed", self._removed)
        self.e.callback_add("group.changed", self._removed)
        self.e.signal.callback_add("program.changed", self._update)
        self.e.signal.callback_add("program.name.changed", self._update)
        self.e.signal.callback_add("program.unselected", self._removed)

        self.open = True
        self.open_disable = True
        self.show()
        self.__notification = None
Example #23
0
class SignalDetails(EditjeDetails):
    def __init__(self, parent, operation_stack_cb):
        EditjeDetails.__init__(self,
                               parent,
                               operation_stack_cb,
                               group="editje/collapsable/part_state")

        self.title = "signal"

        self._parent = parent
        self._actions_added = 0

        self._header_table = PropertyTable(parent, "signal name",
                                           self._header_prop_value_changed)
        self.content_set("part_state.swallow", self._header_table)
        self.focus_custom_chain_set([self._header_table, self._box])

        prop = Property(parent, "name")
        wid = WidgetEntry(self)
        wid.tooltip_set("Unique signal name.")
        prop.widget_add("n", wid)
        self._header_table.property_add(prop)

        popup_hide_cb_list = [(self.e.signal, "program.unselected"),
                              (self.e.signal, "program.changed")]

        prop = Property(parent, "signal")
        wid = WidgetSignal(self,
                           popup_hide_object_signal_list=popup_hide_cb_list)
        wid.tooltip_set(
            "Signal to be received.", "Click to select one common"
            "<br>signal to be received.")
        prop.widget_add("s", wid)
        self["main"].property_add(prop)

        def parts_get():
            return self.e.parts

        def animations_get():
            return self.e.animations

        self._prop_source_animations = Property(parent, "source")
        wid = WidgetSource(self, "Animation list", animations_get,
                           popup_hide_cb_list)
        wid.tooltip_set(
            "Accepted signal source.", "Click to select one "
            "existent<br>animation as source.")
        self._prop_source_animations.widget_add("s", wid)
        self["main"].property_add(self._prop_source_animations)
        self["main"].property_del("source")

        self._prop_source_parts = Property(parent, "source")
        wid = WidgetSource(self, "Parts list", parts_get, popup_hide_cb_list)
        wid.tooltip_set("Accepted signal source.", "Click to select one "
                        "existent<br>part as source.")
        self._prop_source_parts.widget_add("s", wid)
        self["main"].property_add(self._prop_source_parts)

        prop = Property(parent, "delay")
        wid = WidgetEntry(self)
        wid.parser_in = lambda x: str(x)
        wid.parser_out = lambda x: float(x)
        wid.tooltip_set(
            "Fixed delay to do the action in seconds. The<br>total "
            "delay is sum off fixed and variable delays.")
        prop.widget_add("delay", wid)
        wid = WidgetEntry(self)
        wid.parser_in = lambda x: str(x)
        wid.parser_out = lambda x: float(x)
        wid.tooltip_set(
            "Variable delay to do the action in seconds. Will<br>be"
            " selected one random value between 0 and this.")
        prop.widget_add("range", wid)
        self["main"].property_add(prop)

        self.group_add("api")
        prop = Property(parent, "export")
        wid = WidgetBoolean(self)
        wid.tooltip_set("Add this part to exported signals.")
        prop.widget_add("export", wid)
        self["api"].property_add(prop)
        self._prop_api_name = Property(parent, "name")
        wid = WidgetEntry(self)
        wid.tooltip_set("Export name of signal.")
        self._prop_api_name.widget_add("name", wid)
        self["api"].property_add(self._prop_api_name)
        self._prop_api_description = Property(parent, "description")
        wid = WidgetEntry(self)
        wid.tooltip_set("Description of exported signal.")
        self._prop_api_description.widget_add("description", wid)
        self["api"].property_add(self._prop_api_description)

        self.group_add("actions")

        self.group_add("out")

        prop = Property(parent, "signal")
        wid = WidgetSignal(self,
                           popup_hide_object_signal_list=popup_hide_cb_list)
        wid.tooltip_set("Signal to be emmited.", "Click to select one common "
                        "signal to be emmited.")
        prop.widget_add("s", wid)
        self["out"].property_add(prop)

        prop = Property(parent, "source")
        wid = WidgetSource(self, "Parts list", parts_get, popup_hide_cb_list)
        wid.tooltip_set("Name registered as signal source.", "Click to select "
                        "one existent<br>part as source.")
        prop.widget_add("s", wid)
        self["out"].property_add(prop)

        self.e.callback_add("signal.added", self._update)
        self.e.callback_add("signal.removed", self._removed)
        self.e.callback_add("group.changed", self._removed)
        self.e.signal.callback_add("program.changed", self._update)
        self.e.signal.callback_add("program.name.changed", self._update)
        self.e.signal.callback_add("program.unselected", self._removed)

        self.open = True
        self.open_disable = True
        self.show()
        self.__notification = None

    def _header_prop_value_changed(self, prop_name, prop_value, group_name):
        def signal_rename(old_name, new_name):
            # select 1st
            self._context_recall(signal=old_name)

            # rename later
            return self.e.signal.rename(new_name)

        if prop_name != "name":
            return

        old_name = self.e.signal.name
        if signal_rename(old_name, prop_value):
            op = Operation("signal renaming")

            op.redo_callback_add(signal_rename, old_name, prop_value)
            op.undo_callback_add(signal_rename, prop_value, old_name)
            self._operation_stack_cb(op)
        else:
            # TODO: notify the user of renaming failure
            self._header_table["name"].value = old_name

    def _new_action(self, number):
        def programs_get():
            return self.e.programs

        popup_hide_cb_list = [(self.e.signal, "program.unselected"),
                              (self.e.signal, "program.changed")]

        prop = Property(self._parent, "action " + str(number))
        wid = WidgetActionsList(self, "Animations", programs_get, None,
                                popup_hide_cb_list)
        wid.tooltip_set("Animation to be started.<br>Click to select it.")
        prop.widget_add("a", wid)
        self["actions"].property_add(prop)

    def _removed(self, emissor, data):
        self._header_table["name"].value = "Unselected"
        self._header_table["name"].value_obj._values_dict["n"].disabled_set(
            True)

        self["main"]["signal"].value = ""
        self["main"]["signal"].hide_value()

        self["main"]["source"].value = ""
        self["main"]["source"].hide_value()

        self["main"]["delay"].value = (None, None)
        self["main"]["delay"].hide_value()

        self.group_hide("api")
        self.group_show("api")

        if "name" in self["api"]:
            self["api"]["name"].value = None
            self["api"]["description"].value = None

        self.group_hide("actions")
        self.group_show("actions")

        for i in range(self._actions_added):
            self["actions"]["action " + str(i + 1)].value = ""
            self["actions"]["action " + str(i + 1)].hide_value()

        self.group_hide("out")
        self.group_show("out")

        self["out"]["signal"].value = ""
        self["out"]["signal"].hide_value()

        self["out"]["source"].value = ""
        self["out"]["source"].hide_value()

        self.open_set(False)

    def _update(self, emissor, data):
        self._emissor = emissor
        self._data = data

        self._header_table["name"].value = self.e.signal.name
        self._header_table["name"].show_value()
        self._header_table["name"].value_obj._values_dict["n"].disabled_set(
            False)

        signal = self.e.signal.signal
        self["main"]["signal"].show_value()
        if signal:
            self["main"]["signal"].value = signal
        else:
            self.e.signal.signal = ""
            self["main"]["signal"].value = ""

        source = self.e.signal.source
        self["main"]["source"].show_value()
        if source:
            self["main"]["source"].value = source
        else:
            self.e.signal.source = ""
            self["main"]["source"].value = ""

        self["main"]["delay"].show_value()
        self["main"]["delay"].value = self.e.signal.in_time

        action = self.e.signal.action

        self._update_api_props(self.e.signal.api_export, self.e.signal.api)
        self.group_hide("api")
        self.group_show("api")

        if action == edje.EDJE_ACTION_TYPE_NONE:
            afters = self.e.signal.afters

            while (self._actions_added < len(afters) + 1):
                self._actions_added = self._actions_added + 1
                self._new_action(self._actions_added)

            for i in range(self._actions_added):
                self["actions"]["action " + str(i + 1)].hide()

            for i in range(len(afters)):
                self["actions"]["action " + str(i + 1)].show_value()
                self["actions"]["action " + str(i + 1)].show()
                fixedname = re_anim_program.match(afters[i]).groups()[0]
                self["actions"]["action " + str(i + 1)].value = fixedname
            # The last action with none value
            self["actions"]["action " + str(len(afters) + 1)].show_value()
            self["actions"]["action " + str(len(afters) + 1)].show()
            self["actions"]["action " + str(len(afters) + 1)].value = ""

            self.group_hide("out")
            self.group_hide("actions")
            self.group_show("actions")

        elif action == edje.EDJE_ACTION_TYPE_SIGNAL_EMIT:
            self.group_hide("actions")
            self.group_hide("out")
            self.group_show("out")

            state = self.e.signal.state_get()
            self["out"]["signal"].show_value()
            if state:
                self["out"]["signal"].value = state
            else:
                self["out"]["signal"].value = ""

            state = self.e.signal._program.state2_get()
            self["out"]["source"].show_value()
            if state:
                self["out"]["source"].value = state
            else:
                self["out"]["source"].value = ""

        self.open_set(True)
        self.show()

    def _context_recall(self, **kargs):
        self.e.signal.name = kargs["signal"]

    def _prop_object_get(self):
        return self.e.signal

    def _notify(self, message):
        if self.__notification:
            self.__notification.hide()
            self.__notification.delete()
            self.__notification = None
        self.__notification = Notify(self._parent)
        self.__notification.timeout_set(4)
        self.__notification.orient_set(ELM_NOTIFY_ORIENT_BOTTOM)

        bx = Box(self)
        bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
        bx.horizontal_set(True)
        self.__notification.content_set(bx)
        bx.show()

        lb = Label(self)
        lb.text_set(message)
        bx.pack_end(lb)
        lb.show()

        self.__notification.show()

    def _conflicting_animation_get(self, afters_list, anim):
        if not afters_list or not anim:
            return None
        anim_targets_list = self.e.edje.program_get(anim).targets_get()
        for after in afters_list:
            after_targets_list = self.e.edje.program_get(after).targets_get()
            for target in anim_targets_list:
                if target in after_targets_list:
                    return after
        return None

    def prop_value_changed(self, prop, value, group):
        if group == "main":
            if prop == "signal":
                args = [["main"], [prop], [value], [None], [False], [None]]
                self._prop_change_do("signal's triggering action change",
                                     *args)
                self["main"].property_del("source")
                if value == "animation,end":
                    self["main"].property_add(self._prop_source_animations, 1)
                else:
                    self["main"].property_add(self._prop_source_parts, 1)

            elif prop == "source":
                args = [["main"], [prop], [value], [None], [False], [None]]
                self._prop_change_do("signal's source part change", *args)

            elif prop == "delay":
                args = [["main"], [prop], [value], ["in_time"], [False],
                        [None]]
                self._prop_change_do("signal's source delay time change",
                                     *args)

        elif group == "actions":

            def afters_change(afters, sig_name):
                self._context_recall(signal=sig_name)

                self.e.signal.afters_clear()
                for i in range(len(afters)):
                    self.e.signal.after_add(afters[i])
                self._update(self._emissor, self._data)

            old_afters = self.e.signal._afters_get()
            new_afters = self.e.signal._afters_get()

            if value in old_afters:
                value = re_anim_program.match(value).groups()[0]
                self._notify("Error: " + value + " is already in the list")
                self._update(self._emissor, self._data)
                return

            action_number = int(re.match("action (\d+)", prop).group(1))

            if value:
                if action_number <= len(new_afters):
                    new_afters[action_number - 1] = value
                else:
                    new_afters.append(value)
            elif action_number <= len(new_afters):
                new_afters.pop(action_number - 1)

            conflicting_after = self._conflicting_animation_get(
                new_afters, value)
            if conflicting_after and conflicting_after != value:
                conflicting_after = re_anim_program.match(
                    conflicting_after).groups()[0]
                self._notify("Error: this animation conflicts with " +
                             conflicting_after + ".<br>"
                             "There are parts in common being animated.")
                self._update(self._emissor, self._data)
                return

            op = Operation("signal's \"after\" action change")
            op.redo_callback_add(afters_change, new_afters, self.e.signal.name)
            op.undo_callback_add(afters_change, old_afters, self.e.signal.name)
            self._operation_stack_cb(op)
            op.redo()

        elif group == "out":
            if prop == "signal":

                def signal_change(value, sig_name):
                    self._context_recall(signal=sig_name)

                    self.e.signal.signal_emit_action_set(value)
                    self["out"]["signal"].value = value[0]

                val = [value, self["out"]["source"].value]
                old_val = [self.e.signal.state_get() or "", val[1]]

                op = Operation("signal's \"out\" emission change")
                op.redo_callback_add(signal_change, val, self.e.signal.name)
                op.undo_callback_add(signal_change, old_val,
                                     self.e.signal.name)
                self._operation_stack_cb(op)
                op.redo()

            elif prop == "source":

                def source_change(value, sig_name):
                    self._context_recall(signal=sig_name)

                    self.e.signal.signal_emit_action_set(value)
                    self["out"]["source"].value = value[1]

                val = [self["out"]["signal"].value, value]
                old_val = [val[0], self.e.signal.state2_get() or ""]

                op = Operation("signal's \"out\" source change")
                op.redo_callback_add(source_change, val, self.e.signal.name)
                op.undo_callback_add(source_change, old_val,
                                     self.e.signal.name)
                self._operation_stack_cb(op)
                op.redo()

        elif group == "api":
            if prop == "name":

                def api_name_change(value, sig_name):
                    self._context_recall(signal=sig_name)
                    self.e.signal.api = value
                    self["api"]["name"].value = value[0]

                val = [value, self.e.signal.api[1]]
                old_val = [self.e.signal.api[0], val[1]]

                op = Operation("program's api name change")
                op.redo_callback_add(api_name_change, val, self.e.signal.name)
                op.undo_callback_add(api_name_change, old_val,
                                     self.e.signal.name)
                self._operation_stack_cb(op)
                op.redo()

            if prop == "description":

                def api_description_change(value, sig_name):
                    self._context_recall(signal=sig_name)
                    self.e.signal.api = value
                    self["api"]["description"].value = value[1]

                val = [self.e.signal.api[0], value]
                old_val = [val[0], self.e.signal.api[1]]

                op = Operation("program's api description change")
                op.redo_callback_add(api_description_change, val,
                                     self.e.signal.name)
                op.undo_callback_add(api_description_change, old_val,
                                     self.e.signal.name)
                self._operation_stack_cb(op)
                op.redo()

            if prop == "export":

                def api_export_change(value, sig_name, export):
                    self._context_recall(signal=sig_name)
                    self.e.signal.api_export = export
                    self.e.signal.api = value
                    self._update_api_props(export, value)

                export = value
                old_export = self.e.signal.api_export
                old_val = [self.e.signal.api[0], self.e.signal.api[1]]
                val = [None, None]

                op = Operation("program's api description change")
                op.redo_callback_add(api_export_change, val,
                                     self.e.signal.name, export)
                op.undo_callback_add(api_export_change, old_val,
                                     self.e.signal.name, old_export)
                self._operation_stack_cb(op)
                op.redo()

    def _update_api_props(self, export, api):
        self["api"]["export"].value = export
        if self["api"]["export"].value:
            if "name" not in self["api"]:
                self["api"].property_add(self._prop_api_name)
                self["api"].property_add(self._prop_api_description)
            self["api"]["name"].value = api[0]
            self["api"]["description"].value = api[1]
        elif "name" in self["api"]:
            self["api"].property_del("name")
            self["api"].property_del("description")
Example #24
0
    def _text_props_create(self):
        self.group_add("text")
        # missing: text_class
        # not implemented in edje_edit: min, max

        prop = Property(self._parent, "text")
        wid = WidgetEntry(self)
        wid.tooltip_set("Set the text of part.")
        prop.widget_add("t", wid)
        self["text"].property_add(prop)

        prop = Property(self._parent, "font")
        wid = WidgetFont(self._parent, \
                         self._fnt_new_fnt_cb, self._fnt_list_get_cb, \
                         self._workfile_name_get_cb)
        wid.tooltip_set("Change the text's font.")
        prop.widget_add("f", wid)
        self["text"].property_add(prop)

        prop = Property(self._parent, "size")
        wid = WidgetEntry(self)
        wid.type_int()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: int(x)
        wid.tooltip_set("Change text font's size.")
        prop.widget_add("s", wid)
        self["text"].property_add(prop)

        prop = Property(self._parent, "fit")
        prop.widget_add("x", WidgetBoolean(self))
        prop.widget_add("y", WidgetBoolean(self))
        self["text"].property_add(prop)

        prop = Property(self._parent, "align")
        wid = WidgetEntry(self)
        wid.type_float()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: float(x)
        wid.tooltip_set("Text horizontal align.<br>0.0 = left  1.0 = right")
        prop.widget_add("x", wid)
        wid = WidgetEntry(self)
        wid.type_float()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: float(x)
        wid.tooltip_set("Text vertical align.<br>0.0 = top  1.0 = bottom")
        prop.widget_add("y", wid)
        self["text"].property_add(prop)

        prop = Property(self._parent, "elipsis")
        wid = WidgetEntry(self)
        wid.type_float()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: float(x)
        wid.tooltip_set("Cut text if biggest then part's area.<br>"
                        "0.0 = fix the left side  1.0 = right side")
        prop.widget_add("e", wid)
        self["text"].property_add(prop)

        prop = Property(self._parent, "color2")
        wid = WidgetColor(self, self.e)
        wid.tooltip_set("Text shadow color.<br>"
                        "Enter color in integers or<br>"
                        "in Hexa notation.",
                        "Preview of text shadow color.<br>"
                        "Click to edit it.")
        prop.widget_add("c", wid)
        self["text"].property_add(prop)

        prop = Property(self._parent, "color3")
        wid = WidgetColor(self, self.e)
        wid.tooltip_set("Text outline color.<br>"
                        "Enter color in integers or<br>"
                        "in Hexa notation.",
                        "Preview of text outline color.<br>"
                        "Click to edit it.")
        prop.widget_add("c", wid)
        self["text"].property_add(prop)
Example #25
0
    def _common_props_create(self):
        prop = Property(self._parent, "min")
        wid = WidgetEntry(self)
        wid.type_int()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: int(x)
        wid.tooltip_set("Minimum part<br>width in pixels.")
        prop.widget_add("w", wid)
        wid = WidgetEntry(self)
        wid.type_int()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: int(x)
        wid.tooltip_set("Minimum part<br>height in pixels.")
        prop.widget_add("h", wid)
        self["main"].property_add(prop)

        prop = Property(self._parent, "max")
        wid = WidgetEntry(self)
        wid.type_int()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: int(x)
        wid.tooltip_set("Maximum part<br>width in pixels.<br>0 = disabled")
        prop.widget_add("w", wid)
        wid = WidgetEntry(self)
        wid.type_int()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: int(x)
        wid.tooltip_set("Maximum part<br>height in pixels.<br>0 = disabled")
        prop.widget_add("h", wid)
        self["main"].property_add(prop)

        # 'step' not implemented in edje_edit

        prop = Property(self._parent, "current")
        wid = WidgetEntry(self)
        wid.disabled_set(True)
        wid.type_int()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: int(x)
        wid.tooltip_set("Current part<br>height in pixels.")
        prop.widget_add("w", wid)
        wid = WidgetEntry(self)
        wid.disabled_set(True)
        wid.type_int()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: int(x)
        wid.tooltip_set("Current part<br>width in pixels.")
        prop.widget_add("h", wid)
        self["main"].property_add(prop)

        prop = Property(self._parent, "visible")
        wid = WidgetBoolean(self)
        wid.tooltip_set("Change part's visibility.")
        prop.widget_add("v", wid)
        self["main"].property_add(prop)

        prop = Property(self._parent, "align")
        wid = WidgetEntry(self)
        wid.type_float()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: float(x)
        wid.tooltip_set("Part horizontal align.<br>0.0 = left  1.0 = right")
        prop.widget_add("x", wid)
        wid = WidgetEntry(self)
        wid.type_float()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: float(x)
        wid.tooltip_set("Part vertical align.<br>0.0 = top  1.0 = bottom")
        prop.widget_add("y", wid)
        self["main"].property_add(prop)

        # 'fixed' not implemented in edje_edit
        # 'aspect' and 'aspect_preference' missing

        prop = Property(self._parent, "color")
        wid = WidgetColor(self, self.e)
        wid.tooltip_set(
            "Part main color.<br>"
            "Enter color in integers or<br>"
            "in Hexa notation.", "Preview of main color.<br>"
            "Click to edit it.")
        prop.widget_add("c", wid)
        self["main"].property_add(prop)
Example #26
0
    def _image_props_create(self):
        self.group_add("image")

        prop = Property(self._parent, "normal")
        wid = WidgetButton(self)
        wid.clicked = self._image_btn_clicked
        wid.tooltip_set("Actual image.<br>Click to change it.")
        prop.widget_add("n", wid)
        self["image"].property_add(prop)

        prop = Property(self._parent, "border")
        wid = WidgetEntry(self)
        wid.type_int()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: int(x)
        wid.tooltip_set("Lenght of left border in pixels.<br>"
                        "Left border isn't horizontal scalable.")
        prop.widget_add("l", wid)
        wid = WidgetEntry(self)
        wid.type_int()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: int(x)
        wid.tooltip_set("Lenght of right border in pixels.<br>"
                        "Right border isn't horizontal scalable.")
        prop.widget_add("r", wid)
        wid = WidgetEntry(self)
        wid.type_int()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: int(x)
        wid.tooltip_set("Lenght of top border in pixels.<br>"
                        "Top border isn't vertical scalable.")
        prop.widget_add("t", wid)
        wid = WidgetEntry(self)
        wid.type_int()
        #wid.parser_in = lambda x: str(x)
        #wid.parser_out = lambda x: int(x)
        wid.tooltip_set("Lenght of bottom border in pixels.<br>"
                        "Bottom border isn't vertical scalable.")
        prop.widget_add("b", wid)
        self["image"].property_add(prop)

        prop = Property(self._parent, "middle")
        wid = WidgetBoolean(self)
        wid.states_set("Solid", "None")
        wid.tooltip_set("Enables painting of image middle.<br>"
                        "If 'None', the image middle is hidden.")
        prop.widget_add("m", wid)
        self["image"].property_add(prop)

        prop = Property(self._parent, "aspect_pref")
        wid = WidgetCombo(self)
        for null, i in enumerate(self._aspect_prefs):
            wid.item_add(i)
        #FIXME: the 'aspect' property is not yet exposed ;)
        wid.tooltip_set("Sets the scope of the \"aspect\" property to " +
                        "a given dimension")
        prop.widget_add("a", wid)
        self["image"].property_add(prop)