Пример #1
0
 def __init__(self,
              selection=None,
              browser_component=None,
              browser_mode=None,
              browser_hotswap_mode=None,
              insert_left=False,
              *a,
              **k):
     super(CreateDeviceComponent, self).__init__(*a, **k)
     self._selection = selection
     self._add_effect_mode = BrowserAddEffectMode(
         selection=selection,
         browser=self.application.browser,
         application_view=self.application.view,
         insert_left=insert_left)
     self._create_device_modes = ModesComponent(parent=self)
     self._create_device_modes.add_mode(u'create', [
         SetAttributeMode(browser_component, u'do_load_item',
                          self._do_browser_load_item),
         self._add_effect_mode, browser_mode,
         browser_component.reset_load_memory
     ])
     self._create_device_modes.add_mode(
         u'hotswap', [browser_hotswap_mode, browser_mode])
     self._go_to_hotswap_task = self._tasks.add(
         task.sequence(task.delay(1), task.run(self._go_to_hotswap)))
     self._go_to_hotswap_task.kill()
Пример #2
0
class CreateDeviceComponent(CompoundComponent):

    @depends(selection=None)
    def __init__(self, selection = None, browser_component = None, browser_mode = None, browser_hotswap_mode = None, insert_left = False, *a, **k):
        super(CreateDeviceComponent, self).__init__(*a, **k)
        self._selection = selection
        self._add_effect_mode = BrowserAddEffectMode(selection=selection, browser=self.application.browser, application_view=self.application.view, insert_left=insert_left)
        self._create_device_modes = self.register_component(ModesComponent())
        self._create_device_modes.add_mode('create', [SetAttributeMode(browser_component, 'do_load_item', self._do_browser_load_item),
         self._add_effect_mode,
         browser_mode,
         browser_component.reset_load_memory])
        self._create_device_modes.add_mode('hotswap', [browser_hotswap_mode, browser_mode])
        self._go_to_hotswap_task = self._tasks.add(task.sequence(task.delay(1), task.run(self._go_to_hotswap)))
        self._go_to_hotswap_task.kill()

    def on_enabled_changed(self):
        self._go_to_hotswap_task.kill()
        if self.is_enabled():
            if is_empty_drum_pad(self._selection.selected_object):
                self._create_device_modes.selected_mode = 'hotswap'
            else:
                self._create_device_modes.selected_mode = 'create'

    def _go_to_hotswap(self):
        self._create_device_modes.selected_mode = 'hotswap'

    def _do_browser_load_item(self, item):
        selection = self._add_effect_mode.get_selection_for_insert()
        if selection:
            self._selection.selected_object = selection
        item.action()
        self._go_to_hotswap_task.restart()
Пример #3
0
class CreateDeviceComponent(CompoundComponent):

    @depends(selection=None)
    def __init__(self, selection = None, browser_component = None, browser_mode = None, browser_hotswap_mode = None, insert_left = False, *a, **k):
        super(CreateDeviceComponent, self).__init__(*a, **k)
        self._selection = selection
        self._add_effect_mode = BrowserAddEffectMode(selection=selection, browser=self.application.browser, application_view=self.application.view, insert_left=insert_left)
        self._create_device_modes = self.register_component(ModesComponent())
        self._create_device_modes.add_mode('create', [SetAttributeMode(browser_component, 'do_load_item', self._do_browser_load_item),
         self._add_effect_mode,
         browser_mode,
         browser_component.reset_load_memory])
        self._create_device_modes.add_mode('hotswap', [browser_hotswap_mode, browser_mode])
        self._go_to_hotswap_task = self._tasks.add(task.sequence(task.delay(1), task.run(self._go_to_hotswap)))
        self._go_to_hotswap_task.kill()

    def on_enabled_changed(self):
        self._go_to_hotswap_task.kill()
        if self.is_enabled():
            if is_empty_drum_pad(self._selection.selected_object):
                self._create_device_modes.selected_mode = 'hotswap'
            else:
                self._create_device_modes.selected_mode = 'create'

    def _go_to_hotswap(self):
        self._create_device_modes.selected_mode = 'hotswap'

    def _do_browser_load_item(self, item):
        selection = self._add_effect_mode.get_selection_for_insert()
        if selection:
            self._selection.selected_object = selection
        item.action()
        self._go_to_hotswap_task.restart()
Пример #4
0
 def __init__(
     self,
     selection=None,
     browser_component=None,
     browser_mode=None,
     browser_hotswap_mode=None,
     insert_left=False,
     *a,
     **k
 ):
     super(CreateDeviceComponent, self).__init__(*a, **k)
     self._selection = selection
     self._add_effect_mode = BrowserAddEffectMode(
         selection=selection,
         browser=self.application().browser,
         application_view=self.application().view,
         insert_left=insert_left,
     )
     self._create_device_modes = self.register_component(ModesComponent())
     self._create_device_modes.add_mode(
         "create",
         [
             SetAttributeMode(browser_component, "do_load_item", self._do_browser_load_item),
             self._add_effect_mode,
             browser_mode,
             browser_component.reset_load_memory,
         ],
     )
     self._create_device_modes.add_mode("hotswap", [browser_hotswap_mode, browser_mode])
     self._go_to_hotswap_task = self._tasks.add(task.sequence(task.delay(1), task.run(self._go_to_hotswap)))
     self._go_to_hotswap_task.kill()