Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow CTK PythonQt python module to be imported outside of a Qt applicat... #520

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jcfr
Copy link
Member

@jcfr jcfr commented Nov 7, 2014

...io,

On Linux, I was able to import the ctk module doing the following:

$ cd /path/to/CTK-build/CTK-build/bin
$ PYTHONPATH=./Python/ python

import ctk
import pprint as pp
pp.pprint(dir(ctk))
['QAbstractButton',
'QAbstractItemModel',
[...]
'builtins',
'doc',
'file',
'name',
'package',
'path',
'ctkActionsWidget',
'ctkAddRemoveComboBox',
'ctkAxesWidget',
'ctkBasePopupWidget',
'ctkButtonGroup',
'ctkCallback',
'ctkCheckBox',
'ctkCheckBoxPixmaps',
'ctkCheckableComboBox',
'ctkCheckablePushButton',
'ctkCollapsibleButton',
'ctkCollapsibleGroupBox',
'ctkColorDialog',
'ctkColorPickerButton',
'ctkComboBox',
'ctkCommandLineParser',
'ctkCompleter',
'ctkConsole',
[...]

@jcfr
Copy link
Member Author

jcfr commented Nov 7, 2014

This is not ready for integration yet. Further test would have to be done.

I created the PR so that other could have a sneak peak.

Ping @ntoussaint

@pieper
Copy link
Member

pieper commented Nov 7, 2014

Wow!
On Nov 7, 2014 1:22 PM, "Jean-Christophe Fillion-Robin" <
[email protected]> wrote:

This is not ready for integration yet. Further test would have to be done.

I created the PR so that other could have a sneak peak.

Ping @ntoussaint https://github.com/ntoussaint


Reply to this email directly or view it on GitHub
#520 (comment).

The information in this e-mail is intended only for the person to whom it
is
addressed. If you believe this e-mail was sent to you in error and the
e-mail
contains patient information, please contact the Partners Compliance
HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in
error
but does not contain patient information, please contact the sender and
properly
dispose of the e-mail.

…catio,

On Linux, I was able to import the ctk module doing the following:

$ cd /path/to/CTK-build/CTK-build/bin
$ PYTHONPATH=./Python/ python
>> import ctk
>> import pprint as pp
>> pp.pprint(dir(ctk))
['QAbstractButton',
 'QAbstractItemModel',
 [...]
 '__builtins__',
 '__doc__',
 '__file__',
 '__name__',
 '__package__',
 '__path__',
 'ctkActionsWidget',
 'ctkAddRemoveComboBox',
 'ctkAxesWidget',
 'ctkBasePopupWidget',
 'ctkButtonGroup',
 'ctkCallback',
 'ctkCheckBox',
 'ctkCheckBoxPixmaps',
 'ctkCheckableComboBox',
 'ctkCheckablePushButton',
 'ctkCollapsibleButton',
 'ctkCollapsibleGroupBox',
 'ctkColorDialog',
 'ctkColorPickerButton',
 'ctkComboBox',
 'ctkCommandLineParser',
 'ctkCompleter',
 'ctkConsole',
  [...]
@jcfr jcfr force-pushed the pythonqt-module-as-standalone-module branch from 8248925 to e4f7a7c Compare October 10, 2017 04:39
@hjmjohnson
Copy link
Contributor

is this still relevant? It was started 6 years ago.

jcfr added a commit to jcfr/CTK that referenced this pull request Mar 14, 2023
…e python

Since importing a PythonQt-based module outside of a Qt application
leads to a segfault, skip the import if it happens in a standalone
python interpreter.

See commontk#520
jcfr added a commit to jcfr/CTK that referenced this pull request Mar 15, 2023
…e python

Since importing a PythonQt-based module outside of a Qt application
leads to a segfault, skip the import if it happens in a standalone
python interpreter.

See commontk#520
jcfr added a commit that referenced this pull request Mar 15, 2023
…e python

Since importing a PythonQt-based module outside of a Qt application
leads to a segfault, skip the import if it happens in a standalone
python interpreter.

See #520
@pandas-a11y-11
Copy link

pandas-a11y-11 commented Nov 21, 2023

Re: a203172
This modification does not seem to work, an attempt to import any of the following:
CTKCommandLineModulesBackendFunctionPointerPythonQt CTKCommandLineModulesBackendLocalProcessPythonQt CTKCommandLineModulesBackendXMLCheckerPythonQt CTKCommandLineModulesCorePythonQt CTKCommandLineModulesFrontendQtGuiPythonQt CTKCommandLineModulesFrontendQtWebKitPythonQt
Causes Segfault. (Should it show an import error instead?)

Perhaps compiling them as private might do the trick, since allowing them seems to be risky?
Addition: applying this commit to the latest version and attempting to import any of the above yields No Such Module, but it does take care of the Segfault. Is this the intended result?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants