def main(): if hasattr(sys, 'frozen'): sys.stdout = open('pynotepad_stdout.txt', 'w') sys.stderr = open('pynotepad_stderr.txt', 'w') app = QApplication(sys.argv) if not Settings().interpreter: Settings().interpreter = sys.executable win = MainWindow() win.show() app.exec_()
def main(): from pyqode.qt.QtWidgets import QApplication import sys app = QApplication(sys.argv) #win = EditImageWindow("/home/wgryglas/test-edit.png") win = EditImageWindow( "/home/wgryglas/Downloads/car-17-boundary-conditions-right-turbulence.png" ) win.show() sys.exit(app.exec_())
def pytest_runtest_setup(item): """ Display test method name in active window title bar ;param item: test item to run """ from pyqode.qt.QtWidgets import QApplication global EDITOR, APP if APP is None: APP = QApplication(sys.argv) module, line, method = item.location module = module.replace('.py', '.') title = module + method widgets = QApplication.instance().topLevelWidgets() for w in widgets: w.setWindowTitle(title) logging.info("------------------- %s -------------------", title)
def pytest_runtest_setup(item): """ Display test method name in active window title bar """ global _widget module, line, method = item.location module = module.replace('.py', '.') title = module + method widgets = QApplication.instance().topLevelWidgets() for w in widgets: w.setWindowTitle(title) logging.info("------------------- %s -------------------", title)
def main(): import logging import sys from pyqode.qt.QtWidgets import QApplication from UI import MainWindow # Logging filename = None if sys.platform == 'win32': filename = 'PyCreator.log' logging.basicConfig(level=logging.INFO, filename=filename) # save log to file app = QApplication(sys.argv) # ~To Do~ # create a function to set the style by passing in the app object # or load style sheet from file? app.setStyle('Fusion') # Needed to make dark theme look right win = MainWindow() win.show() sys.exit(app.exec_())
def keyPressEvent(self, event): ctrl = event.modifiers() & Qt.ControlModifier != 0 if not self.is_running or self.textCursor().hasSelection(): if event.key() == Qt.Key_C and ctrl: self.copy() return propagate_to_parent = True delete = event.key() in [Qt.Key_Backspace, Qt.Key_Delete] if delete and not self._usr_buffer: return if event.key() == Qt.Key_V and ctrl: # Paste to usr buffer text = QApplication.clipboard().text() self._usr_buffer += text self.setTextColor(self._stdin_col) if self._mask_user_input: text = len(text) * '*' self.insertPlainText(text) return if event.key() in [Qt.Key_Return, Qt.Key_Enter]: # send the user input to the child process if sys.platform == 'win32': self._usr_buffer += "\r" self._usr_buffer += "\n" self.process.write(self.get_user_buffer_as_bytes()) self._usr_buffer = "" else: if not delete and len(event.text()): txt = event.text() self._usr_buffer += txt if self._mask_user_input: txt = '*' self.setTextColor(self._stdin_col) self.insertPlainText(txt) propagate_to_parent = False elif delete: self._usr_buffer = self._usr_buffer[:len(self._usr_buffer) - 1] # text is inserted here, the text color must be defined before this # line if propagate_to_parent: super(InteractiveConsole, self).keyPressEvent(event) self.setTextColor(self._stdout_col)
def main(): app = QApplication(sys.argv) win = MainWindow() win.show() app.exec_()
""" if isinstance(item, item.Function): logging.info("------------------- %s -------------------", item.name) # ------------------- # Setup logging # ------------------- logging.basicConfig(level=logging.INFO, filename='pytest.log', filemode='w') # ------------------- # Setup QApplication # ------------------- # 2. create qt application print('isinstanciating QApplication') _app = QApplication(sys.argv) _widget = None # ------------------- # Session fixtures # ------------------- @pytest.fixture(scope="session") def app(request): global _app return app @pytest.fixture(scope="session") def editor(request): import gettext
def main(): app = QApplication(sys.argv) root = MainWindow() root.show() sys.exit(app.exec_())