def main(): """ Application entry point. """ app = Application() ret_code = app.run() app.close() return ret_code
def _check_compiler(self, *_): from open_cobol_ide.app import Application self.apply() Application.init_env() pth = self.lineEditCompilerPath.text() if os.path.exists(pth): p = QtCore.QProcess() p.start(pth, ["--version"]) p.waitForFinished() output = bytes(p.readAllStandardOutput()).decode(locale.getpreferredencoding()) DlgCheckCompiler.check(self, pth, output) else: QtWidgets.QMessageBox.warning( self, "Invalid compiler path", "Not a valid compiler path, path does not exists: %s!" % pth )
def _check_compiler(self, *_): from open_cobol_ide.app import Application self.apply() Application.init_env() pth = self.lineEditCompilerPath.text() if os.path.exists(pth): p = QtCore.QProcess() p.start(pth, ['--version']) p.waitForFinished() output = bytes(p.readAllStandardOutput()).decode( locale.getpreferredencoding()) DlgCheckCompiler.check(self, pth, output) else: QtWidgets.QMessageBox.warning( self, 'Invalid compiler path', 'Not a valid compiler path, path does not exists: %s!' % pth)
def main(): """ Application entry point. """ if not hasattr(sys, 'frozen'): override_sys_path() from pyqode.qt import QtGui from open_cobol_ide import system from open_cobol_ide.app import Application from open_cobol_ide.settings import Settings if system.linux: QtGui.QIcon.setThemeName(Settings().icon_theme) app = Application() ret_code = app.run() app.close() return ret_code
def main(): """ Application entry point. """ dev_mode = os.environ.get('OCIDE_DEV_MODE') if not hasattr(sys, 'frozen') and dev_mode is None: override_sys_path() from pyqode.qt import QtGui from open_cobol_ide import system from open_cobol_ide.app import Application from open_cobol_ide.settings import Settings app = Application() if system.linux: QtGui.QIcon.setThemeName(Settings().icon_theme) ret_code = app.run() app.close() return ret_code
def lint(request_data): """ Performs linting of a COBOL document. This method will perform on the pyqode backend. :param request_data: work request data (dict) :return: status, messages """ from open_cobol_ide.app import Application Application.init_env() code = request_data['code'] path = request_data['path'] extension = os.path.splitext(path)[1] if extension.lower() in settings.Settings().cobc_extensions: # code might not have been saved yet, run cobc on a tmp file # we use a time stamp to avoid overwriting the file another cobc # instance might be compiling. file_name = os.path.split(path)[1] file_name, ext = os.path.splitext(file_name) tmp_name = '%s.%s%s' % (file_name, str(int(time.time())), ext) tmp_pth = os.path.join(tempfile.gettempdir(), tmp_name) with open(tmp_pth, 'w') as f: f.write(code) compiler = GnuCobolCompiler() pgm, args = make_linter_command(tmp_name, path) process = QtCore.QProcess() process.setWorkingDirectory(os.path.dirname(tmp_pth)) process.setProcessChannelMode(QtCore.QProcess.MergedChannels) print('linter command: %s %s' % (pgm, ' '.join(args))) print('working directory: %s' % process.workingDirectory()) process.start(pgm, args) process.waitForFinished() output = process.readAllStandardOutput().data().decode( locale.getpreferredencoding()) print('linter raw output: %s' % output) messages = compiler.parse_output(output, tmp_name) print('linter parsed output: %r' % messages) os.remove(tmp_pth) return messages return []
def lint(request_data): """ Performs linting of a cobol document. This method will perform on the pyqode backend. :param request_data: work request data (dict) :return: status, messages """ from open_cobol_ide.app import Application Application.init_env() code = request_data['code'] path = request_data['path'] extension = os.path.splitext(path)[1] if extension.lower() in settings.Settings().cobc_extensions: # code might not have been saved yet, run cobc on a tmp file # we use a time stamp to avoid overwriting the file another cobc # instance might be compiling. file_name = os.path.split(path)[1] file_name, ext = os.path.splitext(file_name) tmp_name = '%s.%s%s' % (file_name, str(int(time.time())), ext) tmp_pth = os.path.join(tempfile.gettempdir(), tmp_name) with open(tmp_pth, 'w') as f: f.write(code) compiler = GnuCobolCompiler() pgm, args = make_linter_command(tmp_name, path) process = QtCore.QProcess() process.setWorkingDirectory(os.path.dirname(tmp_pth)) process.setProcessChannelMode(QtCore.QProcess.MergedChannels) print('linter command: %s %s' % (pgm, ' '.join(args))) print('working directory: %s' % process.workingDirectory()) process.start(pgm, args) process.waitForFinished() output = process.readAllStandardOutput().data().decode( locale.getpreferredencoding()) print('linter raw output: %s' % output) messages = compiler.parse_output(output, tmp_name) print('linter parsed output: %r' % messages) os.remove(tmp_pth) return messages return []
def app(request): global _app # always starts with default settings s = Settings() s.clear() s.perspective = 'default' _app = Application(parse_args=False) def fin(): global _app _app.exit() del _app # _app.win.hide() request.addfinalizer(fin) return _app