How to use the aeidon.deco function in aeidon

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

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

github otsaloma / gaupol / gaupol / agents / help.py View on Github external
    @aeidon.deco.export
    def _on_report_a_bug_activate(self, *args):
        """Open web browser to submit a bug report."""
        gaupol.util.show_uri(gaupol.BUG_REPORT_URL)
github otsaloma / gaupol / gaupol / agents / audio.py View on Github external
    @aeidon.deco.export
    def _on_volume_up_activate(self, *args):
        """Increase volume."""
        self.player.volume = self.player.volume + 0.05
        self.volume_button.set_value(self.player.volume)
        self.update_gui()
github otsaloma / gaupol / gaupol / renderers / float.py View on Github external
    @aeidon.deco.memoize(1000)
    def _text_to_markup(self, text):
        """Return `text` renderer as markup for display."""
        if not text: return ""
        has_comma = text.find(",") > 0
        if has_comma:
            text = text.replace(",", ".")
        text = self._format.format(float(text))
        if has_comma:
            text = text.replace(".", ",")
        return GLib.markup_escape_text(text)
github otsaloma / gaupol / gaupol / agents / open.py View on Github external
    @aeidon.deco.export
    def add_to_recent_files(self, path, format, doc):
        """Add `path` to recent files managed by the recent manager."""
        # XXX: The group field is not available for Python,
        # we cannot differentiate between main and translation files.
        # https://bugzilla.gnome.org/show_bug.cgi?id=695970
        uri = aeidon.util.path_to_uri(path)
        recent = Gtk.RecentData()
        recent.mime_type = format.mime_type
        recent.app_name = "gaupol"
        recent.app_exec = "gaupol %F"
        self.recent_manager.add_full(uri, recent)
github otsaloma / gaupol / aeidon / agents / register.py View on Github external
    @aeidon.deco.export
    def group_actions(self, register, count, description):
        """Group the registered actions as one item in the stack."""
        if register is None: return
        action_group = aeidon.RevertableActionGroup()
        action_group.actions = []
        action_group.description = description
        stack = self._get_destination_stack(register)
        for i in range(count):
            action = stack.pop(0)
            if isinstance(action, aeidon.RevertableActionGroup):
                action_group.actions.extend(action.actions)
            else: # Single action
                action_group.actions.append(action)
        stack.insert(0, action_group)
github otsaloma / gaupol / aeidon / agents / edit.py View on Github external
    @aeidon.deco.revertable
    @aeidon.deco.notify_frozen
    def _insert_blank_subtitles(self, indices, register=-1):
        """Insert new blank subtitles at `indices`."""
        for rindices in aeidon.util.get_ranges(indices):
            first_start = 0.0
            if self.subtitles:
                start = self.subtitles[0].start_seconds
                first_start = 0.0 if start >= 0 else start - 3.0
                if rindices[0] > 0:
                    subtitle = self.subtitles[rindices[0] - 1]
                    first_start = subtitle.end_seconds
            duration = 3.0
            if rindices[0] < len(self.subtitles):
                subtitle = self.subtitles[rindices[0]]
                window = subtitle.start_seconds - first_start
                duration = window / len(rindices)
github otsaloma / gaupol / aeidon / locales.py View on Github external
@aeidon.deco.once
def get_system_modifier():
    """Return the system default script modifier or ``None``."""
    for name in ("LANGUAGE", "LC_ALL", "LC_MESSAGES", "LANG"):
        value = os.environ.get(name, None)
        if value and value.count("@") == 1:
            i = value.index("@")
            return value[i+1:i+5]
    # No script modifier found implies the language default script.
    return None