text-console 2.0.4__tar.gz → 2.0.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: text_console
3
- Version: 2.0.4
3
+ Version: 2.0.6
4
4
  Summary: ('A customizable Tkinter-based text console widget, in which a user types in commands to be sent to the Python interpreter.',)
5
5
  Home-page: https://github.com/Ircama/text_console
6
6
  Author: Ircama
@@ -88,15 +88,15 @@ This program reflects the core functionality of [wxPython Shell](https://github.
88
88
  | Control Return | Move the cursor to the end of the last line of input. |
89
89
  | Tab | Indent code (up to 4 spaces); if selection, indent all selected lines. |
90
90
  | Shift Tab | Un-indent (remove up to 4 spaces before cursor). |
91
- | Down Arrow | Navigate to next command in history. |
92
- | Up Arrow | Navigate to previous command in history. |
91
+ | Down Arrow | Recall next command in history. |
92
+ | Up Arrow | Recall previous command in history. |
93
93
  | Left Arrow | Move to previous non-tagged character. |
94
94
  | Right Arrow | Move to next non-tagged character. |
95
95
  | Control Left Arrow | Move to previous word. |
96
96
  | Control Right Arrow | Move to next word. |
97
-
98
97
  | Escape | Jump to last blank command (empty input) in history. |
99
98
  | BackSpace | Delete character before cursor. |
99
+ | Control R | Open Command History panel / Start reverse history search.|
100
100
  | Control C | Copy selected code, removing prompts first. |
101
101
  | Control V | Paste text from clipboard, handling prompts and multiline input. |
102
102
  | Button-3 (Right Click) | Show context menu (Cut, Copy, Paste, Clear). |
@@ -109,5 +109,15 @@ This program reflects the core functionality of [wxPython Shell](https://github.
109
109
  | Control - | Decrease font size. |
110
110
  | Control 0 | Reset font size. |
111
111
 
112
+ In the History Panel:
113
+
114
+ | Shortcut | Description |
115
+ |-------------------------|--------------------------------------------------------------------------------------------------|
116
+ | Control N | In history panel: Find next search match|
117
+ | Control B | In history panel: Find previous search match|
118
+ | Control S | In history panel: Load selected command to main window|
119
+ |Double-click|Recall command to main window from history panel|
120
+ | Esc | In history panel: Close Command History panel / Cancel search|
121
+
112
122
 
113
123
  Full information and usage details at the [text_console GitHub repository](https://github.com/Ircama/text_console).
@@ -59,15 +59,15 @@ This program reflects the core functionality of [wxPython Shell](https://github.
59
59
  | Control Return | Move the cursor to the end of the last line of input. |
60
60
  | Tab | Indent code (up to 4 spaces); if selection, indent all selected lines. |
61
61
  | Shift Tab | Un-indent (remove up to 4 spaces before cursor). |
62
- | Down Arrow | Navigate to next command in history. |
63
- | Up Arrow | Navigate to previous command in history. |
62
+ | Down Arrow | Recall next command in history. |
63
+ | Up Arrow | Recall previous command in history. |
64
64
  | Left Arrow | Move to previous non-tagged character. |
65
65
  | Right Arrow | Move to next non-tagged character. |
66
66
  | Control Left Arrow | Move to previous word. |
67
67
  | Control Right Arrow | Move to next word. |
68
-
69
68
  | Escape | Jump to last blank command (empty input) in history. |
70
69
  | BackSpace | Delete character before cursor. |
70
+ | Control R | Open Command History panel / Start reverse history search.|
71
71
  | Control C | Copy selected code, removing prompts first. |
72
72
  | Control V | Paste text from clipboard, handling prompts and multiline input. |
73
73
  | Button-3 (Right Click) | Show context menu (Cut, Copy, Paste, Clear). |
@@ -80,6 +80,16 @@ This program reflects the core functionality of [wxPython Shell](https://github.
80
80
  | Control - | Decrease font size. |
81
81
  | Control 0 | Reset font size. |
82
82
 
83
+ In the History Panel:
84
+
85
+ | Shortcut | Description |
86
+ |-------------------------|--------------------------------------------------------------------------------------------------|
87
+ | Control N | In history panel: Find next search match|
88
+ | Control B | In history panel: Find previous search match|
89
+ | Control S | In history panel: Load selected command to main window|
90
+ |Double-click|Recall command to main window from history panel|
91
+ | Esc | In history panel: Close Command History panel / Cancel search|
92
+
83
93
  ## Installation
84
94
 
85
95
  ```bash
@@ -104,6 +114,10 @@ optional arguments:
104
114
  A customizable Tkinter-based text console widget.
105
115
  ```
106
116
 
117
+ ### Running the pre-built GUI executable
118
+
119
+ The *text_console.zip* archive in the [Releases](https://github.com/Ircama/text_console/releases/latest) folder incudes the *text_console.exe* executable asset; the ZIP archive is auto-generated by a [GitHub Action](https://github.com/Ircama/text_console/blob/main/.github/workflows/build.yml). *text_console.exe* is a Windows GUI that can be directly executed.
120
+
107
121
  ### Basic usage with default settings
108
122
 
109
123
  ```python
@@ -235,31 +249,3 @@ class MyCustomConsole(TextConsole):
235
249
  # Use the custom console
236
250
  text_console = MyCustomConsole(main, master)
237
251
  ```
238
-
239
- ## Key bindings
240
-
241
- The text_console module provides the following key bindings for efficient navigation and interaction:
242
-
243
- - `Ctrl + Enter (<Control-Return>)`
244
-
245
- Submit a command while keeping the current context open.
246
-
247
- - `Shift + Enter (<Shift-Return>)`
248
-
249
- Insert a newline without triggering a default submission action.
250
-
251
- - `Tab (<Tab>)`
252
-
253
- Indent input.
254
-
255
- - `Down Arrow (<Down>)`
256
-
257
- Next command from the history.
258
-
259
- - `Up Arrow (<Up>)`
260
-
261
- Previous command from the history.
262
-
263
- - `Right-Click (<Button-3>)`
264
-
265
- Displays the context menu.
@@ -0,0 +1,5 @@
1
+ from .text_console import TextConsole, BaseTextConsole
2
+ from .history import History
3
+ from .__version__ import __version__
4
+
5
+ __all__ = ["TextConsole", "History"]
@@ -0,0 +1 @@
1
+ __version__ = "2.0.6"
@@ -103,6 +103,9 @@ class BaseTextConsole(tk.Text):
103
103
  self.mark_gravity('input', 'left')
104
104
  self.focus_set()
105
105
 
106
+ # Add this attribute in your __init__ method if not present
107
+ self.history_panel = None
108
+
106
109
  def setup_tags(self):
107
110
  """Set up text tags for styling"""
108
111
  font_obj = tkfont.nametofont(self.cget("font"))
@@ -848,7 +851,21 @@ class BaseTextConsole(tk.Text):
848
851
  return 'break'
849
852
 
850
853
  def show_command_history_panel(self):
851
- CommandHistoryPanel(self, self.history, self.insert_cmd, [self._hist_item])
854
+ # If already open and not destroyed, bring to front and focus
855
+ if self.history_panel is not None and self.history_panel.winfo_exists():
856
+ self.history_panel.lift()
857
+ self.history_panel.focus_force()
858
+ self.history_panel.search_entry.focus_set()
859
+ return
860
+
861
+ # Otherwise, create a new panel
862
+ self.history_panel = CommandHistoryPanel(self, self.history, self.insert_cmd, [self._hist_item])
863
+
864
+ # When the panel is closed, clear the reference
865
+ def on_panel_close():
866
+ self.history_panel.destroy()
867
+ self.history_panel = None
868
+ self.history_panel.protocol("WM_DELETE_WINDOW", on_panel_close)
852
869
 
853
870
  def insert_line(self, event=None):
854
871
  """Handle Ctrl+Return key press"""
@@ -898,6 +915,12 @@ class BaseTextConsole(tk.Text):
898
915
 
899
916
  def eval_current(self, auto_indent=False):
900
917
  """Evaluate code"""
918
+ # Close history panel if open
919
+ try:
920
+ self.history_panel.destroy()
921
+ except Exception:
922
+ pass
923
+
901
924
  index = self.index('input')
902
925
  lines = self.get('input', 'insert lineend').splitlines() # commands to execute
903
926
  self.mark_set('insert', 'insert lineend')
@@ -978,14 +1001,6 @@ class BaseTextConsole(tk.Text):
978
1001
  self.insert('insert', '\n', "output")
979
1002
  self.prompt()
980
1003
 
981
- # Close history panel if open
982
- if hasattr(self, '_history_window') and self._history_window is not None:
983
- try:
984
- self._history_window.destroy()
985
- except Exception:
986
- pass
987
- self._history_window = None
988
-
989
1004
  def on_key_press(self, event):
990
1005
  """
991
1006
  Prevent character insertion if the cursor is over a character with any tag (e.g., prompt).
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: text_console
3
- Version: 2.0.4
3
+ Version: 2.0.6
4
4
  Summary: ('A customizable Tkinter-based text console widget, in which a user types in commands to be sent to the Python interpreter.',)
5
5
  Home-page: https://github.com/Ircama/text_console
6
6
  Author: Ircama
@@ -88,15 +88,15 @@ This program reflects the core functionality of [wxPython Shell](https://github.
88
88
  | Control Return | Move the cursor to the end of the last line of input. |
89
89
  | Tab | Indent code (up to 4 spaces); if selection, indent all selected lines. |
90
90
  | Shift Tab | Un-indent (remove up to 4 spaces before cursor). |
91
- | Down Arrow | Navigate to next command in history. |
92
- | Up Arrow | Navigate to previous command in history. |
91
+ | Down Arrow | Recall next command in history. |
92
+ | Up Arrow | Recall previous command in history. |
93
93
  | Left Arrow | Move to previous non-tagged character. |
94
94
  | Right Arrow | Move to next non-tagged character. |
95
95
  | Control Left Arrow | Move to previous word. |
96
96
  | Control Right Arrow | Move to next word. |
97
-
98
97
  | Escape | Jump to last blank command (empty input) in history. |
99
98
  | BackSpace | Delete character before cursor. |
99
+ | Control R | Open Command History panel / Start reverse history search.|
100
100
  | Control C | Copy selected code, removing prompts first. |
101
101
  | Control V | Paste text from clipboard, handling prompts and multiline input. |
102
102
  | Button-3 (Right Click) | Show context menu (Cut, Copy, Paste, Clear). |
@@ -109,5 +109,15 @@ This program reflects the core functionality of [wxPython Shell](https://github.
109
109
  | Control - | Decrease font size. |
110
110
  | Control 0 | Reset font size. |
111
111
 
112
+ In the History Panel:
113
+
114
+ | Shortcut | Description |
115
+ |-------------------------|--------------------------------------------------------------------------------------------------|
116
+ | Control N | In history panel: Find next search match|
117
+ | Control B | In history panel: Find previous search match|
118
+ | Control S | In history panel: Load selected command to main window|
119
+ |Double-click|Recall command to main window from history panel|
120
+ | Esc | In history panel: Close Command History panel / Cancel search|
121
+
112
122
 
113
123
  Full information and usage details at the [text_console GitHub repository](https://github.com/Ircama/text_console).
@@ -1,5 +0,0 @@
1
- from .text_console import BaseTextConsole
2
- from .history import History
3
- from .__version__ import __version__
4
-
5
- __all__ = ["BaseTextConsole", "History"]
@@ -1 +0,0 @@
1
- __version__ = "2.0.4"
File without changes
File without changes
File without changes