Ejemplo n.º 1
0
Archivo: tree.py Proyecto: crnkjck/votr
 def double_click(self):
     if self.action_name:
         action = self.dialog.components[self.action_name]
         if action:
             action.on_execute(self.id)
             return
     ev = action_event(self, None, self.id)
     self.dialog.app.send_events(ev)
Ejemplo n.º 2
0
    def click(self, params=None):
        self.log('action', 'Clicking {}'.format(self.id))

        if self.try_execute_action(params): return

        ev = action_event(self, None, self.id, params)
        # TODO: We should technically ask confirm_question before firing
        # (if ev.listening is True), but we probably don't care.
        self.dialog.app.send_events(ev)
Ejemplo n.º 3
0
    def click(self):
        self.log('action', 'Clicking {}'.format(self.id))

        if self.try_execute_action(): return

        ev = action_event(self, None, self.id)
        # TODO: We should technically ask confirm_question before firing
        # (if ev.listening is True), but we probably don't care.
        self.dialog.app.send_events(ev)
Ejemplo n.º 4
0
 def click(self, command):
     if command not in ('UP', 'DOWN', 'TOP', 'BOTTOM'):
         raise ValueError('wrong UpDown command')
     self.log('action', 'Clicking {} {}'.format(self.id, command.lower()))
     udc = self.dialog.components.get(self.up_downed_component)
     if udc and udc.up_down_row:
         udc.up_down_row(command)
     if not udc:
         ev = action_event(self, command, self.id)
         self.dialog.app.send_events(ev)
Ejemplo n.º 5
0
 def _on_data_tab_dbl_click(self):
     # TODO: rename or inline this appropriately
     if self.action_name:
         action = self.dialog.components[self.action_name]
         if action:
             action.on_execute(self.id)
             return
     if 'EMPTY|' in self.supported_events:
         self.used_listeners_mask |= 64
         ev = action_event(self, None, self.id)
         self.dialog.app.send_events(ev)
Ejemplo n.º 6
0
Archivo: table.py Proyecto: Adman/votr
 def _on_data_tab_dbl_click(self):
     # TODO: rename or inline this appropriately
     if self.action_name:
         action = self.dialog.components[self.action_name]
         if action:
             action.on_execute(self.id)
             return
     if 'EMPTY|' in self.supported_events:
         self.used_listeners_mask |= 64
         ev = action_event(self, None, self.id)
         self.dialog.app.send_events(ev)
Ejemplo n.º 7
0
Archivo: action.py Proyecto: Adman/votr
    def execute(self, original_source_name=None, params=None):
        '''Executes the action and emits the appropriate event.'''
        if not (self.accessible and self.enabled and self.enabled_in_ui and
                self.visible and self.visible_in_ui):
            # TODO: we should return here, but we can only do that once we
            # properly support interactives. for now, the developer knows best.
            pass

        if not original_source_name:
            self.log('action', 'Executing {}'.format(self.id))

        ev = action_event(self, None, original_source_name or self.id, params)
        # TODO: We should technically ask confirm_question before firing
        # (if ev.listening is True), but we probably don't care.
        self.dialog.app.send_events(ev)
Ejemplo n.º 8
0
    def execute(self, original_source_name=None, params=None):
        '''Executes the action and emits the appropriate event.'''
        if not (self.accessible and self.enabled and self.enabled_in_ui and
                self.visible and self.visible_in_ui):
            # TODO: we should return here, but we can only do that once we
            # properly support interactives. for now, the developer knows best.
            pass

        if not original_source_name:
            self.log('action', 'Executing {}'.format(self.id))

        ev = action_event(self, None, original_source_name or self.id, params)
        # TODO: We should technically ask confirm_question before firing
        # (if ev.listening is True), but we probably don't care.
        self.dialog.app.send_events(ev)
Ejemplo n.º 9
0
Archivo: tree.py Proyecto: crnkjck/votr
    def toggle_checkbox(self, id):
        node = self.nodes[id]
        if node.checked is None:
            raise ValueError("this node does not have a checkbox")
        node.checked = not node.checked

        path = id[1:]
        if self.checked_synchronizer.get(path) == (not node.checked):
            del self.checked_synchronizer[path]
        elif self.checked_synchronizer.get(path) == None:
            self.checked_synchronizer[path] = node.checked

            self.checked_changed = True
            self.dialog.component_changes(self, False)
            if 'CHECK_CHANGE_COMMAND|' not in self.commands: return
            self.used_listeners_mask |= 64
            ev = action_event(self, 'CHECK_CHANGE_COMMAND', self.id)
            self.dialog.app.send_events(ev)
Ejemplo n.º 10
0
 def _fire_action_command(self, command):
     if command + '|' in self.supported_events:
         self.used_listeners_mask |= 64
         ev = action_event(self, command, self.id)
         self.dialog.app.send_events(ev)
Ejemplo n.º 11
0
Archivo: panel.py Proyecto: Adman/votr
 def _fire_event(self):
     self.dialog.component_changes(self, False)
     command = "COLLAPSE" if self.collapsed else "EXPAND"
     ev = action_event(self, command, self.id)
     self.dialog.app.send_events(ev)
Ejemplo n.º 12
0
 def _fire_event(self):
     self.dialog.component_changes(self, False)
     command = 'COLLAPSE' if self.collapsed else 'EXPAND'
     ev = action_event(self, command, self.id)
     self.dialog.app.send_events(ev)
Ejemplo n.º 13
0
Archivo: table.py Proyecto: Adman/votr
 def _fire_action_command(self, command):
     if command + '|' in self.supported_events:
         self.used_listeners_mask |= 64
         ev = action_event(self, command, self.id)
         self.dialog.app.send_events(ev)