pyqt-code-editor 0.0.19__tar.gz → 0.0.21__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.
Files changed (77) hide show
  1. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/PKG-INFO +1 -1
  2. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/__init__.py +1 -1
  3. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/_settings.py +1 -0
  4. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/app.py +5 -5
  5. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/code_editors/languages/python.py +1 -1
  6. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/components/find_in_files.py +87 -3
  7. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/components/project_explorer.py +10 -2
  8. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/mixins/base.py +8 -0
  9. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/mixins/comment.py +21 -2
  10. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/mixins/complete.py +1 -3
  11. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/mixins/line_number.py +2 -0
  12. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/widgets/quick_open_dialog.py +35 -2
  13. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/COPYING +0 -0
  14. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyproject.toml +0 -0
  15. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/code_editors/__init__.py +0 -0
  16. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/code_editors/code_editors.py +0 -0
  17. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/code_editors/languages/__init__.py +0 -0
  18. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/code_editors/languages/generic.py +0 -0
  19. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/code_editors/languages/markdown.py +0 -0
  20. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/code_editors/languages/text.py +0 -0
  21. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/components/__init__.py +0 -0
  22. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/components/editor_panel.py +0 -0
  23. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/components/jupyter_console.py +0 -0
  24. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/components/settings_panel.py +0 -0
  25. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/components/sigmund.py +0 -0
  26. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/components/workspace_explorer.py +0 -0
  27. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/mixins/__init__.py +0 -0
  28. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/mixins/auto_indent.py +0 -0
  29. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/mixins/auto_pair.py +0 -0
  30. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/mixins/check.py +0 -0
  31. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/mixins/execute.py +0 -0
  32. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/mixins/file_link.py +0 -0
  33. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/mixins/python_auto_indent.py +0 -0
  34. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/mixins/search_replace.py +0 -0
  35. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/mixins/shortcuts.py +0 -0
  36. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/mixins/smart_backspace_delete.py +0 -0
  37. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/mixins/symbols.py +0 -0
  38. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/mixins/theme.py +0 -0
  39. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/mixins/widgets/__init__.py +0 -0
  40. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/mixins/zoom.py +0 -0
  41. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/signal_router.py +0 -0
  42. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/syntax_highlighters/__init__.py +0 -0
  43. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/syntax_highlighters/languages/__init__.py +0 -0
  44. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/syntax_highlighters/languages/generic.py +0 -0
  45. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/syntax_highlighters/languages/python.py +0 -0
  46. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/syntax_highlighters/syntax_highlighter.py +0 -0
  47. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/themes.py +0 -0
  48. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/utils/__init__.py +0 -0
  49. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/utils/languages/__init__.py +0 -0
  50. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/utils/languages/python/__init__.py +0 -0
  51. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/utils/languages/python/_auto_indent.py +0 -0
  52. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/utils/languages/python/_extract_cells.py +0 -0
  53. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/utils/languages/python/_mask_str_in_code.py +0 -0
  54. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/watchdog.py +0 -0
  55. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/widgets/__init__.py +0 -0
  56. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/widgets/calltip_widget.py +0 -0
  57. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/widgets/completion_popup.py +0 -0
  58. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/widgets/dock.py +0 -0
  59. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/widgets/quick_open_file_dialog.py +0 -0
  60. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/widgets/quick_symbol_dialog.py +0 -0
  61. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/widgets/search_replace_frame.py +0 -0
  62. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/widgets/tab_splitter.py +0 -0
  63. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/widgets/tabbed_editor.py +0 -0
  64. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/worker/__init__.py +0 -0
  65. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/worker/languages/__init__.py +0 -0
  66. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/worker/languages/generic.py +0 -0
  67. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/worker/languages/python.py +0 -0
  68. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/worker/manager.py +0 -0
  69. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/worker/process.py +0 -0
  70. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/worker/providers/__init__.py +0 -0
  71. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/worker/providers/codestral.py +0 -0
  72. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/worker/providers/jedi.py +0 -0
  73. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/worker/providers/ruff.py +0 -0
  74. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/worker/providers/sigmund.py +0 -0
  75. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/worker/providers/symbol.py +0 -0
  76. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/pyqt_code_editor/worker/settings.py +0 -0
  77. {pyqt_code_editor-0.0.19 → pyqt_code_editor-0.0.21}/readme.md +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyqt_code_editor
3
- Version: 0.0.19
3
+ Version: 0.0.21
4
4
  Summary: Fully featured code-editor widgets for PyQt
5
5
  Keywords: code editor,pyqt,ide
6
6
  Author-email: Sebastiaan Mathôt <s.mathot@cogsci.nl>
@@ -2,4 +2,4 @@
2
2
 
3
3
  from ._settings import settings
4
4
 
5
- __version__ = '0.0.19'
5
+ __version__ = '0.0.21'
@@ -80,6 +80,7 @@ class Settings(QObject):
80
80
 
81
81
  # Files and Folders
82
82
  current_folder = SettingProperty(os.path.expanduser('~'), "Files")
83
+ project_folders = SettingProperty(os.path.expanduser('~'), "Files")
83
84
  default_filename = SettingProperty('untitled.txt', "Files")
84
85
  default_language = SettingProperty('python', "Files")
85
86
  default_encoding = SettingProperty('utf-8', "Files")
@@ -26,9 +26,8 @@ class MainWindow(QMainWindow):
26
26
  super().__init__()
27
27
  logger.info("MainWindow initialized")
28
28
  # If no path is provided, fall back to current dir
29
- if not root_path:
30
- root_path = settings.current_folder
31
-
29
+ if root_path:
30
+ settings.project_folders = settings.current_folder = root_path
32
31
  self.setWindowTitle(f"Sigmund Analyst {__version__}")
33
32
  # The editor panel provides splittable editor tabs
34
33
  self._editor_panel = EditorPanel()
@@ -38,8 +37,9 @@ class MainWindow(QMainWindow):
38
37
  # Track if project explorers are hidden as a group
39
38
  self._project_explorers_hidden = False
40
39
  # Open initial project explorer
41
- self._open_project_explorer(root_path)
42
-
40
+ for project_folder in str(settings.project_folders).split(':'):
41
+ if project_folder:
42
+ self._open_project_explorer(project_folder)
43
43
  # Set up the workspace explorer
44
44
  self._workspace_explorer = WorkspaceExplorer(parent=self)
45
45
  self.addDockWidget(Qt.RightDockWidgetArea, self._workspace_explorer)
@@ -6,7 +6,7 @@ from pyqt_code_editor.mixins import Complete, PythonAutoIndent, \
6
6
 
7
7
 
8
8
  class Editor(LineNumber, Zoom, SmartBackspaceDelete, PythonAutoPair, Complete,
9
- PythonAutoIndent, Comment, SearchReplace, FileLink, Execute,
9
+ Comment, PythonAutoIndent, SearchReplace, FileLink, Execute,
10
10
  Theme, Check, Shortcuts, Symbols, Base,
11
11
  QPlainTextEdit):
12
12
 
@@ -2,8 +2,9 @@ import os
2
2
  import multiprocessing
3
3
  from qtpy.QtWidgets import QDockWidget, QWidget, QVBoxLayout, QHBoxLayout, \
4
4
  QLineEdit, QCheckBox, QPushButton, QTreeWidget, QTreeWidgetItem, \
5
- QAbstractItemView
5
+ QAbstractItemView, QLabel
6
6
  from qtpy.QtCore import Qt, QTimer, Signal
7
+ import fnmatch
7
8
 
8
9
 
9
10
  def search_in_files_worker(files, search_text, case_sensitive, whole_word, regex, output_queue):
@@ -53,7 +54,8 @@ class FindInFiles(QDockWidget):
53
54
  super().__init__("Find in Files", parent)
54
55
  self.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea)
55
56
 
56
- self._files = files_list[:] # store a copy
57
+ self._all_files = files_list[:] # store all files
58
+ self._filtered_files = [] # files after extension filter
57
59
  self._search_process = None
58
60
  self._output_queue = None
59
61
 
@@ -83,6 +85,20 @@ class FindInFiles(QDockWidget):
83
85
  controls_layout.addWidget(self.searchBtn)
84
86
  controls_layout.setContentsMargins(0, 0, 0, 0)
85
87
 
88
+ # File type filter row
89
+ filter_layout = QHBoxLayout()
90
+ layout.addLayout(filter_layout)
91
+
92
+ filter_label = QLabel("File types:", self)
93
+ self.fileTypesInput = QLineEdit(self)
94
+ self.fileTypesInput.setPlaceholderText("e.g. .py .js .html (default: .*)")
95
+ self.fileTypesInput.setText(".*") # Default to all files
96
+ self.fileTypesInput.setToolTip("Space or comma separated extensions. Use .* for all files.")
97
+
98
+ filter_layout.addWidget(filter_label)
99
+ filter_layout.addWidget(self.fileTypesInput)
100
+ filter_layout.setContentsMargins(0, 0, 0, 0)
101
+
86
102
  # Tree Widget for results
87
103
  self.resultsTree = QTreeWidget(self)
88
104
  self.resultsTree.setHeaderLabels(["File / Line", "Preview"])
@@ -104,6 +120,41 @@ class FindInFiles(QDockWidget):
104
120
  super().showEvent(event)
105
121
  self.searchInput.setFocus()
106
122
 
123
+ def _parse_extensions(self, text):
124
+ """Parse extension filter text into a list of patterns"""
125
+ if not text or text.strip() == ".*":
126
+ return ["*"] # Match all files
127
+
128
+ # Split by spaces or commas
129
+ import re
130
+ extensions = re.split(r'[,\s]+', text.strip())
131
+
132
+ # Convert extensions to glob patterns
133
+ patterns = []
134
+ for ext in extensions:
135
+ if ext:
136
+ if not ext.startswith('.'):
137
+ ext = '.' + ext
138
+ patterns.append('*' + ext)
139
+
140
+ return patterns if patterns else ["*"]
141
+
142
+ def _filter_files_by_extension(self):
143
+ """Filter files based on the extension patterns"""
144
+ patterns = self._parse_extensions(self.fileTypesInput.text())
145
+
146
+ if patterns == ["*"]:
147
+ # No filtering needed
148
+ self._filtered_files = self._all_files[:]
149
+ return
150
+
151
+ self._filtered_files = []
152
+ for file_path in self._all_files:
153
+ for pattern in patterns:
154
+ if fnmatch.fnmatch(os.path.basename(file_path).lower(), pattern.lower()):
155
+ self._filtered_files.append(file_path)
156
+ break
157
+
107
158
  def _start_search(self):
108
159
  # Kill any existing worker first
109
160
  if self._search_process and self._search_process.is_alive():
@@ -112,10 +163,26 @@ class FindInFiles(QDockWidget):
112
163
  # Clear old results
113
164
  self.resultsTree.clear()
114
165
 
166
+ # Filter files by extension
167
+ self._filter_files_by_extension()
168
+
169
+ # Show file count in status
170
+ file_count_item = QTreeWidgetItem(self.resultsTree)
171
+ file_count_item.setText(0, f"Searching {len(self._filtered_files)} files...")
172
+ file_count_item.setForeground(0, Qt.gray)
173
+
174
+ # If no files match the filter, show message
175
+ if not self._filtered_files:
176
+ self.resultsTree.clear()
177
+ no_files_item = QTreeWidgetItem(self.resultsTree)
178
+ no_files_item.setText(0, "No files match the specified extensions")
179
+ no_files_item.setForeground(0, Qt.gray)
180
+ return
181
+
115
182
  # Prepare
116
183
  self._output_queue = multiprocessing.Queue()
117
184
  args = (
118
- self._files,
185
+ self._filtered_files,
119
186
  self.searchInput.text(),
120
187
  self.caseBox.isChecked(),
121
188
  self.wholeWordBox.isChecked(),
@@ -136,6 +203,7 @@ class FindInFiles(QDockWidget):
136
203
  return
137
204
 
138
205
  # Grab everything from the queue
206
+ first_result = True
139
207
  while not self._output_queue.empty():
140
208
  msg = self._output_queue.get()
141
209
  if not msg:
@@ -143,6 +211,13 @@ class FindInFiles(QDockWidget):
143
211
  kind = msg[0]
144
212
 
145
213
  if kind == "found":
214
+ # Clear the "Searching..." message on first result
215
+ if first_result and self.resultsTree.topLevelItemCount() == 1:
216
+ first_item = self.resultsTree.topLevelItem(0)
217
+ if "Searching" in first_item.text(0):
218
+ self.resultsTree.clear()
219
+ first_result = False
220
+
146
221
  # we have file + list of (line_num, text)
147
222
  file_path = msg[1]
148
223
  lines = msg[2]
@@ -154,6 +229,15 @@ class FindInFiles(QDockWidget):
154
229
  elif kind == "done":
155
230
  # done means the worker finished scanning
156
231
  self._search_process = None
232
+
233
+ # If no results found, show message
234
+ if self.resultsTree.topLevelItemCount() == 1:
235
+ first_item = self.resultsTree.topLevelItem(0)
236
+ if "Searching" in first_item.text(0):
237
+ self.resultsTree.clear()
238
+ no_results_item = QTreeWidgetItem(self.resultsTree)
239
+ no_results_item.setText(0, "No matches found")
240
+ no_results_item.setForeground(0, Qt.gray)
157
241
 
158
242
  def _add_file_matches(self, file_path, lines):
159
243
  # Create a top-level item for file
@@ -262,8 +262,12 @@ class ProjectExplorer(QDockWidget):
262
262
  if not selected_dir:
263
263
  return None
264
264
  settings.current_folder = selected_dir
265
+ # Add selected folder to project folders but make sure we don't
266
+ # duplicate
267
+ settings.project_folders = ':'.join(
268
+ set(str(settings.project_folders).split(':')) | {selected_dir})
265
269
  explorer = cls(editor_panel, root_path=selected_dir, parent=parent)
266
- return explorer
270
+ return explorer
267
271
 
268
272
  def _toggle_gitignore(self, enabled):
269
273
  """Toggles the .gitignore filter on or off and refreshes the model.
@@ -514,6 +518,10 @@ class ProjectExplorer(QDockWidget):
514
518
  self._clipboard_operation = None
515
519
  self._clipboard_source_path = None
516
520
 
517
- def closeEvent(self, event):
521
+ def closeEvent(self, event):
522
+ # Add selected folder to project folders but make sure we don't
523
+ # duplicate
524
+ settings.project_folders = ':'.join(
525
+ set(str(settings.project_folders).split(':')) - {self._display_root})
518
526
  super().closeEvent(event)
519
527
  self.closed.emit(self)
@@ -15,6 +15,7 @@ class Base:
15
15
  code_editor_language = 'text'
16
16
  modification_changed = Signal(object, bool)
17
17
  received_focus = Signal(object)
18
+ lost_focus = Signal(object)
18
19
 
19
20
  def __init__(self, *args, **kwargs):
20
21
  # Optionally set the language. This is mainly for generic editors that
@@ -52,6 +53,13 @@ class Base:
52
53
  """
53
54
  super().focusInEvent(event)
54
55
  self.received_focus.emit(self)
56
+
57
+ def focusOutEvent(self, event):
58
+ """Allows managing widgets, such as the editor panel, to keep track of
59
+ which editor is active
60
+ """
61
+ super().focusOutEvent(event)
62
+ self.lost_focus.emit(self)
55
63
 
56
64
  def refresh(self):
57
65
  """Can be called to indicate that the interface needs to be refreshed,
@@ -17,12 +17,31 @@ class Comment:
17
17
  (default "# " for Python).
18
18
  """
19
19
  super().__init__(*args, **kwargs)
20
- # The text to prepend for a commented line
21
- self.code_editor_comment_string
22
20
  self._comment_shortcut = QShortcut(
23
21
  QKeySequence(settings.shortcut_comment), self)
24
22
  self._comment_shortcut.setContext(Qt.WidgetWithChildrenShortcut)
25
23
  self._comment_shortcut.activated.connect(self._toggle_comment)
24
+
25
+ def keyPressEvent(self, event):
26
+ # When a return is pressed on a commented line, the comment should
27
+ # continue on the next line
28
+ if event.key() in (Qt.Key_Enter, Qt.Key_Return):
29
+ cursor = self.textCursor()
30
+ block = cursor.block()
31
+ line_text = block.text()
32
+ # Check if the current line is a comment
33
+ stripped = line_text.lstrip()
34
+ if stripped.startswith(self.code_editor_comment_string[0]):
35
+ # Extract the indentation from the current line
36
+ indentation = line_text[:len(line_text) - len(stripped)]
37
+ # Insert newline with same indentation plus comment marker
38
+ cursor.beginEditBlock()
39
+ cursor.insertText(
40
+ '\n' + indentation + self.code_editor_comment_string)
41
+ cursor.endEditBlock()
42
+ event.accept()
43
+ return
44
+ super().keyPressEvent(event)
26
45
 
27
46
  def _toggle_comment(self):
28
47
  """Toggle comment on the current selection or current line."""
@@ -99,7 +99,7 @@ class Complete:
99
99
  self._cm_completion_popup.hide()
100
100
 
101
101
  def focusOutEvent(self, event):
102
- """Make sure the calltip doesn't stay open when we scroll the viewport.
102
+ """Make sure the calltip doesn't stay open when the widget loses focus.
103
103
  """
104
104
  super().focusOutEvent(event)
105
105
  self._cm_hide_calltip()
@@ -516,9 +516,7 @@ class Complete:
516
516
  global_pos = global_bottom_left
517
517
  logger.info("Positioning calltip below cursor.")
518
518
 
519
- print(f'intended position: {global_pos}')
520
519
  self._cm_calltip_widget.move(global_pos)
521
- print(f'actual position: {self._cm_calltip_widget.pos()}')
522
520
  self._cm_calltip_widget.show()
523
521
 
524
522
  def closeEvent(self, event):
@@ -50,6 +50,8 @@ class LineNumber:
50
50
 
51
51
  def __init__(self, *args, **kwargs):
52
52
  super().__init__(*args, **kwargs)
53
+ self._line_number_rects = {}
54
+ self._line_rects = {}
53
55
  self.setMouseTracking(True)
54
56
  # Create the line number area
55
57
  self.lineNumberArea = LineNumberArea(self)
@@ -1,4 +1,3 @@
1
- import os
2
1
  import logging
3
2
  from qtpy.QtWidgets import (
4
3
  QDialog,
@@ -10,6 +9,7 @@ from qtpy.QtWidgets import (
10
9
  )
11
10
  from qtpy.QtCore import Qt, QSortFilterProxyModel, QModelIndex
12
11
  from qtpy.QtGui import QStandardItemModel, QStandardItem
12
+ from .. import settings, themes
13
13
 
14
14
  logger = logging.getLogger(__name__)
15
15
 
@@ -42,6 +42,26 @@ class MultiNeedleFilterProxyModel(QSortFilterProxyModel):
42
42
  if needle not in item_text_lower:
43
43
  return False
44
44
  return True
45
+
46
+ STYLESHEET = '''
47
+ QuickOpenDialog {{
48
+ background-color: {background};
49
+ color: {foreground};
50
+ padding: 8px;
51
+ border-radius: 4px;
52
+ }}
53
+ QLineEdit {{
54
+ margin-bottom: 4px;
55
+ }}
56
+ QLineEdit, QListView {{
57
+ color: {foreground};
58
+ border: none;
59
+ font-family: {font_family};
60
+ font-size: {font_size}px;
61
+ background-color: {selection_background};
62
+ padding: 4px;
63
+ }}
64
+ '''
45
65
 
46
66
  class QuickOpenDialog(QDialog):
47
67
  """
@@ -52,11 +72,20 @@ class QuickOpenDialog(QDialog):
52
72
  """
53
73
  def __init__(self, parent, items, title="Quick Open"):
54
74
  super().__init__(parent)
75
+ color_scheme = themes.THEMES.get(settings.color_scheme)
76
+ if color_scheme:
77
+ self.setStyleSheet(STYLESHEET.format(
78
+ background=color_scheme['background_color'],
79
+ foreground=color_scheme['text_color'],
80
+ selection_background=color_scheme['selection_background'],
81
+ font_size=settings.font_size,
82
+ font_family=settings.font_family
83
+ ))
55
84
  self.setWindowFlags(Qt.Dialog | Qt.FramelessWindowHint)
56
85
  self.setWindowModality(Qt.ApplicationModal)
57
86
 
58
87
  self.setWindowTitle(title)
59
- self.resize(400, 400)
88
+ self.resize(800, 400)
60
89
 
61
90
  layout = QVBoxLayout(self)
62
91
  self._filter_edit = QLineEdit(self)
@@ -65,6 +94,10 @@ class QuickOpenDialog(QDialog):
65
94
 
66
95
  self._list_view = QListView(self)
67
96
  self._list_view.setSelectionMode(QAbstractItemView.SingleSelection)
97
+ self._list_view.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
98
+ self._list_view.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
99
+ self._list_view.setTextElideMode(Qt.ElideMiddle)
100
+
68
101
  layout.addWidget(self._list_view)
69
102
 
70
103
  self._items = items