Beispiel #1
0
 def _on_right_down(self, event):
     def edit_function():
         self._store_hit_info(event)
         for (menu_item, should_be_enabled_fn) in self.context_menu_items:
             menu_item.Enable(should_be_enabled_fn(self.last_hit_info))
         self.PopupMenu(self.context_menu)
     safe_locking(self.parent, edit_function)
Beispiel #2
0
        def edit_shortcuts(evt):

            def edit_function():
                dialog = ShortcutsEditorDialog(self, self.shortcut_controller)
                dialog.ShowModal()
                dialog.Destroy()
            safe_locking(self, edit_function)
Beispiel #3
0
def open_duplicate_event_dialog_for_event(parent, db, handle_db_error, event):
    def create_dialog():
        return DuplicateEventDialog(parent, db, event)

    def edit_function():
        gui_utils.show_modal(create_dialog, handle_db_error)
    safe_locking(parent, edit_function)
Beispiel #4
0
 def _on_right_down(self, event):
     def edit_function():
         self._store_hit_info(event)
         for (menu_item, should_be_enabled_fn) in self.context_menu_items:
             menu_item.Enable(should_be_enabled_fn(self.last_hit_info))
         self.PopupMenu(self.context_menu)
     safe_locking(self.parent, edit_function)
Beispiel #5
0
def open_create_event_editor(parent, config, db, handle_db_error, start=None, end=None):
    def create_event_editor():
        label = _("Create Event")
        return EditEventDialog(parent, config, label, db, start, end)
    def edit_function():
        gui_utils.show_modal(create_event_editor, handle_db_error)
    safe_locking(parent, edit_function)
Beispiel #6
0
        def preferences(evt):
            def edit_function():
                dialog = PreferencesDialog(self, self.config)
                dialog.ShowModal()
                dialog.Destroy()

            safe_locking(self, edit_function)
Beispiel #7
0
        def edit_shortcuts(evt):
            def edit_function():
                dialog = ShortcutsEditorDialog(self, self.shortcut_controller)
                dialog.ShowModal()
                dialog.Destroy()

            safe_locking(self, edit_function)
Beispiel #8
0
    def _mnu_file_import_on_click(self, menu):
        def open_import_dialog():
            dialog = ImportEventsDialog(self.timeline, self)
            dialog.ShowModal()
            dialog.Destroy()

        safe_locking(self, open_import_dialog)
Beispiel #9
0
 def _on_key_down(self, e):
     def edit_function():
         self.controller.delete_selected_category()
     if self.GetFirstVisibleItem() is None:
         return
     if e.GetKeyCode() == wx.WXK_DELETE:
         safe_locking(self.parent, edit_function)
     e.Skip()
Beispiel #10
0
 def _on_right_down(self, e):
     def edit_function():
         (item, flags) = self.HitTest(e.GetPosition())
         if item is not None:
             self.SelectItem(item, True)
         self._update_menu_enableness()
         self.PopupMenu(self.mnu)
     safe_locking(self.parent, edit_function)
Beispiel #11
0
def open_duplicate_event_dialog_for_event(parent, db, handle_db_error, event):
    def create_dialog():
        return DuplicateEventDialog(parent, db, event)

    def edit_function():
        gui_utils.show_modal(create_dialog, handle_db_error)

    safe_locking(parent, edit_function)
Beispiel #12
0
def open_duplicate_event_dialog_for_event(edit_controller, parent, db, event):
    def create_dialog():
        return DuplicateEventDialog(parent, db, event)

    def edit_function():
        dialog = create_dialog()
        dialog.ShowModal()
        dialog.Destroy()
    safe_locking(edit_controller, edit_function)
Beispiel #13
0
 def _context_menu_on_done_event(self, evt):
     def edit_function():
         with self.timeline_canvas.GetDb().transaction("Mark events done"):
             for event in self.timeline_canvas.GetSelectedEvents():
                 if not event.is_container():
                     event.set_progress(100)
                     event.save()
         self.timeline_canvas.ClearSelectedEvents()
     safe_locking(self._edit_controller, edit_function)
Beispiel #14
0
def open_duplicate_event_dialog_for_event(edit_controller, parent, db, event):
    def create_dialog():
        return DuplicateEventDialog(parent, db, event)

    def edit_function():
        dialog = create_dialog()
        dialog.ShowModal()
        dialog.Destroy()

    safe_locking(edit_controller, edit_function)
Beispiel #15
0
def open_create_event_editor(edit_controller, parent, config, db, start=None, end=None):
    def create_event_editor():
        label = _("Create Event")
        return EditEventDialog(parent, config, label, db, start, end)

    def edit_function():
        dialog = create_event_editor()
        dialog.ShowModal()
        dialog.Destroy()
    safe_locking(edit_controller, edit_function)
Beispiel #16
0
def open_create_event_editor(edit_controller, parent, config, db, start=None, end=None):
    def create_event_editor():
        label = _("Create Event")
        return EditEventDialog(parent, config, label, db, start, end)

    def edit_function():
        dialog = create_event_editor()
        dialog.ShowModal()
        dialog.Destroy()
    safe_locking(edit_controller, edit_function)
Beispiel #17
0
def open_event_editor_for(parent, config, db, handle_db_error, event):
    def create_event_editor():
        if event.is_container():
            title = _("Edit Container")
            return EditContainerDialog(parent, title, db, event)
        else:
            return EditEventDialog(
                parent, config, _("Edit Event"), db, event=event)
    def edit_function():
        gui_utils.show_modal(create_event_editor, handle_db_error)
    safe_locking(parent, edit_function)
Beispiel #18
0
def open_event_editor_for(edit_controller, parent, config, db, event):
    def create_event_editor():
        if event.is_container():
            title = _("Edit Container")
            return EditContainerDialog(parent, title, db, event)
        else:
            return EditEventDialog(
                parent, config, _("Edit Event"), db, event=event)

    def edit_function():
        dialog = create_event_editor()
        dialog.ShowModal()
        dialog.Destroy()
    safe_locking(edit_controller, edit_function)
Beispiel #19
0
def open_event_editor_for(edit_controller, parent, config, db, event):
    def create_event_editor():
        if event.is_container():
            title = _("Edit Container")
            return EditContainerDialog(parent, title, db, event)
        else:
            return EditEventDialog(
                parent, config, _("Edit Event"), db, event=event)

    def edit_function():
        dialog = create_event_editor()
        dialog.ShowModal()
        dialog.Destroy()
    safe_locking(edit_controller, edit_function)
Beispiel #20
0
def open_milestone_editor_for(edit_controller, parent, config, db, event=None):

    def create_milestone_editor():
        if event is None:
            label = _("Create Milestone")
        else:
            label = _("Edit Milestone")
        return EditMilestoneDialog(parent, label, db, config, event)

    def edit_function():
        dialog = create_milestone_editor()
        dialog.ShowModal()
        dialog.Destroy()
    safe_locking(edit_controller, edit_function)
Beispiel #21
0
def open_milestone_editor_for(edit_controller, parent, config, db, event=None):
    def create_milestone_editor():
        if event is None:
            label = _("Create Milestone")
        else:
            label = _("Edit Milestone")
        return EditMilestoneDialog(parent, label, db, config, event)

    def edit_function():
        dialog = create_milestone_editor()
        dialog.ShowModal()
        dialog.Destroy()

    safe_locking(edit_controller, edit_function)
Beispiel #22
0
    def _delete_selected_events(self):
        selected_events = self.timeline_canvas.GetSelectedEvents()
        number_of_selected_events = len(selected_events)

        def edit_function():
            if user_ack():
                with self.timeline_canvas.GetDb().transaction("Delete events"):
                    for event in selected_events:
                        event.delete()
            self.timeline_canvas.ClearSelectedEvents()

        def user_ack():
            if number_of_selected_events > 1:
                text = _("Are you sure you want to delete %d events?" %
                         number_of_selected_events)
            else:
                text = _("Are you sure you want to delete this event?")
            return _ask_question(text) == wx.YES
        safe_locking(self._edit_controller, edit_function)
Beispiel #23
0
    def _move_event_vertically(self, event, up=True):
        def edit_function():
            (overlapping_event,
             direction) = self.timeline_canvas.GetClosestOverlappingEvent(
                 event, up=up)
            if overlapping_event is None:
                pass
            elif direction > 0:
                self.timeline_canvas.GetDb().place_event_after_event(
                    event, overlapping_event)
            else:
                self.timeline_canvas.GetDb().place_event_before_event(
                    event, overlapping_event)
            # GetClosestOverlappingEvent inflates rectangles, so subsequent
            # calls do calculations on incorrect rectangles. A redraw
            # recalculates all rectangles.
            self.redraw_timeline()

        safe_locking(self._edit_controller, edit_function)
Beispiel #24
0
 def _move_event_vertically(self, event, up=True):
     def edit_function():
         (
             overlapping_event,
             direction
         ) = self.timeline_canvas.GetClosestOverlappingEvent(event, up=up)
         if overlapping_event is None:
             pass
         elif direction > 0:
             self.timeline_canvas.GetDb().place_event_after_event(
                 event,
                 overlapping_event
             )
         else:
             self.timeline_canvas.GetDb().place_event_before_event(
                 event,
                 overlapping_event
             )
         # GetClosestOverlappingEvent inflates rectangles, so subsequent
         # calls do calculations on incorrect rectangles. A redraw
         # recalculates all rectangles.
         self.redraw_timeline()
     safe_locking(self._edit_controller, edit_function)
Beispiel #25
0
 def redo(evt):
     safe_locking(self, self.timeline.redo)
Beispiel #26
0
        def edit_eras(evt):
            def edit_function():
                self._edit_eras()

            safe_locking(self, edit_function)
Beispiel #27
0
 def undo(evt):
     safe_locking(self, self.timeline.undo)
Beispiel #28
0
        def set_category_on_without(evt):
            def edit_function():
                self._set_category()

            safe_locking(self, edit_function)
Beispiel #29
0
        def edit_categories(evt):
            def edit_function():
                self._edit_categories()

            safe_locking(self, edit_function)
Beispiel #30
0
 def edit_categories(evt):
     def edit_function():
         self._edit_categories()
     safe_locking(self, edit_function)
Beispiel #31
0
        def set_categoryon_selected(evt):
            def edit_function():
                self._set_category_to_selected_events()

            safe_locking(self, edit_function)
Beispiel #32
0
        def set_categoryon_selected(evt):

            def edit_function():
                self._set_category_to_selected_events()
            safe_locking(self, edit_function)
Beispiel #33
0
    def _on_left_doubleclick(self, event):
        def edit_function():
            self._edit_category()

        safe_locking(self.parent, edit_function)
Beispiel #34
0
 def compress(evt):
     safe_locking(self, self.timeline.compress)
Beispiel #35
0
 def _mnu_file_import_on_click(self, menu):
     def open_import_dialog():
         dialog = ImportEventsDialog(self.timeline, self)
         dialog.ShowModal()
         dialog.Destroy()
     safe_locking(self, open_import_dialog)
Beispiel #36
0
 def redo(evt):
     safe_locking(self, self.timeline.redo)
Beispiel #37
0
 def undo(evt):
     safe_locking(self, self.timeline.undo)
Beispiel #38
0
 def edit_eras(evt):
     def edit_function():
         self._edit_eras()
     safe_locking(self, edit_function)
Beispiel #39
0
 def compress(evt):
     safe_locking(self, self.timeline.compress)
Beispiel #40
0
 def _on_left_doubleclick(self, event):
     def edit_function():
         self._edit_category()
     safe_locking(self.parent, edit_function)
Beispiel #41
0
 def preferences(evt):
     def edit_function():
         dialog = PreferencesDialog(self, self.config)
         dialog.ShowModal()
         dialog.Destroy()
     safe_locking(self, edit_function)
Beispiel #42
0
 def set_category_on_without(evt):
     def edit_function():
         self._set_category()
     safe_locking(self, edit_function)