add completer for extra/* arguments to read_data
This commit is contained in:
@ -143,7 +143,8 @@ CodeEditor::CodeEditor(QWidget *parent) :
|
|||||||
minimize_comp(new QCompleter(this)), variable_comp(new QCompleter(this)),
|
minimize_comp(new QCompleter(this)), variable_comp(new QCompleter(this)),
|
||||||
units_comp(new QCompleter(this)), group_comp(new QCompleter(this)),
|
units_comp(new QCompleter(this)), group_comp(new QCompleter(this)),
|
||||||
varname_comp(new QCompleter(this)), fixid_comp(new QCompleter(this)),
|
varname_comp(new QCompleter(this)), fixid_comp(new QCompleter(this)),
|
||||||
compid_comp(new QCompleter(this)), file_comp(new QCompleter(this)), highlight(NO_HIGHLIGHT)
|
compid_comp(new QCompleter(this)), file_comp(new QCompleter(this)),
|
||||||
|
extra_comp(new QCompleter(this)), highlight(NO_HIGHLIGHT)
|
||||||
{
|
{
|
||||||
help_action = new QShortcut(QKeySequence::fromString("Ctrl+?"), parent);
|
help_action = new QShortcut(QKeySequence::fromString("Ctrl+?"), parent);
|
||||||
connect(help_action, &QShortcut::activated, this, &CodeEditor::get_help);
|
connect(help_action, &QShortcut::activated, this, &CodeEditor::get_help);
|
||||||
@ -180,6 +181,7 @@ CodeEditor::CodeEditor(QWidget *parent) :
|
|||||||
COMPLETER_SETUP(fixid_comp);
|
COMPLETER_SETUP(fixid_comp);
|
||||||
COMPLETER_SETUP(compid_comp);
|
COMPLETER_SETUP(compid_comp);
|
||||||
COMPLETER_SETUP(file_comp);
|
COMPLETER_SETUP(file_comp);
|
||||||
|
COMPLETER_SETUP(extra_comp);
|
||||||
#undef COMPLETER_SETUP
|
#undef COMPLETER_SETUP
|
||||||
|
|
||||||
// initialize help system
|
// initialize help system
|
||||||
@ -248,6 +250,7 @@ CodeEditor::~CodeEditor()
|
|||||||
delete fixid_comp;
|
delete fixid_comp;
|
||||||
delete compid_comp;
|
delete compid_comp;
|
||||||
delete file_comp;
|
delete file_comp;
|
||||||
|
delete extra_comp;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CodeEditor::lineNumberAreaWidth()
|
int CodeEditor::lineNumberAreaWidth()
|
||||||
@ -396,6 +399,7 @@ COMPLETER_INIT_FUNC(integrate, Integrate)
|
|||||||
COMPLETER_INIT_FUNC(minimize, Minimize)
|
COMPLETER_INIT_FUNC(minimize, Minimize)
|
||||||
COMPLETER_INIT_FUNC(variable, Variable)
|
COMPLETER_INIT_FUNC(variable, Variable)
|
||||||
COMPLETER_INIT_FUNC(units, Units)
|
COMPLETER_INIT_FUNC(units, Units)
|
||||||
|
COMPLETER_INIT_FUNC(extra, Extra)
|
||||||
|
|
||||||
#undef COMPLETER_INIT_FUNC
|
#undef COMPLETER_INIT_FUNC
|
||||||
|
|
||||||
@ -1051,6 +1055,8 @@ void CodeEditor::runCompletion()
|
|||||||
current_comp = fixid_comp;
|
current_comp = fixid_comp;
|
||||||
else if (selected.startsWith("F_"))
|
else if (selected.startsWith("F_"))
|
||||||
current_comp = fixid_comp;
|
current_comp = fixid_comp;
|
||||||
|
else if ((words[0] == "read_data") && selected.startsWith("ex"))
|
||||||
|
current_comp = extra_comp;
|
||||||
else if ((words[0] == "fitpod") || (words[0] == "molecule")) {
|
else if ((words[0] == "fitpod") || (words[0] == "molecule")) {
|
||||||
if (selected.contains('/')) {
|
if (selected.contains('/')) {
|
||||||
if (popup && popup->isVisible()) popup->hide();
|
if (popup && popup->isVisible()) popup->hide();
|
||||||
@ -1099,6 +1105,8 @@ void CodeEditor::runCompletion()
|
|||||||
current_comp = fixid_comp;
|
current_comp = fixid_comp;
|
||||||
else if (selected.startsWith("F_"))
|
else if (selected.startsWith("F_"))
|
||||||
current_comp = fixid_comp;
|
current_comp = fixid_comp;
|
||||||
|
else if ((words[0] == "read_data") && selected.startsWith("ex"))
|
||||||
|
current_comp = extra_comp;
|
||||||
|
|
||||||
if (current_comp) {
|
if (current_comp) {
|
||||||
current_comp->setCompletionPrefix(words[3].c_str());
|
current_comp->setCompletionPrefix(words[3].c_str());
|
||||||
@ -1128,6 +1136,8 @@ void CodeEditor::runCompletion()
|
|||||||
current_comp = fixid_comp;
|
current_comp = fixid_comp;
|
||||||
else if (selected.startsWith("F_"))
|
else if (selected.startsWith("F_"))
|
||||||
current_comp = fixid_comp;
|
current_comp = fixid_comp;
|
||||||
|
else if ((words[0] == "read_data") && selected.startsWith("ex"))
|
||||||
|
current_comp = extra_comp;
|
||||||
|
|
||||||
if (current_comp) {
|
if (current_comp) {
|
||||||
current_comp->setCompletionPrefix(selected);
|
current_comp->setCompletionPrefix(selected);
|
||||||
@ -1265,14 +1275,14 @@ void CodeEditor::open_url()
|
|||||||
|
|
||||||
void CodeEditor::view_file()
|
void CodeEditor::view_file()
|
||||||
{
|
{
|
||||||
auto *act = qobject_cast<QAction *>(sender());
|
auto *act = qobject_cast<QAction *>(sender());
|
||||||
auto *guimain = qobject_cast<LammpsGui *>(parent());
|
auto *guimain = qobject_cast<LammpsGui *>(parent());
|
||||||
guimain->view_file(act->data().toString());
|
guimain->view_file(act->data().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CodeEditor::inspect_file()
|
void CodeEditor::inspect_file()
|
||||||
{
|
{
|
||||||
auto *act = qobject_cast<QAction *>(sender());
|
auto *act = qobject_cast<QAction *>(sender());
|
||||||
auto *guimain = qobject_cast<LammpsGui *>(parent());
|
auto *guimain = qobject_cast<LammpsGui *>(parent());
|
||||||
guimain->inspect_file(act->data().toString());
|
guimain->inspect_file(act->data().toString());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -64,6 +64,7 @@ public:
|
|||||||
void setMinimizeList(const QStringList &words);
|
void setMinimizeList(const QStringList &words);
|
||||||
void setVariableList(const QStringList &words);
|
void setVariableList(const QStringList &words);
|
||||||
void setUnitsList(const QStringList &words);
|
void setUnitsList(const QStringList &words);
|
||||||
|
void setExtraList(const QStringList &words);
|
||||||
void setGroupList();
|
void setGroupList();
|
||||||
void setVarNameList();
|
void setVarNameList();
|
||||||
void setComputeIDList();
|
void setComputeIDList();
|
||||||
@ -104,7 +105,7 @@ private:
|
|||||||
QCompleter *current_comp, *command_comp, *fix_comp, *compute_comp, *dump_comp, *atom_comp,
|
QCompleter *current_comp, *command_comp, *fix_comp, *compute_comp, *dump_comp, *atom_comp,
|
||||||
*pair_comp, *bond_comp, *angle_comp, *dihedral_comp, *improper_comp, *kspace_comp,
|
*pair_comp, *bond_comp, *angle_comp, *dihedral_comp, *improper_comp, *kspace_comp,
|
||||||
*region_comp, *integrate_comp, *minimize_comp, *variable_comp, *units_comp, *group_comp,
|
*region_comp, *integrate_comp, *minimize_comp, *variable_comp, *units_comp, *group_comp,
|
||||||
*varname_comp, *fixid_comp, *compid_comp, *file_comp;
|
*varname_comp, *fixid_comp, *compid_comp, *file_comp, *extra_comp;
|
||||||
|
|
||||||
int highlight;
|
int highlight;
|
||||||
bool reformat_on_return;
|
bool reformat_on_return;
|
||||||
|
|||||||
@ -334,6 +334,16 @@ LammpsGui::LammpsGui(QWidget *parent, const char *filename) :
|
|||||||
style_list.sort();
|
style_list.sort();
|
||||||
ui->textEdit->setUnitsList(style_list);
|
ui->textEdit->setUnitsList(style_list);
|
||||||
|
|
||||||
|
style_list.clear();
|
||||||
|
const char *extraargs[] = {"extra/atom/types", "extra/bond/types",
|
||||||
|
"extra/angle/types", "extra/dihedral/types",
|
||||||
|
"extra/improper/types", "extra/bond/per/atom",
|
||||||
|
"extra/angle/per/atom", "extra/dihedral/per/atom",
|
||||||
|
"extra/improper/per/atom", "extra/special/per/atom"};
|
||||||
|
for (const auto *const extra : extraargs)
|
||||||
|
style_list << extra;
|
||||||
|
ui->textEdit->setExtraList(style_list);
|
||||||
|
|
||||||
ui->textEdit->setFileList();
|
ui->textEdit->setFileList();
|
||||||
|
|
||||||
#define ADD_STYLES(keyword, Type) \
|
#define ADD_STYLES(keyword, Type) \
|
||||||
|
|||||||
Reference in New Issue
Block a user