Exemplo n.º 1
0
	def onKeyDown(self, event):
		if html5.isReturn(event):  # Return
			self.activateCurrentSelection()
			event.preventDefault()
			return
		elif html5.isControl(event):  # and "multi" in (self.selectMode or ""): #Ctrl
			self._isCtlPressed = True
Exemplo n.º 2
0
    def onKeyPress(self, event):
        if html5.isReturn(event):
            if html5.utils.doesEventHitWidgetOrChildren(event, self.username):
                if self.username["value"]:
                    self.password.element.focus()
            elif html5.utils.doesEventHitWidgetOrChildren(
                    event, self.password):
                if self.username["value"] and self.password["value"]:
                    self.onLoginClick()
            elif html5.utils.doesEventHitWidgetOrChildren(event, self.otp):
                if self.otp["value"]:
                    self.onVerifyClick()

            event.stopPropagation()
            event.preventDefault()
Exemplo n.º 3
0
    def onKeyDown(self, event):
        if html5.isArrowDown(event):  # Arrow down

            if self._currentRow is None:
                self.setCursorRow(0)

            else:
                if self._isCtlPressed or self._isShiftPressed:

                    if self._ctlStartRow > self._currentRow:
                        self.removeSelectedRow(self._currentRow)
                    else:
                        self.addSelectedRow(self._currentRow)

                        if self._currentRow + 1 < self.getRowCount():
                            self.addSelectedRow(self._currentRow + 1)

                if self._currentRow + 1 < self.getRowCount():
                    self.setCursorRow(
                        self._currentRow + 1,
                        removeExistingSelection=(not self._isShiftPressed
                                                 and not self._isCtlPressed))

            event.preventDefault()

        elif html5.isArrowUp(event):  # Arrow up

            if self._currentRow is None:
                self.setCursorRow(0)
            else:

                if self._isCtlPressed or self._isShiftPressed:  # Check if we extend a selection
                    if self._ctlStartRow < self._currentRow:
                        self.removeSelectedRow(self._currentRow)
                    else:
                        self.addSelectedRow(self._currentRow)

                        if self._currentRow > 0:
                            self.addSelectedRow(self._currentRow - 1)

                if self._currentRow > 0:  # Move the cursor if possible
                    self.setCursorRow(
                        self._currentRow - 1,
                        removeExistingSelection=(not self._isShiftPressed
                                                 and not self._isCtlPressed))

            event.preventDefault()

        elif html5.isReturn(event):  # Return

            if len(self._selectedRows) > 0:
                self.selectionActivatedEvent.fire(self, self._selectedRows)
                event.preventDefault()
                return

            if self._currentRow is not None:
                self.selectionActivatedEvent.fire(self, [self._currentRow])
                event.preventDefault()
                return

        elif html5.isControl(event):  # Ctrl
            self._isCtlPressed = True
            self._ctlStartRow = self._currentRow or 0
            if self._currentRow is not None:
                self.addSelectedRow(
                    self._currentRow)  # add already selected row to selection

        elif html5.isShift(event):  # Shift
            self._isShiftPressed = True
            try:
                self._ctlStartRow = self._currentRow or self._selectedRows[
                    0] or 0
            except:
                self._ctlStartRow = 0
Exemplo n.º 4
0
 def onKeyDown(self, event):
     if html5.isReturn(event):
         self.filterChangedEvent.fire()
Exemplo n.º 5
0
 def onKeyDown(self, event):
     if html5.isReturn(event):
         self.doSearch()
         event.preventDefault()
         event.stopPropagation()