Commit Graph

31 Commits

Author SHA1 Message Date
baldurk 804fddcdf7 Allow python extensions to be loaded from app folder as well as user
* This will let us distribute extensions with the renderdoc builds.
2020-11-10 13:57:27 +00:00
baldurk 36d74b32b9 Add optional output file for qrenderdoc unit tests 2020-06-11 20:06:43 +01:00
baldurk 7d4685fc17 Fix exception catch-and-rethrow in extension BlockInvoke. Closes #1721 2020-02-13 11:01:45 +00:00
baldurk 2916c0f9f7 Update copyright years to 2020 2020-01-06 16:20:45 +00:00
baldurk ff08748238 Ensure all files have trailing new-lines and enforce with clang warning 2019-12-02 20:28:05 +00:00
baldurk 699f8753af Convert ToStr, Serialise, and TypeName to use literal strings 2019-05-15 14:12:17 +01:00
baldurk 86ff87863e Update copyright years to 2019 2019-02-01 18:32:13 +00:00
baldurk 67fc971cd9 Add a dummy pass-through conversion for already converted python objects 2018-10-23 14:23:12 +01:00
baldurk 2dd293d691 Add the ability to load/reload global python extensions 2018-10-23 14:23:11 +01:00
baldurk e305029ddd Update copyright years to 2018 2018-01-01 17:55:29 +00:00
baldurk a7398525b2 Add simple tab-completion in interactive python shell 2017-12-25 15:05:30 +00:00
baldurk 417a811fad Expand docstring checks to also check names of symbols in the interface 2017-12-22 14:41:43 +00:00
baldurk c860d8baa3 Fix uninitialized variable warnings from static analysis
* Reported by Coverity Scan
2017-11-22 11:31:07 +00:00
baldurk 657c343ac8 Support multi-line input in the python shell 2017-11-20 20:01:02 +00:00
baldurk 8c74c92079 Move docstring check from fatal-onstart-hack to unit test run by CI 2017-10-02 15:54:23 +01:00
baldurk 3d11c502f5 Don't use SWIG_BUILTIN_INIT for passing SWIG ptrs, use SWIG_POINTER_OWN
* The former is only needed inside tp_init of a new object. Instead when
  we want to pass in and own a pointer, we use SWIG_POINTER_OWN.
* This also removes the need to pass 'self' all the way down in
  ConvertToPy which tidies up a lot of code.
2017-09-29 12:11:15 +01:00
baldurk ef84f494a2 Add a macro that enables qt-compatibility in the renderdoc replay API
* This will be used to remove the ToQStr everywhere (where it's not
  used for actual stringification of enums/structs)
2017-08-16 18:28:11 +01:00
baldurk ee67b85b58 When we hit an exception, pass the line number of the top-of-stack
* This allows us to update the current line highlight before stopping.
2017-08-03 17:57:24 +01:00
baldurk 87ef595cce For a block invoke to another thread, safe and restore
* In future we could handle async exceptions by storing the exception
  information in a std::function derived object (instead of the separate
  ExceptionHandling that lives on the stack) and query it out in a new
  WaitForInvoke function maybe. Right now we just print the exception
  to the output log and abort the callback.
2017-08-03 17:57:23 +01:00
baldurk 0b1c3725b9 Add a fallback path for opaque qwidgets if pyside2 isn't compiled in
* Even if we don't have pyside2 to treat qwidgets as full objects and
  access their methods and data, we still need to be able to pass around
  the QWidget* as an opaque pointer to be able to use the API properly.
* This change falls back to just using SWIG's default opaque pointer
  wrapping and unwrapping when pyside2 isn't available.
2017-06-09 17:02:09 +01:00
baldurk 0ecc6ca877 Enable QT_NO_CAST_FROM_ASCII & QT_NO_CAST_TO_ASCII
* Added a couple of utility macros to help with the conversion. lit() is
  paired with tr() for untranslated text.
* QFormatStr is more explicitly for non-textual formatting strings.
* Both are just #define'd to QStringLiteral()
2017-05-02 22:58:12 +01:00
baldurk 2a4596e06a Add python shell qt window 2017-04-19 18:03:19 +01:00
baldurk 31050d651e Batch up output callbacks, instead of calling for every write
* If it's called every write then it risks spamming the system with
  signals and locking the UI thread with constant writes. Checking and
  flushing output every 100ms is sufficient.
2017-04-19 18:03:18 +01:00
baldurk b904b28187 Add support for aborting python execution at the next traceback call 2017-04-18 14:57:50 +01:00
baldurk f0853eda9f Fix exception fetching and passing through signals 2017-04-18 14:57:50 +01:00
baldurk c3505944bd Add interactive evaluation that prints the result of a command 2017-04-18 14:57:49 +01:00
baldurk 6f52ef5c68 Add support for passing QWidget * to/from PySide in qrenderdoc bindings 2017-04-18 14:57:43 +01:00
baldurk 6969b5b677 Fix refcounting and lifetime management around async python callbacks
* We need to keep a PythonContext (and its globals Dict) around while
  we still have some pending callbacks happening. So now the external
  code creates a PythonContext and then releases it when it's done, but
  the context will hang around until the global redirector object is
  destructed, which is responsible for deleting the context.
* The global redirector is deleted when a refcounting cycle is detected
  and the dict is unreachable, which only happens after the context is
  released.
* Any time a callback is passed to something and converted to a
  std::function we add a reference on the global redirector to keep it
  alive. When the callback has finished executing we remove the ref.
* This way, any pending callbacks that have been called but not finished
  or converted (queued) and not called yet asynchronously will keep the
  context object alive to be able to output, handle exceptions, etc.
* Additionally we need to detect when we're being called asynchronously
  and handle exceptions separately instead of trying to propagate up the
  call chain, because there might not be any more python code up the
  chain (e.g. the render manager calling a python callback).
2017-04-18 14:57:42 +01:00
baldurk 2e2a58950a Integrate pyside2/shiboken2 to be able to bind Qt to python
* On linux we make it optional since it's too large a project to add
  as a build step via ExternalProject_add.
2017-04-18 14:57:41 +01:00
baldurk 849f5b443d Change python handling from sub-interpreters to per-context globals
* Using a separate dict for globals/locals for each interpreter means we
  still get separation of variables and no persistence where we don't
  want it, but removing sub-interpreters means pyside can work as it
  uses the PyGILState_ APIs which do not support sub-interpreters.
* We import everything up front then duplicate the __main__ each time we
  create a new context so we keep the __main__ pristine and muck up an
  individual copy.
* Because sys is now shared, the output redirectors that overwrite
  sys.stdout and sys.stderr have a NULL context, and instead they look
  up a specific global which contains the actual context pointer.
2017-04-18 14:57:41 +01:00
baldurk cb510298d8 Add wrapper around tracking a python context and executing scripts 2017-04-18 14:57:41 +01:00