IncludeCPP 3.7.3__py3-none-any.whl
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.
- includecpp/__init__.py +59 -0
- includecpp/__init__.pyi +255 -0
- includecpp/__main__.py +4 -0
- includecpp/cli/__init__.py +4 -0
- includecpp/cli/commands.py +8270 -0
- includecpp/cli/config_parser.py +127 -0
- includecpp/core/__init__.py +19 -0
- includecpp/core/ai_integration.py +2132 -0
- includecpp/core/build_manager.py +2416 -0
- includecpp/core/cpp_api.py +376 -0
- includecpp/core/cpp_api.pyi +95 -0
- includecpp/core/cppy_converter.py +3448 -0
- includecpp/core/cssl/CSSL_DOCUMENTATION.md +2075 -0
- includecpp/core/cssl/__init__.py +42 -0
- includecpp/core/cssl/cssl_builtins.py +2271 -0
- includecpp/core/cssl/cssl_builtins.pyi +1393 -0
- includecpp/core/cssl/cssl_events.py +621 -0
- includecpp/core/cssl/cssl_modules.py +2803 -0
- includecpp/core/cssl/cssl_parser.py +2575 -0
- includecpp/core/cssl/cssl_runtime.py +3051 -0
- includecpp/core/cssl/cssl_syntax.py +488 -0
- includecpp/core/cssl/cssl_types.py +1512 -0
- includecpp/core/cssl_bridge.py +882 -0
- includecpp/core/cssl_bridge.pyi +488 -0
- includecpp/core/error_catalog.py +802 -0
- includecpp/core/error_formatter.py +1016 -0
- includecpp/core/exceptions.py +97 -0
- includecpp/core/path_discovery.py +77 -0
- includecpp/core/project_ui.py +3370 -0
- includecpp/core/settings_ui.py +326 -0
- includecpp/generator/__init__.py +1 -0
- includecpp/generator/parser.cpp +1903 -0
- includecpp/generator/parser.h +281 -0
- includecpp/generator/type_resolver.cpp +363 -0
- includecpp/generator/type_resolver.h +68 -0
- includecpp/py.typed +0 -0
- includecpp/templates/cpp.proj.template +18 -0
- includecpp/vscode/__init__.py +1 -0
- includecpp/vscode/cssl/__init__.py +1 -0
- includecpp/vscode/cssl/language-configuration.json +38 -0
- includecpp/vscode/cssl/package.json +50 -0
- includecpp/vscode/cssl/snippets/cssl.snippets.json +1080 -0
- includecpp/vscode/cssl/syntaxes/cssl.tmLanguage.json +341 -0
- includecpp-3.7.3.dist-info/METADATA +1076 -0
- includecpp-3.7.3.dist-info/RECORD +49 -0
- includecpp-3.7.3.dist-info/WHEEL +5 -0
- includecpp-3.7.3.dist-info/entry_points.txt +2 -0
- includecpp-3.7.3.dist-info/licenses/LICENSE +21 -0
- includecpp-3.7.3.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import json
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
try:
|
|
6
|
+
from PyQt6.QtWidgets import (
|
|
7
|
+
QApplication, QWidget, QVBoxLayout, QHBoxLayout, QLabel,
|
|
8
|
+
QPushButton, QLineEdit, QCheckBox, QComboBox, QFrame,
|
|
9
|
+
QScrollArea
|
|
10
|
+
)
|
|
11
|
+
from PyQt6.QtCore import Qt
|
|
12
|
+
from PyQt6.QtGui import QFont
|
|
13
|
+
PYQT_AVAILABLE = True
|
|
14
|
+
except ImportError:
|
|
15
|
+
PYQT_AVAILABLE = False
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def is_experimental_enabled() -> bool:
|
|
19
|
+
"""Check if experimental features are enabled globally."""
|
|
20
|
+
config_path = Path.home() / '.includecpp' / '.secret'
|
|
21
|
+
if config_path.exists():
|
|
22
|
+
try:
|
|
23
|
+
config = json.loads(config_path.read_text(encoding='utf-8'))
|
|
24
|
+
return config.get('experimental_features', False)
|
|
25
|
+
except Exception:
|
|
26
|
+
pass
|
|
27
|
+
return False
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class SettingsWidget(QWidget):
|
|
31
|
+
def __init__(self):
|
|
32
|
+
super().__init__()
|
|
33
|
+
self.config_path = Path.home() / '.includecpp' / '.secret'
|
|
34
|
+
self.config = self._load_config()
|
|
35
|
+
self._setup_ui()
|
|
36
|
+
self._load_values()
|
|
37
|
+
|
|
38
|
+
def _load_config(self):
|
|
39
|
+
if self.config_path.exists():
|
|
40
|
+
try:
|
|
41
|
+
return json.loads(self.config_path.read_text(encoding='utf-8'))
|
|
42
|
+
except Exception:
|
|
43
|
+
pass
|
|
44
|
+
return {}
|
|
45
|
+
|
|
46
|
+
def _save_config(self):
|
|
47
|
+
self.config_path.parent.mkdir(parents=True, exist_ok=True)
|
|
48
|
+
self.config_path.write_text(json.dumps(self.config, indent=2), encoding='utf-8')
|
|
49
|
+
|
|
50
|
+
def _setup_ui(self):
|
|
51
|
+
self.setWindowTitle('IncludeCPP Settings')
|
|
52
|
+
self.setFixedSize(360, 580)
|
|
53
|
+
self.setWindowFlags(Qt.WindowType.FramelessWindowHint)
|
|
54
|
+
self.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground)
|
|
55
|
+
|
|
56
|
+
# Main container with background
|
|
57
|
+
main = QWidget(self)
|
|
58
|
+
main.setGeometry(0, 0, 360, 580)
|
|
59
|
+
|
|
60
|
+
base_style = '''
|
|
61
|
+
QWidget {
|
|
62
|
+
background-color: #1a1a1a;
|
|
63
|
+
border-radius: 12px;
|
|
64
|
+
color: #e0e0e0;
|
|
65
|
+
}
|
|
66
|
+
QLabel {
|
|
67
|
+
color: #e0e0e0;
|
|
68
|
+
font-size: 12px;
|
|
69
|
+
background-color: transparent;
|
|
70
|
+
}
|
|
71
|
+
QLineEdit {
|
|
72
|
+
background-color: #2d2d2d;
|
|
73
|
+
border: 1px solid #3d3d3d;
|
|
74
|
+
border-radius: 6px;
|
|
75
|
+
padding: 8px 10px;
|
|
76
|
+
color: #e0e0e0;
|
|
77
|
+
font-size: 12px;
|
|
78
|
+
min-height: 14px;
|
|
79
|
+
}
|
|
80
|
+
QLineEdit:focus {
|
|
81
|
+
border: 1px solid #4a9eff;
|
|
82
|
+
}
|
|
83
|
+
QPushButton {
|
|
84
|
+
background-color: #2d2d2d;
|
|
85
|
+
border: 1px solid #3d3d3d;
|
|
86
|
+
border-radius: 6px;
|
|
87
|
+
padding: 8px 16px;
|
|
88
|
+
color: #e0e0e0;
|
|
89
|
+
font-size: 12px;
|
|
90
|
+
}
|
|
91
|
+
QPushButton:hover {
|
|
92
|
+
background-color: #3d3d3d;
|
|
93
|
+
}
|
|
94
|
+
QPushButton:pressed {
|
|
95
|
+
background-color: #4a9eff;
|
|
96
|
+
}
|
|
97
|
+
QCheckBox {
|
|
98
|
+
color: #e0e0e0;
|
|
99
|
+
font-size: 12px;
|
|
100
|
+
background-color: transparent;
|
|
101
|
+
}
|
|
102
|
+
QCheckBox::indicator {
|
|
103
|
+
width: 16px;
|
|
104
|
+
height: 16px;
|
|
105
|
+
border-radius: 4px;
|
|
106
|
+
background-color: #2d2d2d;
|
|
107
|
+
border: 1px solid #3d3d3d;
|
|
108
|
+
}
|
|
109
|
+
QCheckBox::indicator:checked {
|
|
110
|
+
background-color: #4a9eff;
|
|
111
|
+
}
|
|
112
|
+
QComboBox {
|
|
113
|
+
background-color: #2d2d2d;
|
|
114
|
+
border: 1px solid #3d3d3d;
|
|
115
|
+
border-radius: 6px;
|
|
116
|
+
padding: 8px 10px;
|
|
117
|
+
color: #e0e0e0;
|
|
118
|
+
font-size: 12px;
|
|
119
|
+
min-height: 14px;
|
|
120
|
+
}
|
|
121
|
+
QComboBox::drop-down {
|
|
122
|
+
border: none;
|
|
123
|
+
width: 20px;
|
|
124
|
+
}
|
|
125
|
+
QComboBox QAbstractItemView {
|
|
126
|
+
background-color: #2d2d2d;
|
|
127
|
+
color: #e0e0e0;
|
|
128
|
+
selection-background-color: #4a9eff;
|
|
129
|
+
}
|
|
130
|
+
QScrollArea {
|
|
131
|
+
background-color: transparent;
|
|
132
|
+
border: none;
|
|
133
|
+
}
|
|
134
|
+
QScrollBar:vertical {
|
|
135
|
+
background-color: #2d2d2d;
|
|
136
|
+
width: 8px;
|
|
137
|
+
border-radius: 4px;
|
|
138
|
+
}
|
|
139
|
+
QScrollBar::handle:vertical {
|
|
140
|
+
background-color: #4a4a4a;
|
|
141
|
+
border-radius: 4px;
|
|
142
|
+
min-height: 20px;
|
|
143
|
+
}
|
|
144
|
+
QScrollBar::handle:vertical:hover {
|
|
145
|
+
background-color: #5a5a5a;
|
|
146
|
+
}
|
|
147
|
+
QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical {
|
|
148
|
+
height: 0px;
|
|
149
|
+
}
|
|
150
|
+
'''
|
|
151
|
+
main.setStyleSheet(base_style)
|
|
152
|
+
|
|
153
|
+
# Main layout for the container
|
|
154
|
+
main_layout = QVBoxLayout(main)
|
|
155
|
+
main_layout.setContentsMargins(16, 16, 16, 16)
|
|
156
|
+
main_layout.setSpacing(8)
|
|
157
|
+
|
|
158
|
+
# Header (fixed, not scrollable)
|
|
159
|
+
header = QHBoxLayout()
|
|
160
|
+
title = QLabel('IncludeCPP Settings')
|
|
161
|
+
title.setFont(QFont('Segoe UI', 13, QFont.Weight.Bold))
|
|
162
|
+
title.setStyleSheet('color: #4a9eff; background-color: transparent;')
|
|
163
|
+
header.addWidget(title)
|
|
164
|
+
header.addStretch()
|
|
165
|
+
close_btn = QPushButton('×')
|
|
166
|
+
close_btn.setFixedSize(24, 24)
|
|
167
|
+
close_btn.setStyleSheet('font-size: 16px; border-radius: 12px;')
|
|
168
|
+
close_btn.clicked.connect(self.close)
|
|
169
|
+
header.addWidget(close_btn)
|
|
170
|
+
main_layout.addLayout(header)
|
|
171
|
+
|
|
172
|
+
self._add_separator(main_layout)
|
|
173
|
+
|
|
174
|
+
# Scroll area for content
|
|
175
|
+
scroll = QScrollArea()
|
|
176
|
+
scroll.setWidgetResizable(True)
|
|
177
|
+
scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
|
|
178
|
+
scroll.setStyleSheet('QScrollArea { background-color: transparent; border: none; }')
|
|
179
|
+
|
|
180
|
+
# Content widget inside scroll area
|
|
181
|
+
content = QWidget()
|
|
182
|
+
content.setStyleSheet('background-color: transparent;')
|
|
183
|
+
content_layout = QVBoxLayout(content)
|
|
184
|
+
content_layout.setContentsMargins(0, 0, 8, 0)
|
|
185
|
+
content_layout.setSpacing(10)
|
|
186
|
+
|
|
187
|
+
# --- Experimental Features Section ---
|
|
188
|
+
exp_label = QLabel('Experimental')
|
|
189
|
+
exp_label.setFont(QFont('Segoe UI', 10, QFont.Weight.Bold))
|
|
190
|
+
exp_label.setStyleSheet('color: #ff9800; background-color: transparent;')
|
|
191
|
+
content_layout.addWidget(exp_label)
|
|
192
|
+
|
|
193
|
+
self.experimental_enabled = QCheckBox('Enable Experimental Features')
|
|
194
|
+
self.experimental_enabled.setToolTip('Enables AI and CPPY commands (may contain bugs)')
|
|
195
|
+
content_layout.addWidget(self.experimental_enabled)
|
|
196
|
+
|
|
197
|
+
self._add_separator(content_layout)
|
|
198
|
+
|
|
199
|
+
# --- AI Configuration Section ---
|
|
200
|
+
ai_label = QLabel('AI Configuration')
|
|
201
|
+
ai_label.setFont(QFont('Segoe UI', 10, QFont.Weight.Bold))
|
|
202
|
+
content_layout.addWidget(ai_label)
|
|
203
|
+
|
|
204
|
+
self.ai_enabled = QCheckBox('Enable AI Features')
|
|
205
|
+
content_layout.addWidget(self.ai_enabled)
|
|
206
|
+
|
|
207
|
+
content_layout.addWidget(QLabel('OpenAI API Key'))
|
|
208
|
+
self.api_key = QLineEdit()
|
|
209
|
+
self.api_key.setEchoMode(QLineEdit.EchoMode.Password)
|
|
210
|
+
self.api_key.setPlaceholderText('sk-...')
|
|
211
|
+
content_layout.addWidget(self.api_key)
|
|
212
|
+
|
|
213
|
+
content_layout.addWidget(QLabel('Model'))
|
|
214
|
+
self.model = QComboBox()
|
|
215
|
+
self.model.addItems(['gpt-5', 'gpt-5-nano', 'gpt-4o', 'gpt-4-turbo', 'gpt-3.5-turbo'])
|
|
216
|
+
content_layout.addWidget(self.model)
|
|
217
|
+
|
|
218
|
+
self._add_separator(content_layout)
|
|
219
|
+
|
|
220
|
+
# --- API Tokens Section ---
|
|
221
|
+
tokens_label = QLabel('API Tokens')
|
|
222
|
+
tokens_label.setFont(QFont('Segoe UI', 10, QFont.Weight.Bold))
|
|
223
|
+
content_layout.addWidget(tokens_label)
|
|
224
|
+
|
|
225
|
+
content_layout.addWidget(QLabel('Brave Search API'))
|
|
226
|
+
self.brave_key = QLineEdit()
|
|
227
|
+
self.brave_key.setEchoMode(QLineEdit.EchoMode.Password)
|
|
228
|
+
self.brave_key.setPlaceholderText('Token for --websearch')
|
|
229
|
+
content_layout.addWidget(self.brave_key)
|
|
230
|
+
|
|
231
|
+
self._add_separator(content_layout)
|
|
232
|
+
|
|
233
|
+
# --- Usage Limits Section ---
|
|
234
|
+
limits_label = QLabel('Usage Limits')
|
|
235
|
+
limits_label.setFont(QFont('Segoe UI', 10, QFont.Weight.Bold))
|
|
236
|
+
content_layout.addWidget(limits_label)
|
|
237
|
+
|
|
238
|
+
content_layout.addWidget(QLabel('Daily Token Limit'))
|
|
239
|
+
self.daily_limit = QLineEdit()
|
|
240
|
+
self.daily_limit.setPlaceholderText('220000')
|
|
241
|
+
content_layout.addWidget(self.daily_limit)
|
|
242
|
+
|
|
243
|
+
content_layout.addStretch()
|
|
244
|
+
|
|
245
|
+
scroll.setWidget(content)
|
|
246
|
+
main_layout.addWidget(scroll)
|
|
247
|
+
|
|
248
|
+
# Save button (fixed at bottom)
|
|
249
|
+
btn_layout = QHBoxLayout()
|
|
250
|
+
save_btn = QPushButton('Save')
|
|
251
|
+
save_btn.setStyleSheet('background-color: #4a9eff; font-weight: bold;')
|
|
252
|
+
save_btn.clicked.connect(self._save)
|
|
253
|
+
btn_layout.addWidget(save_btn)
|
|
254
|
+
main_layout.addLayout(btn_layout)
|
|
255
|
+
|
|
256
|
+
self._drag_pos = None
|
|
257
|
+
|
|
258
|
+
def _add_separator(self, layout):
|
|
259
|
+
line = QFrame()
|
|
260
|
+
line.setFrameShape(QFrame.Shape.HLine)
|
|
261
|
+
line.setStyleSheet('background-color: #3d3d3d; max-height: 1px;')
|
|
262
|
+
layout.addWidget(line)
|
|
263
|
+
|
|
264
|
+
def _load_values(self):
|
|
265
|
+
# Experimental features
|
|
266
|
+
self.experimental_enabled.setChecked(self.config.get('experimental_features', False))
|
|
267
|
+
# AI settings
|
|
268
|
+
self.ai_enabled.setChecked(self.config.get('enabled', False))
|
|
269
|
+
api = self.config.get('api_key', '')
|
|
270
|
+
if api:
|
|
271
|
+
self.api_key.setText(api)
|
|
272
|
+
model = self.config.get('model', 'gpt-5')
|
|
273
|
+
idx = self.model.findText(model)
|
|
274
|
+
if idx >= 0:
|
|
275
|
+
self.model.setCurrentIndex(idx)
|
|
276
|
+
brave = self.config.get('brave_api_key', '')
|
|
277
|
+
if brave:
|
|
278
|
+
self.brave_key.setText(brave)
|
|
279
|
+
daily_limit = self.config.get('daily_limit', 220000)
|
|
280
|
+
self.daily_limit.setText(str(daily_limit))
|
|
281
|
+
|
|
282
|
+
def _save(self):
|
|
283
|
+
# Experimental features
|
|
284
|
+
self.config['experimental_features'] = self.experimental_enabled.isChecked()
|
|
285
|
+
# AI settings
|
|
286
|
+
self.config['enabled'] = self.ai_enabled.isChecked()
|
|
287
|
+
api = self.api_key.text().strip()
|
|
288
|
+
if api:
|
|
289
|
+
self.config['api_key'] = api
|
|
290
|
+
# Only update model if user explicitly changed it (preserve existing if combo unchanged)
|
|
291
|
+
self.config['model'] = self.model.currentText()
|
|
292
|
+
brave = self.brave_key.text().strip()
|
|
293
|
+
if brave:
|
|
294
|
+
self.config['brave_api_key'] = brave
|
|
295
|
+
limit_text = self.daily_limit.text().strip()
|
|
296
|
+
if limit_text.isdigit() and int(limit_text) >= 1000:
|
|
297
|
+
self.config['daily_limit'] = int(limit_text)
|
|
298
|
+
self._save_config()
|
|
299
|
+
self.close()
|
|
300
|
+
|
|
301
|
+
def mousePressEvent(self, event):
|
|
302
|
+
if event.button() == Qt.MouseButton.LeftButton:
|
|
303
|
+
self._drag_pos = event.globalPosition().toPoint() - self.frameGeometry().topLeft()
|
|
304
|
+
event.accept()
|
|
305
|
+
|
|
306
|
+
def mouseMoveEvent(self, event):
|
|
307
|
+
if event.buttons() == Qt.MouseButton.LeftButton and self._drag_pos:
|
|
308
|
+
self.move(event.globalPosition().toPoint() - self._drag_pos)
|
|
309
|
+
event.accept()
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
def show_settings():
|
|
313
|
+
if not PYQT_AVAILABLE:
|
|
314
|
+
return False, 'PyQt6 not installed. Run: pip install PyQt6'
|
|
315
|
+
app = QApplication.instance()
|
|
316
|
+
if not app:
|
|
317
|
+
app = QApplication(sys.argv)
|
|
318
|
+
widget = SettingsWidget()
|
|
319
|
+
widget.show()
|
|
320
|
+
app.exec()
|
|
321
|
+
return True, 'Settings saved'
|
|
322
|
+
|
|
323
|
+
if __name__ == '__main__':
|
|
324
|
+
success, message = show_settings()
|
|
325
|
+
if not success:
|
|
326
|
+
print(message)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Plugin generator module containing parser source code."""
|