def _on_char_hook(self, evt): keystr = hotkey.build_keystr(evt) if hotkey.check(hotkey.EXPLORER_RENAME, keystr): tree_item_id = self.GetSelection() if tree_item_id.IsOk(): fs_node = self.get_focused_node() if self.node_tool.can_rename(fs_node): self.EditLabel(tree_item_id) return evt.Skip()
def StartingKey(self, evt): key_str = hotkey.build_keystr(evt) if hotkey.check(hotkey.INCREASE, key_str): val = self.get_value() + 1 self._ctrl.SetValue(unicode(val)) self._grid.DisableCellEditControl() elif hotkey.check(hotkey.DECREASE, key_str): val = self.get_value() - 1 self._ctrl.SetValue(unicode(val)) self._grid.DisableCellEditControl() GridCellStrEditor.StartingKey(self, evt)
def __on_key_down(self, evt): # print '>>>__OnKeyDown', evt.GetKeyCode() keystr = hotkey.build_keystr(evt) for action in self.grid_actions: if action.check_enable and not action.check_enable(): continue if hotkey.check(action.hot_key_tr, keystr): action.callback() return evt.Skip()
def _on_char_hook(self, evt): keystr = hotkey.build_keystr(evt) if hotkey.check(hotkey.EXPLORER_RENAME, keystr): tree_item_id = self.GetSelection() if tree_item_id.IsOk(): fs_node = self.get_focused_node() if self.node_tool.can_rename(fs_node): self.EditLabel(tree_item_id) return evt.Skip()
def __on_key_down(self, evt): # print '>>>__OnKeyDown', evt.GetKeyCode() keystr = hotkey.build_keystr(evt) for action in self.grid_actions: if action.check_enable and not action.check_enable(): continue if hotkey.check(action.hot_key_tr, keystr): action.callback() return evt.Skip()
def OnCharHook(self, evt): keystr = hotkey.build_keystr(evt) if hotkey.check(hotkey.CLOSE_DIALOG, keystr): if not self.editor_panel.grid.IsCellEditControlEnabled(): self.Close() return if hotkey.check(hotkey.SHOW_EXPLORER, keystr): self.editor_context.project.explorer.Raise() return evt.Skip()
def OnCharHook(self, evt): keystr = hotkey.build_keystr(evt) if hotkey.check(hotkey.CLOSE_DIALOG, keystr): if not self.editor_panel.grid.IsCellEditControlEnabled(): self.Close() return if hotkey.check(hotkey.SHOW_EXPLORER, keystr): self.editor_context.project.explorer.Raise() return evt.Skip()
def _on_char_hook(self, evt): keystr = hotkey.build_keystr(evt) if hotkey.check(hotkey.EXPLORER_UP_LEVEL, keystr): self.go_up() return if hotkey.check(hotkey.EXPLORER_HISTORY_PREV, keystr): self.go_back() return if hotkey.check(hotkey.EXPLORER_HISTORY_NEXT, keystr): self.go_forward() return evt.Skip()
def _on_char_hook(self, evt): keystr = hotkey.build_keystr(evt) if hotkey.check(hotkey.EXPLORER_UP_LEVEL, keystr): self.go_up() return if hotkey.check(hotkey.EXPLORER_HISTORY_PREV, keystr): self.go_back() return if hotkey.check(hotkey.EXPLORER_HISTORY_NEXT, keystr): self.go_forward() return evt.Skip()
def OnKeyDown(self, evt): key_str = hotkey.build_keystr(evt) if hotkey.check(hotkey.CLOSE_EDITOR_FRAME, key_str): if not self.editor_panel.grid.IsCellEditControlEnabled(): self.Close() return if hotkey.check(hotkey.SAVE, key_str): self.save() return if hotkey.check(hotkey.SHOW_EXPLORER, key_str): self.editor_context.project.explorer.Raise() return evt.Skip()
def OnKeyDown(self, evt): key_str = hotkey.build_keystr(evt) if hotkey.check(hotkey.CLOSE_EDITOR_FRAME, key_str): if not self.editor_panel.grid.IsCellEditControlEnabled(): self.Close() return if hotkey.check(hotkey.SAVE, key_str): self.save() return if hotkey.check(hotkey.SHOW_EXPLORER, key_str): self.editor_context.project.explorer.Raise() return evt.Skip()
def _on_char_hook(self, evt): keystr = hotkey.build_keystr(evt) # editing label, skip if self.GetEditControl(): evt.Skip() return if hotkey.check(hotkey.EXPLORER_OPEN, keystr): fs_nodes = self.get_selected_nodes() if len(fs_nodes) == 1: fs_nodes = fs_nodes[0] if self.node_tool.can_open(fs_nodes): self.node_tool.open(fs_nodes) return if hotkey.check(hotkey.EXPLORER_RENAME, keystr): fs_node = self.get_focused_node() if self.node_tool.can_rename(fs_node): self.EditLabel(self.GetFocusedItem()) return evt.Skip()
def _on_char_hook(self, evt): keystr = hotkey.build_keystr(evt) # editing label, skip if self.GetEditControl(): evt.Skip() return if hotkey.check(hotkey.EXPLORER_OPEN, keystr): fs_nodes = self.get_selected_nodes() if len(fs_nodes) == 1: fs_nodes = fs_nodes[0] if self.node_tool.can_open(fs_nodes): self.node_tool.open(fs_nodes) return if hotkey.check(hotkey.EXPLORER_RENAME, keystr): fs_node = self.get_focused_node() if self.node_tool.can_rename(fs_node): self.EditLabel(self.GetFocusedItem()) return evt.Skip()
def StartingKey(self, evt): """ If the editor is enabled by pressing keys on the grid, this will be called to let the editor do something about that first key if desired. """ keystr = hotkey.build_keystr(evt) if hotkey.check(hotkey.INSERT_FRONT, keystr): self._ctrl.SetSelection(0, 0) self._ctrl.SetInsertionPoint(0) elif hotkey.check(hotkey.INSERT_TAIL, keystr): self._ctrl.SetSelection(0, 0) self._ctrl.SetInsertionPointEnd() # elif hotkey.check(hotkey.INCREASE, keystr): # val = self.get_value() + 1 # self._ctrl.SetValue(unicode(val)) # self._grid.DisableCellEditControl() # elif hotkey.check(hotkey.DECREASE, keystr): # val = self.get_value() - 1 # self._ctrl.SetValue(unicode(val)) # self._grid.DisableCellEditControl() elif hotkey.check(hotkey.CELL_BEGIN_EDIT, keystr): evt.Skip() else: key = evt.GetKeyCode() if 0 <= key <= 255: ch = chr(key) if evt.ShiftDown(): ch = ch.upper() if ch in string.printable: self._ctrl.SetValue(ch) self._ctrl.SetInsertionPointEnd() else: evt.Skip() else: evt.Skip()
def StartingKey(self, evt): """ If the editor is enabled by pressing keys on the grid, this will be called to let the editor do something about that first key if desired. """ keystr = hotkey.build_keystr(evt) if hotkey.check(hotkey.INSERT_FRONT, keystr): self._ctrl.SetSelection(0, 0) self._ctrl.SetInsertionPoint(0) elif hotkey.check(hotkey.INSERT_TAIL, keystr): self._ctrl.SetSelection(0, 0) self._ctrl.SetInsertionPointEnd() # elif hotkey.check(hotkey.INCREASE, keystr): # val = self.get_value() + 1 # self._ctrl.SetValue(unicode(val)) # self._grid.DisableCellEditControl() # elif hotkey.check(hotkey.DECREASE, keystr): # val = self.get_value() - 1 # self._ctrl.SetValue(unicode(val)) # self._grid.DisableCellEditControl() elif hotkey.check(hotkey.CELL_BEGIN_EDIT, keystr): evt.Skip() else: key = evt.GetKeyCode() if 0 <= key <= 255: ch = chr(key) if evt.ShiftDown(): ch = ch.upper() if ch in string.printable: self._ctrl.SetValue(ch) self._ctrl.SetInsertionPointEnd() else: evt.Skip() else: evt.Skip()
def OnCharHook(self, evt): keystr = hotkey.build_keystr(evt) if hotkey.check(hotkey.CLOSE_DIALOG, keystr): self.Close() return evt.Skip()
def OnCharHook(self, evt): keystr = hotkey.build_keystr(evt) if hotkey.check(hotkey.CLOSE_DIALOG, keystr): self.Close() return evt.Skip()