def __init__(self, parent=None): super().__init__(parent) self.setupUi(self) self.checkBoxVerbose.setChecked(Settings().verbose) self.tabWidget.setCurrentIndex(0) self.tbwVersions.setColumnCount(1) self.tbwVersions.setRowCount(len(self.HEADERS)) self.tbwVersions.setVerticalHeaderLabels(self.HEADERS) self.tbwVersions.setHorizontalHeaderLabels(['Version']) self.tbwVersions.verticalHeader().setStretchLastSection(False) self.labelMain.setText(self.labelMain.text() % __version__) self.setMinimumWidth(640) self.setMinimumHeight(480) self.setWindowIcon(QtGui.QIcon.fromTheme( 'help-about', QtGui.QIcon( ':/ide-icons/rc/dialog-information.png'))) try: import qdarkstyle except ImportError: qdarkstyle_version = 'Not installed' else: qdarkstyle_version = qdarkstyle.__version__ versions = [GnuCobolCompiler().get_version(), QtCore.QT_VERSION_STR, QtCore.PYQT_VERSION_STR, pyqode.core.__version__, pyqode.cobol.__version__, pygments.__version__, qdarkstyle_version] for i, version in enumerate(versions): item = QtWidgets.QTableWidgetItem(version) self.tbwVersions.setItem(i, 0, item) with open(logger.get_path(), 'r') as f: self.textEditLog.setText(f.read()) self.checkBoxVerbose.toggled.connect(self._on_verbose_toggled)
def __init__(self, parent=None): super().__init__(parent) self.setupUi(self) self.checkBoxVerbose.setChecked(Settings().verbose) self.tabWidget.setCurrentIndex(0) self.tbwVersions.setColumnCount(1) self.tbwVersions.setRowCount(len(self.HEADERS)) self.tbwVersions.setVerticalHeaderLabels(self.HEADERS) self.tbwVersions.setHorizontalHeaderLabels(['Version']) self.tbwVersions.verticalHeader().setStretchLastSection(False) self.labelMain.setText(self.labelMain.text() % __version__) self.setMinimumWidth(640) self.setMinimumHeight(480) self.setWindowIcon( QtGui.QIcon.fromTheme( 'help-about', QtGui.QIcon(':/ide-icons/rc/dialog-information.png'))) try: import qdarkstyle except ImportError: qdarkstyle_version = 'Not installed' else: qdarkstyle_version = qdarkstyle.__version__ versions = [ GnuCobolCompiler().get_version(), QtCore.QT_VERSION_STR, QtCore.PYQT_VERSION_STR, pyqode.core.__version__, pyqode.cobol.__version__, pygments.__version__, qdarkstyle_version ] for i, version in enumerate(versions): item = QtWidgets.QTableWidgetItem(version) self.tbwVersions.setItem(i, 0, item) with open(logger.get_path(), 'r') as f: self.textEditLog.setText(f.read()) self.checkBoxVerbose.toggled.connect(self._on_verbose_toggled) self.edit_compiler_infos.setFont(QtGui.QFont(Settings().font, 9)) # from pyqode.core._forms.pyqode_core_rc QtGui.QFontDatabase.addApplicationFont( ':/fonts/rc/SourceCodePro-Regular.ttf') QtGui.QFontDatabase.addApplicationFont( ':/fonts/rc/SourceCodePro-Bold.ttf') template = '''cobc --info ============ %(cobc_infos)s cobcrun --runtime-env ===================== %(cobcrun_infos)s ''' gnucobol_infos = template % { 'cobc_infos': GnuCobolCompiler.get_cobc_infos(), 'cobcrun_infos': GnuCobolCompiler.get_cobcrun_infos() } self.edit_compiler_infos.setPlainText(gnucobol_infos)
def __init__(self, parent=None): super().__init__(parent) self.setupUi(self) self.checkBoxVerbose.setChecked(Settings().verbose) self.tabWidget.setCurrentIndex(0) self.tbwVersions.setColumnCount(1) self.tbwVersions.setRowCount(len(self.HEADERS)) self.tbwVersions.setVerticalHeaderLabels(self.HEADERS) self.tbwVersions.setHorizontalHeaderLabels(["Version"]) self.tbwVersions.verticalHeader().setStretchLastSection(False) self.labelMain.setText(self.labelMain.text() % __version__) self.setMinimumWidth(640) self.setMinimumHeight(480) self.setWindowIcon(QtGui.QIcon.fromTheme("help-about", QtGui.QIcon(":/ide-icons/rc/dialog-information.png"))) try: import qdarkstyle except ImportError: qdarkstyle_version = "Not installed" else: qdarkstyle_version = qdarkstyle.__version__ versions = [ GnuCobolCompiler().get_version(), QtCore.QT_VERSION_STR, QtCore.PYQT_VERSION_STR, pyqode.core.__version__, pyqode.cobol.__version__, pygments.__version__, qdarkstyle_version, ] for i, version in enumerate(versions): item = QtWidgets.QTableWidgetItem(version) self.tbwVersions.setItem(i, 0, item) with open(logger.get_path(), "r") as f: self.textEditLog.setText(f.read()) self.checkBoxVerbose.toggled.connect(self._on_verbose_toggled) self.edit_compiler_infos.setFont(QtGui.QFont(Settings().font, 9)) # from pyqode.core._forms.pyqode_core_rc QtGui.QFontDatabase.addApplicationFont(":/fonts/rc/SourceCodePro-Regular.ttf") QtGui.QFontDatabase.addApplicationFont(":/fonts/rc/SourceCodePro-Bold.ttf") template = """cobc --info ============ %(cobc_infos)s cobcrun --runtime-env ===================== %(cobcrun_infos)s """ gnucobol_infos = template % { "cobc_infos": GnuCobolCompiler.get_cobc_infos(), "cobcrun_infos": GnuCobolCompiler.get_cobcrun_infos(), } self.edit_compiler_infos.setPlainText(gnucobol_infos)
def get_application_log(self): try: with open(logger.get_path(), 'r') as f: content = f.read() lines = [] for l in content.splitlines(): if l.strip(): lines.append(l) return '\n'.join(lines[-100:]) except FileNotFoundError: return ''
def __init__(self, parent=None): super().__init__(parent) self.setupUi(self) self.tabWidget.setCurrentIndex(0) self.tbwVersions.setColumnCount(1) self.tbwVersions.setRowCount(len(self.HEADERS)) self.tbwVersions.setVerticalHeaderLabels(self.HEADERS) self.tbwVersions.setHorizontalHeaderLabels(['Version']) self.tbwVersions.verticalHeader().setStretchLastSection(False) self.labelMain.setText(self.labelMain.text() % __version__) self.setMinimumWidth(640) self.setMinimumHeight(480) self.setWindowIcon( QtGui.QIcon.fromTheme( 'help-about', QtGui.QIcon(':/ide-icons/rc/dialog-information.png'))) for i, (name, version) in enumerate( sorted(list(DlgAbout.get_runtime_env().items()), key=lambda x: x[0])): item = QtWidgets.QTableWidgetItem(name) self.tbwVersions.setVerticalHeaderItem(i, item) item = QtWidgets.QTableWidgetItem(version) self.tbwVersions.setItem(i, 0, item) try: with open(logger.get_path(), 'r') as f: self.textEditLog.setPlainText('\n'.join( f.read().splitlines()[-1000:])) except FileNotFoundError: self.textEditLog.setPlainText('') self.edit_compiler_infos.setFont(QtGui.QFont(Settings().font, 9)) # from pyqode.core._forms.pyqode_core_rc QtGui.QFontDatabase.addApplicationFont( ':/fonts/rc/SourceCodePro-Regular.ttf') QtGui.QFontDatabase.addApplicationFont( ':/fonts/rc/SourceCodePro-Bold.ttf') self.edit_compiler_infos.setPlainText(DlgAbout.get_cobc_runtime_env()) try: name = LEVEL_NAMES[Settings().log_level] except KeyError: name = 'INFO' self.combo_log_level.setCurrentText(name) self.combo_log_level.currentIndexChanged.connect( self._on_log_level_changed) self.bt_clear_logs.clicked.connect(self._clear_logs)
def __init__(self, parent=None): super().__init__(parent) self.setupUi(self) self.checkBoxVerbose.setChecked(Settings().verbose) self.tabWidget.setCurrentIndex(0) self.tbwVersions.setColumnCount(1) self.tbwVersions.setRowCount(len(self.HEADERS)) self.tbwVersions.setVerticalHeaderLabels(self.HEADERS) self.tbwVersions.setHorizontalHeaderLabels(['Version']) self.tbwVersions.verticalHeader().setStretchLastSection(False) self.labelMain.setText(self.labelMain.text() % __version__) self.setMinimumWidth(640) self.setMinimumHeight(480) self.setWindowIcon(QtGui.QIcon.fromTheme( 'help-about', QtGui.QIcon( ':/ide-icons/rc/dialog-information.png'))) for i, (name, version) in enumerate( sorted(DlgAbout.get_runtime_env().items(), key=lambda x: x[0])): item = QtWidgets.QTableWidgetItem(name) self.tbwVersions.setVerticalHeaderItem(i, item) item = QtWidgets.QTableWidgetItem(version) self.tbwVersions.setItem(i, 0, item) try: with open(logger.get_path(), 'r') as f: self.textEditLog.setPlainText( '\n'.join(f.read().splitlines()[-1000:])) except FileNotFoundError: self.textEditLog.setText('') self.checkBoxVerbose.toggled.connect(self._on_verbose_toggled) self.edit_compiler_infos.setFont( QtGui.QFont(Settings().font, 9)) # from pyqode.core._forms.pyqode_core_rc QtGui.QFontDatabase.addApplicationFont( ':/fonts/rc/SourceCodePro-Regular.ttf') QtGui.QFontDatabase.addApplicationFont( ':/fonts/rc/SourceCodePro-Bold.ttf') self.edit_compiler_infos.setPlainText(DlgAbout.get_cobc_runtime_env()) self.bt_clear_logs.clicked.connect(self._clear_logs)
def get_application_log(self): with open(logger.get_path(), 'r') as f: return f.read()