Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openstructure
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
schwede
openstructure
Commits
e33da01a
Commit
e33da01a
authored
5 years ago
by
Studer Gabriel
Browse files
Options
Downloads
Patches
Plain Diff
port code that we directly feed into the Python interpreter from C++
parent
00ebde86
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/gui/src/gosty.cc
+9
-5
9 additions, 5 deletions
modules/gui/src/gosty.cc
modules/gui/src/python_shell/python_interpreter.cc
+1
-1
1 addition, 1 deletion
modules/gui/src/python_shell/python_interpreter.cc
with
10 additions
and
6 deletions
modules/gui/src/gosty.cc
+
9
−
5
View file @
e33da01a
...
...
@@ -185,14 +185,18 @@ int init_python_interpreter()
String
python_loc
=
setup_python_search_path
(
root
,
py
);
//py.RunCommand("from ost import *");
//py.RunCommand("gui_mode=True");
std
::
stringstream
cmd
;
cmd
<<
"execfile('"
<<
python_loc
;
std
::
stringstream
script_path
;
script_path
<<
python_loc
;
#ifdef _MSC_VER
cmd
<<
"
\\
ost
\\
gui
\\
"
;
script_path
<<
"
\\
ost
\\
gui
\\
"
;
#else
cmd
<<
"/ost/gui/"
;
script_path
<<
"/ost/gui/"
;
#endif
cmd
<<
"gosty_startup.py')"
;
script_path
<<
"gosty_startup.py"
;
std
::
stringstream
cmd
;
cmd
<<
"exec(compile(open('"
<<
script_path
.
str
()
<<
"').read(),'"
;
cmd
<<
script_path
.
str
()
<<
"', 'exec'))"
;
py
.
RunCommand
(
QString
::
fromStdString
(
cmd
.
str
()));
return
0
;
}
...
...
This diff is collapsed.
Click to expand it.
modules/gui/src/python_shell/python_interpreter.cc
+
1
−
1
View file @
e33da01a
...
...
@@ -54,7 +54,7 @@ PythonInterpreter::PythonInterpreter():
main_module_
=
bp
::
import
(
"__main__"
);
main_namespace_
=
bp
::
extract
<
bp
::
dict
>
(
main_module_
.
attr
(
"__dict__"
));
main_namespace_
[
"os"
]
=
bp
::
import
(
"os"
);
main_namespace_
[
"
__
builtin
__
"
]
=
bp
::
import
(
"
__
builtin
__
"
);
main_namespace_
[
"builtin
s
"
]
=
bp
::
import
(
"builtin
s
"
);
main_namespace_
[
"keyword"
]
=
bp
::
import
(
"keyword"
);
bp
::
object
code
=
bp
::
import
(
"code"
);
compile_command_
=
code
.
attr
(
"compile_command"
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment