Exemple #1
0
def main():
    app = QtWidgets.QApplication(sys.argv)
    window = QtWidgets.QMainWindow()

    # code from the simple example
    editor = api.CodeEdit()
    editor.file.open(__file__)
    editor.modes.append(modes.CaretLineHighlighterMode())
    sh = modes.PygmentsSyntaxHighlighter(editor.document())
    editor.modes.append(sh)
    editor.panels.append(panels.SearchAndReplacePanel(),
                      api.Panel.Position.TOP)
    # make the code edit show whitespaces in dark gray
    editor.show_white_spaces = True
    editor.whitespaces_foreground = QtGui.QColor('#606020')

    # make a dark editor using the monokai theme
    sh.pygments_style = 'monokai'

    window.setCentralWidget(editor)
    window.show()

    app.exec_()

    editor.file.close()
    del editor
    del window
    del app
Exemple #2
0
def main():
    app = QtWidgets.QApplication(sys.argv)

    # create editor and window
    window = QtWidgets.QMainWindow()
    editor = api.CodeEdit()
    window.setCentralWidget(editor)

    # start the backend as soon as possible
    editor.backend.start('server.py')

    # append some modes and panels
    editor.modes.append(modes.CodeCompletionMode())
    editor.modes.append(modes.CaretLineHighlighterMode())
    editor.modes.append(modes.PygmentsSyntaxHighlighter(editor.document()))
    editor.panels.append(panels.SearchAndReplacePanel(),
                         api.Panel.Position.BOTTOM)

    # open a file
    editor.file.open(__file__)

    # run
    window.show()
    app.exec_()
    editor.file.close()
Exemple #3
0
    def __init__(self, parse_args=True):
        super().__init__()
        if system.darwin:
            Application._osx_init()
        self.app = QtWidgets.QApplication(sys.argv)

        self._reported_tracebacks = []
        qcrash.get_system_information = system.get_system_infos
        qcrash.get_application_log = logger.get_application_log
        qcrash.install_backend(
            qcrash.backends.GithubBackend(QCRASH_GH_OWNER, QCRASH_GH_REPO),
            qcrash.backends.EmailBackend(QCRASH_EMAIL, 'OpenCobolIDE'))
        qcrash.set_qsettings(Settings()._settings)
        qcrash.install_except_hook(except_hook=self._report_exception)
        # if hasattr(sys, 'frozen') and sys.platform == 'win32':
        #     sys.stdout = open(os.path.join(system.get_cache_directory(),
        #                                    'ocide_stdout.log'), 'w')
        #     sys.stderr = open(os.path.join(system.get_cache_directory(),
        #                                    'ocide_stderr.log'), 'w')
        if parse_args and not system.darwin:
            files = self.handle_command_line_args()
        else:
            files = []
        _logger().info('files to open: %r' % files)
        self.name = 'OpenCobolIDE'
        self.version = __version__
        self.title = '%s %s' % (self.name, self.version)

        self.apply_mimetypes_preferences()

        self.win = MainWindow()
        self.win.setWindowTitle(self.title)
        self.file = FileController(self)
        self.view = ViewController(self)
        self.home = HomeController(self)
        self.edit = EditController(self)
        self.cobol = CobolController(self)
        self.help = HelpController(self)
        self.win.app = self

        self.view.show_perspective(Settings().perspective)

        self.update_app_style()

        try:
            check_compiler()
        except CompilerNotFound:
            msg = 'Failed to find a working GnuCOBOL compiler!\n' \
                "The IDE will continue to work but you won't be able to " \
                'compile...'
            if system.windows:
                msg += '\n\nTip: Ensure that there is no additional ' \
                    'installation of MinGW in %s:\MinGW' % sys.executable[0]
            QtWidgets.QMessageBox.warning(
                self.win, 'COBOL compiler not found or not working', msg)
        else:
            _logger().info('GnuCOBOL version: %s',
                           GnuCobolCompiler.get_version(include_all=False))
        self._files = files
Exemple #4
0
def main():
    app = QtWidgets.QApplication(sys.argv)
    w = Terminal()
    w.resize(640, 480)
    w.show()
    w.open(selectPort(), 115200)
    w.remoteExec('\x04')
    app.exec_()
Exemple #5
0
 def __init__(self, files, verbose):
     logger.setup(verbose=verbose)
     _logger().info('QIdle v%s', self.version_str)
     self.windows = []
     self.qapp = QtWidgets.QApplication(sys.argv)
     icons.init()
     self._init_libraries()
     self.recent_files_manager = RecentFilesManager(*Preferences.names)
     self._current = None
     self.qapp.focusChanged.connect(self.on_focus_changed)
     self._setup_custom_mimetypes()
Exemple #6
0
    def __init__(self, parse_args=True):
        if hasattr(sys, 'frozen') and sys.platform == 'win32':
            sys.stdout = open(
                os.path.join(system.get_cache_directory(), 'ocide_stdout.log'),
                'w')
            sys.stderr = open(
                os.path.join(system.get_cache_directory(), 'ocide_stderr.log'),
                'w')
        self.init_env()
        self.app = QtWidgets.QApplication(sys.argv)
        if parse_args and not system.darwin:
            args = self.parse_args()
            verbose = args.verbose
            files = args.files
        else:
            verbose = False
            files = []
        logger.setup_logging(__version__, debug=verbose or Settings().verbose)
        self.name = 'OpenCobolIDE'
        self.version = __version__
        self.title = '%s %s' % (self.name, self.version)

        self.apply_mimetypes_preferences()

        self.win = MainWindow()
        self.win.setWindowTitle(self.title)
        self.file = FileController(self)
        self.view = ViewController(self)
        self.home = HomeController(self)
        self.edit = EditController(self)
        self.cobol = CobolController(self)
        self.help = HelpController(self)

        self.view.show_perspective(Settings().perspective)
        self.view.show_home_page()

        self.update_app_style()

        try:
            check_compiler()
        except CompilerNotFound as e:
            QtWidgets.QMessageBox.warning(
                self.win, 'COBOL compiler not found',
                'Failed to find GnuCOBOL compiler!\n\n%s\n\n'
                "The IDE will continue to work but you won't be able to "
                'compile any file...' % e)
        else:
            _logger().info('GnuCOBOL version: %s',
                           GnuCobolCompiler.get_version())
        # open specified files
        for f in files:
            self.file.open_file(f)
Exemple #7
0
def main():
    app = QtWidgets.QApplication(sys.argv)
    app.setQuitOnLastWindowClosed(True)
    splash = QtWidgets.QSplashScreen()
    splash.setPixmap(about_pixmap())
    splash.show()

    def do_app():
        splash.close()
        w = MainWindow()
        w.show()
    QtCore.QTimer.singleShot(2000, do_app)
    sys.exit(app.exec_())
Exemple #8
0
def main():
    app = QtWidgets.QApplication(sys.argv)

    # create editor and window
    window = QtWidgets.QMainWindow()
    editor = GenericCodeEdit()

    # open a file
    editor.file.open(__file__)
    window.setCentralWidget(editor)

    # run
    window.show()
    app.exec_()
    editor.file.close()
Exemple #9
0
    def __init__(self, parse_args=True):
        self.init_env()
        if parse_args and not system.darwin:
            args = self.parse_args()
            verbose = args.verbose
            files = args.files
        else:
            verbose = False
            files = []
        logger.setup_logging(__version__, debug=verbose or Settings().verbose)
        self.name = 'OpenCobolIDE'
        self.version = __version__
        self.title = '%s %s' % (self.name, self.version)
        self.app = QtWidgets.QApplication(sys.argv)
        self.win = MainWindow()
        self.win.setWindowTitle(self.title)
        self.file = FileController(self)
        self.view = ViewController(self)
        self.home = HomeController(self)
        self.edit = EditController(self)
        self.cobol = CobolController(self)
        self.help = HelpController(self)

        self.win.show()
        self.view.show_perspective(Settings().perspective)
        self.view.show_home_page()

        self.update_app_style()

        try:
            check_compiler()
        except CompilerNotFound as e:
            QtWidgets.QMessageBox.warning(
                self.win, 'Cobol compiler not found',
                'Failed to find GnuCobol compiler!\n\n%s.\n\n'
                "The IDE will continue to work but you won't be able to "
                'compile any file' % e)

        # open specified files
        for f in files:
            self.file.open_file(f)
Exemple #10
0
def main():
    app = QtWidgets.QApplication(sys.argv)
    window = QtWidgets.QMainWindow()

    # configure editor (see examples/simple/basic.py)
    editor = api.CodeEdit()
    editor.file.open(__file__)
    editor.modes.append(modes.CaretLineHighlighterMode())
    editor.modes.append(modes.PygmentsSyntaxHighlighter(editor.document()))
    editor.panels.append(panels.SearchAndReplacePanel(),
                         api.Panel.Position.TOP)
    window.setCentralWidget(editor)
    window.show()

    # Change action properties
    editor.action_duplicate_line.setShortcut('Ctrl+Shift+Down')
    editor.action_duplicate_line.setText('DUPLICATE LINE')

    app.exec_()
    editor.file.close()
    del editor
    del window
    del app
Exemple #11
0
"""
Minimal example showing the use of the ExtendedSelectionMode.
"""
import logging

logging.basicConfig(level=logging.DEBUG)
import sys
import os

os.environ['QT_API'] = 'pyside2'
# os.environ['QT_API'] = 'pyqt5'

from pyqode.qt import QtWidgets
from pyqode.core.api import CodeEdit
from pyqode.core.backend import server
from pyqode.core.modes import ExtendedSelectionMode

if __name__ == '__main__':
    app = QtWidgets.QApplication(sys.argv)
    editor = CodeEdit()
    editor.backend.start(server.__file__)
    editor.resize(800, 600)
    print(editor.modes.append(ExtendedSelectionMode()))
    editor.file.open(__file__)
    editor.show()
    app.exec_()
    editor.close()
    del editor
    del app
Exemple #12
0
"""
This example show you how to use the Terminal widget
"""
from pyqode.qt import QtWidgets

from pyqode.core.widgets import Terminal

if __name__ == '__main__':
    app = QtWidgets.QApplication([])
    win = Terminal()
    win.resize(800, 600)
    win.show()
    app.exec_()
Exemple #13
0
    def __init__(self, parse_args=True):
        super().__init__()
        if system.darwin:
            Application._osx_init()
        self._reported_tracebacks = []
        self._old_except_hook = sys.excepthook
        sys.excepthook = self._except_hook
        self._report_exception_requested.connect(self._report_exception)
        if hasattr(sys, 'frozen') and sys.platform == 'win32':
            sys.stdout = open(
                os.path.join(system.get_cache_directory(), 'ocide_stdout.log'),
                'w')
            sys.stderr = open(
                os.path.join(system.get_cache_directory(), 'ocide_stderr.log'),
                'w')
        self.app = QtWidgets.QApplication(sys.argv)
        if parse_args and not system.darwin:
            args = self.parse_args()
            verbose = args.verbose
            files = args.files
        else:
            verbose = False
            files = []
        logger.setup_logging(__version__, debug=verbose or Settings().verbose)
        self.name = 'OpenCobolIDE'
        self.version = __version__
        self.title = '%s %s' % (self.name, self.version)

        self.apply_mimetypes_preferences()

        self.win = MainWindow()
        self.win.setWindowTitle(self.title)
        self.file = FileController(self)
        self.view = ViewController(self)
        self.home = HomeController(self)
        self.edit = EditController(self)
        self.cobol = CobolController(self)
        self.help = HelpController(self)

        self.view.show_perspective(Settings().perspective)
        self.view.show_home_page()

        self.update_app_style()

        try:
            check_compiler()
        except CompilerNotFound:
            msg = 'Failed to find a working GnuCOBOL compiler!\n' \
                "The IDE will continue to work but you won't be able to " \
                'compile...'
            if system.windows:
                msg += '\n\nTip: Ensure that there is no additional ' \
                    'installation of MinGW in %s:\MinGW' % sys.executable[0]
            QtWidgets.QMessageBox.warning(
                self.win, 'COBOL compiler not found or not working', msg)
        else:
            _logger().info('GnuCOBOL version: %s',
                           GnuCobolCompiler.get_version())
        # open specified files
        for f in files:
            self.file.open_file(f)