##// END OF EJS Templates
Fixed stupid mistake.
Jeandet Alexis -
r99:bb6776ca85e6 default
parent child
Show More
@@ -1,122 +1,126
1 1 /*------------------------------------------------------------------------------
2 2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS
4 4 --
5 5 -- This program is free software; you can redistribute it and/or modify
6 6 -- it under the terms of the GNU General Public License as published by
7 7 -- the Free Software Foundation; either version 2 of the License, or
8 8 -- (at your option) any later version.
9 9 --
10 10 -- This program is distributed in the hope that it will be useful,
11 11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 13 -- GNU General Public License for more details.
14 14 --
15 15 -- You should have received a copy of the GNU General Public License
16 16 -- along with this program; if not, write to the Free Software
17 17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 18 -------------------------------------------------------------------------------*/
19 19 /*-- Author : Alexis Jeandet
20 20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 21 ----------------------------------------------------------------------------*/
22 22 #include <QApplication>
23 23 #include "mainwindow.h"
24 24 #include <PythonQt.h>
25 25 #include <PythonQt_QtAll.h>
26 26 #include <gui/PythonQtScriptingConsole.h>
27 27 #include <socexplorerplugin.h>
28 28 #include <QStyle>
29 29 #include <QStyleFactory>
30 30 #include <QStringList>
31 31 #include <QFile>
32 32 #include <QCommandLineOption>
33 33 #include <QCommandLineParser>
34 34
35 35
36 36 QCommandLineOption executeOption = QCommandLineOption (
37 37 QStringList() << "e" << "execute",
38 38 QCoreApplication::translate("main", "Execute given script <script>."),
39 39 QCoreApplication::translate("main", "script"));
40 40
41 41 QCommandLineOption debugLevelOption = QCommandLineOption (
42 42 QStringList() << "d" << "debug-level",
43 43 QCoreApplication::translate("main", "Sets debug level to <level>, higher the level is more verbose the application will be."),
44 44 QCoreApplication::translate("main", "level"),
45 45 "1");
46 46
47 47 QCommandLineOption noGUIOption = QCommandLineOption (
48 48 QStringList() << "n" << "no-gui",
49 49 QCoreApplication::translate("main", "Starts SocExplorer in batch mode[not fully implemented yet!]."));
50 50
51 51 const char* socexplorerDesc="\
52 52 SocExplorer is an open source generic System On Chip testing software/framework.\
53 53 We write this software for the development and the validation of our instrument,\
54 54 the Low Frequency Receiver(LFR) for the Solar Orbiter mission. This instrument is\
55 55 based on an actel FPGA hosting a LEON3FT processor and some peripherals. To make\
56 56 it more collaborative, we use a plugin based system, the main executable is SocExplorer\
57 57 then all the functionality are provided by plugins. Like this everybody can provide\
58 58 his set of plugins to handle a new SOC or just a new peripheral. SocExplorer uses\
59 59 PythonQt to allow user to automate some tasks such as loading some plugins, configuring\
60 60 them and talking with his device. SocExplorer is provided under the terms of the GNU\
61 61 General Public License as published by the Free Software Foundation; either version 2\
62 62 of the License, or (at your option) any later version.";
63 63
64 64 int main(int argc, char *argv[])
65 65 {
66 66 QApplication a(argc, argv);
67 67 QString scriptToEval;
68 68 QApplication::setOrganizationName("LPP");
69 69 QApplication::setOrganizationDomain("lpp.fr");
70 70 QApplication::setApplicationName("SocExplorer");
71 71 QCommandLineParser parser;
72 72 parser.setApplicationDescription(socexplorerDesc);
73 73 parser.addHelpOption();
74 74 parser.addVersionOption();
75 75 bool noGUI=false;
76 76 parser.addPositionalArgument("file", QCoreApplication::translate("main", "The Python file to execute."));
77 77 parser.addOption(executeOption);
78 78 parser.addOption(debugLevelOption);
79 79 parser.addOption(noGUIOption);
80 80 parser.process(a);
81 81 if(parser.isSet(executeOption))
82 82 {
83 83 scriptToEval = parser.value(executeOption);
84 84 if(!QFile::exists(scriptToEval))
85 85 {
86 86 scriptToEval.clear();
87 87 }
88 88 }
89 89 else
90 90 {
91 scriptToEval = parser.positionalArguments().first();
92 if(!QFile::exists(scriptToEval))
91 QStringList posArgs = parser.positionalArguments();
92 if(posArgs.count())
93 93 {
94 scriptToEval.clear();
94 scriptToEval = posArgs.first();
95 if(!QFile::exists(scriptToEval))
96 {
97 scriptToEval.clear();
98 }
95 99 }
96 100 }
97 101 if(parser.isSet(debugLevelOption))
98 102 {
99 103 bool success;
100 104 int lvl;
101 105 lvl = parser.value(debugLevelOption).toInt(&success,10);
102 106 if(success)
103 107 {
104 108 SocExplorerEngine::setLogLevel(lvl);
105 109 }
106 110 }
107 111 if(parser.isSet(noGUIOption))
108 112 {
109 113 noGUI = true;
110 114 qDebug() << "CLI mode";
111 115 }
112 116 SocExplorerMainWindow w(scriptToEval);
113 117 if(!noGUI)
114 118 {
115 119 w.show();
116 120 }
117 121 else
118 122 {
119 123
120 124 }
121 125 return a.exec();
122 126 }
General Comments 0
You need to be logged in to leave comments. Login now