forked from KiCad/kicad-source-mirror
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial support for Phoenix (new wxPython binding)
Based on the work of @mmccoo: https://kicad.mmccoo.com/2017/11/23/learnings-from-moving-kicad-to-wxpython-4-0/ Please note that wxpy_api.h is currently not distributed in Phoenix. As workaround it is required to manually copy the file from the repo onto your system where cmake can find it. file: https://github.com/wxWidgets/Phoenix/blob/master/src/wxpy_api.h
- Loading branch information
Showing
8 changed files
with
171 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Find SIP | ||
# ~~~~~~~~ | ||
# | ||
# SIP website: http://www.riverbankcomputing.co.uk/sip/index.php | ||
# | ||
# Find the installed version of SIP. FindSIP should be called after Python | ||
# has been found. | ||
# | ||
# This file defines the following variables: | ||
# | ||
# SIP_VERSION - The version of SIP found expressed as a 6 digit hex number | ||
# suitable for comparison as a string. | ||
# | ||
# SIP_VERSION_STR - The version of SIP found as a human readable string. | ||
# | ||
# SIP_BINARY_PATH - Path and filename of the SIP command line executable. | ||
# | ||
# SIP_INCLUDE_DIR - Directory holding the SIP C++ header file. | ||
# | ||
# SIP_DEFAULT_SIP_DIR - Default directory where .sip files should be installed | ||
# into. | ||
|
||
# Copyright (c) 2007, Simon Edwards <[email protected]> | ||
# Redistribution and use is allowed according to the terms of the BSD license. | ||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file. | ||
|
||
|
||
|
||
IF(SIP_VERSION) | ||
# Already in cache, be silent | ||
SET(SIP_FOUND TRUE) | ||
ELSE(SIP_VERSION) | ||
|
||
FIND_FILE(_find_sip_py FindSIP.py PATHS ${CMAKE_MODULE_PATH}) | ||
|
||
EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} ${_find_sip_py} OUTPUT_VARIABLE sip_config) | ||
IF(sip_config) | ||
STRING(REGEX REPLACE "^sip_version:([^\n]+).*$" "\\1" SIP_VERSION ${sip_config}) | ||
STRING(REGEX REPLACE ".*\nsip_version_num:([^\n]+).*$" "\\1" SIP_VERSION_NUM ${sip_config}) | ||
STRING(REGEX REPLACE ".*\nsip_version_str:([^\n]+).*$" "\\1" SIP_VERSION_STR ${sip_config}) | ||
STRING(REGEX REPLACE ".*\nsip_bin:([^\n]+).*$" "\\1" SIP_BINARY_PATH ${sip_config}) | ||
STRING(REGEX REPLACE ".*\ndefault_sip_dir:([^\n]+).*$" "\\1" SIP_DEFAULT_SIP_DIR ${sip_config}) | ||
STRING(REGEX REPLACE ".*\nsip_inc_dir:([^\n]+).*$" "\\1" SIP_INCLUDE_DIR ${sip_config}) | ||
STRING(REGEX REPLACE ".*\nsip_module_dir:([^\n]+).*$" "\\1" SIP_MODULE_DIR ${sip_config}) | ||
SET(SIP_FOUND TRUE) | ||
ENDIF(sip_config) | ||
|
||
IF(SIP_FOUND) | ||
IF(NOT SIP_FIND_QUIETLY) | ||
MESSAGE(STATUS "Found SIP version: ${SIP_VERSION_STR}") | ||
ENDIF(NOT SIP_FIND_QUIETLY) | ||
ELSE(SIP_FOUND) | ||
IF(SIP_FIND_REQUIRED) | ||
MESSAGE(FATAL_ERROR "Could not find SIP") | ||
ENDIF(SIP_FIND_REQUIRED) | ||
ENDIF(SIP_FOUND) | ||
|
||
ENDIF(SIP_VERSION) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# Copyright (c) 2007, Simon Edwards <[email protected]> | ||
# All rights reserved. | ||
# | ||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions are met: | ||
# * Redistributions of source code must retain the above copyright | ||
# notice, this list of conditions and the following disclaimer. | ||
# * Redistributions in binary form must reproduce the above copyright | ||
# notice, this list of conditions and the following disclaimer in the | ||
# documentation and/or other materials provided with the distribution. | ||
# * Neither the name of the Simon Edwards <[email protected]> nor the | ||
# names of its contributors may be used to endorse or promote products | ||
# derived from this software without specific prior written permission. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY Simon Edwards <[email protected]> ''AS IS'' AND ANY | ||
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
# DISCLAIMED. IN NO EVENT SHALL Simon Edwards <[email protected]> BE LIABLE FOR ANY | ||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
# | ||
# FindSIP.py | ||
# Copyright (c) 2007, Simon Edwards <[email protected]> | ||
# Redistribution and use is allowed according to the terms of the BSD license. | ||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file. | ||
|
||
import sipconfig | ||
|
||
sipcfg = sipconfig.Configuration() | ||
print("sip_version:%06.0x" % sipcfg.sip_version) | ||
print("sip_version_num:%d" % sipcfg.sip_version) | ||
print("sip_version_str:%s" % sipcfg.sip_version_str) | ||
print("sip_bin:%s" % sipcfg.sip_bin) | ||
print("default_sip_dir:%s" % sipcfg.default_sip_dir) | ||
print("sip_inc_dir:%s" % sipcfg.sip_inc_dir) | ||
# SIP 4.19.10+ has new sipcfg.sip_module_dir | ||
if hasattr(sipcfg, "sip_module_dir"): | ||
print("sip_module_dir:%s" % sipcfg.sip_module_dir) | ||
else: | ||
print("sip_module_dir:%s" % sipcfg.sip_mod_dir) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
b70b779
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
b70b779
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, the python3 branch misses some testing on mac (KiCad/kicad-mac-builder#205). When this is finished it seems we can merge Python3 support and focus on wxPython.
For wxPython it is the same process. Getting it verified on windows and mac and then merge into upstream (https://bugs.launchpad.net/kicad/+bug/1785119).
For wxpy_api.h, I will look to port the required code into kicad if possible. If that is not possible, we can copy the file into the KiCad sources (If license permits).
b70b779
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello Thomas,
Are you on the kicad team, one of the CERN folks? I don't know that I'd seen your name before.
If so, perhaps you can help get a patch of mine approved/merged. It's sort of been in purgatory. I submitted it twice with no rejection or merge.
I have a proposed patch to remove the dependence on pywx_api.h
I put a copy here
I don't see a way to attach files to comments.
Before I describe the change, a comment about wxpython and wxwidgets. I found that in order to compile kicad, I needed wxwidgets installed. (not entirely trivial due to kicad sitting in gtk2). I also need wxpython phoenix installed. of course. The thing is that wxpython has its own copy of wxwidgets. If you let pcbnew just use the installed wxWidgets, you could get an error like this:
ImportError: /usr/local/lib/python2.7/dist-packages/wx/_core.so: symbol _ZN13wxWindowIDRef6AssignEi, version WXU_3.0 not defined in file libwx_gtk2u_core-3.0.so.0 with link time reference
In any case, to talk about the proposed patch.
The dependence on pywx_api is pretty small.
Another difference is that I changed the way the window creation stuff is invoked. Before, it would create a python function and then call it. Instead, I'm just calling some python code. Perhaps, the other/old way is more "pythonic", but I think it's just roundabout.
b70b779
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @mmccoo,
I'm in the kicad team as library maintainer, so no write access for the code :). You could post the patch on launchpad, and poke @nickoe or @c4757p on IRC about it.
Thanks for the clarification of the pywx_api stuff. I will try to implement it soon. For wxpython, I only tested it with Python3 so there was no wxpython conflict.
b70b779
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mmccoo,
It seems you did some additional patching which is not visible in https://mmccoo.com/random/diffs_for_phoenix. Could you please give me a link to the extended patch? This would simplify things for me quite a bit to get the stuff finished.
b70b779
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
b70b779
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thx, I incoperated your changes and it seems to work fine.
The lib stuff is annoying. Wonder why it didn't happen in the past.
I reported it: wxWidgets/Phoenix#982