Ejemplo n.º 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)
Ejemplo n.º 2
0
        def edit_shortcuts(evt):

            def edit_function():
                dialog = ShortcutsEditorDialog(self, self.shortcut_controller)
                dialog.ShowModal()
                dialog.Destroy()
            safe_locking(self, edit_function)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 6
0
        def preferences(evt):
            def edit_function():
                dialog = PreferencesDialog(self, self.config)
                dialog.ShowModal()
                dialog.Destroy()

            safe_locking(self, edit_function)
Ejemplo n.º 7
0
        def edit_shortcuts(evt):
            def edit_function():
                dialog = ShortcutsEditorDialog(self, self.shortcut_controller)
                dialog.ShowModal()
                dialog.Destroy()

            safe_locking(self, edit_function)
Ejemplo n.º 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)
Ejemplo n.º 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()
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 12
0
Archivo: view.py Proyecto: ncqgm/gnumed
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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 15
0
Archivo: view.py Proyecto: ncqgm/gnumed
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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 19
0
Archivo: view.py Proyecto: ncqgm/gnumed
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)
Ejemplo n.º 20
0
Archivo: view.py Proyecto: ncqgm/gnumed
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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 25
0
 def redo(evt):
     safe_locking(self, self.timeline.redo)
Ejemplo n.º 26
0
        def edit_eras(evt):
            def edit_function():
                self._edit_eras()

            safe_locking(self, edit_function)
Ejemplo n.º 27
0
 def undo(evt):
     safe_locking(self, self.timeline.undo)
Ejemplo n.º 28
0
        def set_category_on_without(evt):
            def edit_function():
                self._set_category()

            safe_locking(self, edit_function)
Ejemplo n.º 29
0
        def edit_categories(evt):
            def edit_function():
                self._edit_categories()

            safe_locking(self, edit_function)
Ejemplo n.º 30
0
 def edit_categories(evt):
     def edit_function():
         self._edit_categories()
     safe_locking(self, edit_function)
Ejemplo n.º 31
0
        def set_categoryon_selected(evt):
            def edit_function():
                self._set_category_to_selected_events()

            safe_locking(self, edit_function)
Ejemplo n.º 32
0
        def set_categoryon_selected(evt):

            def edit_function():
                self._set_category_to_selected_events()
            safe_locking(self, edit_function)
Ejemplo n.º 33
0
    def _on_left_doubleclick(self, event):
        def edit_function():
            self._edit_category()

        safe_locking(self.parent, edit_function)
Ejemplo n.º 34
0
 def compress(evt):
     safe_locking(self, self.timeline.compress)
Ejemplo n.º 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)
Ejemplo n.º 36
0
 def redo(evt):
     safe_locking(self, self.timeline.redo)
Ejemplo n.º 37
0
 def undo(evt):
     safe_locking(self, self.timeline.undo)
Ejemplo n.º 38
0
 def edit_eras(evt):
     def edit_function():
         self._edit_eras()
     safe_locking(self, edit_function)
Ejemplo n.º 39
0
 def compress(evt):
     safe_locking(self, self.timeline.compress)
Ejemplo n.º 40
0
 def _on_left_doubleclick(self, event):
     def edit_function():
         self._edit_category()
     safe_locking(self.parent, edit_function)
Ejemplo n.º 41
0
 def preferences(evt):
     def edit_function():
         dialog = PreferencesDialog(self, self.config)
         dialog.ShowModal()
         dialog.Destroy()
     safe_locking(self, edit_function)
Ejemplo n.º 42
0
 def set_category_on_without(evt):
     def edit_function():
         self._set_category()
     safe_locking(self, edit_function)