├── locale
└── README.md
├── fiddle
├── helpers
│ ├── __init__.py
│ ├── linter.py
│ └── builtins.py
├── controllers
│ ├── __init__.py
│ ├── ManageInterpretersDialog.py
│ ├── PyConsole.py
│ ├── FiddleTabWidget.py
│ └── Editors.py
├── views
│ ├── __init__.py
│ ├── icons
│ │ ├── add.png
│ │ ├── cut.png
│ │ ├── cross.png
│ │ ├── delete.png
│ │ ├── disk.png
│ │ ├── find.png
│ │ ├── folder.png
│ │ ├── help.png
│ │ ├── wand.png
│ │ ├── zoom.png
│ │ ├── arrow_left.png
│ │ ├── arrow_right.png
│ │ ├── page_white.png
│ │ ├── paste_plain.png
│ │ ├── play_green.png
│ │ ├── arrow_refresh.png
│ │ ├── find_replace.png
│ │ ├── page_white_copy.png
│ │ ├── python_twosnakes.png
│ │ ├── python_twosnakes_v.png
│ │ └── readme.txt
│ ├── logos
│ │ └── fiddle_icon_light.png
│ ├── build_pyqt_ui.cmd
│ ├── resources.qrc
│ ├── ManageInterpretersDialog.py
│ ├── ManageInterpretersDialog.ui
│ └── MainWindow.py
├── __init__.py
├── __main__.py
└── config.py
├── requirements.txt
├── .gitignore
├── tests
├── data
│ ├── run_forever.py
│ ├── main.css
│ ├── main.js
│ ├── server.py
│ ├── unlinted.py
│ ├── index.html
│ ├── unclean.py
│ ├── cleaned.py
│ ├── lorem.txt
│ ├── utf8_test.txt
│ └── win1252_test.txt
├── helpers.py
├── __init__.py
├── test_manage_interpreters.py
├── test_fiddle_codefuncs.py
├── test_fiddle_filetypes.py
├── test_fiddle_mainwindow.py
├── test_fiddle_findreplace.py
└── test_fiddle_consoles.py
├── media
├── fiddle_logo_128.png
├── fiddle_0.1pre_main.png
├── fiddle_0.2dev_main.png
└── fiddle_0.3dev_main.png
├── searchers.json
├── fIDDLE.py
├── README.md
├── setup.py
└── LICENSE
/locale/README.md:
--------------------------------------------------------------------------------
1 | fIDDLE localization data
2 |
--------------------------------------------------------------------------------
/fiddle/helpers/__init__.py:
--------------------------------------------------------------------------------
1 | __author__ = 'Aaron Kehrer'
2 |
--------------------------------------------------------------------------------
/fiddle/controllers/__init__.py:
--------------------------------------------------------------------------------
1 | __author__ = 'Aaron Kehrer'
2 |
--------------------------------------------------------------------------------
/fiddle/views/__init__.py:
--------------------------------------------------------------------------------
1 | __author__ = 'Aaron Kehrer'
2 |
3 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | PyQt4
2 | chardet
3 | autopep8
4 | pyflakes
5 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea/
2 | *.pyc
3 | build/
4 |
5 | .recent
6 |
7 | *.log
8 |
--------------------------------------------------------------------------------
/tests/data/run_forever.py:
--------------------------------------------------------------------------------
1 | i = 1
2 | while True:
3 | print(i)
4 | i += 1
--------------------------------------------------------------------------------
/fiddle/views/icons/add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/akehrer/fiddle/HEAD/fiddle/views/icons/add.png
--------------------------------------------------------------------------------
/fiddle/views/icons/cut.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/akehrer/fiddle/HEAD/fiddle/views/icons/cut.png
--------------------------------------------------------------------------------
/media/fiddle_logo_128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/akehrer/fiddle/HEAD/media/fiddle_logo_128.png
--------------------------------------------------------------------------------
/fiddle/views/icons/cross.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/akehrer/fiddle/HEAD/fiddle/views/icons/cross.png
--------------------------------------------------------------------------------
/fiddle/views/icons/delete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/akehrer/fiddle/HEAD/fiddle/views/icons/delete.png
--------------------------------------------------------------------------------
/fiddle/views/icons/disk.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/akehrer/fiddle/HEAD/fiddle/views/icons/disk.png
--------------------------------------------------------------------------------
/fiddle/views/icons/find.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/akehrer/fiddle/HEAD/fiddle/views/icons/find.png
--------------------------------------------------------------------------------
/fiddle/views/icons/folder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/akehrer/fiddle/HEAD/fiddle/views/icons/folder.png
--------------------------------------------------------------------------------
/fiddle/views/icons/help.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/akehrer/fiddle/HEAD/fiddle/views/icons/help.png
--------------------------------------------------------------------------------
/fiddle/views/icons/wand.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/akehrer/fiddle/HEAD/fiddle/views/icons/wand.png
--------------------------------------------------------------------------------
/fiddle/views/icons/zoom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/akehrer/fiddle/HEAD/fiddle/views/icons/zoom.png
--------------------------------------------------------------------------------
/media/fiddle_0.1pre_main.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/akehrer/fiddle/HEAD/media/fiddle_0.1pre_main.png
--------------------------------------------------------------------------------
/media/fiddle_0.2dev_main.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/akehrer/fiddle/HEAD/media/fiddle_0.2dev_main.png
--------------------------------------------------------------------------------
/media/fiddle_0.3dev_main.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/akehrer/fiddle/HEAD/media/fiddle_0.3dev_main.png
--------------------------------------------------------------------------------
/tests/data/main.css:
--------------------------------------------------------------------------------
1 | html, body, #map-canvas {
2 | height: 100%;
3 | margin: 0;
4 | padding: 0;
5 | }
--------------------------------------------------------------------------------
/fiddle/views/icons/arrow_left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/akehrer/fiddle/HEAD/fiddle/views/icons/arrow_left.png
--------------------------------------------------------------------------------
/fiddle/views/icons/arrow_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/akehrer/fiddle/HEAD/fiddle/views/icons/arrow_right.png
--------------------------------------------------------------------------------
/fiddle/views/icons/page_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/akehrer/fiddle/HEAD/fiddle/views/icons/page_white.png
--------------------------------------------------------------------------------
/fiddle/views/icons/paste_plain.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/akehrer/fiddle/HEAD/fiddle/views/icons/paste_plain.png
--------------------------------------------------------------------------------
/fiddle/views/icons/play_green.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/akehrer/fiddle/HEAD/fiddle/views/icons/play_green.png
--------------------------------------------------------------------------------
/fiddle/views/icons/arrow_refresh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/akehrer/fiddle/HEAD/fiddle/views/icons/arrow_refresh.png
--------------------------------------------------------------------------------
/fiddle/views/icons/find_replace.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/akehrer/fiddle/HEAD/fiddle/views/icons/find_replace.png
--------------------------------------------------------------------------------
/fiddle/views/icons/page_white_copy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/akehrer/fiddle/HEAD/fiddle/views/icons/page_white_copy.png
--------------------------------------------------------------------------------
/fiddle/views/icons/python_twosnakes.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/akehrer/fiddle/HEAD/fiddle/views/icons/python_twosnakes.png
--------------------------------------------------------------------------------
/fiddle/views/icons/python_twosnakes_v.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/akehrer/fiddle/HEAD/fiddle/views/icons/python_twosnakes_v.png
--------------------------------------------------------------------------------
/fiddle/views/logos/fiddle_icon_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/akehrer/fiddle/HEAD/fiddle/views/logos/fiddle_icon_light.png
--------------------------------------------------------------------------------
/tests/data/main.js:
--------------------------------------------------------------------------------
1 | var map;
2 | function initialize() {
3 | map = new google.maps.Map(document.getElementById('map-canvas'), {
4 | zoom: 8,
5 | center: {lat: -34.397, lng: 150.644}
6 | });
7 | }
8 |
9 | google.maps.event.addDomListener(window, 'load', initialize);
10 |
--------------------------------------------------------------------------------
/tests/data/server.py:
--------------------------------------------------------------------------------
1 | import SimpleHTTPServer
2 | import SocketServer
3 |
4 | PORT = 8000
5 |
6 | Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
7 |
8 | httpd = SocketServer.TCPServer(("", PORT), Handler)
9 |
10 | print("Serving http://localhost:{0}".format(PORT))
11 | httpd.serve_forever()
12 |
13 |
--------------------------------------------------------------------------------
/fiddle/views/build_pyqt_ui.cmd:
--------------------------------------------------------------------------------
1 | call C:\Python34\Lib\site-packages\PyQt4\pyuic4 --from-imports MainWindow.ui -o MainWindow.py
2 | call C:\Python34\Lib\site-packages\PyQt4\pyuic4 --from-imports ManageInterpretersDialog.ui -o ManageInterpretersDialog.py
3 | call C:\Python34\Lib\site-packages\PyQt4\pyrcc4 -o resources_rc.py resources.qrc -py3
4 |
5 |
6 |
--------------------------------------------------------------------------------
/tests/helpers.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2015 Aaron Kehrer
2 | # Licensed under the terms of the MIT License
3 | # (see fiddle/__init__.py for details)
4 |
5 | import os
6 | import sys
7 | import hashlib
8 |
9 |
10 | def sha_hash_file(filepath):
11 | h = hashlib.sha1()
12 | with open(filepath, 'rb') as fp:
13 | h.update(fp.read())
14 |
15 | return h.hexdigest()
16 |
--------------------------------------------------------------------------------
/tests/data/unlinted.py:
--------------------------------------------------------------------------------
1 | import math
2 | import re
3 | import os
4 | import random
5 | import multiprocessing
6 | import grp, pwd, platform
7 | import subprocess, sys
8 |
9 |
10 | def foo():
11 | from abc import ABCMeta, WeakSet
12 | try:
13 | import multiprocessing
14 | print(multiprocessing.cpu_count())
15 | except ImportError as exception:
16 | print(sys.version)
17 | return math.pi
--------------------------------------------------------------------------------
/searchers.json:
--------------------------------------------------------------------------------
1 | [
2 | {"name": "Python 2 (python.org)",
3 | "query_tmpl": "https://docs.python.org/2/search.html?q={query}"},
4 | {"name": "Python 3 (python.org)",
5 | "query_tmpl": "https://docs.python.org/3/search.html?q={query}"},
6 | {"name": "Read the docs",
7 | "query_tmpl": "https://readthedocs.org/search/?q={query}"},
8 | {"name": "Google",
9 | "query_tmpl": "https://www.google.com/search?q={query}"}
10 | ]
--------------------------------------------------------------------------------
/tests/data/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Simple Map
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | A Map!
16 |
17 |
18 |
--------------------------------------------------------------------------------
/fiddle/views/icons/readme.txt:
--------------------------------------------------------------------------------
1 | Silk icon set 1.3
2 |
3 | _________________________________________
4 | Mark James
5 | http://www.famfamfam.com/lab/icons/silk/
6 | _________________________________________
7 |
8 | This work is licensed under a
9 | Creative Commons Attribution 2.5 License.
10 | [ http://creativecommons.org/licenses/by/2.5/ ]
11 |
12 | This means you may use it for any purpose,
13 | and make any changes you like.
14 | All I ask is that you include a link back
15 | to this page in your credits.
16 |
17 | Are you using this icon set? Send me an email
18 | (including a link or picture if available) to
19 | mjames@gmail.com
20 |
21 | Any other questions about this icon set please
22 | contact mjames@gmail.com
--------------------------------------------------------------------------------
/tests/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2015 Aaron Kehrer
2 | # Licensed under the terms of the MIT License
3 | # (see fiddle/__init__.py for details)
4 |
5 | import os
6 | import sys
7 | import unittest
8 | import sip
9 | from PyQt4.QtGui import QApplication
10 |
11 | from fiddle.controllers.MainWindow import MainWindow
12 |
13 | sip.setdestroyonexit(False)
14 | app = QApplication(sys.argv)
15 |
16 |
17 | class FiddleTestFixture(unittest.TestCase):
18 | def setUp(self):
19 | self.app = app
20 | self.form = MainWindow(app=app)
21 | self.this_dir = os.path.dirname(__file__)
22 | self.data_dir = os.path.join(self.this_dir, 'data')
23 |
24 | def tearDown(self):
25 | self.form.stop()
--------------------------------------------------------------------------------
/tests/test_manage_interpreters.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2015 Aaron Kehrer
2 | # Licensed under the terms of the MIT License
3 | # (see fiddle/__init__.py for details)
4 |
5 | import os
6 | import unittest
7 | from string import ascii_letters, digits, punctuation
8 |
9 | from PyQt4.QtTest import QTest
10 | from PyQt4.QtCore import Qt
11 |
12 | from fiddle.controllers.ManageInterpretersDialog import ManageInterpretersDialog
13 | from fiddle.config import CONSOLE_PYTHON
14 |
15 | from tests import FiddleTestFixture
16 | from tests.helpers import *
17 |
18 |
19 | class FiddleInterpretersTest(FiddleTestFixture):
20 | def test_open_interpreters_dialog(self):
21 | mi_dialog = ManageInterpretersDialog(self.form)
22 | self.assertIn(CONSOLE_PYTHON['path'], mi_dialog.ui.defaultInterpreterPath_label.text())
23 |
--------------------------------------------------------------------------------
/fiddle/views/resources.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | icons/arrow_left.png
4 | icons/arrow_right.png
5 | icons/wand.png
6 | icons/zoom.png
7 | icons/python_twosnakes.png
8 | icons/python_twosnakes_v.png
9 | icons/add.png
10 | icons/delete.png
11 | icons/play_green.png
12 | icons/arrow_refresh.png
13 | icons/cross.png
14 | icons/find.png
15 | icons/find_replace.png
16 | icons/cut.png
17 | icons/help.png
18 | icons/page_white_copy.png
19 | icons/paste_plain.png
20 | icons/disk.png
21 | icons/folder.png
22 | icons/page_white.png
23 |
24 |
25 | logos/fiddle_logo_64.png
26 | logos/fiddle_icon_light.png
27 |
28 |
29 |
--------------------------------------------------------------------------------
/tests/data/unclean.py:
--------------------------------------------------------------------------------
1 | import math, sys;
2 |
3 | def example1():
4 | ####This is a long comment. This should be wrapped to fit within 72 characters.
5 | some_tuple=( 1,2, 3,'a' );
6 | some_variable={'long':'Long code lines should be wrapped within 79 characters.',
7 | 'other':[math.pi, 100,200,300,9876543210,'This is a long string that goes on'],
8 | 'more':{'inner':'This whole logical line should be wrapped.',some_tuple:[1,
9 | 20,300,40000,500000000,60000000000000000]}}
10 | return (some_tuple, some_variable)
11 | def example2(): return {'has_key() is deprecated':True}.has_key({'f':2}.has_key(''));
12 | class Example3( object ):
13 | def __init__ ( self, bar ):
14 | #Comments should have a space after the hash.
15 | if bar : bar+=1; bar=bar* bar ; return bar
16 | else:
17 | some_string = """
18 | Indentation in multiline strings should not be touched.
19 | Only actual code should be reindented.
20 | """
21 | return (sys.path, some_string)
22 |
--------------------------------------------------------------------------------
/fIDDLE.py:
--------------------------------------------------------------------------------
1 | # Licensed under the terms of the MIT License
2 | # Copyright (c) 2015 Aaron Kehrer
3 | #
4 | # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
5 | # documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
6 | # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
7 | # permit persons to whom the Software is furnished to do so, subject to the following conditions:
8 | #
9 | # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
10 | # Software.
11 | #
12 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
13 | # THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
15 | # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
16 | # THE SOFTWARE.
17 |
18 | from fiddle import main
19 |
20 | if __name__ == '__main__':
21 | main()
22 |
--------------------------------------------------------------------------------
/fiddle/__init__.py:
--------------------------------------------------------------------------------
1 | # Licensed under the terms of the MIT License
2 | # Copyright (c) 2015 Aaron Kehrer
3 | #
4 | # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
5 | # documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
6 | # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
7 | # permit persons to whom the Software is furnished to do so, subject to the following conditions:
8 | #
9 | # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
10 | # Software.
11 | #
12 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
13 | # THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
15 | # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
16 | # THE SOFTWARE.
17 |
18 | __version__ = '0.4' # autogenerated from Git (see setup.py)
19 |
20 | from fiddle.__main__ import main
21 |
--------------------------------------------------------------------------------
/tests/data/cleaned.py:
--------------------------------------------------------------------------------
1 | import math
2 | import sys
3 |
4 |
5 | def example1():
6 | # This is a long comment. This should be wrapped to fit within 72
7 | # characters.
8 | some_tuple = (1, 2, 3, 'a')
9 | some_variable = {
10 | 'long': 'Long code lines should be wrapped within 79 characters.',
11 | 'other': [
12 | math.pi,
13 | 100,
14 | 200,
15 | 300,
16 | 9876543210,
17 | 'This is a long string that goes on'],
18 | 'more': {
19 | 'inner': 'This whole logical line should be wrapped.',
20 | some_tuple: [
21 | 1,
22 | 20,
23 | 300,
24 | 40000,
25 | 500000000,
26 | 60000000000000000]}}
27 | return (some_tuple, some_variable)
28 |
29 |
30 | def example2(): return ('' in {'f': 2}) in {'has_key() is deprecated': True}
31 |
32 |
33 | class Example3(object):
34 |
35 | def __init__(self, bar):
36 | # Comments should have a space after the hash.
37 | if bar:
38 | bar += 1
39 | bar = bar * bar
40 | return bar
41 | else:
42 | some_string = """
43 | Indentation in multiline strings should not be touched.
44 | Only actual code should be reindented.
45 | """
46 | return (sys.path, some_string)
47 |
--------------------------------------------------------------------------------
/tests/test_fiddle_codefuncs.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2015 Aaron Kehrer
2 | # Licensed under the terms of the MIT License
3 | # (see fiddle/__init__.py for details)
4 |
5 | from PyQt4.QtTest import QTest
6 |
7 | from tests import FiddleTestFixture
8 | from tests.helpers import *
9 |
10 |
11 | class FiddleMainWindowTest(FiddleTestFixture):
12 | def test_clean_code(self):
13 | """
14 | Can a file with poor PEP8 formatting be cleaned with better formatting?
15 | :return:
16 | """
17 | srcpath = os.path.join(self.data_dir, 'unclean.py')
18 | cleanpath = os.path.join(self.data_dir, 'cleaned.py')
19 | with open(cleanpath, 'rb') as fp:
20 | clean_data = fp.read().decode()
21 | self.form.open_filepath(srcpath)
22 | tab = self.form.documents_tabWidget.currentWidget()
23 | self.assertNotEqual(tab.editor.text(), clean_data)
24 | self.form.ui.actionClean_Code.trigger()
25 | self.assertEqual(tab.editor.text(), clean_data)
26 |
27 | def test_check_code(self):
28 | """
29 | Can quality issues in code be flagged for review by the user?
30 | :return:
31 | """
32 | srcpath = os.path.join(self.data_dir, 'unlinted.py')
33 | self.form.open_filepath(srcpath)
34 | tab = self.form.documents_tabWidget.currentWidget()
35 | self.form.ui.actionCheck_Code.trigger()
36 | QTest.qWait(200)
37 | next_marker = tab.editor.markerFindNext(0,-1)
38 | self.assertGreater(next_marker, -1)
--------------------------------------------------------------------------------
/fiddle/__main__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2015 Aaron Kehrer
2 | # Licensed under the terms of the MIT License
3 | # (see fiddle/__init__.py for details)
4 |
5 | # Import standard library modules
6 | import argparse
7 | import logging
8 | import os
9 | import sys
10 |
11 | # Import Qt modules
12 | import sip
13 | from PyQt4 import QtCore, QtGui
14 |
15 | # Import app modules
16 | from fiddle.controllers.MainWindow import MainWindow
17 | from fiddle.config import *
18 |
19 | # Build the logger
20 | logging.basicConfig(filename='fiddle.log',
21 | filemode='a',
22 | format='%(asctime)s:%(levelname)s:%(message)s',
23 | level=LOG_LEVEL)
24 |
25 | # Commandline arguments
26 | parser = argparse.ArgumentParser()
27 | parser.add_argument('files', nargs='*')
28 |
29 |
30 | class App(QtGui.QApplication):
31 | def __init__(self, *args):
32 | QtGui.QApplication.__init__(self, *args)
33 | pargs = parser.parse_args()
34 |
35 | self.main = MainWindow(self, files=pargs.files)
36 | self.main.setStyleSheet(WINDOW_STYLE)
37 |
38 | self.aboutToQuit.connect(self.byebye)
39 | self.main.show()
40 | self.main.raise_()
41 |
42 | def byebye(self):
43 | self.main.stop()
44 | self.exit(0)
45 |
46 |
47 | def main():
48 | sip.setdestroyonexit(False) # fix for occasional crashes on exit
49 | app = App(sys.argv)
50 | translator = QtCore.QTranslator()
51 | translator.load(QtCore.QLocale.system().name() + '.qm', 'locale')
52 | app.exec_()
53 |
54 | if __name__ == "__main__":
55 | main()
56 |
--------------------------------------------------------------------------------
/tests/data/lorem.txt:
--------------------------------------------------------------------------------
1 | Lorem ipsum dolor sit amet, sed an putent mollis persecuti, pri ut facilisis necessitatibus, in purto aliquip vituperata vis. Vis te summo zril urbanitas, eum brute impetus dolorem no, no dolorum feugait his. Has melius dissentiunt ex, quo ex posse probatus platonem, meis vidit dicit usu no. Eos adhuc partem propriae te, summo aliquid explicari te eam, diam efficiendi duo ne. Nec inani essent quaeque ne, mea porro quodsi adipiscing an. Esse veri his ei, ad est aperiam suavitate appellantur.
2 |
3 | Impedit persecuti vim at. Per ut magna iriure, sit adipisci neglegentur in, at quem meliore hendrerit has. Cu vidit appellantur quo. Ei homero regione scripserit per, viris dicunt debitis id vix, ad his equidem perpetua. Ne eam maiestatis constituam cotidieque. Sed falli admodum molestie eu, at pro ancillae corrumpit. Nec expetenda gubergren ut.
4 |
5 | Ius ea dicam cotidieque. Falli probatus abhorreant pri an. Adhuc liber munere has ne, no vix dicat nonumy. Ex alii omnesque ius, assueverit inciderint scribentur pro et. Ius ex audire saperet, mel an ubique iriure prompta. Impetus appetere ocurreret has at.
6 |
7 | Tale alienum ex eam. No mel veniam vidisse impedit, nec id quod esse nostro. Nam solum eirmod ex, ex sed illud honestatis. Vis et apeirian invenire. Per vero sonet intellegat ad, id sea lorem offendit, ex prima errem per. Ad his vide quodsi argumentum, eum ex simul disputationi. In nec ignota deterruisset, cu duo ferri audiam.
8 |
9 | Veniam hendrerit ne vim, ut cum summo liberavisse. Denique epicuri ad vel, fuisset mentitum vis et. Te duo appareat theophrastus, ex aperiam eligendi vel. Eu per melius abhorreant, mei cu magna saperet legimus, eam te docendi cotidieque.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # 
2 |
3 | ```python
4 | from __future__ import idle
5 | ```
6 |
7 | fiddle is a Python code editor designed as an alternate to Python's default IDLE development environment. It is aimed
8 | at both beginning Python programmers just learning the language and experience Python developers that may not require a
9 | full IDE for simpler projects.
10 |
11 | fiddle has been inspired by the [IDLE Reimagined](https://github.com/asweigart/idle-reimagined) project.
12 |
13 | 
14 |
15 | ## Features
16 | - Interactive interpreter (Python shell)
17 | - Tabbed file editor with code completion
18 | - Easy access to built-in Python documentation (via pydoc)
19 | - Quick search for errors
20 | - Improved traceback information
21 | - One touch code cleaner and code checker
22 | - Easily switch between interpreters (including virtual environments)
23 |
24 | ## Status
25 | fiddle is currently in beta development so features may be removed or changed and things will be rough around the
26 | edges.
27 |
28 | ## Installation
29 | There are Windows builds available for each [release](https://github.com/akehrer/fiddle/releases) in a ZIP
30 | archive. These were built use [cx_Freeze](http://cx-freeze.sourceforge.net/).
31 |
32 | If you want to run the source directly, installation instructions for the three major systems are available
33 | [here](https://github.com/akehrer/fiddle/wiki/Installation).
34 |
35 | ## Requirements
36 | - [Python 3.4](https://www.python.org/downloads/)
37 | - [PyQt4](https://www.riverbankcomputing.com/software/pyqt/download)
38 | - [chardet](https://pypi.python.org/pypi/chardet) - to guess file encodings
39 | - [autopep8](https://pypi.python.org/pypi/autopep8) - to clean Python files formatting
40 | - [pyflakes](https://pypi.python.org/pypi/pyflakes) - to check Python files for errors
41 |
42 | ## Contribute
43 | Contributions to the development of fiddle are welcome from anyone. Here are a few ways to help out:
44 |
45 | - There is an open mailing list at [fiddle-discuss](https://groups.google.com/forum/#!forum/fiddle-discuss) where we talk about all things related to fiddle.
46 | - If you have found a bug please submit an [issue](https://github.com/akehrer/fiddle/issues)
47 | - If you would like to contribute code please base your feature branch off of `master` and make sure all tests pass before submitting a pull request
48 |
49 |
50 | ## License
51 | fiddle is released under the MIT License, see [LICENSE](./LICENSE) for more information.
52 |
53 | Copyright (c) 2015 Aaron Kehrer
54 |
--------------------------------------------------------------------------------
/tests/test_fiddle_filetypes.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2015 Aaron Kehrer
2 | # Licensed under the terms of the MIT License
3 | # (see fiddle/__init__.py for details)
4 |
5 | import os
6 | import unittest
7 | from PyQt4.QtTest import QTest
8 | from PyQt4.QtCore import Qt
9 |
10 | from fiddle.controllers.Editors import *
11 | from tests import FiddleTestFixture
12 | from tests.helpers import *
13 |
14 |
15 | class FiddleFiletypesTest(FiddleTestFixture):
16 | def test_unicode_open_saveas(self):
17 | srcpath = os.path.join(self.data_dir, 'utf8_test.txt')
18 | destpath = os.path.join(self.this_dir, 'utf8_test_temp.txt')
19 | srchash = sha_hash_file(srcpath)
20 | self.form.open_filepath(srcpath)
21 | tab = self.form.documents_tabWidget.currentWidget()
22 | tab._write_file(destpath)
23 | desthash = sha_hash_file(destpath)
24 | self.assertEqual(srchash, desthash)
25 | os.remove(destpath)
26 |
27 | def test_win1252_open_saveas(self):
28 | srcpath = os.path.join(self.data_dir, 'win1252_test.txt')
29 | destpath = os.path.join(self.this_dir, 'win1252_test_temp.txt')
30 | srchash = sha_hash_file(srcpath)
31 | self.form.open_filepath(srcpath)
32 | tab = self.form.documents_tabWidget.currentWidget()
33 | tab._write_file(destpath)
34 | desthash = sha_hash_file(destpath)
35 | self.assertEqual(srchash, desthash)
36 | os.remove(destpath)
37 |
38 | def test_pyfile_open(self):
39 | srcpath = os.path.join(self.data_dir, 'server.py')
40 | self.form.open_filepath(srcpath)
41 | tab = self.form.documents_tabWidget.currentWidget()
42 | self.assertIsInstance(tab.editor, PythonEditor)
43 |
44 | def test_jsfile_open(self):
45 | srcpath = os.path.join(self.data_dir, 'main.js')
46 | self.form.open_filepath(srcpath)
47 | tab = self.form.documents_tabWidget.currentWidget()
48 | self.assertIsInstance(tab.editor, JavascriptEditor)
49 |
50 | def test_htmlfile_open(self):
51 | srcpath = os.path.join(self.data_dir, 'index.html')
52 | self.form.open_filepath(srcpath)
53 | tab = self.form.documents_tabWidget.currentWidget()
54 | self.assertIsInstance(tab.editor, HTMLEditor)
55 |
56 | def test_cssfile_open(self):
57 | srcpath = os.path.join(self.data_dir, 'main.css')
58 | self.form.open_filepath(srcpath)
59 | tab = self.form.documents_tabWidget.currentWidget()
60 | self.assertIsInstance(tab.editor, CSSEditor)
61 |
62 |
63 | if __name__ == "__main__":
64 | unittest.main()
65 |
--------------------------------------------------------------------------------
/fiddle/helpers/linter.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2015 Aaron Kehrer
2 | # Licensed under the terms of the MIT License
3 | # (see fiddle/__init__.py for details)
4 |
5 | """
6 | The internal linter uses :mod:`pyflakes` as its base with the need for a :class:`pyflakes.reporter.Reporter` class
7 | removed and the warnings passed as a list to the caller.
8 | """
9 |
10 | import sys
11 | import _ast
12 |
13 | from pyflakes import checker
14 |
15 |
16 | class LinterError(Exception):
17 | def __init__(self, filename):
18 | self.filename = filename
19 | self.message = 'linter error'
20 |
21 | def __str__(self):
22 | return self.message
23 |
24 |
25 | class LinterUnexpectedError(LinterError):
26 | def __init__(self, filename):
27 | self.filename = filename
28 | self.message = '%s problem decoding source' % self.filename
29 |
30 | def __str__(self):
31 | return self.message
32 |
33 |
34 | class LinterSyntaxError(LinterError):
35 | def __init__(self, filename, msg, lineno, offset, text):
36 | self.filename = filename
37 | self.message = msg
38 | self.lineno = lineno
39 | self.offset = offset
40 | self.text = text
41 |
42 | def __str__(self):
43 | return '%s:%d:%d: %s' % (self.filename, self.lineno, self.offset + 1, self.message)
44 |
45 |
46 | def check(codeString, filename):
47 | """
48 | This is a reimplementation of :func:`pyflask.api.check` to output a list of warnings.
49 |
50 | :param codeString: the code to parse for issues
51 | :param filename: the source filename
52 | :return: list of :class:`pyflakes.messages.Message`
53 |
54 | See the pyflakes license in the LICENSE file.
55 | """
56 | # First, compile into an AST and handle syntax errors.
57 | try:
58 | tree = compile(codeString, filename, "exec", _ast.PyCF_ONLY_AST)
59 | except SyntaxError:
60 | value = sys.exc_info()[1]
61 | msg = value.args[0]
62 |
63 | (lineno, offset, text) = value.lineno, value.offset, value.text
64 |
65 | # If there's an encoding problem with the file, the text is None.
66 | if text is None:
67 | # Avoid using msg, since for the only known case, it contains a
68 | # bogus message that claims the encoding the file declared was
69 | # unknown.
70 | raise LinterUnexpectedError(filename)
71 | else:
72 | raise LinterSyntaxError(filename, msg, lineno, offset, text)
73 | except Exception:
74 | raise LinterUnexpectedError(filename)
75 |
76 | # Okay, it's syntactically valid. Now check it.
77 | w = checker.Checker(tree, filename)
78 | w.messages.sort(key=lambda m: m.lineno)
79 |
80 | return w.messages
81 |
--------------------------------------------------------------------------------
/tests/test_fiddle_mainwindow.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2015 Aaron Kehrer
2 | # Licensed under the terms of the MIT License
3 | # (see fiddle/__init__.py for details)
4 |
5 | from PyQt4.QtTest import QTest
6 | from PyQt4.QtCore import *
7 | from PyQt4.QtGui import *
8 |
9 | from tests import app, FiddleTestFixture
10 | from tests.helpers import *
11 |
12 |
13 | class FiddleMainWindowTest(FiddleTestFixture):
14 | def test_close_tab_discard(self):
15 | """
16 | Test closing a tab with unsaved data. The changes are discarded.
17 | Note: Modal will flash...
18 | :return:
19 | """
20 | # Open the file
21 | srcpath = os.path.join(self.data_dir, 'lorem.txt')
22 | srchash = sha_hash_file(srcpath)
23 | self.form.open_filepath(srcpath)
24 | tab = self.form.documents_tabWidget.currentWidget()
25 | self.assertTrue(tab.saved)
26 | # Modify the file
27 | QTest.keyClick(tab.editor, Qt.Key_Return)
28 | QTest.keyClick(tab.editor, Qt.Key_Return)
29 | self.assertFalse(tab.saved)
30 | # Close the tab and discard the changes
31 | pre_cnt = self.form.documents_tabWidget.count()
32 | QTimer.singleShot(200, self._discard_dialog)
33 | self.form.close_tab(1)
34 | post_cnt = self.form.documents_tabWidget.count()
35 | self.assertNotEqual(pre_cnt, post_cnt)
36 | self.assertEqual(srchash, sha_hash_file(srcpath))
37 |
38 | def test_drag_drop_file(self):
39 | """
40 | Test dropping multiple files on the tab widget.
41 | :return:
42 |
43 | http://stackoverflow.com/questions/11500844/qtest-its-possible-to-test-dragdrop
44 | http://wiki.qt.io/Drag_and_Drop_of_files
45 | """
46 | #
47 | pre_cnt = self.form.documents_tabWidget.count()
48 | # D&D events take MIME data and for files need URLs
49 | mime_files = QMimeData()
50 | files = [QUrl().fromLocalFile(os.path.join(self.data_dir, 'lorem.txt')),
51 | QUrl().fromLocalFile(os.path.join(self.data_dir, 'utf8_test.txt'))]
52 | mime_files.setUrls(files)
53 | # Drag the files
54 | action = Qt.MoveAction
55 | target = self.form.documents_tabWidget.rect().center()
56 | drag_drop = QDropEvent(target, action, mime_files, Qt.LeftButton, Qt.NoModifier)
57 | drag_drop.acceptProposedAction()
58 | # Drop the files
59 | self.form.documents_tabWidget.dropEvent(drag_drop)
60 | QTest.qWait(200) # Give the GUI time to load the data
61 | # Check the new tabs
62 | post_cnt = self.form.documents_tabWidget.count()
63 | self.assertEqual(post_cnt, pre_cnt + len(files))
64 | self.assertEqual(self.form.documents_tabWidget.widget(1).filename, 'lorem.txt')
65 | self.assertEqual(self.form.documents_tabWidget.widget(2).filename, 'utf8_test.txt')
66 |
67 | def _discard_dialog(self):
68 | """
69 | Click the 'Discard' button on a modal dialog.
70 | This function is usually called by a QTimer that starts before the
71 | function that creates the dialog.
72 |
73 | QTimer.singleShot(200, self._discard_dialog)
74 |
75 | :return:
76 | """
77 | widgets = app.topLevelWidgets()
78 | for w in widgets:
79 | if type(w) is QMessageBox:
80 | btns = w.findChildren(QPushButton)
81 | for b in btns:
82 | if b.text().lower() == 'discard':
83 | QTest.mouseClick(b, Qt.LeftButton)
84 |
--------------------------------------------------------------------------------
/fiddle/controllers/ManageInterpretersDialog.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2015 Aaron Kehrer
2 | # Licensed under the terms of the MIT License
3 | # (see fiddle/__init__.py for details)
4 |
5 | # Import standard library modules
6 | import os
7 | import json
8 | import logging
9 |
10 | # Import Qt modules
11 | from PyQt4 import QtCore, QtGui
12 |
13 | # Import application modules
14 | from fiddle.views.ManageInterpretersDialog import Ui_manageInterpreters_Dialog
15 |
16 | from fiddle.config import PLATFORM, APP_DIR, CONSOLE_PYTHON, CONSOLE_PYTHON_INTERPRETERS
17 |
18 | # Set up the logger
19 | logger = logging.getLogger(__name__)
20 |
21 |
22 | class ManageInterpretersDialog(QtGui.QDialog):
23 | def __init__(self, parent=None):
24 | super(ManageInterpretersDialog, self).__init__()
25 |
26 | self.parent = parent
27 |
28 | self.ui = Ui_manageInterpreters_Dialog()
29 | self.ui.setupUi(self)
30 |
31 | self.temp_interpreters = CONSOLE_PYTHON_INTERPRETERS
32 |
33 | self.py_icon = QtGui.QIcon()
34 | self.py_icon.addPixmap(QtGui.QPixmap(":/icons/icons/python_twosnakes.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
35 | self.pyvenv_icon = QtGui.QIcon()
36 | self.pyvenv_icon.addPixmap(QtGui.QPixmap(":/icons/icons/python_twosnakes_v.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
37 |
38 | self.init_default_interpreter()
39 | self.init_elements()
40 |
41 | # Catch changes in the order of items
42 | self.ui.pyInterpreters_List.model().layoutChanged.connect(self.update_temp_interpreters)
43 |
44 | def init_default_interpreter(self):
45 | # Add system interpreter
46 | self.ui.defaultInterpreterPath_label.setText('(Default) ' + CONSOLE_PYTHON['path'])
47 |
48 | def init_elements(self):
49 | # Add user interpreters
50 | self.ui.pyInterpreters_List.clear()
51 | for item in self.temp_interpreters:
52 | w = QtGui.QListWidgetItem()
53 | w.setText(item['path'])
54 | if item['virtualenv']:
55 | w.setIcon(self.pyvenv_icon)
56 | else:
57 | w.setIcon(self.py_icon)
58 | self.ui.pyInterpreters_List.addItem(w)
59 |
60 | def add_interpreter(self):
61 | filepath = QtGui.QFileDialog.getOpenFileName(None,
62 | None,
63 | '/',
64 | 'Python Interpreters (python* ipython*);;All Files (*.*)')
65 | if filepath != '':
66 | # Check for executable
67 | if os.path.isfile(filepath) and os.access(filepath, os.X_OK):
68 | interpreter = {'path': filepath, 'virtualenv': False}
69 | # Check for virtual environment scripts
70 | basepath, filename = os.path.split(filepath)
71 | files = os.listdir(basepath)
72 | for f in files:
73 | if f.startswith('activate'):
74 | interpreter['virtualenv'] = True
75 | break
76 | self.temp_interpreters.append(interpreter)
77 | self.init_elements()
78 |
79 | def remove_interpreter(self):
80 | item = self.ui.pyInterpreters_List.takeItem(self.ui.pyInterpreters_List.currentRow())
81 | del item
82 | self.update_temp_interpreters()
83 |
84 | def update_temp_interpreters(self):
85 | self.temp_interpreters = []
86 | for i in range(self.ui.pyInterpreters_List.count()):
87 | self.temp_interpreters.append(self.ui.pyInterpreters_List.item(i).text())
--------------------------------------------------------------------------------
/fiddle/config.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2015 Aaron Kehrer
2 | # Licensed under the terms of the MIT License
3 | # (see fiddle/__init__.py for details)
4 |
5 | # Import standard library modules
6 | import json
7 | import logging
8 | import os
9 | import re
10 | import subprocess
11 | import sys
12 |
13 | PLATFORM = sys.platform
14 | LOG_LEVEL = logging.DEBUG
15 |
16 | ABOUT_FIDDLE = """
17 | Copyright (c) 2015 Aaron Kehrer
18 | Licensed under the terms of the MIT License
19 |
20 | Created using Python and PyQT
21 |
22 | Silk icons CC-BY Mark James
23 |
24 | See the LICENSE file for additional license information
25 | """
26 |
27 |
28 | def find_python_exe():
29 | """
30 | Find the path to the system's Python executable
31 | :return: str
32 | """
33 | try:
34 | if PLATFORM == 'win32':
35 | p = subprocess.check_output(['where', 'python'])
36 | else:
37 | p = subprocess.check_output(['which', 'python'])
38 | return p.strip().decode('utf8')
39 | except subprocess.CalledProcessError:
40 | return ''
41 |
42 |
43 | # Determine if application is a script file or frozen exe
44 | # see: http://stackoverflow.com/questions/404744/determining-application-path-in-a-python-exe-generated-by-pyinstaller
45 | # also up the logging level to INFO for frozen app
46 | APP_DIR = os.path.dirname(os.path.realpath(__file__))
47 | APP_FROZEN = False
48 | if getattr(sys, 'frozen', False):
49 | APP_DIR = os.path.dirname(sys.executable)
50 | LOG_LEVEL = logging.INFO
51 | APP_FROZEN = True
52 |
53 |
54 | # App file types
55 | FILE_TYPES = ['fiddle Files (*.py *.html *.htm *.js *.css)',
56 | 'Python Files (*.py)',
57 | 'HTML Files (*.html *.htm)',
58 | 'Javascript Files (*.js)',
59 | 'CSS Files (*.css)',
60 | 'All Files (*.*)']
61 |
62 | # Editor configuration
63 | if PLATFORM == 'win32':
64 | EDITOR_FONT = 'Consolas'
65 | EDITOR_FONT_SIZE = 10
66 | WINDOW_FONT_SIZE = 15
67 | elif PLATFORM == 'darwin':
68 | EDITOR_FONT = 'Menlo'
69 | EDITOR_FONT_SIZE = 12
70 | WINDOW_FONT_SIZE = 13
71 | else:
72 | EDITOR_FONT = 'Courier'
73 | EDITOR_FONT_SIZE = 12
74 | WINDOW_FONT_SIZE = 15
75 |
76 | EDITOR_MARGIN_COLOR = '#cccccc'
77 | EDITOR_EDGECOL_COLOR = '#dddddd'
78 | EDITOR_CARET_LINE_COLOR = '#ffffe0'
79 |
80 | # Window title prefix
81 | WINDOW_TITLE = 'fiddle'
82 |
83 | # MainWindow Stylesheet
84 | WINDOW_STYLE = """
85 | QMainWindow {
86 | background-color: white;
87 | }
88 |
89 | QWidget {
90 | /* Applies to all the widgets */
91 | font-family: "Segoe UI", "Lucida Grande", sans-serif;
92 | font-size: %spx;
93 | }
94 |
95 | QFrame {
96 | background-color: white;
97 | }
98 |
99 | QTextBrowser {
100 | font-family: "Consolas", "Menlo", "Monaco", "DejaVu Sans Mono", monospace, fixed;
101 | }
102 |
103 | QFrame QToolButton {
104 | background-color: white;
105 | }
106 |
107 | QTabWidget::pane {
108 | background-color: white;
109 | }
110 |
111 | QDockWidget::title {
112 | text-align: left;
113 | background: whitesmoke;
114 | padding: 7px;
115 | }
116 |
117 | QDockWidget::close-button {
118 | subcontrol-position: top right;
119 | subcontrol-origin: margin;
120 | position: absolute;
121 | top: 0px; right: 10px; bottom: 0px;
122 | width: 14px;
123 | }
124 |
125 | QDockWidget QToolButton {
126 | background-color: white;
127 | }
128 | """ % WINDOW_FONT_SIZE
129 |
130 | # Python Console Configuration
131 | CONSOLE_HOST = '127.0.0.1'
132 | CONSOLE_PYTHON = {'path': find_python_exe(), 'virtualenv': False}
133 | CONSOLE_PYTHON_DIR = os.path.dirname(CONSOLE_PYTHON['path'])
134 | CONSOLE_PS1 = getattr(sys, "ps1", ">>> ")
135 | CONSOLE_PS2 = getattr(sys, "ps2", "... ")
136 | CONSOLE_HELP_PORT = 7464
137 |
138 | # Console colors
139 | CONSOLE_COLOR_BASE = "#000000"
140 | CONSOLE_COLOR_ERROR = "#990000"
141 | CONSOLE_COLOR_INFO = "#000099"
142 |
143 | # Console RegEx
144 | CONSOLE_RE_PYVER = re.compile(r'.*?(\d)\.(\d)\.(\d)', re.IGNORECASE|re.DOTALL)
145 | CONSOLE_RE_LINENUM = re.compile(r'(\s+File\s+)(".*")(.\s+line\s+)(\d+)(.*)', re.IGNORECASE|re.DOTALL)
146 | CONSOLE_RE_ERROR = re.compile(r'([A-Za-z]+Error)', re.IGNORECASE|re.DOTALL)
147 | CONSOLE_RE_HTTP = re.compile(r'(https?://[^\s/$.?#].[^\s\'\"]*)', re.IGNORECASE|re.DOTALL) # based on @stephenhay
148 |
149 | # Help Configuration
150 | try:
151 | with open('searchers.json') as fp:
152 | HELP_WEB_SEARCH_SOURCES = json.load(fp)
153 | except (ValueError, FileNotFoundError):
154 | HELP_WEB_SEARCH_SOURCES = [{'name': 'Google',
155 | 'query_tmpl': 'https://www.google.com/search?q={query}'}]
156 |
157 | # Python Interpreters Configuration
158 | try:
159 | with open('interpreters.json') as fp:
160 | CONSOLE_PYTHON_INTERPRETERS = json.load(fp)
161 | except (ValueError, FileNotFoundError):
162 | CONSOLE_PYTHON_INTERPRETERS = []
163 |
--------------------------------------------------------------------------------
/setup.py:
--------------------------------------------------------------------------------
1 | from distutils.core import setup, Command
2 | import fileinput
3 | import os
4 | import subprocess
5 | import logging
6 | import sys
7 | # For cx-freeze to work on Windows install from here
8 | # http://www.lfd.uci.edu/~gohlke/pythonlibs/#cx_freeze
9 | from cx_Freeze import setup, Executable
10 |
11 | from fiddle.config import LOG_LEVEL
12 | from fiddle import __version__
13 |
14 | # Dependencies are automatically detected, but it might need fine tuning.
15 | build_exe_options = {
16 | 'packages': [],
17 | 'excludes': ['tkinter', 'lib2to3'],
18 | 'zip_includes': [],
19 | 'bin_excludes': [],
20 | 'includes': [
21 | 'PyQt4.QtNetwork',
22 | 'PyQt4.QtWebKit',
23 | 'PyQt4.Qsci'],
24 | 'include_files': [
25 | 'locale/',
26 | 'LICENSE',
27 | 'searchers.json'],
28 | 'include_msvcr': False}
29 |
30 |
31 | # ##### Missing includes #####
32 | # lib2to3 needs to load its Grammar files at run time, but cannot open them when they are included in the cx_Freeze
33 | # `library.zip` file. The module is excluded in the options and then copied over here in the include_files.
34 | import lib2to3
35 | lib23_path = os.path.dirname(lib2to3.__file__)
36 | build_exe_options['include_files'].append(lib23_path)
37 |
38 | # ##### Platform Specific Parameters #####
39 | base = None
40 | icon = None
41 | if sys.platform == 'win32':
42 | # GUI applications require a different base on Windows (the default is for a console application).
43 | # Hide the console window in Windows
44 | base = 'Win32GUI'
45 | build_exe_options['include_msvcr'] = True
46 | target_name = 'fiddle.exe'
47 | icon = os.path.join('.', 'media', 'icons', 'fiddle_icon_light.ico')
48 | elif sys.platform == 'darwin':
49 | # exclude: libQsci.dylib
50 | # the compiled file is copied from libQsci.dylib to Qsci.so during build process
51 | # this leaves the original library name intact and cx_Freeze cannot detect this
52 | # so to get this to build cleanly, need to exclude libQsci.dylib file
53 | # Thanks to the RAFT project for this hint…
54 | # build_exe_options['bin_excludes'].append('libQsci.dylib')
55 | excludes = ['Qsci',
56 | 'QtCore',
57 | 'QtDeclarative',
58 | 'QtDesigner',
59 | 'QtGui',
60 | 'QtHelp',
61 | 'QtMultimedia',
62 | 'QtNetwork',
63 | 'QtOpenGL',
64 | 'QtScript',
65 | 'QtScriptTools',
66 | 'QtSql',
67 | 'QtSvg',
68 | 'QtTest',
69 | 'QtWebKit',
70 | 'QtXml',
71 | 'QtXmlPatterns']
72 | for e in excludes:
73 | build_exe_options['bin_excludes'].append('lib%s.dylib' % (e))
74 | target_name = 'fiddle'
75 | icon = os.path.join('.', 'media', 'icons', 'fiddle_icon_light.hqx')
76 | else:
77 | target_name = 'fiddle.py'
78 |
79 |
80 | # ##### Version #####
81 | # Update the module version based on:
82 | # https://github.com/warner/python-ecdsa/blob/9e21c3388cc98ba90877a1e4dbc2aaf66c67d365/setup.py#L33
83 | VERSION = __version__
84 |
85 |
86 | def update_version_py():
87 | if not os.path.isdir(".git"):
88 | print("This does not appear to be a Git repository.")
89 | return
90 | try:
91 | p = subprocess.Popen(["git", "describe",
92 | "--tags", "--dirty", "--always"],
93 | stdout=subprocess.PIPE)
94 | except EnvironmentError:
95 | print("Unable to run git, leaving fiddle/__init__.py version alone")
96 | return
97 | gitout = p.communicate()[0]
98 | if p.returncode != 0:
99 | print("Unable to run git, leaving fiddle/__init__.py version alone")
100 | return
101 | ver = gitout.decode().strip()
102 | for line in fileinput.input('fiddle/__init__.py', inplace=True):
103 | if line.startswith('__version__'):
104 | print(
105 | "__version__ = '{0}' # autogenerated from Git (see setup.py)".format(ver))
106 | else:
107 | print(line, end='')
108 | print("Set fiddle/__init__.py version to '%s'" % ver)
109 | return ver
110 |
111 |
112 | class Version(Command):
113 | description = "Update __init__.py version from Git repo"
114 | user_options = []
115 | boolean_options = []
116 |
117 | def initialize_options(self):
118 | pass
119 |
120 | def finalize_options(self):
121 | pass
122 |
123 | def run(self):
124 | ver = update_version_py()
125 | VERSION = ver
126 | print("Version is now", VERSION)
127 |
128 |
129 | # ##### Setup #####
130 | setup(
131 | name='fiddle',
132 | version=VERSION,
133 | author='Aaron Kehrer',
134 | author_email='akehrer@gmail.com',
135 | url='https://github.com/akehrer/fiddle',
136 | license='The MIT License (MIT)',
137 | windows=[{'script': 'fiddle.py'}],
138 | options={'build_exe': build_exe_options},
139 | executables=[Executable('fiddle.py', base=base, targetName=target_name, icon=icon)],
140 | cmdclass={'version': Version}
141 | )
142 |
--------------------------------------------------------------------------------
/fiddle/controllers/PyConsole.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2015 Aaron Kehrer
2 | # Licensed under the terms of the MIT License
3 | # (see fiddle/__init__.py for details)
4 |
5 | import os
6 | import unicodedata
7 | from io import StringIO
8 |
9 | from PyQt4 import QtCore, QtGui
10 | from fiddle.config import EDITOR_FONT, EDITOR_FONT_SIZE
11 |
12 |
13 | class PyConsoleTextBrowser(QtGui.QTextBrowser):
14 | def __init__(self, parent=None, process=None):
15 | super(PyConsoleTextBrowser, self).__init__(parent)
16 |
17 | self.process = process
18 |
19 | # The start position in the QTextBrowser document where new user input will be inserted
20 | self._input_insert_pos = -1
21 |
22 | self.history = []
23 | self.history_idx = 0
24 |
25 | self.setLineWrapMode(QtGui.QTextEdit.NoWrap)
26 | self.setAcceptRichText(False)
27 | self.setReadOnly(False)
28 | self.setOpenExternalLinks(False)
29 | self.setOpenLinks(False)
30 | self.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse | QtCore.Qt.TextEditorInteraction)
31 |
32 | def keyPressEvent(self, event):
33 | if self.process is not None:
34 | # Skip keys modified with Ctrl or Alt
35 | if event.modifiers() != QtCore.Qt.ControlModifier and event.modifiers() != QtCore.Qt.AltModifier:
36 | # Get the insert cursor and make sure it's at the end of the console
37 | cursor = self.textCursor()
38 | cursor.movePosition(QtGui.QTextCursor.End)
39 | if self._input_insert_pos < 0:
40 | self._input_insert_pos = cursor.position()
41 |
42 | # Scroll view to end of console
43 | self.setTextCursor(cursor)
44 | self.ensureCursorVisible()
45 |
46 | # Process the key event
47 | if event.key() == QtCore.Qt.Key_Up:
48 | # Clear any previous input
49 | self._clear_insert_line(cursor)
50 | # Get the history
51 | if len(self.history) > 0:
52 | self.history_idx -= 1
53 | try:
54 | cursor.insertText(self.history[self.history_idx])
55 | except IndexError:
56 | self.history_idx += 1
57 | cursor.insertText('')
58 | elif event.key() == QtCore.Qt.Key_Down:
59 | # Clear any previous input
60 | self._clear_insert_line(cursor)
61 | # Get the history
62 | if len(self.history) > 0 >= self.history_idx:
63 | self.history_idx += 1
64 | try:
65 | cursor.insertText(self.history[self.history_idx])
66 | except IndexError:
67 | self.history_idx -= 1
68 | cursor.insertText('')
69 | elif event.key() == QtCore.Qt.Key_Return:
70 | txt = self._select_insert_line(cursor)
71 | self.process.write('{0}\n'.format(txt).encode('utf-8'))
72 | # Reset the insert position
73 | self._input_insert_pos = -1
74 | # Update the history
75 | self.history.append(txt)
76 | self.history_idx = 0
77 | # Pass the event on to the parent for handling
78 | return QtGui.QTextBrowser.keyPressEvent(self, event)
79 |
80 | def _clear_insert_line(self, cursor):
81 | """
82 | Remove all the displayed text from the input insert line and clear the input buffer
83 | """
84 | cursor.setPosition(self._input_insert_pos, QtGui.QTextCursor.KeepAnchor)
85 | cursor.removeSelectedText()
86 |
87 | def _select_insert_line(self, cursor):
88 | cursor.setPosition(self._input_insert_pos, QtGui.QTextCursor.KeepAnchor)
89 | txt = cursor.selectedText()
90 | cursor.clearSelection()
91 | return txt
92 |
93 |
94 | class PyConsoleLineEdit(QtGui.QLineEdit):
95 | """
96 | https://wiki.python.org/moin/PyQt/Adding%20tab-completion%20to%20a%20QLineEdit
97 | http://www.saltycrane.com/blog/2008/01/how-to-capture-tab-key-press-event-with/
98 | """
99 | def __init__(self):
100 | super(PyConsoleLineEdit, self).__init__()
101 |
102 | line_font = QtGui.QFont()
103 | line_font.setFamily(EDITOR_FONT)
104 | line_font.setPointSize(EDITOR_FONT_SIZE)
105 | self.setFont(line_font)
106 |
107 | self.history = []
108 | self.history_idx = -1
109 |
110 | def event(self, event):
111 | if event.type() == QtCore.QEvent.KeyPress:
112 | if event.key() == QtCore.Qt.Key_Tab:
113 | if self.text().strip() == '':
114 | self.setText(self.text() + ' ')
115 | return True
116 | elif event.key() == QtCore.Qt.Key_Up:
117 | if len(self.history) > 0 and self.history_idx > 0:
118 | self.history_idx -= 1
119 | self.setText(self.history[self.history_idx])
120 | return True
121 | elif event.key() == QtCore.Qt.Key_Down:
122 | if 0 < len(self.history) > self.history_idx:
123 | self.history_idx += 1
124 | try:
125 | self.setText(self.history[self.history_idx])
126 | except IndexError:
127 | self.setText('')
128 | return True
129 | elif event.key() == QtCore.Qt.Key_Return:
130 | try:
131 | if self.history[-1] != self.text():
132 | self.history.append(self.text())
133 | except IndexError:
134 | self.history.append(self.text())
135 | self.history_idx = len(self.history)
136 | return QtGui.QLineEdit.event(self, event)
137 |
138 | return QtGui.QLineEdit.event(self, event)
139 |
--------------------------------------------------------------------------------
/tests/test_fiddle_findreplace.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2015 Aaron Kehrer
2 | # Licensed under the terms of the MIT License
3 | # (see fiddle/__init__.py for details)
4 |
5 | from PyQt4.QtTest import QTest
6 | from PyQt4.QtCore import Qt
7 |
8 | from tests import FiddleTestFixture
9 | from tests.helpers import *
10 |
11 |
12 | class FiddleFindReplaceTest(FiddleTestFixture):
13 | findtext = 'abhorreant'
14 | replacetext = 'tnaerrohba'
15 |
16 | def test_find_text_return(self):
17 | """
18 | Test using the Return key to cycle through found elements in the test text and wrap around at EOF.
19 | :return:
20 | """
21 | srcpath = os.path.join(self.data_dir, 'lorem.txt')
22 | self.form.open_filepath(srcpath)
23 | tab = self.form.documents_tabWidget.currentWidget()
24 | self.form.ui.findPane.show()
25 | self.form.ui.find_text_lineEdit.setText(self.findtext)
26 | QTest.keyClick(self.form.ui.find_text_lineEdit, Qt.Key_Return)
27 | first_pos = tab.editor.getCursorPosition()
28 | self.assertEqual(tab.editor.selectedText(), self.findtext)
29 | QTest.keyClick(self.form.ui.find_text_lineEdit, Qt.Key_Return)
30 | second_pos = tab.editor.getCursorPosition()
31 | self.assertEqual(tab.editor.selectedText(), self.findtext)
32 | self.assertNotEqual(first_pos, second_pos)
33 | # Wrap...
34 | QTest.keyClick(self.form.ui.find_text_lineEdit, Qt.Key_Return)
35 | wrap_pos = tab.editor.getCursorPosition()
36 | self.assertEqual(first_pos, wrap_pos)
37 |
38 | def test_find_text_next(self):
39 | """
40 | Test using the Next button to cycle through found elements in the test text and wrap around at EOF.
41 | :return:
42 | """
43 | srcpath = os.path.join(self.data_dir, 'lorem.txt')
44 | self.form.open_filepath(srcpath)
45 | tab = self.form.documents_tabWidget.currentWidget()
46 | self.form.ui.findPane.show()
47 | self.form.ui.find_text_lineEdit.setText(self.findtext)
48 | QTest.mouseClick(self.form.ui.find_next_Button, Qt.LeftButton)
49 | first_pos = tab.editor.getCursorPosition()
50 | self.assertEqual(tab.editor.selectedText(), self.findtext)
51 | QTest.mouseClick(self.form.ui.find_next_Button, Qt.LeftButton)
52 | second_pos = tab.editor.getCursorPosition()
53 | self.assertEqual(tab.editor.selectedText(), self.findtext)
54 | self.assertNotEqual(first_pos, second_pos)
55 | # Wrap...
56 | QTest.mouseClick(self.form.ui.find_next_Button, Qt.LeftButton)
57 | wrap_pos = tab.editor.getCursorPosition()
58 | self.assertEqual(first_pos, wrap_pos)
59 |
60 | def test_find_text_previous(self):
61 | """
62 | Test using the Previous button to cycle through found elements in the test text and wrap around at EOF. The
63 | search should wrap immediately and start from the end of the file.
64 | :return:
65 | """
66 | srcpath = os.path.join(self.data_dir, 'lorem.txt')
67 | self.form.open_filepath(srcpath)
68 | tab = self.form.documents_tabWidget.currentWidget()
69 | self.form.ui.findPane.show()
70 | self.form.ui.find_text_lineEdit.setText(self.findtext)
71 | # Wrap...
72 | QTest.mouseClick(self.form.ui.find_previous_Button, Qt.LeftButton)
73 | first_pos = tab.editor.getCursorPosition() # (line, col) tuple
74 | self.assertEqual(tab.editor.selectedText(), self.findtext)
75 | QTest.mouseClick(self.form.ui.find_previous_Button, Qt.LeftButton)
76 | second_pos = tab.editor.getCursorPosition()
77 | self.assertEqual(tab.editor.selectedText(), self.findtext)
78 | self.assertNotEqual(first_pos, second_pos)
79 | self.assertGreater(first_pos[0], second_pos[0]) # Started from end of file
80 | QTest.mouseClick(self.form.ui.find_previous_Button, Qt.LeftButton)
81 | wrap_pos = tab.editor.getCursorPosition()
82 | self.assertEqual(first_pos, wrap_pos)
83 |
84 | def test_replace_text(self):
85 | """
86 | Test using the Replace button to cycle through found elements and replace them.
87 | :return:
88 | """
89 | srcpath = os.path.join(self.data_dir, 'lorem.txt')
90 | self.form.open_filepath(srcpath)
91 | tab = self.form.documents_tabWidget.currentWidget()
92 | self.form.ui.findPane.show()
93 | self.form.ui.find_text_lineEdit.setText(self.findtext)
94 | self.form.ui.replace_text_lineEdit.setText(self.replacetext)
95 | # Find first instance
96 | QTest.mouseClick(self.form.ui.replace_Button, Qt.LeftButton)
97 | first_pos = tab.editor.getCursorPosition()
98 | self.assertEqual(tab.editor.selectedText(), self.findtext)
99 | # Replace it an move to the next
100 | QTest.mouseClick(self.form.ui.replace_Button, Qt.LeftButton)
101 | self.assertEqual(tab.editor.selectedText(), self.findtext)
102 | second_pos = tab.editor.getCursorPosition()
103 | self.assertNotEqual(first_pos, second_pos)
104 | # Replace it and wrap (nothing found so don't change selection)
105 | QTest.mouseClick(self.form.ui.replace_Button, Qt.LeftButton)
106 | third_pos = tab.editor.getCursorPosition()
107 | self.assertEqual(tab.editor.selectedText(), self.replacetext)
108 | self.assertEqual(second_pos, third_pos)
109 |
110 | def test_replace_all_text(self):
111 | """
112 | Test using the Replace All button to cycle through all found elements and replace them.
113 | :return:
114 | """
115 | srcpath = os.path.join(self.data_dir, 'lorem.txt')
116 | self.form.open_filepath(srcpath)
117 | tab = self.form.documents_tabWidget.currentWidget()
118 | self.form.ui.findPane.show()
119 | self.form.ui.find_text_lineEdit.setText(self.findtext)
120 | self.form.ui.replace_text_lineEdit.setText(self.replacetext)
121 | QTest.mouseClick(self.form.ui.replace_all_Button, Qt.LeftButton)
122 | self.assertEqual(tab.editor.selectedText(), self.replacetext)
123 | # Try to find again (no text should be selected)
124 | QTest.mouseClick(self.form.ui.find_next_Button, Qt.LeftButton)
125 | self.assertEqual(tab.editor.selectedText(), '')
126 |
--------------------------------------------------------------------------------
/fiddle/views/ManageInterpretersDialog.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Form implementation generated from reading ui file 'ManageInterpretersDialog.ui'
4 | #
5 | # Created by: PyQt4 UI code generator 4.11.4
6 | #
7 | # WARNING! All changes made in this file will be lost!
8 |
9 | from PyQt4 import QtCore, QtGui
10 |
11 | try:
12 | _fromUtf8 = QtCore.QString.fromUtf8
13 | except AttributeError:
14 | def _fromUtf8(s):
15 | return s
16 |
17 | try:
18 | _encoding = QtGui.QApplication.UnicodeUTF8
19 | def _translate(context, text, disambig):
20 | return QtGui.QApplication.translate(context, text, disambig, _encoding)
21 | except AttributeError:
22 | def _translate(context, text, disambig):
23 | return QtGui.QApplication.translate(context, text, disambig)
24 |
25 | class Ui_manageInterpreters_Dialog(object):
26 | def setupUi(self, manageInterpreters_Dialog):
27 | manageInterpreters_Dialog.setObjectName(_fromUtf8("manageInterpreters_Dialog"))
28 | manageInterpreters_Dialog.setWindowModality(QtCore.Qt.ApplicationModal)
29 | manageInterpreters_Dialog.resize(400, 300)
30 | self.verticalLayout = QtGui.QVBoxLayout(manageInterpreters_Dialog)
31 | self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
32 | self.defaulInterpreter_layout = QtGui.QHBoxLayout()
33 | self.defaulInterpreter_layout.setObjectName(_fromUtf8("defaulInterpreter_layout"))
34 | self.defaulInterpreter_label = QtGui.QLabel(manageInterpreters_Dialog)
35 | self.defaulInterpreter_label.setMinimumSize(QtCore.QSize(18, 18))
36 | self.defaulInterpreter_label.setMaximumSize(QtCore.QSize(18, 18))
37 | self.defaulInterpreter_label.setText(_fromUtf8(""))
38 | self.defaulInterpreter_label.setPixmap(QtGui.QPixmap(_fromUtf8(":/icons/icons/python_twosnakes.png")))
39 | self.defaulInterpreter_label.setScaledContents(True)
40 | self.defaulInterpreter_label.setObjectName(_fromUtf8("defaulInterpreter_label"))
41 | self.defaulInterpreter_layout.addWidget(self.defaulInterpreter_label)
42 | self.defaultInterpreterPath_label = QtGui.QLabel(manageInterpreters_Dialog)
43 | self.defaultInterpreterPath_label.setObjectName(_fromUtf8("defaultInterpreterPath_label"))
44 | self.defaulInterpreter_layout.addWidget(self.defaultInterpreterPath_label)
45 | spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
46 | self.defaulInterpreter_layout.addItem(spacerItem)
47 | self.verticalLayout.addLayout(self.defaulInterpreter_layout)
48 | self.horizontalLayout = QtGui.QHBoxLayout()
49 | self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
50 | self.label = QtGui.QLabel(manageInterpreters_Dialog)
51 | self.label.setObjectName(_fromUtf8("label"))
52 | self.horizontalLayout.addWidget(self.label)
53 | spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
54 | self.horizontalLayout.addItem(spacerItem1)
55 | self.addInterpreter_Button = QtGui.QToolButton(manageInterpreters_Dialog)
56 | icon = QtGui.QIcon()
57 | icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/icons/add.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
58 | self.addInterpreter_Button.setIcon(icon)
59 | self.addInterpreter_Button.setAutoRaise(True)
60 | self.addInterpreter_Button.setObjectName(_fromUtf8("addInterpreter_Button"))
61 | self.horizontalLayout.addWidget(self.addInterpreter_Button)
62 | self.removeInterpreter_Button = QtGui.QToolButton(manageInterpreters_Dialog)
63 | icon1 = QtGui.QIcon()
64 | icon1.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/icons/delete.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
65 | self.removeInterpreter_Button.setIcon(icon1)
66 | self.removeInterpreter_Button.setAutoRaise(True)
67 | self.removeInterpreter_Button.setObjectName(_fromUtf8("removeInterpreter_Button"))
68 | self.horizontalLayout.addWidget(self.removeInterpreter_Button)
69 | self.verticalLayout.addLayout(self.horizontalLayout)
70 | self.pyInterpreters_List = QtGui.QListWidget(manageInterpreters_Dialog)
71 | self.pyInterpreters_List.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
72 | self.pyInterpreters_List.setProperty("showDropIndicator", False)
73 | self.pyInterpreters_List.setDragDropMode(QtGui.QAbstractItemView.InternalMove)
74 | self.pyInterpreters_List.setDefaultDropAction(QtCore.Qt.MoveAction)
75 | self.pyInterpreters_List.setAlternatingRowColors(True)
76 | self.pyInterpreters_List.setObjectName(_fromUtf8("pyInterpreters_List"))
77 | self.verticalLayout.addWidget(self.pyInterpreters_List)
78 | self.buttonBox = QtGui.QDialogButtonBox(manageInterpreters_Dialog)
79 | self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
80 | self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Save)
81 | self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
82 | self.verticalLayout.addWidget(self.buttonBox)
83 |
84 | self.retranslateUi(manageInterpreters_Dialog)
85 | QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), manageInterpreters_Dialog.accept)
86 | QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), manageInterpreters_Dialog.reject)
87 | QtCore.QObject.connect(self.addInterpreter_Button, QtCore.SIGNAL(_fromUtf8("clicked()")), manageInterpreters_Dialog.add_interpreter)
88 | QtCore.QObject.connect(self.removeInterpreter_Button, QtCore.SIGNAL(_fromUtf8("clicked()")), manageInterpreters_Dialog.remove_interpreter)
89 | QtCore.QMetaObject.connectSlotsByName(manageInterpreters_Dialog)
90 |
91 | def retranslateUi(self, manageInterpreters_Dialog):
92 | manageInterpreters_Dialog.setWindowTitle(_translate("manageInterpreters_Dialog", "Manage Interpreters", None))
93 | self.defaultInterpreterPath_label.setText(_translate("manageInterpreters_Dialog", "/", None))
94 | self.label.setText(_translate("manageInterpreters_Dialog", "User Interpreters", None))
95 | self.addInterpreter_Button.setText(_translate("manageInterpreters_Dialog", "Add Interpreter", None))
96 | self.removeInterpreter_Button.setText(_translate("manageInterpreters_Dialog", "Remove Interpreter", None))
97 | self.pyInterpreters_List.setSortingEnabled(False)
98 |
99 | from . import resources_rc
100 |
--------------------------------------------------------------------------------
/fiddle/helpers/builtins.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2015 Aaron Kehrer
2 | # Licensed under the terms of the MIT License
3 | # (see fiddle/__init__.py for details)
4 |
5 | py3_builtins = ['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException', 'BlockingIOError',
6 | 'BrokenPipeError', 'BufferError', 'BytesWarning', 'ChildProcessError', 'ConnectionAbortedError',
7 | 'ConnectionError', 'ConnectionRefusedError', 'ConnectionResetError', 'DeprecationWarning', 'EOFError',
8 | 'Ellipsis', 'EnvironmentError', 'Exception', 'False', 'FileExistsError', 'FileNotFoundError',
9 | 'FloatingPointError', 'FutureWarning', 'GeneratorExit', 'IOError', 'ImportError', 'ImportWarning',
10 | 'IndentationError', 'IndexError', 'InterruptedError', 'IsADirectoryError', 'KeyError',
11 | 'KeyboardInterrupt', 'LookupError', 'MemoryError', 'NameError', 'None', 'NotADirectoryError',
12 | 'NotImplemented', 'NotImplementedError', 'OSError', 'OverflowError', 'PendingDeprecationWarning',
13 | 'PermissionError', 'ProcessLookupError', 'ReferenceError', 'ResourceWarning', 'RuntimeError',
14 | 'RuntimeWarning', 'StopIteration', 'SyntaxError', 'SyntaxWarning', 'SystemError', 'SystemExit',
15 | 'TabError', 'TimeoutError', 'True', 'TypeError', 'UnboundLocalError', 'UnicodeDecodeError',
16 | 'UnicodeEncodeError', 'UnicodeError', 'UnicodeTranslateError', 'UnicodeWarning', 'UserWarning',
17 | 'ValueError', 'Warning', 'WindowsError', 'ZeroDivisionError', '_', '__build_class__', '__debug__',
18 | '__doc__', '__import__', '__loader__', '__name__', '__package__', '__spec__', 'abs', 'all', 'any',
19 | 'ascii', 'bin', 'bool', 'bytearray', 'bytes', 'callable', 'chr', 'classmethod', 'compile', 'complex',
20 | 'copyright', 'credits', 'delattr', 'dict', 'dir', 'divmod', 'enumerate', 'eval', 'exec', 'execfile',
21 | 'exit', 'filter', 'float', 'format', 'frozenset', 'getattr', 'globals', 'hasattr', 'hash', 'help',
22 | 'hex', 'id', 'input', 'int', 'isinstance', 'issubclass', 'iter', 'len', 'license', 'list', 'locals',
23 | 'map', 'max', 'memoryview', 'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'print', 'property',
24 | 'quit', 'range', 'repr', 'reversed', 'round', 'runfile', 'set', 'setattr', 'slice', 'sorted',
25 | 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'vars', 'zip']
26 |
27 | py3_exceptions = ['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException', 'BlockingIOError',
28 | 'BrokenPipeError', 'BufferError', 'BytesWarning', 'ChildProcessError', 'ConnectionAbortedError',
29 | 'ConnectionError', 'ConnectionRefusedError', 'ConnectionResetError', 'DeprecationWarning', 'EOFError',
30 | 'Ellipsis', 'EnvironmentError', 'Exception', 'False', 'FileExistsError', 'FileNotFoundError',
31 | 'FloatingPointError', 'FutureWarning', 'GeneratorExit', 'IOError', 'ImportError', 'ImportWarning',
32 | 'IndentationError', 'IndexError', 'InterruptedError', 'IsADirectoryError', 'KeyError',
33 | 'KeyboardInterrupt', 'LookupError', 'MemoryError', 'NameError', 'None', 'NotADirectoryError',
34 | 'NotImplemented', 'NotImplementedError', 'OSError', 'OverflowError', 'PendingDeprecationWarning',
35 | 'PermissionError', 'ProcessLookupError', 'ReferenceError', 'ResourceWarning', 'RuntimeError',
36 | 'RuntimeWarning', 'StopIteration', 'SyntaxError', 'SyntaxWarning', 'SystemError', 'SystemExit',
37 | 'TabError', 'TimeoutError', 'True', 'TypeError', 'UnboundLocalError', 'UnicodeDecodeError',
38 | 'UnicodeEncodeError', 'UnicodeError', 'UnicodeTranslateError', 'UnicodeWarning', 'UserWarning',
39 | 'ValueError', 'Warning', 'WindowsError', 'ZeroDivisionError']
40 |
41 | py2_builtins = ['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException', 'BufferError', 'BytesWarning',
42 | 'DeprecationWarning', 'EOFError', 'Ellipsis', 'EnvironmentError', 'Exception', 'False',
43 | 'FloatingPointError', 'FutureWarning', 'GeneratorExit', 'IOError', 'ImportError', 'ImportWarning',
44 | 'IndentationError', 'IndexError', 'KeyError', 'KeyboardInterrupt', 'LookupError', 'MemoryError',
45 | 'NameError', 'None', 'NotImplemented', 'NotImplementedError', 'OSError', 'OverflowError',
46 | 'PendingDeprecationWarning', 'ReferenceError', 'RuntimeError', 'RuntimeWarning', 'StandardError',
47 | 'StopIteration', 'SyntaxError', 'SyntaxWarning', 'SystemError', 'SystemExit', 'TabError', 'True',
48 | 'TypeError', 'UnboundLocalError', 'UnicodeDecodeError', 'UnicodeEncodeError', 'UnicodeError',
49 | 'UnicodeTranslateError', 'UnicodeWarning', 'UserWarning', 'ValueError', 'Warning', 'WindowsError',
50 | 'ZeroDivisionError', '__debug__', '__doc__', '__import__', '__name__', '__package__', 'abs', 'all',
51 | 'any', 'apply', 'basestring', 'bin', 'bool', 'buffer', 'bytearray', 'bytes', 'callable', 'chr',
52 | 'classmethod', 'cmp', 'coerce', 'compile', 'complex', 'copyright', 'credits', 'delattr', 'dict', 'dir',
53 | 'divmod', 'enumerate', 'eval', 'execfile', 'exit', 'file', 'filter', 'float', 'format', 'frozenset',
54 | 'getattr', 'globals', 'hasattr', 'hash', 'help', 'hex', 'id', 'input', 'int', 'intern', 'isinstance',
55 | 'issubclass', 'iter', 'len', 'license', 'list', 'locals', 'long', 'map', 'max', 'memoryview', 'min',
56 | 'next', 'object', 'oct', 'open', 'ord', 'pow', 'print', 'property', 'quit', 'range', 'raw_input',
57 | 'reduce', 'reload', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice', 'sorted', 'staticmethod',
58 | 'str', 'sum', 'super', 'tuple', 'type', 'unichr', 'unicode', 'vars', 'xrange', 'zip']
59 |
60 | py2_exceptions = ['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException', 'BufferError', 'BytesWarning',
61 | 'DeprecationWarning', 'EOFError', 'EnvironmentError', 'Exception', 'FloatingPointError',
62 | 'FutureWarning', 'GeneratorExit', 'IOError', 'ImportError', 'ImportWarning', 'IndentationError',
63 | 'IndexError', 'KeyError', 'KeyboardInterrupt', 'LookupError', 'MemoryError', 'NameError',
64 | 'NotImplementedError', 'OSError', 'OverflowError', 'PendingDeprecationWarning', 'ReferenceError',
65 | 'RuntimeError', 'RuntimeWarning', 'StandardError', 'StopIteration', 'SyntaxError', 'SyntaxWarning',
66 | 'SystemError', 'SystemExit', 'TabError', 'TypeError', 'UnboundLocalError', 'UnicodeDecodeError',
67 | 'UnicodeEncodeError', 'UnicodeError', 'UnicodeTranslateError', 'UnicodeWarning', 'UserWarning',
68 | 'ValueError', 'Warning', 'WindowsError', 'ZeroDivisionError']
69 |
--------------------------------------------------------------------------------
/fiddle/views/ManageInterpretersDialog.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | manageInterpreters_Dialog
4 |
5 |
6 | Qt::ApplicationModal
7 |
8 |
9 |
10 | 0
11 | 0
12 | 400
13 | 300
14 |
15 |
16 |
17 | Manage Interpreters
18 |
19 |
20 | -
21 |
22 |
-
23 |
24 |
25 |
26 | 18
27 | 18
28 |
29 |
30 |
31 |
32 | 18
33 | 18
34 |
35 |
36 |
37 |
38 |
39 |
40 | :/icons/icons/python_twosnakes.png
41 |
42 |
43 | true
44 |
45 |
46 |
47 | -
48 |
49 |
50 | /
51 |
52 |
53 |
54 | -
55 |
56 |
57 | Qt::Horizontal
58 |
59 |
60 |
61 | 40
62 | 20
63 |
64 |
65 |
66 |
67 |
68 |
69 | -
70 |
71 |
-
72 |
73 |
74 | User Interpreters
75 |
76 |
77 |
78 | -
79 |
80 |
81 | Qt::Horizontal
82 |
83 |
84 |
85 | 40
86 | 20
87 |
88 |
89 |
90 |
91 | -
92 |
93 |
94 | Add Interpreter
95 |
96 |
97 |
98 | :/icons/icons/add.png:/icons/icons/add.png
99 |
100 |
101 | true
102 |
103 |
104 |
105 | -
106 |
107 |
108 | Remove Interpreter
109 |
110 |
111 |
112 | :/icons/icons/delete.png:/icons/icons/delete.png
113 |
114 |
115 | true
116 |
117 |
118 |
119 |
120 |
121 | -
122 |
123 |
124 | QAbstractItemView::NoEditTriggers
125 |
126 |
127 | false
128 |
129 |
130 | QAbstractItemView::InternalMove
131 |
132 |
133 | Qt::MoveAction
134 |
135 |
136 | true
137 |
138 |
139 | false
140 |
141 |
142 |
143 | -
144 |
145 |
146 | Qt::Horizontal
147 |
148 |
149 | QDialogButtonBox::Cancel|QDialogButtonBox::Save
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 | buttonBox
161 | accepted()
162 | manageInterpreters_Dialog
163 | accept()
164 |
165 |
166 | 229
167 | 275
168 |
169 |
170 | 157
171 | 274
172 |
173 |
174 |
175 |
176 | buttonBox
177 | rejected()
178 | manageInterpreters_Dialog
179 | reject()
180 |
181 |
182 | 297
183 | 281
184 |
185 |
186 | 286
187 | 274
188 |
189 |
190 |
191 |
192 | addInterpreter_Button
193 | clicked()
194 | manageInterpreters_Dialog
195 | add_interpreter()
196 |
197 |
198 | 346
199 | 58
200 |
201 |
202 | 456
203 | 68
204 |
205 |
206 |
207 |
208 | removeInterpreter_Button
209 | clicked()
210 | manageInterpreters_Dialog
211 | remove_interpreter()
212 |
213 |
214 | 378
215 | 57
216 |
217 |
218 | 442
219 | 53
220 |
221 |
222 |
223 |
224 |
225 | add_interpreter()
226 | remove_interpreter()
227 | update_interpreters(QListWidgetItem*)
228 |
229 |
230 |
--------------------------------------------------------------------------------
/tests/test_fiddle_consoles.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2015 Aaron Kehrer
2 | # Licensed under the terms of the MIT License
3 | # (see fiddle/__init__.py for details)
4 |
5 | import os
6 | import unittest
7 | from string import ascii_letters, digits, punctuation
8 |
9 | from PyQt4.QtTest import QTest
10 | from PyQt4.QtCore import Qt
11 |
12 | from tests import FiddleTestFixture
13 | from tests.helpers import *
14 |
15 |
16 | class FiddleConsolesTest(FiddleTestFixture):
17 | def test_no_console_restart(self):
18 | """
19 | Can the program handle trying to restart the Python console interpreter when one doesn't exist?
20 | :return:
21 | """
22 | old_int = self.form.current_interpreter
23 | old_int_dir = self.form.current_interpreter_dir
24 | self.form.current_interpreter = ''
25 | self.form.current_interpreter_dir = ''
26 | self.form.restart_pyconsole_process()
27 | self.assertEqual('', self.form.pyconsole_output.toPlainText())
28 | self.form.current_interpreter = old_int
29 | self.form.current_interpreter_dir = old_int_dir
30 |
31 | def test_no_help_restart(self):
32 | """
33 | Can the program handle trying to restart the help interpreter when one doesn't exist?
34 | :return:
35 | """
36 | old_int = self.form.current_interpreter
37 | old_int_dir = self.form.current_interpreter_dir
38 | self.form.current_interpreter = ''
39 | self.form.current_interpreter_dir = ''
40 | self.form.restart_pyconsole_help()
41 | self.assertEqual('', self.form.ui.helpBrowser.page().mainFrame().toPlainText())
42 | self.form.current_interpreter = old_int
43 | self.form.current_interpreter_dir = old_int_dir
44 |
45 | def test_pyconsole_insert_ascii(self):
46 | """
47 | Can ASCII text be sent to the Python console from the input widget?
48 | :return:
49 | """
50 | self.form.pyconsole_output.clear()
51 | console_pre_txt = self.form.pyconsole_output.toPlainText()
52 | test_str = ascii_letters + digits + punctuation
53 | QTest.keyClicks(self.form.pyconsole_output, "i = '{0}'".format(test_str))
54 | QTest.keyClick(self.form.pyconsole_output, Qt.Key_Return)
55 |
56 | console_post_txt = self.form.pyconsole_output.toPlainText()
57 | self.assertNotEqual(console_pre_txt, console_post_txt)
58 | self.assertTrue(test_str in console_post_txt)
59 |
60 | def test_pyconsole_history(self):
61 | """
62 | Is there a history of commands send to the Python console that can be cycled through?
63 | :return:
64 | """
65 | test_strs = [ascii_letters, digits, punctuation]
66 | # Load the history
67 | for ts in test_strs:
68 | QTest.keyClicks(self.form.pyconsole_output, "i = '{0}'".format(ts), delay=50)
69 | QTest.keyClick(self.form.pyconsole_output, Qt.Key_Return, delay=200)
70 |
71 | def test_console_NameError_link(self):
72 | """
73 | Does causing a NameError on the Python console result in a help//: link
74 | :return:
75 | """
76 | self.form.pyconsole_output.clear()
77 | console_pre_txt = self.form.pyconsole_output.toPlainText()
78 | QTest.keyClick(self.form.pyconsole_output, Qt.Key_I, delay=100)
79 | QTest.keyClick(self.form.pyconsole_output, Qt.Key_Return, delay=200)
80 | console_post_txt = self.form.pyconsole_output.toPlainText()
81 | console_post_html = self.form.pyconsole_output.toHtml()
82 | self.assertNotEqual(console_pre_txt, console_post_txt)
83 | self.assertTrue('href="help://?object=NameError' in console_post_html)
84 |
85 | def test_runscript_command_default_interpreter(self):
86 | """
87 | Does the run script command contain the current interpreter and tab script path?
88 | :return:
89 | """
90 | tab = self.form.documents_tabWidget.currentWidget()
91 | cmd = self.form.ui.runScript_command.text()
92 | self.assertIn(self.form.current_interpreter, cmd)
93 | self.assertIn(tab.filepath, cmd)
94 |
95 | def test_runscript_command_openfile(self):
96 | """
97 | Does opening a new .py file change the run script command?
98 | :return:
99 | """
100 | tab1 = self.form.documents_tabWidget.currentWidget()
101 | cmd1 = self.form.ui.runScript_command.text()
102 | self.assertIn(tab1.filepath, cmd1)
103 | # Load file
104 | srcpath = os.path.join(self.data_dir, 'server.py')
105 | self.form.open_filepath(srcpath)
106 | tab2 = self.form.documents_tabWidget.currentWidget()
107 | cmd2 = self.form.ui.runScript_command.text()
108 | self.assertIn(tab2.filepath, cmd2)
109 | self.assertNotEqual(cmd1, cmd2)
110 |
111 | def test_runscript_command_change_tab(self):
112 | """
113 | Does changing the tab change the run script command?
114 | :return:
115 | """
116 | tab1 = self.form.documents_tabWidget.currentWidget()
117 | cmd1 = self.form.ui.runScript_command.text()
118 | self.assertIn(tab1.filepath, cmd1)
119 | # Load file
120 | srcpath = os.path.join(self.data_dir, 'server.py')
121 | self.form.open_filepath(srcpath)
122 | tab2 = self.form.documents_tabWidget.currentWidget()
123 | cmd2 = self.form.ui.runScript_command.text()
124 | self.assertIn(tab2.filepath, cmd2)
125 | # Change tab
126 | self.form.documents_tabWidget.setCurrentWidget(tab1)
127 | cmd3 = self.form.ui.runScript_command.text()
128 | self.assertIn(tab1.filepath, cmd3)
129 | self.assertNotEqual(cmd1, cmd2)
130 | self.assertEqual(cmd1, cmd3)
131 |
132 | def test_halt_python_console(self):
133 | """
134 | Can the Python console be cleanly halted?
135 | :return:
136 | """
137 | self.form.terminate_pyconsole_process()
138 | self.assertEqual(self.form.pyconsole_process.state(), 0)
139 |
140 | def test_halt_help(self):
141 | """
142 | Can the Python help be cleanly halted?
143 | :return:
144 | """
145 | self.form.terminate_pyconsole_help()
146 | self.assertEqual(self.form.help_process.state(), 0)
147 |
148 | def test_halt_running_script(self):
149 | """
150 | Can a long running script be cleanly halted?
151 | :return:
152 | """
153 | srcpath = os.path.join(self.data_dir, 'run_forever.py')
154 | self.form.open_filepath(srcpath)
155 | cmd = self.form.ui.runScript_command.text()
156 | self.assertIn('run_forever.py', cmd)
157 | self.form.ui.actionRun_Current_Script.trigger()
158 | self.assertGreater(self.form.runscript_process.state(), 0)
159 | QTest.qWait(200)
160 | self.form.terminate_current_script()
161 | self.assertEqual(self.form.runscript_process.state(), 0)
162 |
163 |
164 | if __name__ == "__main__":
165 | unittest.main()
--------------------------------------------------------------------------------
/tests/data/utf8_test.txt:
--------------------------------------------------------------------------------
1 | Original by Markus Kuhn, adapted for HTML by Martin Dürst.
2 |
3 | UTF-8 encoded sample plain-text file
4 | ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
5 |
6 | Markus Kuhn [ˈmaʳkʊs kuːn] — 1999-08-20
7 |
8 |
9 | The ASCII compatible UTF-8 encoding of ISO 10646 and Unicode
10 | plain-text files is defined in RFC 2279 and in ISO 10646-1 Annex R.
11 |
12 |
13 | Using Unicode/UTF-8, you can write in emails and source code things such as
14 |
15 | Mathematics and Sciences:
16 |
17 | ∮ E⋅da = Q, n → ∞, ∑ f(i) = ∏ g(i), ∀x∈ℝ: ⌈x⌉ = −⌊−x⌋, α ∧ ¬β = ¬(¬α ∨ β),
18 |
19 | ℕ ⊆ ℕ₀ ⊂ ℤ ⊂ ℚ ⊂ ℝ ⊂ ℂ, ⊥ < a ≠ b ≡ c ≤ d ≪ ⊤ ⇒ (A ⇔ B),
20 |
21 | 2H₂ + O₂ ⇌ 2H₂O, R = 4.7 kΩ, ⌀ 200 mm
22 |
23 | Linguistics and dictionaries:
24 |
25 | ði ıntəˈnæʃənəl fəˈnɛtık əsoʊsiˈeıʃn
26 | Y [ˈʏpsilɔn], Yen [jɛn], Yoga [ˈjoːgɑ]
27 |
28 | APL:
29 |
30 | ((V⍳V)=⍳⍴V)/V←,V ⌷←⍳→⍴∆∇⊃‾⍎⍕⌈
31 |
32 | Nicer typography in plain text files:
33 |
34 | ╔══════════════════════════════════════════╗
35 | ║ ║
36 | ║ • ‘single’ and “double” quotes ║
37 | ║ ║
38 | ║ • Curly apostrophes: “We’ve been here” ║
39 | ║ ║
40 | ║ • Latin-1 apostrophe and accents: '´` ║
41 | ║ ║
42 | ║ • ‚deutsche‘ „Anführungszeichen“ ║
43 | ║ ║
44 | ║ • †, ‡, ‰, •, 3–4, —, −5/+5, ™, … ║
45 | ║ ║
46 | ║ • ASCII safety test: 1lI|, 0OD, 8B ║
47 | ║ ╭─────────╮ ║
48 | ║ • the euro symbol: │ 14.95 € │ ║
49 | ║ ╰─────────╯ ║
50 | ╚══════════════════════════════════════════╝
51 |
52 | Greek (in Polytonic):
53 |
54 | The Greek anthem:
55 |
56 | Σὲ γνωρίζω ἀπὸ τὴν κόψη
57 | τοῦ σπαθιοῦ τὴν τρομερή,
58 | σὲ γνωρίζω ἀπὸ τὴν ὄψη
59 | ποὺ μὲ βία μετράει τὴ γῆ.
60 |
61 | ᾿Απ᾿ τὰ κόκκαλα βγαλμένη
62 | τῶν ῾Ελλήνων τὰ ἱερά
63 | καὶ σὰν πρῶτα ἀνδρειωμένη
64 | χαῖρε, ὦ χαῖρε, ᾿Ελευθεριά!
65 |
66 | From a speech of Demosthenes in the 4th century BC:
67 |
68 | Οὐχὶ ταὐτὰ παρίσταταί μοι γιγνώσκειν, ὦ ἄνδρες ᾿Αθηναῖοι,
69 | ὅταν τ᾿ εἰς τὰ πράγματα ἀποβλέψω καὶ ὅταν πρὸς τοὺς
70 | λόγους οὓς ἀκούω· τοὺς μὲν γὰρ λόγους περὶ τοῦ
71 | τιμωρήσασθαι Φίλιππον ὁρῶ γιγνομένους, τὰ δὲ πράγματ᾿
72 | εἰς τοῦτο προήκοντα, ὥσθ᾿ ὅπως μὴ πεισόμεθ᾿ αὐτοὶ
73 | πρότερον κακῶς σκέψασθαι δέον. οὐδέν οὖν ἄλλο μοι δοκοῦσιν
74 | οἱ τὰ τοιαῦτα λέγοντες ἢ τὴν ὑπόθεσιν, περὶ ἧς βουλεύεσθαι,
75 | οὐχὶ τὴν οὖσαν παριστάντες ὑμῖν ἁμαρτάνειν. ἐγὼ δέ, ὅτι μέν
76 | ποτ᾿ ἐξῆν τῇ πόλει καὶ τὰ αὑτῆς ἔχειν ἀσφαλῶς καὶ Φίλιππον
77 | τιμωρήσασθαι, καὶ μάλ᾿ ἀκριβῶς οἶδα· ἐπ᾿ ἐμοῦ γάρ, οὐ πάλαι
78 | γέγονεν ταῦτ᾿ ἀμφότερα· νῦν μέντοι πέπεισμαι τοῦθ᾿ ἱκανὸν
79 | προλαβεῖν ἡμῖν εἶναι τὴν πρώτην, ὅπως τοὺς συμμάχους
80 | σώσομεν. ἐὰν γὰρ τοῦτο βεβαίως ὑπάρξῃ, τότε καὶ περὶ τοῦ
81 | τίνα τιμωρήσεταί τις καὶ ὃν τρόπον ἐξέσται σκοπεῖν· πρὶν δὲ
82 | τὴν ἀρχὴν ὀρθῶς ὑποθέσθαι, μάταιον ἡγοῦμαι περὶ τῆς
83 | τελευτῆς ὁντινοῦν ποιεῖσθαι λόγον.
84 |
85 | Δημοσθένους, Γ´ ᾿Ολυνθιακὸς
86 |
87 | Georgian:
88 |
89 | From a Unicode conference invitation:
90 |
91 | გთხოვთ ახლავე გაიაროთ რეგისტრაცია Unicode-ის მეათე საერთაშორისო
92 | კონფერენციაზე დასასწრებად, რომელიც გაიმართება 10-12 მარტს,
93 | ქ. მაინცში, გერმანიაში. კონფერენცია შეჰკრებს ერთად მსოფლიოს
94 | ექსპერტებს ისეთ დარგებში როგორიცაა ინტერნეტი და Unicode-ი,
95 | ინტერნაციონალიზაცია და ლოკალიზაცია, Unicode-ის გამოყენება
96 | ოპერაციულ სისტემებსა, და გამოყენებით პროგრამებში, შრიფტებში,
97 | ტექსტების დამუშავებასა და მრავალენოვან კომპიუტერულ სისტემებში.
98 |
99 | Russian:
100 |
101 | From a Unicode conference invitation:
102 |
103 | Зарегистрируйтесь сейчас на Десятую Международную Конференцию по
104 | Unicode, которая состоится 10-12 марта 1997 года в Майнце в Германии.
105 | Конференция соберет широкий круг экспертов по вопросам глобального
106 | Интернета и Unicode, локализации и интернационализации, воплощению и
107 | применению Unicode в различных операционных системах и программных
108 | приложениях, шрифтах, верстке и многоязычных компьютерных системах.
109 |
110 | Thai (UCS Level 2):
111 |
112 | Excerpt from a poetry on The Romance of The Three Kingdoms (a Chinese
113 | classic 'San Gua'):
114 |
115 | [----------------------------|------------------------]
116 | ๏ แผ่นดินฮั่นเสื่อมโทรมแสนสังเวช พระปกเกศกองบู๊กู้ขึ้นใหม่
117 | สิบสองกษัตริย์ก่อนหน้าแลถัดไป สององค์ไซร้โง่เขลาเบาปัญญา
118 | ทรงนับถือขันทีเป็นที่พึ่ง บ้านเมืองจึงวิปริตเป็นนักหนา
119 | โฮจิ๋นเรียกทัพทั่วหัวเมืองมา หมายจะฆ่ามดชั่วตัวสำคัญ
120 | เหมือนขับไสไล่เสือจากเคหา รับหมาป่าเข้ามาเลยอาสัญ
121 | ฝ่ายอ้องอุ้นยุแยกให้แตกกัน ใช้สาวนั้นเป็นชนวนชื่นชวนใจ
122 | พลันลิฉุยกุยกีกลับก่อเหตุ ช่างอาเพศจริงหนาฟ้าร้องไห้
123 | ต้องรบราฆ่าฟันจนบรรลัย ฤๅหาใครค้ำชูกู้บรรลังก์ ฯ
124 |
125 | (The above is a two-column text. If combining characters are handled
126 | correctly, the lines of the second column should be aligned with the
127 | | character above.)
128 |
129 | Ethiopian:
130 |
131 | Proverbs in the Amharic language:
132 |
133 | ሰማይ አይታረስ ንጉሥ አይከሰስ።
134 | ብላ ካለኝ እንደአባቴ በቆመጠኝ።
135 | ጌጥ ያለቤቱ ቁምጥና ነው።
136 | ደሀ በሕልሙ ቅቤ ባይጠጣ ንጣት በገደለው።
137 | የአፍ ወለምታ በቅቤ አይታሽም።
138 | አይጥ በበላ ዳዋ ተመታ።
139 | ሲተረጉሙ ይደረግሙ።
140 | ቀስ በቀስ፥ ዕንቁላል በእግሩ ይሄዳል።
141 | ድር ቢያብር አንበሳ ያስር።
142 | ሰው እንደቤቱ እንጅ እንደ ጉረቤቱ አይተዳደርም።
143 | እግዜር የከፈተውን ጉሮሮ ሳይዘጋው አይድርም።
144 | የጎረቤት ሌባ፥ ቢያዩት ይስቅ ባያዩት ያጠልቅ።
145 | ሥራ ከመፍታት ልጄን ላፋታት።
146 | ዓባይ ማደሪያ የለው፥ ግንድ ይዞ ይዞራል።
147 | የእስላም አገሩ መካ የአሞራ አገሩ ዋርካ።
148 | ተንጋሎ ቢተፉ ተመልሶ ባፉ።
149 | ወዳጅህ ማር ቢሆን ጨርስህ አትላሰው።
150 | እግርህን በፍራሽህ ልክ ዘርጋ።
151 |
152 | Runes:
153 |
154 | ᚻᛖ ᚳᚹᚫᚦ ᚦᚫᛏ ᚻᛖ ᛒᚢᛞᛖ ᚩᚾ ᚦᚫᛗ ᛚᚪᚾᛞᛖ ᚾᚩᚱᚦᚹᛖᚪᚱᛞᚢᛗ ᚹᛁᚦ ᚦᚪ ᚹᛖᛥᚫ
155 |
156 | (Old English, which transcribed into Latin reads 'He cwaeth that he
157 | bude thaem lande northweardum with tha Westsae.' and means 'He said
158 | that he lived in the northern land near the Western Sea.')
159 |
160 | Braille:
161 |
162 | ⡌⠁⠧⠑ ⠼⠁⠒ ⡍⠜⠇⠑⠹⠰⠎ ⡣⠕⠌
163 |
164 | ⡍⠜⠇⠑⠹ ⠺⠁⠎ ⠙⠑⠁⠙⠒ ⠞⠕ ⠃⠑⠛⠔ ⠺⠊⠹⠲ ⡹⠻⠑ ⠊⠎ ⠝⠕ ⠙⠳⠃⠞
165 | ⠱⠁⠞⠑⠧⠻ ⠁⠃⠳⠞ ⠹⠁⠞⠲ ⡹⠑ ⠗⠑⠛⠊⠌⠻ ⠕⠋ ⠙⠊⠎ ⠃⠥⠗⠊⠁⠇ ⠺⠁⠎
166 | ⠎⠊⠛⠝⠫ ⠃⠹ ⠹⠑ ⠊⠇⠻⠛⠹⠍⠁⠝⠂ ⠹⠑ ⠊⠇⠻⠅⠂ ⠹⠑ ⠥⠝⠙⠻⠞⠁⠅⠻⠂
167 | ⠁⠝⠙ ⠹⠑ ⠡⠊⠑⠋ ⠍⠳⠗⠝⠻⠲ ⡎⠊⠗⠕⠕⠛⠑ ⠎⠊⠛⠝⠫ ⠊⠞⠲ ⡁⠝⠙
168 | ⡎⠊⠗⠕⠕⠛⠑⠰⠎ ⠝⠁⠍⠑ ⠺⠁⠎ ⠛⠕⠕⠙ ⠥⠏⠕⠝ ⠰⡡⠁⠝⠛⠑⠂ ⠋⠕⠗ ⠁⠝⠹⠹⠔⠛ ⠙⠑
169 | ⠡⠕⠎⠑ ⠞⠕ ⠏⠥⠞ ⠙⠊⠎ ⠙⠁⠝⠙ ⠞⠕⠲
170 |
171 | ⡕⠇⠙ ⡍⠜⠇⠑⠹ ⠺⠁⠎ ⠁⠎ ⠙⠑⠁⠙ ⠁⠎ ⠁ ⠙⠕⠕⠗⠤⠝⠁⠊⠇⠲
172 |
173 | ⡍⠔⠙⠖ ⡊ ⠙⠕⠝⠰⠞ ⠍⠑⠁⠝ ⠞⠕ ⠎⠁⠹ ⠹⠁⠞ ⡊ ⠅⠝⠪⠂ ⠕⠋ ⠍⠹
174 | ⠪⠝ ⠅⠝⠪⠇⠫⠛⠑⠂ ⠱⠁⠞ ⠹⠻⠑ ⠊⠎ ⠏⠜⠞⠊⠊⠥⠇⠜⠇⠹ ⠙⠑⠁⠙ ⠁⠃⠳⠞
175 | ⠁ ⠙⠕⠕⠗⠤⠝⠁⠊⠇⠲ ⡊ ⠍⠊⠣⠞ ⠙⠁⠧⠑ ⠃⠑⠲ ⠔⠊⠇⠔⠫⠂ ⠍⠹⠎⠑⠇⠋⠂ ⠞⠕
176 | ⠗⠑⠛⠜⠙ ⠁ ⠊⠕⠋⠋⠔⠤⠝⠁⠊⠇ ⠁⠎ ⠹⠑ ⠙⠑⠁⠙⠑⠌ ⠏⠊⠑⠊⠑ ⠕⠋ ⠊⠗⠕⠝⠍⠕⠝⠛⠻⠹
177 | ⠔ ⠹⠑ ⠞⠗⠁⠙⠑⠲ ⡃⠥⠞ ⠹⠑ ⠺⠊⠎⠙⠕⠍ ⠕⠋ ⠳⠗ ⠁⠝⠊⠑⠌⠕⠗⠎
178 | ⠊⠎ ⠔ ⠹⠑ ⠎⠊⠍⠊⠇⠑⠆ ⠁⠝⠙ ⠍⠹ ⠥⠝⠙⠁⠇⠇⠪⠫ ⠙⠁⠝⠙⠎
179 | ⠩⠁⠇⠇ ⠝⠕⠞ ⠙⠊⠌⠥⠗⠃ ⠊⠞⠂ ⠕⠗ ⠹⠑ ⡊⠳⠝⠞⠗⠹⠰⠎ ⠙⠕⠝⠑ ⠋⠕⠗⠲ ⡹⠳
180 | ⠺⠊⠇⠇ ⠹⠻⠑⠋⠕⠗⠑ ⠏⠻⠍⠊⠞ ⠍⠑ ⠞⠕ ⠗⠑⠏⠑⠁⠞⠂ ⠑⠍⠏⠙⠁⠞⠊⠊⠁⠇⠇⠹⠂ ⠹⠁⠞
181 | ⡍⠜⠇⠑⠹ ⠺⠁⠎ ⠁⠎ ⠙⠑⠁⠙ ⠁⠎ ⠁ ⠙⠕⠕⠗⠤⠝⠁⠊⠇⠲
182 |
183 | (The first couple of paragraphs of "A Christmas Carol" by Dickens)
184 |
185 | Compact font selection example text:
186 |
187 | ABCDEFGHIJKLMNOPQRSTUVWXYZ /0123456789
188 | abcdefghijklmnopqrstuvwxyz £©µÀÆÖÞßéöÿ
189 | –—‘“”„†•…‰™œŠŸž€ ΑΒΓΔΩαβγδω АБВГДабвгд
190 | ∀∂∈ℝ∧∪≡∞ ↑↗↨↻⇣ ┐┼╔╘░►☺♀ fi�⑀₂ἠḂӥẄɐː⍎אԱა
191 |
192 | Greetings in various languages:
193 |
194 | Hello world, Καλημέρα κόσμε, コンニチハ
195 |
196 | Box drawing alignment tests: █
197 | ▉
198 | ╔══╦══╗ ┌──┬──┐ ╭──┬──╮ ╭──┬──╮ ┏━━┳━━┓ ┎┒┏┑ ╷ ╻ ┏┯┓ ┌┰┐ ▊ ╱╲╱╲╳╳╳
199 | ║┌─╨─┐║ │╔═╧═╗│ │╒═╪═╕│ │╓─╁─╖│ ┃┌─╂─┐┃ ┗╃╄┙ ╶┼╴╺╋╸┠┼┨ ┝╋┥ ▋ ╲╱╲╱╳╳╳
200 | ║│╲ ╱│║ │║ ║│ ││ │ ││ │║ ┃ ║│ ┃│ ╿ │┃ ┍╅╆┓ ╵ ╹ ┗┷┛ └┸┘ ▌ ╱╲╱╲╳╳╳
201 | ╠╡ ╳ ╞╣ ├╢ ╟┤ ├┼─┼─┼┤ ├╫─╂─╫┤ ┣┿╾┼╼┿┫ ┕┛┖┚ ┌┄┄┐ ╎ ┏┅┅┓ ┋ ▍ ╲╱╲╱╳╳╳
202 | ║│╱ ╲│║ │║ ║│ ││ │ ││ │║ ┃ ║│ ┃│ ╽ │┃ ░░▒▒▓▓██ ┊ ┆ ╎ ╏ ┇ ┋ ▎
203 | ║└─╥─┘║ │╚═╤═╝│ │╘═╪═╛│ │╙─╀─╜│ ┃└─╂─┘┃ ░░▒▒▓▓██ ┊ ┆ ╎ ╏ ┇ ┋ ▏
204 | ╚══╩══╝ └──┴──┘ ╰──┴──╯ ╰──┴──╯ ┗━━┻━━┛ └╌╌┘ ╎ ┗╍╍┛ ┋ ▁▂▃▄▅▆▇█
205 |
--------------------------------------------------------------------------------
/tests/data/win1252_test.txt:
--------------------------------------------------------------------------------
1 | Original by Markus Kuhn, adapted for HTML by Martin D?rst.
2 |
3 | Windows-1252 encoded sample plain-text file
4 | ????????????????????????????????????
5 |
6 | Markus Kuhn ['ma?k?s ku?n] ? 1999-08-20
7 |
8 |
9 | The ASCII compatible UTF-8 encoding of ISO 10646 and Unicode
10 | plain-text files is defined in RFC 2279 and in ISO 10646-1 Annex R.
11 |
12 |
13 | Using Unicode/UTF-8, you can write in emails and source code things such as
14 |
15 | Mathematics and Sciences:
16 |
17 | ? E?da = Q, n ? 8, ? f(i) = ? g(i), ?x?R: ?x? = -?-x?, a ? ?? = ?(?a ? ?),
18 |
19 | N ? N0 ? Z ? Q ? R ? C, ? < a ? b = c = d ? ? ? (A ? B),
20 |
21 | 2H2 + O2 ? 2H2O, R = 4.7 kO, ? 200 mm
22 |
23 | Linguistics and dictionaries:
24 |
25 | ?i int?'n???n?l f?'n?tik ?so?si'ei?n
26 | Y ['?psil?n], Yen [j?n], Yoga ['jo?g?]
27 |
28 | APL:
29 |
30 | ((V?V)=??V)/V?,V ????????????
31 |
32 | Nicer typography in plain text files:
33 |
34 | +------------------------------------------+
35 | ? ?
36 | ? ? ?single? and ?double? quotes ?
37 | ? ?
38 | ? ? Curly apostrophes: ?We?ve been here? ?
39 | ? ?
40 | ? ? Latin-1 apostrophe and accents: '?` ?
41 | ? ?
42 | ? ? ?deutsche? ?Anf?hrungszeichen? ?
43 | ? ?
44 | ? ? ?, ?, ?, ?, 3?4, ?, -5/+5, ?, ? ?
45 | ? ?
46 | ? ? ASCII safety test: 1lI|, 0OD, 8B ?
47 | ? ?---------? ?
48 | ? ? the euro symbol: ? 14.95 ? ? ?
49 | ? ?---------? ?
50 | +------------------------------------------+
51 |
52 | Greek (in Polytonic):
53 |
54 | The Greek anthem:
55 |
56 | S? ??????? ?p? t?? ????
57 | t?? spa???? t?? t???e??,
58 | s? ??????? ?p? t?? ???
59 | p?? ?? ??a ?et??e? t? ??.
60 |
61 | ??p? t? ????a?a ??a?????
62 | t?? ???????? t? ?e??
63 | ?a? s?? p??ta ??d?e??????
64 | ?a??e, ? ?a??e, ???e??e???!
65 |
66 | From a speech of Demosthenes in the 4th century BC:
67 |
68 | ???? ta?t? pa??stata? ??? ?????s?e??, ? ??d?e? ?????a???,
69 | ?ta? t? e?? t? p????ata ?p?????? ?a? ?ta? p??? t???
70 | ?????? ??? ?????? t??? ??? ??? ?????? pe?? t??
71 | t?????sas?a? F???pp?? ??? ???????????, t? d? p????at?
72 | e?? t??t? p??????ta, ?s?? ?p?? ?? pe?s??e?? a?t??
73 | p??te??? ?a??? s???as?a? d???. ??d?? ??? ???? ??? d????s??
74 | ?? t? t??a?ta ?????te? ? t?? ?p??es??, pe?? ?? ????e?es?a?,
75 | ???? t?? ??sa? pa??st??te? ???? ??a?t??e??. ??? d?, ?t? ???
76 | p?t? ???? t? p??e? ?a? t? a?t?? ??e?? ?sfa??? ?a? F???pp??
77 | t?????sas?a?, ?a? ???? ??????? ??da? ?p? ???? ???, ?? p??a?
78 | ?????e? ta?t? ??f?te?a? ??? ???t?? p?pe?s?a? t???? ??a???
79 | p???a?e?? ???? e??a? t?? p??t??, ?p?? t??? s????????
80 | s?s??e?. ??? ??? t??t? ?e?a??? ?p????, t?te ?a? pe?? t??
81 | t??a t?????seta? t?? ?a? ?? t??p?? ???sta? s??pe??? p??? d?
82 | t?? ????? ????? ?p???s?a?, ??ta??? ?????a? pe?? t??
83 | te?e?t?? ??t????? p??e?s?a? ?????.
84 |
85 | ????s??????, G? ???????a???
86 |
87 | Georgian:
88 |
89 | From a Unicode conference invitation:
90 |
91 | ?????? ?????? ??????? ??????????? Unicode-?? ????? ????????????
92 | ????????????? ???????????, ??????? ?????????? 10-12 ?????,
93 | ?. ???????, ??????????. ??????????? ???????? ????? ????????
94 | ?????????? ???? ???????? ????????? ????????? ?? Unicode-?,
95 | ??????????????????? ?? ???????????, Unicode-?? ??????????
96 | ????????? ??????????, ?? ??????????? ???????????, ?????????,
97 | ????????? ???????????? ?? ???????????? ??????????? ??????????.
98 |
99 | Russian:
100 |
101 | From a Unicode conference invitation:
102 |
103 | ????????????????? ?????? ?? ??????? ????????????? ??????????? ??
104 | Unicode, ??????? ????????? 10-12 ????? 1997 ???? ? ?????? ? ????????.
105 | ??????????? ??????? ??????? ???? ????????? ?? ???????? ???????????
106 | ????????? ? Unicode, ??????????? ? ???????????????????, ?????????? ?
107 | ?????????? Unicode ? ????????? ???????????? ???????? ? ???????????
108 | ???????????, ???????, ??????? ? ???????????? ???????????? ????????.
109 |
110 | Thai (UCS Level 2):
111 |
112 | Excerpt from a poetry on The Romance of The Three Kingdoms (a Chinese
113 | classic 'San Gua'):
114 |
115 | [----------------------------|------------------------]
116 | ? ?????????????????????????????? ?????????????????????????
117 | ????????????????????????????? ??????????????????????????
118 | ????????????????????????? ????????????????????????????
119 | ???????????????????????????? ???????????????????????
120 | ????????????????????????? ???????????????????????
121 | ?????????????????????????? ???????????????????????????
122 | ????????????????????????? ??????????????????????????
123 | ?????????????????????? ??????????????????????? ?
124 |
125 | (The above is a two-column text. If combining characters are handled
126 | correctly, the lines of the second column should be aligned with the
127 | | character above.)
128 |
129 | Ethiopian:
130 |
131 | Proverbs in the Amharic language:
132 |
133 | ??? ????? ??? ??????
134 | ?? ??? ?????? ??????
135 | ?? ???? ???? ???
136 | ?? ???? ?? ???? ??? ??????
137 | ??? ???? ??? ??????
138 | ??? ??? ?? ????
139 | ????? ??????
140 | ?? ???? ????? ???? ?????
141 | ?? ???? ???? ????
142 | ?? ????? ??? ??? ???? ????????
143 | ???? ?????? ??? ????? ??????
144 | ????? ??? ???? ??? ???? ?????
145 | ?? ????? ??? ?????
146 | ??? ???? ???? ??? ?? ?????
147 | ????? ??? ?? ???? ??? ????
148 | ???? ??? ???? ???
149 | ???? ?? ??? ???? ??????
150 | ????? ????? ?? ????
151 |
152 | Runes:
153 |
154 | ?? ???? ??? ?? ???? ?? ??? ????? ??????????? ??? ?? ????
155 |
156 | (Old English, which transcribed into Latin reads 'He cwaeth that he
157 | bude thaem lande northweardum with tha Westsae.' and means 'He said
158 | that he lived in the northern land near the Western Sea.')
159 |
160 | Braille:
161 |
162 | ???? ??? ??????? ???
163 |
164 | ????? ??? ????? ?? ???? ???? ??? ?? ?? ????
165 | ?????? ???? ???? ?? ?????? ?? ??? ?????? ???
166 | ????? ?? ?? ????????? ?? ????? ?? ?????????
167 | ??? ?? ???? ?????? ??????? ????? ??? ???
168 | ????????? ???? ??? ???? ???? ??????? ??? ?????? ??
169 | ???? ?? ??? ??? ???? ???
170 |
171 | ??? ????? ??? ?? ???? ?? ? ??????????
172 |
173 | ???? ? ????? ???? ?? ??? ??? ? ???? ?? ??
174 | ?? ???????? ??? ??? ?? ?????????? ???? ????
175 | ? ?????????? ? ???? ???? ??? ?????? ??????? ??
176 | ????? ? ?????????? ?? ?? ?????? ????? ?? ??????????
177 | ? ?? ?????? ??? ?? ?????? ?? ?? ????????
178 | ?? ? ?? ??????? ??? ?? ???????? ?????
179 | ???? ??? ?????? ??? ?? ?? ???????? ???? ???? ??
180 | ???? ??????? ????? ?? ?? ??????? ????????????? ???
181 | ????? ??? ?? ???? ?? ? ??????????
182 |
183 | (The first couple of paragraphs of "A Christmas Carol" by Dickens)
184 |
185 | Compact font selection example text:
186 |
187 | ABCDEFGHIJKLMNOPQRSTUVWXYZ /0123456789
188 | abcdefghijklmnopqrstuvwxyz ???????????
189 | ???????????????? ??G?Oa??d? ??????????
190 | ???R??=8 ????? ++++???? ???2??????????
191 |
192 | Greetings in various languages:
193 |
194 | Hello world, ?a?????a ??s?e, ?????
195 |
196 | Box drawing alignment tests: ?
197 | ?
198 | +-----+ +-----+ ?-----? ?-----? ??????? ???? ? ? ??? +?+ ? ???????
199 | ?+---+? ?+---+? ?+-+-+? ?+-?-+? ?+-?-+? ???? ?+?????+? ??? ? ???????
200 | ??? ??? ?? ?? ?? ? ?? ?? ? ?? ?? ? ?? ???? ? ? ??? +?+ ? ???????
201 | ?? ? ?? +? ?? ++-+-+? ++-?-+? ???+??? ???? +??+ ? ???? ? ? ???????
202 | ??? ??? ?? ?? ?? ? ?? ?? ? ?? ?? ? ?? ???????? ? ? ? ? ? ? ?
203 | ?+---+? ?+---+? ?+-+-+? ?+-?-+? ?+-?-+? ???????? ? ? ? ? ? ? ?
204 | +-----+ +-----+ ?-----? ?-----? ??????? +??+ ? ???? ? ???_????
205 |
--------------------------------------------------------------------------------
/fiddle/controllers/FiddleTabWidget.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2015 Aaron Kehrer
2 | # Licensed under the terms of the MIT License
3 | # (see fiddle/__init__.py for details)
4 |
5 | # Import standard library modules
6 | import os
7 |
8 | # Import additional modules
9 | import chardet
10 |
11 | from PyQt4 import QtCore, QtGui
12 |
13 | from fiddle.controllers.Editors import *
14 | from fiddle.config import FILE_TYPES, PLATFORM
15 |
16 | # An iterator to update as the user creates new files
17 | new_file_iter = 1
18 |
19 |
20 | class FiddleTabWidget(QtGui.QTabWidget):
21 | def __init__(self, parent=None):
22 | super(FiddleTabWidget, self).__init__(parent)
23 |
24 | self.parent = parent
25 |
26 | self.setAcceptDrops(True)
27 | self.setTabsClosable(True)
28 | self.setMovable(True)
29 | self.setElideMode(QtCore.Qt.ElideRight)
30 | self.setMinimumSize(QtCore.QSize(800, 300))
31 | self.setDocumentMode(False)
32 | self.setAutoFillBackground(False)
33 | self.setTabShape(QtGui.QTabWidget.Rounded)
34 | self.setCurrentIndex(-1)
35 |
36 | sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
37 | sizePolicy.setHorizontalStretch(5)
38 | sizePolicy.setVerticalStretch(3)
39 | sizePolicy.setHeightForWidth(self.sizePolicy().hasHeightForWidth())
40 | self.setSizePolicy(sizePolicy)
41 |
42 | def dragEnterEvent(self, e):
43 | """
44 | For drag-and-drop we need to accept drag enter events
45 | """
46 | e.accept()
47 |
48 | def dragMoveEvent(self, e):
49 | """
50 | For drag-and-drop we need to accept drag move events
51 | http://qt-project.org/forums/viewthread/3093
52 | """
53 | e.accept()
54 |
55 | def dropEvent(self, e):
56 | """
57 | Handle the drop
58 | http://qt-project.org/wiki/Drag_and_Drop_of_files
59 | """
60 | # dropped files are file:// urls
61 | if e.mimeData().hasUrls():
62 | self._insert_list_of_files(e.mimeData().urls())
63 |
64 | def _insert_list_of_files(self, file_list):
65 | for filepath in file_list:
66 | if filepath.isLocalFile():
67 | if 'win32' in PLATFORM:
68 | # mimedata path includes a leading slash that confuses copyfile on windows
69 | # http://stackoverflow.com/questions/2144748/is-it-safe-to-use-sys-platform-win32-check-on-64-bit-python
70 | fpath = filepath.path()[1:]
71 | else:
72 | # not windows
73 | fpath = filepath.path()
74 |
75 | self.parent.open_filepath(fpath)
76 |
77 |
78 | class FiddleTabFile(QtGui.QWidget):
79 | editor_changed = QtCore.pyqtSignal()
80 | cursor_changed = QtCore.pyqtSignal(int, int)
81 | find_wrapped = QtCore.pyqtSignal()
82 |
83 | def __init__(self, parent=None, filepath=None):
84 | super(FiddleTabFile, self).__init__(parent)
85 |
86 | self._filepath = None
87 | self._saved = True
88 |
89 | self.basepath = None
90 | self.filename = None
91 | self.extension = None
92 | self.encoding = 'utf-8' # Default to UTF-8 encoding
93 |
94 |
95 | # Set the layout and insert the editor
96 | self.editor = None
97 | self.setLayout(QtGui.QVBoxLayout())
98 | self.layout().setMargin(0)
99 | self.layout().setSpacing(0)
100 |
101 | # Find/Replace
102 | self.find_expr = ''
103 | self.find_forward = False
104 | self.found_first = False
105 | self.first_found = (0, 0) # line, col
106 |
107 | self.filepath = filepath
108 | self.watcher = None
109 |
110 | @property
111 | def filepath(self):
112 | return self._filepath
113 |
114 | @filepath.setter
115 | def filepath(self, path):
116 | global new_file_iter
117 | if path is not None:
118 | self._filepath = path
119 | self.basepath, self.filename = os.path.split(path)
120 | _, ext = os.path.splitext(path)
121 | self.extension = ext.lower()
122 |
123 | with open(path, 'rb') as fp:
124 | data = fp.read()
125 | enc = chardet.detect(data)['encoding']
126 | self.encoding = enc if enc is not None else 'utf-8'
127 |
128 | if '.htm' in self.extension:
129 | self.insert_editor(HTMLEditor(parent=self))
130 | elif self.extension == '.js':
131 | self.insert_editor(JavascriptEditor(parent=self))
132 | elif self.extension == '.css':
133 | self.insert_editor(CSSEditor(parent=self))
134 | elif self.extension == '.py':
135 | self.insert_editor(PythonEditor(parent=self))
136 | else:
137 | self.insert_editor(BaseEditor(parent=self))
138 |
139 | try:
140 | self.editor.setText(data.decode(self.encoding))
141 | except TypeError:
142 | self.editor.setText('')
143 | self._saved = True
144 | else:
145 | self.basepath = None
146 | self.filename = 'new_{}.py'.format(new_file_iter)
147 | self.extension = '.py'
148 | self._filepath = os.path.join(os.path.expanduser('~'), self.filename)
149 | self.insert_editor(PythonEditor(parent=self))
150 | new_file_iter += 1
151 | self._saved = False
152 |
153 | @property
154 | def saved(self):
155 | return self._saved
156 |
157 | @saved.setter
158 | def saved(self, state):
159 | self._saved = state
160 | self.editor_changed.emit()
161 |
162 | def insert_editor(self, editor):
163 | if self.editor is not None and self.layout().indexOf(self.editor) >= 0:
164 | self.layout().removeWidget(self.editor)
165 | self.editor.deleteLater()
166 | self.editor = None
167 | self.editor = editor
168 | self.editor.textChanged.connect(self._set_text_changed)
169 | self.editor.cursorPositionChanged.connect(self._cursor_position_changed)
170 | self.layout().addWidget(self.editor)
171 |
172 | def save(self):
173 | if self.basepath is None:
174 | self.save_as()
175 | else:
176 | self._write_file(self.filepath)
177 | self.saved = True
178 |
179 | def save_as(self):
180 | path = self.basepath or os.path.join(os.path.expanduser('~'), self.filename)
181 | filepath = QtGui.QFileDialog.getSaveFileName(None, None, path, ';;'.join(FILE_TYPES[1:]))
182 | if filepath is not '':
183 | self._write_file(filepath)
184 | self.filepath = filepath
185 | self.saved = True
186 |
187 | def find_text(self, expr, re, cs, wo, wrap,
188 | in_select=False, forward=True, line=-1, index=-1, show=True, posix=False):
189 | """
190 | Find the string expr and return true if expr was found, otherwise returns false.
191 | If expr is found it becomes the current selection. This is a convenience function around the find features
192 | built in to QsciScintilla.
193 |
194 | http://pyqt.sourceforge.net/Docs/QScintilla2/classQsciScintilla.html
195 |
196 | :param expr:
197 | :param re:
198 | :param cs:
199 | :param wo:
200 | :param wrap:
201 | :param in_select:
202 | :param forward:
203 | :param line:
204 | :param index:
205 | :param show:
206 | :param posix:
207 | :return:
208 | """
209 | # Check for new expression
210 | if expr != self.find_expr:
211 | self.find_expr = expr
212 | self.found_first = False
213 |
214 | # Check for change in direction
215 | if forward != self.find_forward:
216 | if self.editor.hasSelectedText():
217 | line, idx, _, _ = self.editor.getSelection()
218 | self.editor.setCursorPosition(line, idx)
219 | self.find_forward = forward
220 | self.found_first = False
221 |
222 | if self.found_first:
223 | f = self.editor.findNext()
224 | c = self.editor.getCursorPosition()
225 | if c[0] <= self.first_found[0] and forward:
226 | self.find_wrapped.emit()
227 | elif c[0] >= self.first_found[0] and not forward:
228 | self.find_wrapped.emit()
229 | return f
230 | elif in_select:
231 | res = self.editor.findFirstInSelection(expr, re, cs, wo, forward, show, posix)
232 | if res:
233 | self.found_first = True
234 | self.first_found = self.editor.getCursorPosition()
235 | return True
236 | else:
237 | self.found_first = False
238 | return False
239 | else:
240 | res = self.editor.findFirst(expr, re, cs, wo, wrap, forward, line, index, show, posix)
241 | if res:
242 | self.found_first = True
243 | self.first_found = self.editor.getCursorPosition()
244 | return True
245 | else:
246 | self.found_first = False
247 | return False
248 |
249 | def replace_text(self, old_expr, new_text, re, cs, wo, wrap,
250 | in_select=False, forward=True, line=-1, index=-1, show=True, posix=False):
251 | if self.found_first:
252 | # Replace the text and move to the next occurrence
253 | self.editor.replace(new_text)
254 | self.editor.findNext()
255 | else:
256 | # Find the first occurrence
257 | self.find_text(old_expr, re, cs, wo, wrap, in_select, forward, line, index, show, posix)
258 |
259 | def replace_all_text(self, old_expr, new_text, re, cs, wo, in_select=False):
260 | i = 0
261 | if in_select:
262 | if self.editor.findFirstInSelection(old_expr, re, cs, wo, False):
263 | self.editor.replace(new_text)
264 | i = 1
265 | while self.editor.findNext():
266 | self.editor.replace(new_text)
267 | i += 1
268 | else:
269 | # Start from the beginning of the document and work to the end
270 | if self.editor.findFirst(old_expr, re, cs, wo, False, True, 0, 0):
271 | self.editor.replace(new_text)
272 | i = 1
273 | while self.editor.findNext():
274 | self.editor.replace(new_text)
275 | i += 1
276 | return i
277 |
278 | def _write_file(self, filepath):
279 | with open(filepath, 'wb') as fp:
280 | fp.write(bytes(self.editor.text(), self.encoding))
281 |
282 | def _set_text_changed(self):
283 | self.editor.autoCompleteFromAll()
284 | self.saved = False
285 |
286 | def _cursor_position_changed(self, line, idx):
287 | self.cursor_changed.emit(line, idx)
288 |
--------------------------------------------------------------------------------
/fiddle/controllers/Editors.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2015 Aaron Kehrer
2 | # Licensed under the terms of the MIT License
3 | # (see fiddle/__init__.py for details)
4 | # -------------------------------------------------------------------------
5 | # Original QScintilla sample with PyQt from:
6 | # Eli Bendersky (eliben@gmail.com)
7 | # This code is in the public domain
8 | # http://eli.thegreenplace.net/2011/04/01/sample-using-qscintilla-with-pyqt
9 | # -------------------------------------------------------------------------
10 |
11 | import os
12 | import autopep8
13 |
14 | from PyQt4 import QtCore
15 | from PyQt4.QtGui import *
16 | from PyQt4.Qsci import QsciScintilla, QsciAPIs, QsciLexerPython, QsciLexerHTML, QsciLexerJavaScript, QsciLexerCSS
17 |
18 | from fiddle.helpers import linter
19 |
20 | from fiddle.config import EDITOR_CARET_LINE_COLOR, EDITOR_FONT, EDITOR_FONT_SIZE, \
21 | EDITOR_MARGIN_COLOR, EDITOR_EDGECOL_COLOR
22 |
23 |
24 | class BaseEditor(QsciScintilla):
25 | editor_changed = QtCore.pyqtSignal()
26 |
27 | lintErrorMarkerNum = 8
28 | lintWarnMarkerNum = 9
29 | colorErrorForeground = '#a94442'
30 | colorErrorBackground = '#f2dede'
31 | colorWarnForeground = '#8a6d3b'
32 | colorWarnBackground = EDITOR_CARET_LINE_COLOR
33 |
34 | def __init__(self, parent=None, line_num_margin=3, autocomplete_list=None):
35 | super(BaseEditor, self).__init__(parent)
36 |
37 | # Set the default font
38 | self.editor_font = QFont()
39 | self.editor_font.setFamily(EDITOR_FONT)
40 | self.editor_font.setFixedPitch(True)
41 | self.editor_font.setPointSize(EDITOR_FONT_SIZE)
42 | self.setFont(self.editor_font)
43 | self.setMarginsFont(self.editor_font)
44 |
45 | # Default to UTF-8 encoding
46 | self.setUtf8(True)
47 |
48 | # Margin is used for line numbers
49 | fontmetrics = QFontMetrics(self.editor_font)
50 | self.setMarginsFont(self.editor_font)
51 | margin_width = '0' * (line_num_margin + 1)
52 | self.setMarginWidth(0, fontmetrics.width(margin_width))
53 | self.setMarginLineNumbers(0, True)
54 | self.setMarginsBackgroundColor(QColor(EDITOR_MARGIN_COLOR))
55 | self.setMarginSensitivity(1, True)
56 |
57 | # Edge Mode shows a gray vertical bar at the column set
58 | self._edgecol = 0
59 | self.setEdgeColor(QColor(EDITOR_EDGECOL_COLOR))
60 |
61 | # Fold code
62 | self.setFolding(QsciScintilla.BoxedTreeFoldStyle)
63 |
64 | # Brace matching: enable for a brace immediately before or after the current position
65 | self.setBraceMatching(QsciScintilla.SloppyBraceMatch)
66 |
67 | # Current line visible with special background color
68 | self.setCaretLineVisible(True)
69 | self.setCaretLineBackgroundColor(QColor(EDITOR_CARET_LINE_COLOR))
70 |
71 | # Indentation
72 | self.setIndentationWidth(4)
73 | self.setBackspaceUnindents(True)
74 |
75 | # Use raw messages to Scintilla here
76 | # (all messages are documented here: http://www.scintilla.org/ScintillaDoc.html)
77 | # Ensure the width of the currently visible lines can be scrolled
78 | self.SendScintilla(QsciScintilla.SCI_SETSCROLLWIDTHTRACKING, 1)
79 | # Multiple cursor support
80 | self.SendScintilla(QsciScintilla.SCI_SETMULTIPLESELECTION, True)
81 | self.SendScintilla(QsciScintilla.SCI_SETMULTIPASTE, 1)
82 | self.SendScintilla(QsciScintilla.SCI_SETADDITIONALSELECTIONTYPING, True)
83 |
84 | # Lexer
85 | self.lexer = None
86 |
87 | # Autocomplete
88 | self.api = None
89 |
90 | # Linter
91 | self.linter = None # Linter program to run, should be in the system's path
92 | self.lint_data = {}
93 |
94 | # Linter output markers
95 | self.marginClicked.connect(self.margin_clicked)
96 | self.lint_err_marker = self.markerDefine('!', self.lintErrorMarkerNum)
97 | self.setMarkerForegroundColor(QColor(self.colorErrorForeground), self.lint_err_marker)
98 | self.setMarkerBackgroundColor(QColor(self.colorErrorBackground), self.lint_err_marker)
99 | self.lint_warn_marker = self.markerDefine('?', self.lintWarnMarkerNum)
100 | self.setMarkerForegroundColor(QColor(self.colorWarnForeground), self.lint_warn_marker)
101 | self.setMarkerBackgroundColor(QColor(self.colorWarnBackground), self.lint_warn_marker)
102 |
103 | # Margin popup
104 | self._margin_popup = QWidget(self)
105 | self._margin_popup.setObjectName('Margin popup for %s' % self.__class__.__name__)
106 | self._margin_popup_lbl = QLabel(self._margin_popup)
107 | self._init_margin_popup()
108 | self._margin_popup_timer = QtCore.QTimer()
109 | self._margin_popup_timer.setSingleShot(True)
110 | self._margin_popup_timer.setInterval(2000)
111 | self._margin_popup_timer.timeout.connect(self._hide_margin_popup)
112 |
113 | def __repr__(self):
114 | return "<%s instance at %s>" % (self.__class__.__name__, id(self))
115 |
116 | def __del__(self):
117 | if self._margin_popup_timer.isActive():
118 | self._margin_popup_timer.stop()
119 |
120 | @property
121 | def encoding(self):
122 | if self.isUtf8():
123 | return 'utf-8'
124 | else:
125 | return 'Latin1'
126 |
127 | @property
128 | def wordwrap(self):
129 | if self.wrapMode() == QsciScintilla.WrapWhitespace:
130 | return True
131 | else:
132 | return False
133 |
134 | @wordwrap.setter
135 | def wordwrap(self, state):
136 | if state:
137 | self.setWrapMode(QsciScintilla.WrapWhitespace)
138 | self.setWrapVisualFlags(QsciScintilla.WrapFlagByBorder)
139 | else:
140 | self.setWrapMode(QsciScintilla.WrapNone)
141 | self.setWrapVisualFlags(QsciScintilla.WrapFlagNone)
142 |
143 | @property
144 | def whitespace(self):
145 | if self.whitespaceVisibility() == QsciScintilla.WsVisible:
146 | return True
147 | else:
148 | return False
149 |
150 | @whitespace.setter
151 | def whitespace(self, state):
152 | if state:
153 | self.setWhitespaceVisibility(QsciScintilla.WsVisible)
154 | else:
155 | self.setWhitespaceVisibility(QsciScintilla.WsInvisible)
156 |
157 | @property
158 | def eolchars(self):
159 | return self.eolVisibility()
160 |
161 | @eolchars.setter
162 | def eolchars(self, state):
163 | self.setEolVisibility(state)
164 |
165 | @property
166 | def edgecol(self):
167 | return self._edgecol
168 |
169 | @edgecol.setter
170 | def edgecol(self, col):
171 | self._edgecol = col
172 | self.setEdgeColumn(col)
173 | if col > 0:
174 | self.setEdgeMode(QsciScintilla.EdgeLine)
175 | else:
176 | self.setEdgeMode(QsciScintilla.EdgeNone)
177 |
178 | def clean_code(self):
179 | """
180 | Runs a code cleaner to conform code to a certain style a la PEP8
181 | :return:
182 | """
183 | pass
184 |
185 | def check_code(self, path):
186 | """
187 | Runs a code linter to catch mistakes. This is usually an external program like Pylint.
188 | :param str path:
189 | File path to lint
190 | :return:
191 | """
192 | pass
193 |
194 | def margin_clicked(self, marnum, linenum, modifiers):
195 | """
196 | Slot that catches margin clicks. The linter puts error and warning markers in the margin
197 | :param int marnum: marker number in the list of markers (starting at 1)
198 | :param int linenum: line number where marker was clicked
199 | :param QtCore.KeyboardModifiers modifiers: any keyboard modifiers (Ctrl, Shift, Alt)
200 | :return:
201 | """
202 | pass
203 |
204 | def _clear_all_margin_markers(self):
205 | self.markerDeleteAll(-1)
206 |
207 | def _add_error_margin_marker(self, line):
208 | self.markerAdd(line, self.lint_err_marker)
209 |
210 | def _add_warn_margin_marker(self, line):
211 | self.markerAdd(line, self.lint_warn_marker)
212 |
213 | def _init_margin_popup(self):
214 | self._margin_popup_lbl.setText('')
215 | layout = QVBoxLayout(self._margin_popup)
216 | layout.addWidget(self._margin_popup_lbl)
217 | self._margin_popup.setLayout(layout)
218 |
219 | self._margin_popup.setWindowFlags(QtCore.Qt.Popup)
220 | self._margin_popup.setFocusPolicy(QtCore.Qt.NoFocus)
221 | self._margin_popup.setFocusProxy(self)
222 |
223 | self._margin_popup.setWindowOpacity(0.95)
224 | self._margin_popup.setStyleSheet('background-color:%s' % self.colorWarnBackground)
225 |
226 | def _show_margin_popup(self, msg, bg_color=EDITOR_CARET_LINE_COLOR):
227 | self._margin_popup_lbl.setText(msg)
228 | self._margin_popup.setStyleSheet('background-color:%s' % bg_color)
229 | self._margin_popup.move(QCursor.pos())
230 | self._margin_popup.setFocus()
231 | self._margin_popup.show()
232 | self._margin_popup_timer.start()
233 |
234 | def _hide_margin_popup(self):
235 | self._margin_popup.hide()
236 |
237 |
238 | class PythonEditor(BaseEditor):
239 | def __init__(self, parent=None, line_num_margin=3, autocomplete_list=None):
240 | super(PythonEditor, self).__init__(parent, line_num_margin, autocomplete_list)
241 |
242 | # Set Python lexer
243 | self.lexer = QsciLexerPython(self)
244 | self.lexer.setDefaultFont(self.editor_font)
245 | self.lexer.setFont(self.editor_font, QsciLexerPython.Comment)
246 | # Indentation warning ("The indentation is inconsistent when compared to the previous line")
247 | self.lexer.setIndentationWarning(QsciLexerPython.Inconsistent)
248 | # Set auto-completion
249 | self.api = QsciAPIs(self.lexer)
250 | if autocomplete_list is not None:
251 | # Add additional completion strings
252 | for i in autocomplete_list:
253 | self.api.add(i)
254 | self.api.prepare()
255 | self.setAutoCompletionThreshold(3)
256 | self.setAutoCompletionSource(QsciScintilla.AcsAll)
257 | self.setAutoCompletionUseSingle(QsciScintilla.AcusExplicit)
258 | self.setLexer(self.lexer)
259 |
260 | # PEP8 tabs
261 | self.setIndentationsUseTabs(False)
262 | self.setAutoIndent(True)
263 | self.setIndentationGuides(True)
264 |
265 | # PEP8 edge column line
266 | self.edgecol = 80
267 |
268 | # Linters
269 | self.linter = 'internal'
270 |
271 | def clean_code(self):
272 | self.setText(autopep8.fix_code(self.text(), options={'aggressive': 2}))
273 |
274 | def check_code(self, path):
275 | self._clear_all_margin_markers()
276 | self.lint_data = {}
277 | try:
278 | warnings = linter.check(self.text(), os.path.basename(path))
279 | for w in warnings:
280 | w.type = 'warning'
281 | key = w.lineno - 1
282 | if key in self.lint_data.keys():
283 | self.lint_data[key].append(w)
284 | else:
285 | self.lint_data[key] = [w]
286 | self._add_warn_margin_marker(w.lineno - 1)
287 | except linter.LinterSyntaxError as e:
288 | e.type = 'error'
289 | self.lint_data[e.lineno - 1] = e
290 | self._add_error_margin_marker(e.lineno - 1)
291 | except linter.LinterUnexpectedError as e:
292 | print(e)
293 |
294 | def margin_clicked(self, marnum, linenum, modifiers):
295 | if self._margin_popup.isVisible():
296 | self._hide_margin_popup()
297 | else:
298 | try:
299 | warnings = self.lint_data[linenum]
300 | desc = ''
301 | if isinstance(warnings, linter.LinterError):
302 | desc = warnings.message
303 | self._show_margin_popup(desc.strip(), bg_color=self.colorErrorBackground)
304 | else:
305 | for warning in warnings:
306 | desc += warning.message % warning.message_args + '\n'
307 | self._show_margin_popup(desc.strip(), bg_color=self.colorWarnBackground)
308 | except KeyError:
309 | pass
310 | return True
311 |
312 |
313 | class HTMLEditor(BaseEditor):
314 | def __init__(self, parent=None, line_num_margin=3, autocomplete_list=None):
315 | super(HTMLEditor, self).__init__(parent, line_num_margin, autocomplete_list)
316 |
317 | # Set HTML lexer
318 | self.lexer = QsciLexerHTML(self)
319 | self.lexer.setDefaultFont(self.editor_font)
320 | self.lexer.setFont(self.editor_font, QsciLexerHTML.Default) # Text between tags
321 | self.lexer.setFont(self.editor_font, QsciLexerHTML.JavaScriptWord) # Text between script tags
322 | # Set auto-completion
323 | self.api = QsciAPIs(self.lexer)
324 | if autocomplete_list is not None:
325 | # Add additional completion strings
326 | for i in autocomplete_list:
327 | self.api.add(i)
328 | self.api.prepare()
329 | self.setAutoCompletionThreshold(3)
330 | self.setAutoCompletionSource(QsciScintilla.AcsAPIs)
331 | self.setAutoCompletionUseSingle(QsciScintilla.AcusExplicit)
332 | self.setLexer(self.lexer)
333 |
334 |
335 | class JavascriptEditor(BaseEditor):
336 | def __init__(self, parent=None, line_num_margin=3, autocomplete_list=None):
337 | super(JavascriptEditor, self).__init__(parent, line_num_margin, autocomplete_list)
338 |
339 | # Set HTML lexer
340 | self.lexer = QsciLexerJavaScript(self)
341 | self.lexer.setDefaultFont(self.editor_font)
342 | # Set auto-completion
343 | self.api = QsciAPIs(self.lexer)
344 | if autocomplete_list is not None:
345 | # Add additional completion strings
346 | for i in autocomplete_list:
347 | self.api.add(i)
348 | self.api.prepare()
349 | self.setAutoCompletionThreshold(3)
350 | self.setAutoCompletionSource(QsciScintilla.AcsAPIs)
351 | self.setAutoCompletionUseSingle(QsciScintilla.AcusExplicit)
352 | self.setLexer(self.lexer)
353 |
354 |
355 | class CSSEditor(BaseEditor):
356 | def __init__(self, parent=None, line_num_margin=3, autocomplete_list=None):
357 | super(CSSEditor, self).__init__(parent, line_num_margin, autocomplete_list)
358 |
359 | # Set HTML lexer
360 | self.lexer = QsciLexerCSS(self)
361 | self.lexer.setDefaultFont(self.editor_font)
362 | # Set auto-completion
363 | self.api = QsciAPIs(self.lexer)
364 | if autocomplete_list is not None:
365 | # Add additional completion strings
366 | for i in autocomplete_list:
367 | self.api.add(i)
368 | self.api.prepare()
369 | self.setAutoCompletionThreshold(3)
370 | self.setAutoCompletionSource(QsciScintilla.AcsAPIs)
371 | self.setAutoCompletionUseSingle(QsciScintilla.AcusExplicit)
372 | self.setLexer(self.lexer)
373 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | fIDDLE
2 |
3 | Copyright (c) 2015 Aaron Kehrer
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining
6 | a copy of this software and associated documentation files (the
7 | "Software"), to deal in the Software without restriction, including
8 | without limitation the rights to use, copy, modify, merge, publish,
9 | distribute, sublicense, and/or sell copies of the Software, and to
10 | permit persons to whom the Software is furnished to do so, subject to
11 | the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be
14 | included in all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
20 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | SOFTWARE.
24 |
25 |
26 | ------------------------------------------------------------------------------------------------------------------------
27 |
28 | Silk icon set 1.3
29 |
30 | _________________________________________
31 | Mark James
32 | http://www.famfamfam.com/lab/icons/silk/
33 | _________________________________________
34 |
35 | This work is licensed under a
36 | Creative Commons Attribution 2.5 License.
37 | [ http://creativecommons.org/licenses/by/2.5/ ]
38 |
39 | This means you may use it for any purpose,
40 | and make any changes you like.
41 | All I ask is that you include a link back
42 | to this page in your credits.
43 |
44 | Are you using this icon set? Send me an email
45 | (including a link or picture if available) to
46 | mjames@gmail.com
47 |
48 | Any other questions about this icon set please
49 | contact mjames@gmail.com
50 |
51 |
52 | ------------------------------------------------------------------------------------------------------------------------
53 |
54 | autopep8
55 |
56 | Copyright (C) 2010-2011 Hideo Hattori
57 | Copyright (C) 2011-2013 Hideo Hattori, Steven Myint
58 | Copyright (C) 2013-2015 Hideo Hattori, Steven Myint, Bill Wendling
59 |
60 | Permission is hereby granted, free of charge, to any person obtaining
61 | a copy of this software and associated documentation files (the
62 | "Software"), to deal in the Software without restriction, including
63 | without limitation the rights to use, copy, modify, merge, publish,
64 | distribute, sublicense, and/or sell copies of the Software, and to
65 | permit persons to whom the Software is furnished to do so, subject to
66 | the following conditions:
67 |
68 | The above copyright notice and this permission notice shall be
69 | included in all copies or substantial portions of the Software.
70 |
71 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
72 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
73 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
74 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
75 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
76 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
77 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
78 | SOFTWARE.
79 |
80 |
81 | ------------------------------------------------------------------------------------------------------------------------
82 |
83 | Pyflakes
84 |
85 | Copyright 2005-2011 Divmod, Inc.
86 | Copyright 2013-2014 Florent Xicluna
87 |
88 | Permission is hereby granted, free of charge, to any person obtaining
89 | a copy of this software and associated documentation files (the
90 | "Software"), to deal in the Software without restriction, including
91 | without limitation the rights to use, copy, modify, merge, publish,
92 | distribute, sublicense, and/or sell copies of the Software, and to
93 | permit persons to whom the Software is furnished to do so, subject to
94 | the following conditions:
95 |
96 | The above copyright notice and this permission notice shall be
97 | included in all copies or substantial portions of the Software.
98 |
99 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
100 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
101 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
102 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
103 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
104 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
105 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
106 |
107 | ------------------------------------------------------------------------------------------------------------------------
108 |
109 |
110 | PyQt is Copyright (C) 2015 Riverbank Computing Limited
111 |
112 |
113 | You may use, distribute and copy PyQt under the terms of GNU General
114 | Public License version 3, which is displayed below.
115 |
116 | -------------------------------------------------------------------------
117 |
118 | GNU GENERAL PUBLIC LICENSE
119 | Version 3, 29 June 2007
120 |
121 | Copyright (C) 2007 Free Software Foundation, Inc.
122 | Everyone is permitted to copy and distribute verbatim copies
123 | of this license document, but changing it is not allowed.
124 |
125 | Preamble
126 |
127 | The GNU General Public License is a free, copyleft license for
128 | software and other kinds of works.
129 |
130 | The licenses for most software and other practical works are designed
131 | to take away your freedom to share and change the works. By contrast,
132 | the GNU General Public License is intended to guarantee your freedom to
133 | share and change all versions of a program--to make sure it remains free
134 | software for all its users. We, the Free Software Foundation, use the
135 | GNU General Public License for most of our software; it applies also to
136 | any other work released this way by its authors. You can apply it to
137 | your programs, too.
138 |
139 | When we speak of free software, we are referring to freedom, not
140 | price. Our General Public Licenses are designed to make sure that you
141 | have the freedom to distribute copies of free software (and charge for
142 | them if you wish), that you receive source code or can get it if you
143 | want it, that you can change the software or use pieces of it in new
144 | free programs, and that you know you can do these things.
145 |
146 | To protect your rights, we need to prevent others from denying you
147 | these rights or asking you to surrender the rights. Therefore, you have
148 | certain responsibilities if you distribute copies of the software, or if
149 | you modify it: responsibilities to respect the freedom of others.
150 |
151 | For example, if you distribute copies of such a program, whether
152 | gratis or for a fee, you must pass on to the recipients the same
153 | freedoms that you received. You must make sure that they, too, receive
154 | or can get the source code. And you must show them these terms so they
155 | know their rights.
156 |
157 | Developers that use the GNU GPL protect your rights with two steps:
158 | (1) assert copyright on the software, and (2) offer you this License
159 | giving you legal permission to copy, distribute and/or modify it.
160 |
161 | For the developers' and authors' protection, the GPL clearly explains
162 | that there is no warranty for this free software. For both users' and
163 | authors' sake, the GPL requires that modified versions be marked as
164 | changed, so that their problems will not be attributed erroneously to
165 | authors of previous versions.
166 |
167 | Some devices are designed to deny users access to install or run
168 | modified versions of the software inside them, although the manufacturer
169 | can do so. This is fundamentally incompatible with the aim of
170 | protecting users' freedom to change the software. The systematic
171 | pattern of such abuse occurs in the area of products for individuals to
172 | use, which is precisely where it is most unacceptable. Therefore, we
173 | have designed this version of the GPL to prohibit the practice for those
174 | products. If such problems arise substantially in other domains, we
175 | stand ready to extend this provision to those domains in future versions
176 | of the GPL, as needed to protect the freedom of users.
177 |
178 | Finally, every program is threatened constantly by software patents.
179 | States should not allow patents to restrict development and use of
180 | software on general-purpose computers, but in those that do, we wish to
181 | avoid the special danger that patents applied to a free program could
182 | make it effectively proprietary. To prevent this, the GPL assures that
183 | patents cannot be used to render the program non-free.
184 |
185 | The precise terms and conditions for copying, distribution and
186 | modification follow.
187 |
188 | TERMS AND CONDITIONS
189 |
190 | 0. Definitions.
191 |
192 | "This License" refers to version 3 of the GNU General Public License.
193 |
194 | "Copyright" also means copyright-like laws that apply to other kinds of
195 | works, such as semiconductor masks.
196 |
197 | "The Program" refers to any copyrightable work licensed under this
198 | License. Each licensee is addressed as "you". "Licensees" and
199 | "recipients" may be individuals or organizations.
200 |
201 | To "modify" a work means to copy from or adapt all or part of the work
202 | in a fashion requiring copyright permission, other than the making of an
203 | exact copy. The resulting work is called a "modified version" of the
204 | earlier work or a work "based on" the earlier work.
205 |
206 | A "covered work" means either the unmodified Program or a work based
207 | on the Program.
208 |
209 | To "propagate" a work means to do anything with it that, without
210 | permission, would make you directly or secondarily liable for
211 | infringement under applicable copyright law, except executing it on a
212 | computer or modifying a private copy. Propagation includes copying,
213 | distribution (with or without modification), making available to the
214 | public, and in some countries other activities as well.
215 |
216 | To "convey" a work means any kind of propagation that enables other
217 | parties to make or receive copies. Mere interaction with a user through
218 | a computer network, with no transfer of a copy, is not conveying.
219 |
220 | An interactive user interface displays "Appropriate Legal Notices"
221 | to the extent that it includes a convenient and prominently visible
222 | feature that (1) displays an appropriate copyright notice, and (2)
223 | tells the user that there is no warranty for the work (except to the
224 | extent that warranties are provided), that licensees may convey the
225 | work under this License, and how to view a copy of this License. If
226 | the interface presents a list of user commands or options, such as a
227 | menu, a prominent item in the list meets this criterion.
228 |
229 | 1. Source Code.
230 |
231 | The "source code" for a work means the preferred form of the work
232 | for making modifications to it. "Object code" means any non-source
233 | form of a work.
234 |
235 | A "Standard Interface" means an interface that either is an official
236 | standard defined by a recognized standards body, or, in the case of
237 | interfaces specified for a particular programming language, one that
238 | is widely used among developers working in that language.
239 |
240 | The "System Libraries" of an executable work include anything, other
241 | than the work as a whole, that (a) is included in the normal form of
242 | packaging a Major Component, but which is not part of that Major
243 | Component, and (b) serves only to enable use of the work with that
244 | Major Component, or to implement a Standard Interface for which an
245 | implementation is available to the public in source code form. A
246 | "Major Component", in this context, means a major essential component
247 | (kernel, window system, and so on) of the specific operating system
248 | (if any) on which the executable work runs, or a compiler used to
249 | produce the work, or an object code interpreter used to run it.
250 |
251 | The "Corresponding Source" for a work in object code form means all
252 | the source code needed to generate, install, and (for an executable
253 | work) run the object code and to modify the work, including scripts to
254 | control those activities. However, it does not include the work's
255 | System Libraries, or general-purpose tools or generally available free
256 | programs which are used unmodified in performing those activities but
257 | which are not part of the work. For example, Corresponding Source
258 | includes interface definition files associated with source files for
259 | the work, and the source code for shared libraries and dynamically
260 | linked subprograms that the work is specifically designed to require,
261 | such as by intimate data communication or control flow between those
262 | subprograms and other parts of the work.
263 |
264 | The Corresponding Source need not include anything that users
265 | can regenerate automatically from other parts of the Corresponding
266 | Source.
267 |
268 | The Corresponding Source for a work in source code form is that
269 | same work.
270 |
271 | 2. Basic Permissions.
272 |
273 | All rights granted under this License are granted for the term of
274 | copyright on the Program, and are irrevocable provided the stated
275 | conditions are met. This License explicitly affirms your unlimited
276 | permission to run the unmodified Program. The output from running a
277 | covered work is covered by this License only if the output, given its
278 | content, constitutes a covered work. This License acknowledges your
279 | rights of fair use or other equivalent, as provided by copyright law.
280 |
281 | You may make, run and propagate covered works that you do not
282 | convey, without conditions so long as your license otherwise remains
283 | in force. You may convey covered works to others for the sole purpose
284 | of having them make modifications exclusively for you, or provide you
285 | with facilities for running those works, provided that you comply with
286 | the terms of this License in conveying all material for which you do
287 | not control copyright. Those thus making or running the covered works
288 | for you must do so exclusively on your behalf, under your direction
289 | and control, on terms that prohibit them from making any copies of
290 | your copyrighted material outside their relationship with you.
291 |
292 | Conveying under any other circumstances is permitted solely under
293 | the conditions stated below. Sublicensing is not allowed; section 10
294 | makes it unnecessary.
295 |
296 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
297 |
298 | No covered work shall be deemed part of an effective technological
299 | measure under any applicable law fulfilling obligations under article
300 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
301 | similar laws prohibiting or restricting circumvention of such
302 | measures.
303 |
304 | When you convey a covered work, you waive any legal power to forbid
305 | circumvention of technological measures to the extent such circumvention
306 | is effected by exercising rights under this License with respect to
307 | the covered work, and you disclaim any intention to limit operation or
308 | modification of the work as a means of enforcing, against the work's
309 | users, your or third parties' legal rights to forbid circumvention of
310 | technological measures.
311 |
312 | 4. Conveying Verbatim Copies.
313 |
314 | You may convey verbatim copies of the Program's source code as you
315 | receive it, in any medium, provided that you conspicuously and
316 | appropriately publish on each copy an appropriate copyright notice;
317 | keep intact all notices stating that this License and any
318 | non-permissive terms added in accord with section 7 apply to the code;
319 | keep intact all notices of the absence of any warranty; and give all
320 | recipients a copy of this License along with the Program.
321 |
322 | You may charge any price or no price for each copy that you convey,
323 | and you may offer support or warranty protection for a fee.
324 |
325 | 5. Conveying Modified Source Versions.
326 |
327 | You may convey a work based on the Program, or the modifications to
328 | produce it from the Program, in the form of source code under the
329 | terms of section 4, provided that you also meet all of these conditions:
330 |
331 | a) The work must carry prominent notices stating that you modified
332 | it, and giving a relevant date.
333 |
334 | b) The work must carry prominent notices stating that it is
335 | released under this License and any conditions added under section
336 | 7. This requirement modifies the requirement in section 4 to
337 | "keep intact all notices".
338 |
339 | c) You must license the entire work, as a whole, under this
340 | License to anyone who comes into possession of a copy. This
341 | License will therefore apply, along with any applicable section 7
342 | additional terms, to the whole of the work, and all its parts,
343 | regardless of how they are packaged. This License gives no
344 | permission to license the work in any other way, but it does not
345 | invalidate such permission if you have separately received it.
346 |
347 | d) If the work has interactive user interfaces, each must display
348 | Appropriate Legal Notices; however, if the Program has interactive
349 | interfaces that do not display Appropriate Legal Notices, your
350 | work need not make them do so.
351 |
352 | A compilation of a covered work with other separate and independent
353 | works, which are not by their nature extensions of the covered work,
354 | and which are not combined with it such as to form a larger program,
355 | in or on a volume of a storage or distribution medium, is called an
356 | "aggregate" if the compilation and its resulting copyright are not
357 | used to limit the access or legal rights of the compilation's users
358 | beyond what the individual works permit. Inclusion of a covered work
359 | in an aggregate does not cause this License to apply to the other
360 | parts of the aggregate.
361 |
362 | 6. Conveying Non-Source Forms.
363 |
364 | You may convey a covered work in object code form under the terms
365 | of sections 4 and 5, provided that you also convey the
366 | machine-readable Corresponding Source under the terms of this License,
367 | in one of these ways:
368 |
369 | a) Convey the object code in, or embodied in, a physical product
370 | (including a physical distribution medium), accompanied by the
371 | Corresponding Source fixed on a durable physical medium
372 | customarily used for software interchange.
373 |
374 | b) Convey the object code in, or embodied in, a physical product
375 | (including a physical distribution medium), accompanied by a
376 | written offer, valid for at least three years and valid for as
377 | long as you offer spare parts or customer support for that product
378 | model, to give anyone who possesses the object code either (1) a
379 | copy of the Corresponding Source for all the software in the
380 | product that is covered by this License, on a durable physical
381 | medium customarily used for software interchange, for a price no
382 | more than your reasonable cost of physically performing this
383 | conveying of source, or (2) access to copy the
384 | Corresponding Source from a network server at no charge.
385 |
386 | c) Convey individual copies of the object code with a copy of the
387 | written offer to provide the Corresponding Source. This
388 | alternative is allowed only occasionally and noncommercially, and
389 | only if you received the object code with such an offer, in accord
390 | with subsection 6b.
391 |
392 | d) Convey the object code by offering access from a designated
393 | place (gratis or for a charge), and offer equivalent access to the
394 | Corresponding Source in the same way through the same place at no
395 | further charge. You need not require recipients to copy the
396 | Corresponding Source along with the object code. If the place to
397 | copy the object code is a network server, the Corresponding Source
398 | may be on a different server (operated by you or a third party)
399 | that supports equivalent copying facilities, provided you maintain
400 | clear directions next to the object code saying where to find the
401 | Corresponding Source. Regardless of what server hosts the
402 | Corresponding Source, you remain obligated to ensure that it is
403 | available for as long as needed to satisfy these requirements.
404 |
405 | e) Convey the object code using peer-to-peer transmission, provided
406 | you inform other peers where the object code and Corresponding
407 | Source of the work are being offered to the general public at no
408 | charge under subsection 6d.
409 |
410 | A separable portion of the object code, whose source code is excluded
411 | from the Corresponding Source as a System Library, need not be
412 | included in conveying the object code work.
413 |
414 | A "User Product" is either (1) a "consumer product", which means any
415 | tangible personal property which is normally used for personal, family,
416 | or household purposes, or (2) anything designed or sold for incorporation
417 | into a dwelling. In determining whether a product is a consumer product,
418 | doubtful cases shall be resolved in favor of coverage. For a particular
419 | product received by a particular user, "normally used" refers to a
420 | typical or common use of that class of product, regardless of the status
421 | of the particular user or of the way in which the particular user
422 | actually uses, or expects or is expected to use, the product. A product
423 | is a consumer product regardless of whether the product has substantial
424 | commercial, industrial or non-consumer uses, unless such uses represent
425 | the only significant mode of use of the product.
426 |
427 | "Installation Information" for a User Product means any methods,
428 | procedures, authorization keys, or other information required to install
429 | and execute modified versions of a covered work in that User Product from
430 | a modified version of its Corresponding Source. The information must
431 | suffice to ensure that the continued functioning of the modified object
432 | code is in no case prevented or interfered with solely because
433 | modification has been made.
434 |
435 | If you convey an object code work under this section in, or with, or
436 | specifically for use in, a User Product, and the conveying occurs as
437 | part of a transaction in which the right of possession and use of the
438 | User Product is transferred to the recipient in perpetuity or for a
439 | fixed term (regardless of how the transaction is characterized), the
440 | Corresponding Source conveyed under this section must be accompanied
441 | by the Installation Information. But this requirement does not apply
442 | if neither you nor any third party retains the ability to install
443 | modified object code on the User Product (for example, the work has
444 | been installed in ROM).
445 |
446 | The requirement to provide Installation Information does not include a
447 | requirement to continue to provide support service, warranty, or updates
448 | for a work that has been modified or installed by the recipient, or for
449 | the User Product in which it has been modified or installed. Access to a
450 | network may be denied when the modification itself materially and
451 | adversely affects the operation of the network or violates the rules and
452 | protocols for communication across the network.
453 |
454 | Corresponding Source conveyed, and Installation Information provided,
455 | in accord with this section must be in a format that is publicly
456 | documented (and with an implementation available to the public in
457 | source code form), and must require no special password or key for
458 | unpacking, reading or copying.
459 |
460 | 7. Additional Terms.
461 |
462 | "Additional permissions" are terms that supplement the terms of this
463 | License by making exceptions from one or more of its conditions.
464 | Additional permissions that are applicable to the entire Program shall
465 | be treated as though they were included in this License, to the extent
466 | that they are valid under applicable law. If additional permissions
467 | apply only to part of the Program, that part may be used separately
468 | under those permissions, but the entire Program remains governed by
469 | this License without regard to the additional permissions.
470 |
471 | When you convey a copy of a covered work, you may at your option
472 | remove any additional permissions from that copy, or from any part of
473 | it. (Additional permissions may be written to require their own
474 | removal in certain cases when you modify the work.) You may place
475 | additional permissions on material, added by you to a covered work,
476 | for which you have or can give appropriate copyright permission.
477 |
478 | Notwithstanding any other provision of this License, for material you
479 | add to a covered work, you may (if authorized by the copyright holders of
480 | that material) supplement the terms of this License with terms:
481 |
482 | a) Disclaiming warranty or limiting liability differently from the
483 | terms of sections 15 and 16 of this License; or
484 |
485 | b) Requiring preservation of specified reasonable legal notices or
486 | author attributions in that material or in the Appropriate Legal
487 | Notices displayed by works containing it; or
488 |
489 | c) Prohibiting misrepresentation of the origin of that material, or
490 | requiring that modified versions of such material be marked in
491 | reasonable ways as different from the original version; or
492 |
493 | d) Limiting the use for publicity purposes of names of licensors or
494 | authors of the material; or
495 |
496 | e) Declining to grant rights under trademark law for use of some
497 | trade names, trademarks, or service marks; or
498 |
499 | f) Requiring indemnification of licensors and authors of that
500 | material by anyone who conveys the material (or modified versions of
501 | it) with contractual assumptions of liability to the recipient, for
502 | any liability that these contractual assumptions directly impose on
503 | those licensors and authors.
504 |
505 | All other non-permissive additional terms are considered "further
506 | restrictions" within the meaning of section 10. If the Program as you
507 | received it, or any part of it, contains a notice stating that it is
508 | governed by this License along with a term that is a further
509 | restriction, you may remove that term. If a license document contains
510 | a further restriction but permits relicensing or conveying under this
511 | License, you may add to a covered work material governed by the terms
512 | of that license document, provided that the further restriction does
513 | not survive such relicensing or conveying.
514 |
515 | If you add terms to a covered work in accord with this section, you
516 | must place, in the relevant source files, a statement of the
517 | additional terms that apply to those files, or a notice indicating
518 | where to find the applicable terms.
519 |
520 | Additional terms, permissive or non-permissive, may be stated in the
521 | form of a separately written license, or stated as exceptions;
522 | the above requirements apply either way.
523 |
524 | 8. Termination.
525 |
526 | You may not propagate or modify a covered work except as expressly
527 | provided under this License. Any attempt otherwise to propagate or
528 | modify it is void, and will automatically terminate your rights under
529 | this License (including any patent licenses granted under the third
530 | paragraph of section 11).
531 |
532 | However, if you cease all violation of this License, then your
533 | license from a particular copyright holder is reinstated (a)
534 | provisionally, unless and until the copyright holder explicitly and
535 | finally terminates your license, and (b) permanently, if the copyright
536 | holder fails to notify you of the violation by some reasonable means
537 | prior to 60 days after the cessation.
538 |
539 | Moreover, your license from a particular copyright holder is
540 | reinstated permanently if the copyright holder notifies you of the
541 | violation by some reasonable means, this is the first time you have
542 | received notice of violation of this License (for any work) from that
543 | copyright holder, and you cure the violation prior to 30 days after
544 | your receipt of the notice.
545 |
546 | Termination of your rights under this section does not terminate the
547 | licenses of parties who have received copies or rights from you under
548 | this License. If your rights have been terminated and not permanently
549 | reinstated, you do not qualify to receive new licenses for the same
550 | material under section 10.
551 |
552 | 9. Acceptance Not Required for Having Copies.
553 |
554 | You are not required to accept this License in order to receive or
555 | run a copy of the Program. Ancillary propagation of a covered work
556 | occurring solely as a consequence of using peer-to-peer transmission
557 | to receive a copy likewise does not require acceptance. However,
558 | nothing other than this License grants you permission to propagate or
559 | modify any covered work. These actions infringe copyright if you do
560 | not accept this License. Therefore, by modifying or propagating a
561 | covered work, you indicate your acceptance of this License to do so.
562 |
563 | 10. Automatic Licensing of Downstream Recipients.
564 |
565 | Each time you convey a covered work, the recipient automatically
566 | receives a license from the original licensors, to run, modify and
567 | propagate that work, subject to this License. You are not responsible
568 | for enforcing compliance by third parties with this License.
569 |
570 | An "entity transaction" is a transaction transferring control of an
571 | organization, or substantially all assets of one, or subdividing an
572 | organization, or merging organizations. If propagation of a covered
573 | work results from an entity transaction, each party to that
574 | transaction who receives a copy of the work also receives whatever
575 | licenses to the work the party's predecessor in interest had or could
576 | give under the previous paragraph, plus a right to possession of the
577 | Corresponding Source of the work from the predecessor in interest, if
578 | the predecessor has it or can get it with reasonable efforts.
579 |
580 | You may not impose any further restrictions on the exercise of the
581 | rights granted or affirmed under this License. For example, you may
582 | not impose a license fee, royalty, or other charge for exercise of
583 | rights granted under this License, and you may not initiate litigation
584 | (including a cross-claim or counterclaim in a lawsuit) alleging that
585 | any patent claim is infringed by making, using, selling, offering for
586 | sale, or importing the Program or any portion of it.
587 |
588 | 11. Patents.
589 |
590 | A "contributor" is a copyright holder who authorizes use under this
591 | License of the Program or a work on which the Program is based. The
592 | work thus licensed is called the contributor's "contributor version".
593 |
594 | A contributor's "essential patent claims" are all patent claims
595 | owned or controlled by the contributor, whether already acquired or
596 | hereafter acquired, that would be infringed by some manner, permitted
597 | by this License, of making, using, or selling its contributor version,
598 | but do not include claims that would be infringed only as a
599 | consequence of further modification of the contributor version. For
600 | purposes of this definition, "control" includes the right to grant
601 | patent sublicenses in a manner consistent with the requirements of
602 | this License.
603 |
604 | Each contributor grants you a non-exclusive, worldwide, royalty-free
605 | patent license under the contributor's essential patent claims, to
606 | make, use, sell, offer for sale, import and otherwise run, modify and
607 | propagate the contents of its contributor version.
608 |
609 | In the following three paragraphs, a "patent license" is any express
610 | agreement or commitment, however denominated, not to enforce a patent
611 | (such as an express permission to practice a patent or covenant not to
612 | sue for patent infringement). To "grant" such a patent license to a
613 | party means to make such an agreement or commitment not to enforce a
614 | patent against the party.
615 |
616 | If you convey a covered work, knowingly relying on a patent license,
617 | and the Corresponding Source of the work is not available for anyone
618 | to copy, free of charge and under the terms of this License, through a
619 | publicly available network server or other readily accessible means,
620 | then you must either (1) cause the Corresponding Source to be so
621 | available, or (2) arrange to deprive yourself of the benefit of the
622 | patent license for this particular work, or (3) arrange, in a manner
623 | consistent with the requirements of this License, to extend the patent
624 | license to downstream recipients. "Knowingly relying" means you have
625 | actual knowledge that, but for the patent license, your conveying the
626 | covered work in a country, or your recipient's use of the covered work
627 | in a country, would infringe one or more identifiable patents in that
628 | country that you have reason to believe are valid.
629 |
630 | If, pursuant to or in connection with a single transaction or
631 | arrangement, you convey, or propagate by procuring conveyance of, a
632 | covered work, and grant a patent license to some of the parties
633 | receiving the covered work authorizing them to use, propagate, modify
634 | or convey a specific copy of the covered work, then the patent license
635 | you grant is automatically extended to all recipients of the covered
636 | work and works based on it.
637 |
638 | A patent license is "discriminatory" if it does not include within
639 | the scope of its coverage, prohibits the exercise of, or is
640 | conditioned on the non-exercise of one or more of the rights that are
641 | specifically granted under this License. You may not convey a covered
642 | work if you are a party to an arrangement with a third party that is
643 | in the business of distributing software, under which you make payment
644 | to the third party based on the extent of your activity of conveying
645 | the work, and under which the third party grants, to any of the
646 | parties who would receive the covered work from you, a discriminatory
647 | patent license (a) in connection with copies of the covered work
648 | conveyed by you (or copies made from those copies), or (b) primarily
649 | for and in connection with specific products or compilations that
650 | contain the covered work, unless you entered into that arrangement,
651 | or that patent license was granted, prior to 28 March 2007.
652 |
653 | Nothing in this License shall be construed as excluding or limiting
654 | any implied license or other defenses to infringement that may
655 | otherwise be available to you under applicable patent law.
656 |
657 | 12. No Surrender of Others' Freedom.
658 |
659 | If conditions are imposed on you (whether by court order, agreement or
660 | otherwise) that contradict the conditions of this License, they do not
661 | excuse you from the conditions of this License. If you cannot convey a
662 | covered work so as to satisfy simultaneously your obligations under this
663 | License and any other pertinent obligations, then as a consequence you may
664 | not convey it at all. For example, if you agree to terms that obligate you
665 | to collect a royalty for further conveying from those to whom you convey
666 | the Program, the only way you could satisfy both those terms and this
667 | License would be to refrain entirely from conveying the Program.
668 |
669 | 13. Use with the GNU Affero General Public License.
670 |
671 | Notwithstanding any other provision of this License, you have
672 | permission to link or combine any covered work with a work licensed
673 | under version 3 of the GNU Affero General Public License into a single
674 | combined work, and to convey the resulting work. The terms of this
675 | License will continue to apply to the part which is the covered work,
676 | but the special requirements of the GNU Affero General Public License,
677 | section 13, concerning interaction through a network will apply to the
678 | combination as such.
679 |
680 | 14. Revised Versions of this License.
681 |
682 | The Free Software Foundation may publish revised and/or new versions of
683 | the GNU General Public License from time to time. Such new versions will
684 | be similar in spirit to the present version, but may differ in detail to
685 | address new problems or concerns.
686 |
687 | Each version is given a distinguishing version number. If the
688 | Program specifies that a certain numbered version of the GNU General
689 | Public License "or any later version" applies to it, you have the
690 | option of following the terms and conditions either of that numbered
691 | version or of any later version published by the Free Software
692 | Foundation. If the Program does not specify a version number of the
693 | GNU General Public License, you may choose any version ever published
694 | by the Free Software Foundation.
695 |
696 | If the Program specifies that a proxy can decide which future
697 | versions of the GNU General Public License can be used, that proxy's
698 | public statement of acceptance of a version permanently authorizes you
699 | to choose that version for the Program.
700 |
701 | Later license versions may give you additional or different
702 | permissions. However, no additional obligations are imposed on any
703 | author or copyright holder as a result of your choosing to follow a
704 | later version.
705 |
706 | 15. Disclaimer of Warranty.
707 |
708 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
709 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
710 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
711 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
712 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
713 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
714 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
715 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
716 |
717 | 16. Limitation of Liability.
718 |
719 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
720 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
721 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
722 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
723 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
724 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
725 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
726 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
727 | SUCH DAMAGES.
728 |
729 | 17. Interpretation of Sections 15 and 16.
730 |
731 | If the disclaimer of warranty and limitation of liability provided
732 | above cannot be given local legal effect according to their terms,
733 | reviewing courts shall apply local law that most closely approximates
734 | an absolute waiver of all civil liability in connection with the
735 | Program, unless a warranty or assumption of liability accompanies a
736 | copy of the Program in return for a fee.
737 |
738 | END OF TERMS AND CONDITIONS
739 |
740 | How to Apply These Terms to Your New Programs
741 |
742 | If you develop a new program, and you want it to be of the greatest
743 | possible use to the public, the best way to achieve this is to make it
744 | free software which everyone can redistribute and change under these terms.
745 |
746 | To do so, attach the following notices to the program. It is safest
747 | to attach them to the start of each source file to most effectively
748 | state the exclusion of warranty; and each file should have at least
749 | the "copyright" line and a pointer to where the full notice is found.
750 |
751 |
752 | Copyright (C)
753 |
754 | This program is free software: you can redistribute it and/or modify
755 | it under the terms of the GNU General Public License as published by
756 | the Free Software Foundation, either version 3 of the License, or
757 | (at your option) any later version.
758 |
759 | This program is distributed in the hope that it will be useful,
760 | but WITHOUT ANY WARRANTY; without even the implied warranty of
761 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
762 | GNU General Public License for more details.
763 |
764 | You should have received a copy of the GNU General Public License
765 | along with this program. If not, see .
766 |
767 | Also add information on how to contact you by electronic and paper mail.
768 |
769 | If the program does terminal interaction, make it output a short
770 | notice like this when it starts in an interactive mode:
771 |
772 | Copyright (C)
773 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
774 | This is free software, and you are welcome to redistribute it
775 | under certain conditions; type `show c' for details.
776 |
777 | The hypothetical commands `show w' and `show c' should show the appropriate
778 | parts of the General Public License. Of course, your program's commands
779 | might be different; for a GUI interface, you would use an "about box".
780 |
781 | You should also get your employer (if you work as a programmer) or school,
782 | if any, to sign a "copyright disclaimer" for the program, if necessary.
783 | For more information on this, and how to apply and follow the GNU GPL, see
784 | .
785 |
786 | The GNU General Public License does not permit incorporating your program
787 | into proprietary programs. If your program is a subroutine library, you
788 | may consider it more useful to permit linking proprietary applications with
789 | the library. If this is what you want to do, use the GNU Lesser General
790 | Public License instead of this License. But first, please read
791 | .
792 |
793 | ------------------------------------------------------------------------------------------------------------------------
794 |
--------------------------------------------------------------------------------
/fiddle/views/MainWindow.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Form implementation generated from reading ui file 'MainWindow.ui'
4 | #
5 | # Created by: PyQt4 UI code generator 4.11.4
6 | #
7 | # WARNING! All changes made in this file will be lost!
8 |
9 | from PyQt4 import QtCore, QtGui
10 |
11 | try:
12 | _fromUtf8 = QtCore.QString.fromUtf8
13 | except AttributeError:
14 | def _fromUtf8(s):
15 | return s
16 |
17 | try:
18 | _encoding = QtGui.QApplication.UnicodeUTF8
19 | def _translate(context, text, disambig):
20 | return QtGui.QApplication.translate(context, text, disambig, _encoding)
21 | except AttributeError:
22 | def _translate(context, text, disambig):
23 | return QtGui.QApplication.translate(context, text, disambig)
24 |
25 | class Ui_MainWindow(object):
26 | def setupUi(self, MainWindow):
27 | MainWindow.setObjectName(_fromUtf8("MainWindow"))
28 | MainWindow.resize(1366, 768)
29 | icon = QtGui.QIcon()
30 | icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/logos/logos/fiddle_icon_light.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
31 | MainWindow.setWindowIcon(icon)
32 | self.centralwidget = QtGui.QWidget(MainWindow)
33 | self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
34 | self.centralLayout = QtGui.QVBoxLayout(self.centralwidget)
35 | self.centralLayout.setMargin(0)
36 | self.centralLayout.setSpacing(5)
37 | self.centralLayout.setObjectName(_fromUtf8("centralLayout"))
38 | self.verticalLayout_5 = QtGui.QVBoxLayout()
39 | self.verticalLayout_5.setSizeConstraint(QtGui.QLayout.SetMinimumSize)
40 | self.verticalLayout_5.setContentsMargins(0, -1, -1, -1)
41 | self.verticalLayout_5.setSpacing(0)
42 | self.verticalLayout_5.setObjectName(_fromUtf8("verticalLayout_5"))
43 | self.findPane = QtGui.QDockWidget(self.centralwidget)
44 | self.findPane.setFeatures(QtGui.QDockWidget.DockWidgetClosable)
45 | self.findPane.setAllowedAreas(QtCore.Qt.BottomDockWidgetArea)
46 | self.findPane.setObjectName(_fromUtf8("findPane"))
47 | self.dockWidgetContents_3 = QtGui.QWidget()
48 | self.dockWidgetContents_3.setObjectName(_fromUtf8("dockWidgetContents_3"))
49 | self.verticalLayout_8 = QtGui.QVBoxLayout(self.dockWidgetContents_3)
50 | self.verticalLayout_8.setContentsMargins(10, 0, 5, 0)
51 | self.verticalLayout_8.setSpacing(5)
52 | self.verticalLayout_8.setObjectName(_fromUtf8("verticalLayout_8"))
53 | self.horizontalLayout_3 = QtGui.QHBoxLayout()
54 | self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3"))
55 | self.find_re_checkBox = QtGui.QCheckBox(self.dockWidgetContents_3)
56 | self.find_re_checkBox.setObjectName(_fromUtf8("find_re_checkBox"))
57 | self.horizontalLayout_3.addWidget(self.find_re_checkBox)
58 | self.find_case_checkBox = QtGui.QCheckBox(self.dockWidgetContents_3)
59 | self.find_case_checkBox.setObjectName(_fromUtf8("find_case_checkBox"))
60 | self.horizontalLayout_3.addWidget(self.find_case_checkBox)
61 | self.find_word_checkBox = QtGui.QCheckBox(self.dockWidgetContents_3)
62 | self.find_word_checkBox.setObjectName(_fromUtf8("find_word_checkBox"))
63 | self.horizontalLayout_3.addWidget(self.find_word_checkBox)
64 | self.find_selection_checkBox = QtGui.QCheckBox(self.dockWidgetContents_3)
65 | self.find_selection_checkBox.setObjectName(_fromUtf8("find_selection_checkBox"))
66 | self.horizontalLayout_3.addWidget(self.find_selection_checkBox)
67 | self.find_wrap_checkBox = QtGui.QCheckBox(self.dockWidgetContents_3)
68 | self.find_wrap_checkBox.setChecked(True)
69 | self.find_wrap_checkBox.setObjectName(_fromUtf8("find_wrap_checkBox"))
70 | self.horizontalLayout_3.addWidget(self.find_wrap_checkBox)
71 | spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
72 | self.horizontalLayout_3.addItem(spacerItem)
73 | self.verticalLayout_8.addLayout(self.horizontalLayout_3)
74 | self.gridLayout = QtGui.QGridLayout()
75 | self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
76 | self.label_2 = QtGui.QLabel(self.dockWidgetContents_3)
77 | self.label_2.setObjectName(_fromUtf8("label_2"))
78 | self.gridLayout.addWidget(self.label_2, 0, 0, 1, 1)
79 | self.find_text_lineEdit = QtGui.QLineEdit(self.dockWidgetContents_3)
80 | self.find_text_lineEdit.setObjectName(_fromUtf8("find_text_lineEdit"))
81 | self.gridLayout.addWidget(self.find_text_lineEdit, 0, 1, 1, 1)
82 | self.find_next_Button = QtGui.QPushButton(self.dockWidgetContents_3)
83 | self.find_next_Button.setObjectName(_fromUtf8("find_next_Button"))
84 | self.gridLayout.addWidget(self.find_next_Button, 0, 2, 1, 1)
85 | self.find_previous_Button = QtGui.QPushButton(self.dockWidgetContents_3)
86 | self.find_previous_Button.setObjectName(_fromUtf8("find_previous_Button"))
87 | self.gridLayout.addWidget(self.find_previous_Button, 0, 3, 1, 1)
88 | self.label_3 = QtGui.QLabel(self.dockWidgetContents_3)
89 | self.label_3.setObjectName(_fromUtf8("label_3"))
90 | self.gridLayout.addWidget(self.label_3, 1, 0, 1, 1)
91 | self.replace_text_lineEdit = QtGui.QLineEdit(self.dockWidgetContents_3)
92 | self.replace_text_lineEdit.setObjectName(_fromUtf8("replace_text_lineEdit"))
93 | self.gridLayout.addWidget(self.replace_text_lineEdit, 1, 1, 1, 1)
94 | self.replace_Button = QtGui.QPushButton(self.dockWidgetContents_3)
95 | self.replace_Button.setObjectName(_fromUtf8("replace_Button"))
96 | self.gridLayout.addWidget(self.replace_Button, 1, 2, 1, 1)
97 | self.replace_all_Button = QtGui.QPushButton(self.dockWidgetContents_3)
98 | self.replace_all_Button.setObjectName(_fromUtf8("replace_all_Button"))
99 | self.gridLayout.addWidget(self.replace_all_Button, 1, 3, 1, 1)
100 | self.verticalLayout_8.addLayout(self.gridLayout)
101 | self.findPane.setWidget(self.dockWidgetContents_3)
102 | self.verticalLayout_5.addWidget(self.findPane)
103 | self.centralLayout.addLayout(self.verticalLayout_5)
104 | MainWindow.setCentralWidget(self.centralwidget)
105 | self.menubar = QtGui.QMenuBar(MainWindow)
106 | self.menubar.setGeometry(QtCore.QRect(0, 0, 1366, 26))
107 | self.menubar.setObjectName(_fromUtf8("menubar"))
108 | self.menuFile = QtGui.QMenu(self.menubar)
109 | self.menuFile.setObjectName(_fromUtf8("menuFile"))
110 | self.menuOpen_Recent = QtGui.QMenu(self.menuFile)
111 | self.menuOpen_Recent.setObjectName(_fromUtf8("menuOpen_Recent"))
112 | self.menuEdit = QtGui.QMenu(self.menubar)
113 | self.menuEdit.setObjectName(_fromUtf8("menuEdit"))
114 | self.menuShell = QtGui.QMenu(self.menubar)
115 | self.menuShell.setObjectName(_fromUtf8("menuShell"))
116 | self.menuPython_Interpreter = QtGui.QMenu(self.menuShell)
117 | self.menuPython_Interpreter.setObjectName(_fromUtf8("menuPython_Interpreter"))
118 | self.menuHelp = QtGui.QMenu(self.menubar)
119 | self.menuHelp.setObjectName(_fromUtf8("menuHelp"))
120 | self.menuSearch_Provider = QtGui.QMenu(self.menuHelp)
121 | self.menuSearch_Provider.setObjectName(_fromUtf8("menuSearch_Provider"))
122 | self.menuView = QtGui.QMenu(self.menubar)
123 | self.menuView.setObjectName(_fromUtf8("menuView"))
124 | self.menuShow = QtGui.QMenu(self.menuView)
125 | self.menuShow.setObjectName(_fromUtf8("menuShow"))
126 | self.menuCode = QtGui.QMenu(self.menubar)
127 | self.menuCode.setObjectName(_fromUtf8("menuCode"))
128 | MainWindow.setMenuBar(self.menubar)
129 | self.statusbar = QtGui.QStatusBar(MainWindow)
130 | self.statusbar.setObjectName(_fromUtf8("statusbar"))
131 | MainWindow.setStatusBar(self.statusbar)
132 | self.main_toolBar = QtGui.QToolBar(MainWindow)
133 | self.main_toolBar.setMovable(False)
134 | self.main_toolBar.setAllowedAreas(QtCore.Qt.AllToolBarAreas)
135 | self.main_toolBar.setIconSize(QtCore.QSize(16, 16))
136 | self.main_toolBar.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)
137 | self.main_toolBar.setFloatable(False)
138 | self.main_toolBar.setObjectName(_fromUtf8("main_toolBar"))
139 | MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.main_toolBar)
140 | self.helpPane = QtGui.QDockWidget(MainWindow)
141 | self.helpPane.setFeatures(QtGui.QDockWidget.DockWidgetClosable)
142 | self.helpPane.setAllowedAreas(QtCore.Qt.RightDockWidgetArea)
143 | self.helpPane.setObjectName(_fromUtf8("helpPane"))
144 | self.dockWidgetContents = QtGui.QWidget()
145 | self.dockWidgetContents.setObjectName(_fromUtf8("dockWidgetContents"))
146 | self.verticalLayout_2 = QtGui.QVBoxLayout(self.dockWidgetContents)
147 | self.verticalLayout_2.setContentsMargins(5, 0, 5, 0)
148 | self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2"))
149 | self.helpFrame = QtGui.QWidget(self.dockWidgetContents)
150 | sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Maximum)
151 | sizePolicy.setHorizontalStretch(0)
152 | sizePolicy.setVerticalStretch(0)
153 | sizePolicy.setHeightForWidth(self.helpFrame.sizePolicy().hasHeightForWidth())
154 | self.helpFrame.setSizePolicy(sizePolicy)
155 | self.helpFrame.setObjectName(_fromUtf8("helpFrame"))
156 | self.verticalLayout_3 = QtGui.QVBoxLayout(self.helpFrame)
157 | self.verticalLayout_3.setMargin(0)
158 | self.verticalLayout_3.setSpacing(2)
159 | self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3"))
160 | self.horizontalLayout_4 = QtGui.QHBoxLayout()
161 | self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4"))
162 | self.label_5 = QtGui.QLabel(self.helpFrame)
163 | self.label_5.setObjectName(_fromUtf8("label_5"))
164 | self.horizontalLayout_4.addWidget(self.label_5)
165 | self.searchProvider_label = QtGui.QLabel(self.helpFrame)
166 | self.searchProvider_label.setObjectName(_fromUtf8("searchProvider_label"))
167 | self.horizontalLayout_4.addWidget(self.searchProvider_label)
168 | self.horizontalLayout_4.setStretch(1, 1)
169 | self.verticalLayout_3.addLayout(self.horizontalLayout_4)
170 | self.horizontalLayout_2 = QtGui.QHBoxLayout()
171 | self.horizontalLayout_2.setContentsMargins(-1, -1, 0, -1)
172 | self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
173 | self.helpSearch = QtGui.QLineEdit(self.helpFrame)
174 | self.helpSearch.setObjectName(_fromUtf8("helpSearch"))
175 | self.horizontalLayout_2.addWidget(self.helpSearch)
176 | self.web_search_Button = QtGui.QPushButton(self.helpFrame)
177 | self.web_search_Button.setObjectName(_fromUtf8("web_search_Button"))
178 | self.horizontalLayout_2.addWidget(self.web_search_Button)
179 | self.verticalLayout_3.addLayout(self.horizontalLayout_2)
180 | self.label_4 = QtGui.QLabel(self.helpFrame)
181 | self.label_4.setObjectName(_fromUtf8("label_4"))
182 | self.verticalLayout_3.addWidget(self.label_4)
183 | self.horizontalLayout_5 = QtGui.QHBoxLayout()
184 | self.horizontalLayout_5.setContentsMargins(-1, 0, -1, 0)
185 | self.horizontalLayout_5.setObjectName(_fromUtf8("horizontalLayout_5"))
186 | self.browser_back_Button = QtGui.QToolButton(self.helpFrame)
187 | icon1 = QtGui.QIcon()
188 | icon1.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/icons/arrow_left.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
189 | self.browser_back_Button.setIcon(icon1)
190 | self.browser_back_Button.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)
191 | self.browser_back_Button.setAutoRaise(True)
192 | self.browser_back_Button.setObjectName(_fromUtf8("browser_back_Button"))
193 | self.horizontalLayout_5.addWidget(self.browser_back_Button)
194 | spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
195 | self.horizontalLayout_5.addItem(spacerItem1)
196 | self.browser_forward_Button = QtGui.QToolButton(self.helpFrame)
197 | icon2 = QtGui.QIcon()
198 | icon2.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/icons/arrow_right.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
199 | self.browser_forward_Button.setIcon(icon2)
200 | self.browser_forward_Button.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)
201 | self.browser_forward_Button.setAutoRaise(True)
202 | self.browser_forward_Button.setObjectName(_fromUtf8("browser_forward_Button"))
203 | self.horizontalLayout_5.addWidget(self.browser_forward_Button)
204 | self.verticalLayout_3.addLayout(self.horizontalLayout_5)
205 | self.line = QtGui.QFrame(self.helpFrame)
206 | self.line.setFrameShape(QtGui.QFrame.HLine)
207 | self.line.setFrameShadow(QtGui.QFrame.Sunken)
208 | self.line.setObjectName(_fromUtf8("line"))
209 | self.verticalLayout_3.addWidget(self.line)
210 | self.helpBrowser = QtWebKit.QWebView(self.helpFrame)
211 | sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Maximum)
212 | sizePolicy.setHorizontalStretch(0)
213 | sizePolicy.setVerticalStretch(0)
214 | sizePolicy.setHeightForWidth(self.helpBrowser.sizePolicy().hasHeightForWidth())
215 | self.helpBrowser.setSizePolicy(sizePolicy)
216 | self.helpBrowser.setMinimumSize(QtCore.QSize(320, 0))
217 | self.helpBrowser.setUrl(QtCore.QUrl(_fromUtf8("about:blank")))
218 | self.helpBrowser.setObjectName(_fromUtf8("helpBrowser"))
219 | self.verticalLayout_3.addWidget(self.helpBrowser)
220 | self.verticalLayout_3.setStretch(5, 1)
221 | self.verticalLayout_2.addWidget(self.helpFrame)
222 | self.helpPane.setWidget(self.dockWidgetContents)
223 | MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.helpPane)
224 | self.consolePane = QtGui.QDockWidget(MainWindow)
225 | sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
226 | sizePolicy.setHorizontalStretch(0)
227 | sizePolicy.setVerticalStretch(0)
228 | sizePolicy.setHeightForWidth(self.consolePane.sizePolicy().hasHeightForWidth())
229 | self.consolePane.setSizePolicy(sizePolicy)
230 | self.consolePane.setAutoFillBackground(False)
231 | self.consolePane.setFeatures(QtGui.QDockWidget.DockWidgetClosable)
232 | self.consolePane.setAllowedAreas(QtCore.Qt.BottomDockWidgetArea)
233 | self.consolePane.setObjectName(_fromUtf8("consolePane"))
234 | self.dockWidgetContents_2 = QtGui.QWidget()
235 | sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Preferred)
236 | sizePolicy.setHorizontalStretch(0)
237 | sizePolicy.setVerticalStretch(0)
238 | sizePolicy.setHeightForWidth(self.dockWidgetContents_2.sizePolicy().hasHeightForWidth())
239 | self.dockWidgetContents_2.setSizePolicy(sizePolicy)
240 | self.dockWidgetContents_2.setObjectName(_fromUtf8("dockWidgetContents_2"))
241 | self.verticalLayout_6 = QtGui.QVBoxLayout(self.dockWidgetContents_2)
242 | self.verticalLayout_6.setContentsMargins(5, 0, 5, 0)
243 | self.verticalLayout_6.setObjectName(_fromUtf8("verticalLayout_6"))
244 | self.console_tabWidget = QtGui.QTabWidget(self.dockWidgetContents_2)
245 | self.console_tabWidget.setTabPosition(QtGui.QTabWidget.South)
246 | self.console_tabWidget.setDocumentMode(False)
247 | self.console_tabWidget.setObjectName(_fromUtf8("console_tabWidget"))
248 | self.pyconsole_Tab = QtGui.QWidget()
249 | self.pyconsole_Tab.setObjectName(_fromUtf8("pyconsole_Tab"))
250 | self.pyConsoleLayout = QtGui.QVBoxLayout(self.pyconsole_Tab)
251 | self.pyConsoleLayout.setMargin(0)
252 | self.pyConsoleLayout.setSpacing(0)
253 | self.pyConsoleLayout.setObjectName(_fromUtf8("pyConsoleLayout"))
254 | self.pyconsole_prompt_layout = QtGui.QHBoxLayout()
255 | self.pyconsole_prompt_layout.setSizeConstraint(QtGui.QLayout.SetDefaultConstraint)
256 | self.pyconsole_prompt_layout.setSpacing(0)
257 | self.pyconsole_prompt_layout.setObjectName(_fromUtf8("pyconsole_prompt_layout"))
258 | spacerItem2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
259 | self.pyconsole_prompt_layout.addItem(spacerItem2)
260 | self.pyconsole_restart_Button = QtGui.QToolButton(self.pyconsole_Tab)
261 | icon3 = QtGui.QIcon()
262 | icon3.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/icons/arrow_refresh.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
263 | self.pyconsole_restart_Button.setIcon(icon3)
264 | self.pyconsole_restart_Button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
265 | self.pyconsole_restart_Button.setAutoRaise(True)
266 | self.pyconsole_restart_Button.setObjectName(_fromUtf8("pyconsole_restart_Button"))
267 | self.pyconsole_prompt_layout.addWidget(self.pyconsole_restart_Button)
268 | self.pyconsole_halt_Button = QtGui.QToolButton(self.pyconsole_Tab)
269 | icon4 = QtGui.QIcon()
270 | icon4.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/icons/cross.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
271 | self.pyconsole_halt_Button.setIcon(icon4)
272 | self.pyconsole_halt_Button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
273 | self.pyconsole_halt_Button.setAutoRaise(True)
274 | self.pyconsole_halt_Button.setObjectName(_fromUtf8("pyconsole_halt_Button"))
275 | self.pyconsole_prompt_layout.addWidget(self.pyconsole_halt_Button)
276 | self.pyConsoleLayout.addLayout(self.pyconsole_prompt_layout)
277 | self.console_tabWidget.addTab(self.pyconsole_Tab, _fromUtf8(""))
278 | self.runscript_Tab = QtGui.QWidget()
279 | self.runscript_Tab.setObjectName(_fromUtf8("runscript_Tab"))
280 | self.runScriptLayout = QtGui.QVBoxLayout(self.runscript_Tab)
281 | self.runScriptLayout.setContentsMargins(5, 5, 5, 0)
282 | self.runScriptLayout.setObjectName(_fromUtf8("runScriptLayout"))
283 | self.horizontalLayout = QtGui.QHBoxLayout()
284 | self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
285 | self.label = QtGui.QLabel(self.runscript_Tab)
286 | self.label.setObjectName(_fromUtf8("label"))
287 | self.horizontalLayout.addWidget(self.label)
288 | self.runScript_command = QtGui.QLineEdit(self.runscript_Tab)
289 | font = QtGui.QFont()
290 | font.setFamily(_fromUtf8("Courier"))
291 | font.setPointSize(10)
292 | self.runScript_command.setFont(font)
293 | self.runScript_command.setObjectName(_fromUtf8("runScript_command"))
294 | self.horizontalLayout.addWidget(self.runScript_command)
295 | self.run_remember_checkBox = QtGui.QCheckBox(self.runscript_Tab)
296 | self.run_remember_checkBox.setObjectName(_fromUtf8("run_remember_checkBox"))
297 | self.horizontalLayout.addWidget(self.run_remember_checkBox)
298 | self.run_script_Button = QtGui.QToolButton(self.runscript_Tab)
299 | icon5 = QtGui.QIcon()
300 | icon5.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/icons/play_green.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
301 | self.run_script_Button.setIcon(icon5)
302 | self.run_script_Button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
303 | self.run_script_Button.setAutoRaise(True)
304 | self.run_script_Button.setObjectName(_fromUtf8("run_script_Button"))
305 | self.horizontalLayout.addWidget(self.run_script_Button)
306 | self.halt_script_Button = QtGui.QToolButton(self.runscript_Tab)
307 | self.halt_script_Button.setIcon(icon4)
308 | self.halt_script_Button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
309 | self.halt_script_Button.setAutoRaise(True)
310 | self.halt_script_Button.setObjectName(_fromUtf8("halt_script_Button"))
311 | self.horizontalLayout.addWidget(self.halt_script_Button)
312 | self.runScriptLayout.addLayout(self.horizontalLayout)
313 | self.console_tabWidget.addTab(self.runscript_Tab, _fromUtf8(""))
314 | self.verticalLayout_6.addWidget(self.console_tabWidget)
315 | self.consolePane.setWidget(self.dockWidgetContents_2)
316 | MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(8), self.consolePane)
317 | self.actionNew = QtGui.QAction(MainWindow)
318 | icon6 = QtGui.QIcon()
319 | icon6.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/icons/page_white.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
320 | self.actionNew.setIcon(icon6)
321 | self.actionNew.setObjectName(_fromUtf8("actionNew"))
322 | self.actionOpen = QtGui.QAction(MainWindow)
323 | icon7 = QtGui.QIcon()
324 | icon7.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/icons/folder.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
325 | self.actionOpen.setIcon(icon7)
326 | self.actionOpen.setObjectName(_fromUtf8("actionOpen"))
327 | self.actionSave_File = QtGui.QAction(MainWindow)
328 | icon8 = QtGui.QIcon()
329 | icon8.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/icons/disk.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
330 | self.actionSave_File.setIcon(icon8)
331 | self.actionSave_File.setObjectName(_fromUtf8("actionSave_File"))
332 | self.actionSave_File_As = QtGui.QAction(MainWindow)
333 | self.actionSave_File_As.setObjectName(_fromUtf8("actionSave_File_As"))
334 | self.actionPrint = QtGui.QAction(MainWindow)
335 | self.actionPrint.setObjectName(_fromUtf8("actionPrint"))
336 | self.actionClose_Tab = QtGui.QAction(MainWindow)
337 | self.actionClose_Tab.setObjectName(_fromUtf8("actionClose_Tab"))
338 | self.actionClose_All_Tabs = QtGui.QAction(MainWindow)
339 | self.actionClose_All_Tabs.setObjectName(_fromUtf8("actionClose_All_Tabs"))
340 | self.actionExit = QtGui.QAction(MainWindow)
341 | self.actionExit.setObjectName(_fromUtf8("actionExit"))
342 | self.actionCut = QtGui.QAction(MainWindow)
343 | icon9 = QtGui.QIcon()
344 | icon9.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/icons/cut.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
345 | self.actionCut.setIcon(icon9)
346 | self.actionCut.setObjectName(_fromUtf8("actionCut"))
347 | self.actionCopy = QtGui.QAction(MainWindow)
348 | icon10 = QtGui.QIcon()
349 | icon10.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/icons/page_white_copy.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
350 | self.actionCopy.setIcon(icon10)
351 | self.actionCopy.setObjectName(_fromUtf8("actionCopy"))
352 | self.actionPaste = QtGui.QAction(MainWindow)
353 | icon11 = QtGui.QIcon()
354 | icon11.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/icons/paste_plain.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
355 | self.actionPaste.setIcon(icon11)
356 | self.actionPaste.setObjectName(_fromUtf8("actionPaste"))
357 | self.actionSelect_All = QtGui.QAction(MainWindow)
358 | self.actionSelect_All.setObjectName(_fromUtf8("actionSelect_All"))
359 | self.actionFind = QtGui.QAction(MainWindow)
360 | icon12 = QtGui.QIcon()
361 | icon12.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/icons/find.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
362 | self.actionFind.setIcon(icon12)
363 | self.actionFind.setObjectName(_fromUtf8("actionFind"))
364 | self.actionFind_and_Replace = QtGui.QAction(MainWindow)
365 | icon13 = QtGui.QIcon()
366 | icon13.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/icons/find_replace.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
367 | self.actionFind_and_Replace.setIcon(icon13)
368 | self.actionFind_and_Replace.setObjectName(_fromUtf8("actionFind_and_Replace"))
369 | self.actionRestart_Console = QtGui.QAction(MainWindow)
370 | self.actionRestart_Console.setIcon(icon3)
371 | self.actionRestart_Console.setObjectName(_fromUtf8("actionRestart_Console"))
372 | self.actionFIDDLE_Help = QtGui.QAction(MainWindow)
373 | self.actionFIDDLE_Help.setObjectName(_fromUtf8("actionFIDDLE_Help"))
374 | self.actionAbout_fIDDEL = QtGui.QAction(MainWindow)
375 | self.actionAbout_fIDDEL.setObjectName(_fromUtf8("actionAbout_fIDDEL"))
376 | self.actionRun_Current_Script = QtGui.QAction(MainWindow)
377 | self.actionRun_Current_Script.setIcon(icon5)
378 | self.actionRun_Current_Script.setObjectName(_fromUtf8("actionRun_Current_Script"))
379 | self.actionShow_Help_Pane = QtGui.QAction(MainWindow)
380 | icon14 = QtGui.QIcon()
381 | icon14.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/icons/help.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
382 | self.actionShow_Help_Pane.setIcon(icon14)
383 | self.actionShow_Help_Pane.setObjectName(_fromUtf8("actionShow_Help_Pane"))
384 | self.actionShow_Console = QtGui.QAction(MainWindow)
385 | self.actionShow_Console.setObjectName(_fromUtf8("actionShow_Console"))
386 | self.actionHalt_Python_Console = QtGui.QAction(MainWindow)
387 | self.actionHalt_Python_Console.setIcon(icon4)
388 | self.actionHalt_Python_Console.setObjectName(_fromUtf8("actionHalt_Python_Console"))
389 | self.actionHalt_Current_Script = QtGui.QAction(MainWindow)
390 | self.actionHalt_Current_Script.setIcon(icon4)
391 | self.actionHalt_Current_Script.setObjectName(_fromUtf8("actionHalt_Current_Script"))
392 | self.actionShow_Whitespace = QtGui.QAction(MainWindow)
393 | self.actionShow_Whitespace.setCheckable(True)
394 | self.actionShow_Whitespace.setObjectName(_fromUtf8("actionShow_Whitespace"))
395 | self.actionShow_End_of_Line = QtGui.QAction(MainWindow)
396 | self.actionShow_End_of_Line.setCheckable(True)
397 | self.actionShow_End_of_Line.setObjectName(_fromUtf8("actionShow_End_of_Line"))
398 | self.actionWord_Wrap = QtGui.QAction(MainWindow)
399 | self.actionWord_Wrap.setCheckable(True)
400 | self.actionWord_Wrap.setObjectName(_fromUtf8("actionWord_Wrap"))
401 | self.actionClean_Code = QtGui.QAction(MainWindow)
402 | icon15 = QtGui.QIcon()
403 | icon15.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/icons/wand.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
404 | self.actionClean_Code.setIcon(icon15)
405 | self.actionClean_Code.setObjectName(_fromUtf8("actionClean_Code"))
406 | self.actionCheck_Code = QtGui.QAction(MainWindow)
407 | icon16 = QtGui.QIcon()
408 | icon16.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/icons/zoom.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
409 | self.actionCheck_Code.setIcon(icon16)
410 | self.actionCheck_Code.setObjectName(_fromUtf8("actionCheck_Code"))
411 | self.actionZoom_In = QtGui.QAction(MainWindow)
412 | self.actionZoom_In.setObjectName(_fromUtf8("actionZoom_In"))
413 | self.actionZoom_Out = QtGui.QAction(MainWindow)
414 | self.actionZoom_Out.setObjectName(_fromUtf8("actionZoom_Out"))
415 | self.menuFile.addAction(self.actionNew)
416 | self.menuFile.addAction(self.actionOpen)
417 | self.menuFile.addAction(self.menuOpen_Recent.menuAction())
418 | self.menuFile.addAction(self.actionSave_File)
419 | self.menuFile.addAction(self.actionSave_File_As)
420 | self.menuFile.addAction(self.actionPrint)
421 | self.menuFile.addSeparator()
422 | self.menuFile.addAction(self.actionExit)
423 | self.menuEdit.addAction(self.actionCut)
424 | self.menuEdit.addAction(self.actionCopy)
425 | self.menuEdit.addAction(self.actionPaste)
426 | self.menuEdit.addAction(self.actionSelect_All)
427 | self.menuEdit.addSeparator()
428 | self.menuEdit.addAction(self.actionFind)
429 | self.menuEdit.addAction(self.actionFind_and_Replace)
430 | self.menuShell.addAction(self.actionShow_Console)
431 | self.menuShell.addAction(self.menuPython_Interpreter.menuAction())
432 | self.menuShell.addSeparator()
433 | self.menuShell.addAction(self.actionRun_Current_Script)
434 | self.menuShell.addAction(self.actionHalt_Current_Script)
435 | self.menuShell.addSeparator()
436 | self.menuShell.addAction(self.actionRestart_Console)
437 | self.menuShell.addAction(self.actionHalt_Python_Console)
438 | self.menuHelp.addAction(self.actionShow_Help_Pane)
439 | self.menuHelp.addAction(self.menuSearch_Provider.menuAction())
440 | self.menuHelp.addSeparator()
441 | self.menuHelp.addAction(self.actionFIDDLE_Help)
442 | self.menuHelp.addAction(self.actionAbout_fIDDEL)
443 | self.menuShow.addAction(self.actionShow_Whitespace)
444 | self.menuShow.addAction(self.actionShow_End_of_Line)
445 | self.menuView.addAction(self.actionClose_Tab)
446 | self.menuView.addAction(self.actionClose_All_Tabs)
447 | self.menuView.addSeparator()
448 | self.menuView.addAction(self.actionZoom_In)
449 | self.menuView.addAction(self.actionZoom_Out)
450 | self.menuView.addSeparator()
451 | self.menuView.addAction(self.actionWord_Wrap)
452 | self.menuView.addAction(self.menuShow.menuAction())
453 | self.menuCode.addAction(self.actionClean_Code)
454 | self.menuCode.addAction(self.actionCheck_Code)
455 | self.menubar.addAction(self.menuFile.menuAction())
456 | self.menubar.addAction(self.menuEdit.menuAction())
457 | self.menubar.addAction(self.menuView.menuAction())
458 | self.menubar.addAction(self.menuCode.menuAction())
459 | self.menubar.addAction(self.menuShell.menuAction())
460 | self.menubar.addAction(self.menuHelp.menuAction())
461 | self.main_toolBar.addAction(self.actionNew)
462 | self.main_toolBar.addAction(self.actionOpen)
463 | self.main_toolBar.addAction(self.actionSave_File)
464 | self.main_toolBar.addSeparator()
465 | self.main_toolBar.addAction(self.actionCut)
466 | self.main_toolBar.addAction(self.actionCopy)
467 | self.main_toolBar.addAction(self.actionPaste)
468 | self.main_toolBar.addSeparator()
469 | self.main_toolBar.addAction(self.actionFind)
470 | self.main_toolBar.addAction(self.actionFind_and_Replace)
471 | self.main_toolBar.addSeparator()
472 | self.main_toolBar.addAction(self.actionRun_Current_Script)
473 | self.main_toolBar.addAction(self.actionHalt_Current_Script)
474 | self.main_toolBar.addSeparator()
475 | self.main_toolBar.addAction(self.actionClean_Code)
476 | self.main_toolBar.addAction(self.actionCheck_Code)
477 | self.main_toolBar.addSeparator()
478 | self.main_toolBar.addAction(self.actionShow_Help_Pane)
479 |
480 | self.retranslateUi(MainWindow)
481 | self.console_tabWidget.setCurrentIndex(0)
482 | QtCore.QObject.connect(self.find_next_Button, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.find_in_file)
483 | QtCore.QObject.connect(self.find_previous_Button, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.find_in_file_previous)
484 | QtCore.QObject.connect(self.find_text_lineEdit, QtCore.SIGNAL(_fromUtf8("returnPressed()")), MainWindow.find_in_file)
485 | QtCore.QObject.connect(self.replace_Button, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.replace_in_file)
486 | QtCore.QObject.connect(self.replace_all_Button, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.replace_all_in_file)
487 | QtCore.QObject.connect(self.pyconsole_restart_Button, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.restart_pyconsole_process)
488 | QtCore.QObject.connect(self.pyconsole_halt_Button, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.terminate_pyconsole_process)
489 | QtCore.QObject.connect(self.runScript_command, QtCore.SIGNAL(_fromUtf8("returnPressed()")), MainWindow.run_current_script)
490 | QtCore.QObject.connect(self.run_script_Button, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.run_current_script)
491 | QtCore.QObject.connect(self.halt_script_Button, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.terminate_current_script)
492 | QtCore.QObject.connect(self.helpSearch, QtCore.SIGNAL(_fromUtf8("returnPressed()")), MainWindow.run_web_search)
493 | QtCore.QObject.connect(self.web_search_Button, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.run_web_search)
494 | QtCore.QObject.connect(self.replace_text_lineEdit, QtCore.SIGNAL(_fromUtf8("returnPressed()")), MainWindow.replace_in_file)
495 | QtCore.QObject.connect(self.browser_back_Button, QtCore.SIGNAL(_fromUtf8("clicked()")), self.helpBrowser.back)
496 | QtCore.QObject.connect(self.browser_forward_Button, QtCore.SIGNAL(_fromUtf8("clicked()")), self.helpBrowser.forward)
497 | QtCore.QMetaObject.connectSlotsByName(MainWindow)
498 | MainWindow.setTabOrder(self.find_re_checkBox, self.find_case_checkBox)
499 | MainWindow.setTabOrder(self.find_case_checkBox, self.find_word_checkBox)
500 | MainWindow.setTabOrder(self.find_word_checkBox, self.find_selection_checkBox)
501 | MainWindow.setTabOrder(self.find_selection_checkBox, self.find_wrap_checkBox)
502 | MainWindow.setTabOrder(self.find_wrap_checkBox, self.find_text_lineEdit)
503 | MainWindow.setTabOrder(self.find_text_lineEdit, self.replace_text_lineEdit)
504 | MainWindow.setTabOrder(self.replace_text_lineEdit, self.find_next_Button)
505 | MainWindow.setTabOrder(self.find_next_Button, self.find_previous_Button)
506 | MainWindow.setTabOrder(self.find_previous_Button, self.replace_Button)
507 | MainWindow.setTabOrder(self.replace_Button, self.replace_all_Button)
508 | MainWindow.setTabOrder(self.replace_all_Button, self.console_tabWidget)
509 | MainWindow.setTabOrder(self.console_tabWidget, self.pyconsole_restart_Button)
510 | MainWindow.setTabOrder(self.pyconsole_restart_Button, self.pyconsole_halt_Button)
511 | MainWindow.setTabOrder(self.pyconsole_halt_Button, self.runScript_command)
512 | MainWindow.setTabOrder(self.runScript_command, self.run_remember_checkBox)
513 | MainWindow.setTabOrder(self.run_remember_checkBox, self.run_script_Button)
514 | MainWindow.setTabOrder(self.run_script_Button, self.halt_script_Button)
515 | MainWindow.setTabOrder(self.halt_script_Button, self.helpSearch)
516 | MainWindow.setTabOrder(self.helpSearch, self.web_search_Button)
517 | MainWindow.setTabOrder(self.web_search_Button, self.browser_back_Button)
518 | MainWindow.setTabOrder(self.browser_back_Button, self.browser_forward_Button)
519 | MainWindow.setTabOrder(self.browser_forward_Button, self.helpBrowser)
520 |
521 | def retranslateUi(self, MainWindow):
522 | MainWindow.setWindowTitle(_translate("MainWindow", "fiddle", None))
523 | self.findPane.setWindowTitle(_translate("MainWindow", "Find/Replace", None))
524 | self.find_re_checkBox.setText(_translate("MainWindow", "RegEx", None))
525 | self.find_case_checkBox.setText(_translate("MainWindow", "Match Case", None))
526 | self.find_word_checkBox.setText(_translate("MainWindow", "Whole Word", None))
527 | self.find_selection_checkBox.setText(_translate("MainWindow", "In Selection", None))
528 | self.find_wrap_checkBox.setText(_translate("MainWindow", "Wrap", None))
529 | self.label_2.setText(_translate("MainWindow", "Find", None))
530 | self.find_next_Button.setText(_translate("MainWindow", "Next", None))
531 | self.find_previous_Button.setText(_translate("MainWindow", "Previous", None))
532 | self.label_3.setText(_translate("MainWindow", "Replace", None))
533 | self.replace_Button.setText(_translate("MainWindow", "Replace", None))
534 | self.replace_all_Button.setText(_translate("MainWindow", "Replace All", None))
535 | self.menuFile.setTitle(_translate("MainWindow", "File", None))
536 | self.menuOpen_Recent.setTitle(_translate("MainWindow", "Open Recent", None))
537 | self.menuEdit.setTitle(_translate("MainWindow", "Edit", None))
538 | self.menuShell.setTitle(_translate("MainWindow", "Console", None))
539 | self.menuPython_Interpreter.setTitle(_translate("MainWindow", "Python Interpreter", None))
540 | self.menuHelp.setTitle(_translate("MainWindow", "Help", None))
541 | self.menuSearch_Provider.setTitle(_translate("MainWindow", "Search Provider", None))
542 | self.menuView.setTitle(_translate("MainWindow", "View", None))
543 | self.menuShow.setTitle(_translate("MainWindow", "Show", None))
544 | self.menuCode.setTitle(_translate("MainWindow", "Code", None))
545 | self.main_toolBar.setWindowTitle(_translate("MainWindow", "toolBar", None))
546 | self.helpPane.setWindowTitle(_translate("MainWindow", "Help", None))
547 | self.label_5.setText(_translate("MainWindow", "Search - ", None))
548 | self.searchProvider_label.setText(_translate("MainWindow", "", None))
549 | self.web_search_Button.setText(_translate("MainWindow", "Search", None))
550 | self.label_4.setText(_translate("MainWindow", "Built-in Help", None))
551 | self.browser_back_Button.setToolTip(_translate("MainWindow", "Back", None))
552 | self.browser_back_Button.setText(_translate("MainWindow", "Back", None))
553 | self.browser_forward_Button.setToolTip(_translate("MainWindow", "Forward", None))
554 | self.browser_forward_Button.setText(_translate("MainWindow", "Forward", None))
555 | self.consolePane.setWindowTitle(_translate("MainWindow", "Consoles", None))
556 | self.pyconsole_restart_Button.setToolTip(_translate("MainWindow", "Restart Python Console", None))
557 | self.pyconsole_restart_Button.setText(_translate("MainWindow", "Restart", None))
558 | self.pyconsole_halt_Button.setToolTip(_translate("MainWindow", "Halt Python Console", None))
559 | self.pyconsole_halt_Button.setText(_translate("MainWindow", "Halt", None))
560 | self.console_tabWidget.setTabText(self.console_tabWidget.indexOf(self.pyconsole_Tab), _translate("MainWindow", "Python Console", None))
561 | self.label.setText(_translate("MainWindow", "Run Command", None))
562 | self.run_remember_checkBox.setText(_translate("MainWindow", "Remember", None))
563 | self.run_script_Button.setToolTip(_translate("MainWindow", "Run Script", None))
564 | self.run_script_Button.setText(_translate("MainWindow", "Run", None))
565 | self.halt_script_Button.setToolTip(_translate("MainWindow", "Halt Running Script", None))
566 | self.halt_script_Button.setText(_translate("MainWindow", "Halt", None))
567 | self.console_tabWidget.setTabText(self.console_tabWidget.indexOf(self.runscript_Tab), _translate("MainWindow", "Run Script", None))
568 | self.actionNew.setText(_translate("MainWindow", "New", None))
569 | self.actionNew.setToolTip(_translate("MainWindow", "New", None))
570 | self.actionNew.setShortcut(_translate("MainWindow", "Ctrl+N", None))
571 | self.actionOpen.setText(_translate("MainWindow", "Open", None))
572 | self.actionOpen.setToolTip(_translate("MainWindow", "Open", None))
573 | self.actionOpen.setShortcut(_translate("MainWindow", "Ctrl+O", None))
574 | self.actionSave_File.setText(_translate("MainWindow", "Save", None))
575 | self.actionSave_File.setToolTip(_translate("MainWindow", "Save", None))
576 | self.actionSave_File.setShortcut(_translate("MainWindow", "Ctrl+S", None))
577 | self.actionSave_File_As.setText(_translate("MainWindow", "Save As", None))
578 | self.actionPrint.setText(_translate("MainWindow", "Print", None))
579 | self.actionPrint.setShortcut(_translate("MainWindow", "Ctrl+P", None))
580 | self.actionClose_Tab.setText(_translate("MainWindow", "Close Tab", None))
581 | self.actionClose_All_Tabs.setText(_translate("MainWindow", "Close All Tabs", None))
582 | self.actionExit.setText(_translate("MainWindow", "Exit", None))
583 | self.actionCut.setText(_translate("MainWindow", "Cut", None))
584 | self.actionCut.setShortcut(_translate("MainWindow", "Ctrl+X", None))
585 | self.actionCopy.setText(_translate("MainWindow", "Copy", None))
586 | self.actionCopy.setShortcut(_translate("MainWindow", "Ctrl+C", None))
587 | self.actionPaste.setText(_translate("MainWindow", "Paste", None))
588 | self.actionPaste.setShortcut(_translate("MainWindow", "Ctrl+V", None))
589 | self.actionSelect_All.setText(_translate("MainWindow", "Select All", None))
590 | self.actionSelect_All.setShortcut(_translate("MainWindow", "Ctrl+A", None))
591 | self.actionFind.setText(_translate("MainWindow", "Find", None))
592 | self.actionFind.setToolTip(_translate("MainWindow", "Find", None))
593 | self.actionFind.setShortcut(_translate("MainWindow", "Ctrl+F", None))
594 | self.actionFind_and_Replace.setText(_translate("MainWindow", "Find and Replace", None))
595 | self.actionFind_and_Replace.setToolTip(_translate("MainWindow", "Find and Replace", None))
596 | self.actionFind_and_Replace.setShortcut(_translate("MainWindow", "Ctrl+R", None))
597 | self.actionRestart_Console.setText(_translate("MainWindow", "Restart Python Console", None))
598 | self.actionFIDDLE_Help.setText(_translate("MainWindow", "fIDDLE Help", None))
599 | self.actionAbout_fIDDEL.setText(_translate("MainWindow", "About fIDDLE", None))
600 | self.actionRun_Current_Script.setText(_translate("MainWindow", "Run Script", None))
601 | self.actionRun_Current_Script.setToolTip(_translate("MainWindow", "Run Script", None))
602 | self.actionRun_Current_Script.setShortcut(_translate("MainWindow", "F5", None))
603 | self.actionShow_Help_Pane.setText(_translate("MainWindow", "Help", None))
604 | self.actionShow_Help_Pane.setToolTip(_translate("MainWindow", "Help", None))
605 | self.actionShow_Help_Pane.setShortcut(_translate("MainWindow", "Alt+H", None))
606 | self.actionShow_Console.setText(_translate("MainWindow", "Show/Hide Console", None))
607 | self.actionHalt_Python_Console.setText(_translate("MainWindow", "Halt Python Console", None))
608 | self.actionHalt_Current_Script.setText(_translate("MainWindow", "Halt Script", None))
609 | self.actionShow_Whitespace.setText(_translate("MainWindow", "Show Whitespace", None))
610 | self.actionShow_End_of_Line.setText(_translate("MainWindow", "Show End of Line", None))
611 | self.actionWord_Wrap.setText(_translate("MainWindow", "Word Wrap", None))
612 | self.actionClean_Code.setText(_translate("MainWindow", "Clean Code", None))
613 | self.actionCheck_Code.setText(_translate("MainWindow", "Check Code", None))
614 | self.actionZoom_In.setText(_translate("MainWindow", "Zoom In", None))
615 | self.actionZoom_In.setShortcut(_translate("MainWindow", "Ctrl++", None))
616 | self.actionZoom_Out.setText(_translate("MainWindow", "Zoom Out", None))
617 | self.actionZoom_Out.setShortcut(_translate("MainWindow", "Ctrl+-", None))
618 |
619 | from PyQt4 import QtWebKit
620 | from . import resources_rc
621 |
--------------------------------------------------------------------------------