Skip to content

Commit 0eb0452

Browse files
Finish adding support python2
Fix pyQode/pyqode.core#146
1 parent 8ed4a0e commit 0eb0452

25 files changed

Lines changed: 156 additions & 3161 deletions

.travis.yml

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,40 @@
11
language: python
22
python:
3-
- "3.2"
3+
- "2.7"
4+
- "3.2"
45
env:
5-
- QT_API=pyqt4
6-
- QT_API=pyqt5
7-
- PEP8=1
8-
- COV=1
6+
# we only test interpreters who have native python packages
7+
# since those tests are running on ubuntu 12.04, pyqt5 cannot be tested
8+
- TOXENV=py27-pyqt4
9+
- TOXENV=py32-pyqt4
10+
- TOXENV=cov
11+
- TOXENV=pep8
912
matrix:
13+
exclude:
14+
- python: "2.7"
15+
env: TOXENV=cov
16+
- python: "2.7"
17+
env: TOXENV=pep8
18+
- python: "2.7"
19+
env: TOXENV=py32-pyqt4
20+
- python: "3.2"
21+
env: TOXENV=py27-pyqt4
1022
allow_failures:
11-
- env: COV=1
12-
- env: PEP8=1
13-
- env: QT_API=pyqt5
23+
- env: TOXENV=cov
24+
- env: TOXENV=pep8
1425
virtualenv:
1526
system_site_packages: true
1627
before_install:
17-
- "export DISPLAY=:99.0"
18-
- "sh -e /etc/init.d/xvfb start"
28+
- "export DISPLAY=:99.0"
29+
- "sh -e /etc/init.d/xvfb start"
1930
install:
20-
# PyQ4
31+
- sudo apt-get install -qq python-qt4 --fix-missing
2132
- sudo apt-get install -qq python3-pyqt4 --fix-missing
22-
# PyQt5 (won't be available untill travis upgrade to ubuntu 14.04
23-
- if [ $QT_API = "pyqt5" ]; then
24-
sudo apt-get install -qq python3-pyqt5 --fix-missing;
25-
fi
26-
- pip install git+https://github.com/pyQode/pyqode.core.git@develop
33+
- pip install tox
2734
script:
28-
- pip install .
29-
- if [ $QT_API ]; then
30-
python3 runtests.py;
31-
fi
32-
- if [ $PEP8 ]; then
33-
pip install pytest-pep8;
34-
python3 runtests.py --pep8 -m pep8;
35-
fi
36-
- if [ $COV ]; then
37-
pip install pytest-cov;
38-
python3 runtests.py --cov pyqode;
39-
fi
35+
- tox
4036
after_script:
41-
- if [ $COV ]; then
42-
sudo pip install --quiet coveralls;
37+
- if [ $TOXENV == "cov" ]; then
38+
pip install --quiet --use-mirrors coveralls;
4339
coveralls;
4440
fi

CONTRIBUTING.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ Please use **PEP8** to style your code (PEP8 compliance is tested Travis CI).
3232
*You can check pep8 compliance before pushing by running the test suite with
3333
the --pep8 option*::
3434

35-
($ pip3 install pytest-pep8)
36-
$ python3 runtests.py --pep8
35+
($ pip install tox pytest-pep8)
36+
$ tox -e pep8
3737

3838

3939
.. _bug tracker: https://github.com/pyQode/pyqode.python/issues?state=open

README.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Requirements
4242

4343
pyqode.python depends on the following libraries:
4444

45+
- python 2.7 or python 3 (>= 3.2)
4546
- pyqode.core
4647
- jedi
4748
- pep8

conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def pytest_runtest_setup(item):
3939
# -------------------
4040
# Setup logging
4141
# -------------------
42-
logging.basicConfig(level=logging.INFO,
42+
logging.basicConfig(level=logging.DEBUG,
4343
filename='pytest.log',
4444
filemode='w')
4545

doc/make_html.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python3
1+
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33
"""
44
Call this module to creates the pyQode documentation. (Requires Sphinx to be

examples/qidle/freeze_setup.py

Lines changed: 0 additions & 66 deletions
This file was deleted.

examples/qidle/libraries.zip

-181 KB
Binary file not shown.

examples/qidle/qidle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#! /usr/bin/python3
1+
#! /usr/bin/python
22
# -*- coding: utf-8 -*-
33
import logging
44
import sys

examples/qidle/qidle/main_window.py

Lines changed: 4 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
2121
def __init__(self):
22-
super().__init__()
22+
super(MainWindow, self).__init__()
2323
# Load our UI (made in Qt Designer)
2424
self.setupUi(self)
2525
self.dockWidget.hide()
@@ -74,21 +74,6 @@ def setup_recent_files_menu(self):
7474
self.menuFile.insertMenu(self.actionSave, self.menu_recents)
7575
self.menuFile.insertSeparator(self.actionSave)
7676

77-
def setup_menu_interpreters(self):
78-
mnu = QtWidgets.QMenu('Select Python interpreter', self.menuEdit)
79-
group = QtWidgets.QActionGroup(self)
80-
group.triggered.connect(self.on_interpreter_changed)
81-
for interpreter in get_interpreters():
82-
a = QtWidgets.QAction(mnu)
83-
a.setText(interpreter)
84-
a.setCheckable(True)
85-
if interpreter == Settings().interpreter:
86-
a.setChecked(True)
87-
group.addAction(a)
88-
mnu.addAction(a)
89-
self.menuEdit.addSeparator()
90-
self.menuEdit.addMenu(mnu)
91-
9277
def closeEvent(self, QCloseEvent):
9378
"""
9479
Delegates the close event to the tabWidget to be sure we do not quit
@@ -103,20 +88,8 @@ def setup_editor(self, editor):
10388
:param editor: editor to setup.
10489
"""
10590
editor.cursorPositionChanged.connect(self.on_cursor_pos_changed)
106-
zip_path = os.path.join(os.getcwd(), 'libraries.zip')
107-
if not os.path.exists(zip_path):
108-
if platform.system().lower() == 'linux':
109-
zip_path = '/usr/share/qidle/libraries.zip'
110-
if hasattr(sys, "frozen"):
111-
server_path = os.path.join(os.getcwd(), 'server.py')
112-
editor.backend.start(server_path,
113-
interpreter=Settings().interpreter,
114-
args=['-s', zip_path])
115-
else:
116-
editor.backend.start(
117-
server.__file__, interpreter=Settings().interpreter,
118-
args=['-s',
119-
zip_path if 'python2' in Settings().interpreter else ''])
91+
editor.backend.start(
92+
server.__file__, interpreter=sys.executable)
12093
m = editor.modes.get(modes.GoToAssignmentsMode)
12194
assert isinstance(m, modes.GoToAssignmentsMode)
12295
m.out_of_doc.connect(self.on_goto_out_of_doc)
@@ -202,7 +175,6 @@ def setup_mnu_edit(self, editor):
202175
"""
203176
self.menuEdit.addActions(editor.actions())
204177
self.menuEdit.addSeparator()
205-
self.setup_menu_interpreters()
206178
self.setup_mnu_style(editor)
207179

208180
def setup_mnu_style(self, editor):
@@ -279,7 +251,7 @@ def _update_status_bar(self, editor):
279251
'%d:%d' % (l + 1, c + 1))
280252
self.lbl_encoding.setText(editor.file.encoding)
281253
self.lbl_filename.setText(editor.file.path)
282-
self.lbl_interpreter.setText(Settings().interpreter)
254+
self.lbl_interpreter.setText(sys.executable)
283255
else:
284256
self.lbl_encoding.clear()
285257
self.lbl_filename.clear()
@@ -300,27 +272,6 @@ def refresh_color_scheme(self):
300272
editor = self.tabWidget.widget(i)
301273
editor.syntax_highlighter.color_scheme = ColorScheme(style)
302274

303-
@QtCore.Slot(QtWidgets.QAction)
304-
def on_interpreter_changed(self, action):
305-
"""
306-
Change the selected interpreter and restart server of opened editor to
307-
use the new interpreter.
308-
309-
:param action: interpreter action that has been triggered
310-
"""
311-
interpreter = action.text()
312-
Settings().interpreter = interpreter
313-
# restart server with the new interpreter
314-
for i in range(self.tabWidget.count()):
315-
editor = self.tabWidget.widget(i)
316-
editor.backend.stop()
317-
self.setup_editor(editor)
318-
self.lbl_interpreter.setText(interpreter)
319-
m = editor.modes.get(modes.PEP8CheckerMode)
320-
m.request_analysis()
321-
m = editor.modes.get(modes.FrostedCheckerMode)
322-
m.request_analysis()
323-
324275
def on_panel_state_changed(self):
325276
"""
326277
Enable disable the selected panel.

examples/qidle/readme.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ strucuture tree view,...
1212

1313
To **run** the example, just run::
1414

15-
python3 qidle.py
15+
python qidle.py
1616

1717

1818
To **install** the package *on linux*, just run::
1919

20-
sudo python3 setup.py install
20+
sudo python setup.py install
2121

2222
To **freeze the application on Windows**, you first need to install cx_Freeze.
2323
Then you can run::

0 commit comments

Comments
 (0)