def closeEvent(self, event): """Saves some global settings before closing.""" if self.s_listener: self.s_listener.close() main_container = self.get_service("main_container") unsaved_files = self._get_unsaved_files() if (settings.CONFIRM_EXIT and unsaved_files): txt = '\n'.join(unsaved_files) val = QMessageBox.question(self, translations.TR_IDE_CONFIRM_EXIT_TITLE, (translations.TR_IDE_CONFIRM_EXIT_BODY % {'files': txt}), QMessageBox.Yes, QMessageBox.No, QMessageBox.Cancel) if val == QMessageBox.Yes: #Saves all open files self._save_unsaved_files(unsaved_files) if val == QMessageBox.Cancel: event.ignore() return self.save_settings() self.emit(SIGNAL("goingDown()")) #close python documentation server (if running) main_container.close_python_doc() #Shutdown PluginManager self.plugin_manager.shutdown() completion_daemon.shutdown_daemon() super(IDE, self).closeEvent(event)
def analyze_file(self, path, source=None, indent=settings.INDENT, useTabs=settings.USE_TABS): if source is None: with open(path) as f: source = f.read() split_last_lines = source.rsplit('\n', 2) if len(split_last_lines) > 1 and \ split_last_lines[-2].endswith(':') and split_last_lines[-1] == '': indent = helpers.get_indentation(split_last_lines[-2], indent, useTabs) source += '%spass;' % indent self.module_id = path if not self.cdaemon.daemon.is_alive(): completion_daemon.shutdown_daemon() del self.cdaemon self.cdaemon = completion_daemon.CompletionDaemon() # Set modules reference to model model.MODULES = self.cdaemon.modules module = self.cdaemon.get_module(self.module_id) module = self.analyzer.analyze(source, module) self.cdaemon.inspect_module(self.module_id, module)
def closeEvent(self, event): """Saves some global settings before closing.""" if self.s_listener: self.s_listener.close() main_container = self.get_service("main_container") unsaved_files = self._get_unsaved_files() if (settings.CONFIRM_EXIT and unsaved_files): txt = '\n'.join(unsaved_files) val = QMessageBox.question(self, self.tr("Some changes were not saved"), (self.tr("%s\n\nDo you want to save them?") % txt), QMessageBox.Yes, QMessageBox.No, QMessageBox.Cancel) if val == QMessageBox.Yes: #Saves all open files self._save_unsaved_files(unsaved_files) if val == QMessageBox.Cancel: event.ignore() return self.emit(SIGNAL("goingDown()")) self.save_settings() #close python documentation server (if running) main_container.close_python_doc() #Shutdown PluginManager self.plugin_manager.shutdown() completion_daemon.shutdown_daemon() super(IDE, self).closeEvent(event)
def closeEvent(self, event): """Saves some global settings before closing.""" if self.s_listener: self.s_listener.close() main_container = self.get_service("main_container") unsaved_files = self._get_unsaved_files() if (settings.CONFIRM_EXIT and unsaved_files): txt = '\n'.join(unsaved_files) val = QMessageBox.question( self, translations.TR_IDE_CONFIRM_EXIT_TITLE, (translations.TR_IDE_CONFIRM_EXIT_BODY % { 'files': txt }), QMessageBox.Yes, QMessageBox.No, QMessageBox.Cancel) if val == QMessageBox.Yes: #Saves all open files self._save_unsaved_files(unsaved_files) if val == QMessageBox.Cancel: event.ignore() return self.save_settings() self.emit(SIGNAL("goingDown()")) #close python documentation server (if running) main_container.close_python_doc() #Shutdown PluginManager self.plugin_manager.shutdown() completion_daemon.shutdown_daemon() super(IDE, self).closeEvent(event)
def closeEvent(self, event): """Saves some global settings before closing.""" if self.s_listener: self.s_listener.close() main_container = self.get_service("main_container") unsaved_files = self._get_unsaved_files() if (settings.CONFIRM_EXIT and unsaved_files): txt = '\n'.join(unsaved_files) val = QMessageBox.question( self, self.tr("Some changes were not saved"), (self.tr("%s\n\nDo you want to save them?") % txt), QMessageBox.Yes, QMessageBox.No, QMessageBox.Cancel) if val == QMessageBox.Yes: #Saves all open files self._save_unsaved_files(unsaved_files) if val == QMessageBox.Cancel: event.ignore() return self.emit(SIGNAL("goingDown()")) self.save_settings() #close python documentation server (if running) main_container.close_python_doc() #Shutdown PluginManager self.plugin_manager.shutdown() completion_daemon.shutdown_daemon() super(IDE, self).closeEvent(event)
def analyze_file(self, path, source=None): if source is None: with open(path) as f: source = f.read() split_last_lines = source.rsplit('\n', 2) if len(split_last_lines) > 1 and \ split_last_lines[-2].endswith(':') and split_last_lines[-1] == '': indent = helpers.get_indentation(split_last_lines[-2]) source += '%spass;' % indent self.module_id = path if not self.cdaemon.daemon.is_alive(): completion_daemon.shutdown_daemon() del self.cdaemon self.cdaemon = completion_daemon.CompletionDaemon() # Set modules reference to model model.MODULES = self.cdaemon.modules module = self.cdaemon.get_module(self.module_id) module = self.analyzer.analyze(source, module) self.cdaemon.inspect_module(self.module_id, module)
def closeEvent(self, event): if self.s_listener: self.s_listener.close() if settings.CONFIRM_EXIT and \ self.mainContainer.check_for_unsaved_tabs(): unsaved_files = self.mainContainer.get_unsaved_files() txt = '\n'.join(unsaved_files) val = QMessageBox.question( self, self.tr("Some changes were not saved"), self.tr("%s\n\nDo you want to exit anyway?" % txt), QMessageBox.Yes, QMessageBox.No) if val == QMessageBox.No: event.ignore() QApplication.instance().setCursorFlashTime(cursor_flash_time) self.emit(SIGNAL("goingDown()")) self.save_settings() completion_daemon.shutdown_daemon() #close python documentation server (if running) self.mainContainer.close_python_doc() #Shutdown PluginManager self.plugin_manager.shutdown()
def closeEvent(self, event): if self.s_listener: self.s_listener.close() if settings.CONFIRM_EXIT and \ self.mainContainer.check_for_unsaved_tabs(): unsaved_files = self.mainContainer.get_unsaved_files() txt = '\n'.join(unsaved_files) val = QMessageBox.question(self, self.tr("Some changes were not saved"), self.tr("%s\n\nDo you want to exit anyway?" % txt), QMessageBox.Yes, QMessageBox.No) if val == QMessageBox.No: event.ignore() QApplication.instance().setCursorFlashTime(cursor_flash_time) self.emit(SIGNAL("goingDown()")) self.save_settings() completion_daemon.shutdown_daemon() #close python documentation server (if running) self.mainContainer.close_python_doc() #Shutdown PluginManager self.plugin_manager.shutdown()
def closeEvent(self, event): if self.s_listener: self.s_listener.close() if (settings.CONFIRM_EXIT and self.mainContainer.check_for_unsaved_tabs()): unsaved_files = self.mainContainer.get_unsaved_files() txt = '\n'.join(unsaved_files) self.CloseHideAllWindow(False) val = QMessageBox.question(self, self.tr("Some changes were not saved"), (self.tr("%s\n\nDo you want to save them?") % txt), QMessageBox.Yes, QMessageBox.No, QMessageBox.Cancel) ''' msgBox = QMessageBox() msgBox.setWindowTitle("QMessageBox Always On Top") msgBox.setText("This is an always-on-top QMessageBox!") msgBox.setWindowFlags(Qt.WindowStaysOnTopHint) msgBox.show() ''' #val.setWindowFlags(Qt.WindowStaysOnTopHint) if val == QMessageBox.Yes: #Saves all open files self.mainContainer.save_all() if val == QMessageBox.Cancel: event.ignore() return self.emit(SIGNAL("goingDown()")) self.save_settings() completion_daemon.shutdown_daemon() #close python documentation server (if running) self.mainContainer.close_python_doc() #Shutdown PluginManager self.plugin_manager.shutdown() self.CloseHideAllWindow(True)
def closeEvent(self, event): if self.s_listener: self.s_listener.close() if (settings.CONFIRM_EXIT and self.mainContainer.check_for_unsaved_tabs()): unsaved_files = self.mainContainer.get_unsaved_files() txt = '\n'.join(unsaved_files) self.CloseHideAllWindow(False) val = QMessageBox.question( self, self.tr("Some changes were not saved"), (self.tr("%s\n\nDo you want to save them?") % txt), QMessageBox.Yes, QMessageBox.No, QMessageBox.Cancel) ''' msgBox = QMessageBox() msgBox.setWindowTitle("QMessageBox Always On Top") msgBox.setText("This is an always-on-top QMessageBox!") msgBox.setWindowFlags(Qt.WindowStaysOnTopHint) msgBox.show() ''' #val.setWindowFlags(Qt.WindowStaysOnTopHint) if val == QMessageBox.Yes: #Saves all open files self.mainContainer.save_all() if val == QMessageBox.Cancel: event.ignore() return self.emit(SIGNAL("goingDown()")) self.save_settings() completion_daemon.shutdown_daemon() #close python documentation server (if running) self.mainContainer.close_python_doc() #Shutdown PluginManager self.plugin_manager.shutdown() self.CloseHideAllWindow(True)
def closeEvent(self, event): if self.s_listener: self.s_listener.close() if (settings.CONFIRM_EXIT and self.mainContainer.check_for_unsaved_tabs()): unsaved_files = self.mainContainer.get_unsaved_files() txt = '\n'.join(unsaved_files) val = QMessageBox.question(self, self.tr("Some changes were not saved"), (self.tr("%s\n\nDo you want to save them?") % txt), QMessageBox.Yes, QMessageBox.No, QMessageBox.Cancel) if val == QMessageBox.Yes: #Saves all open files self.mainContainer.save_all() if val == QMessageBox.Cancel: event.ignore() self.emit(SIGNAL("goingDown()")) self.save_settings() completion_daemon.shutdown_daemon() #close python documentation server (if running) self.mainContainer.close_python_doc() #Shutdown PluginManager self.plugin_manager.shutdown()
def tearDown(self): completion_daemon.shutdown_daemon()
# You should have received a copy of the GNU General Public License # along with NINJA-IDE; If not, see <http://www.gnu.org/licenses/>. from __future__ import absolute_import import _ast import time import unittest from ninja_ide.tools.completion import analyzer from ninja_ide.tools.completion import model from ninja_ide.tools.completion import code_completion from ninja_ide.tools.completion import completion_daemon from tests.tools.completion import get_source_data, SOURCE_LATE_RESOLUTION, SOURCE_INHERITANCE completion_daemon.shutdown_daemon() completion_daemon.WAITING_BEFORE_START = 0 class AnalyzerLateResolutionTestCase(unittest.TestCase): def setUp(self): code_completion.settings.SYNTAX = {"python": {"keywords": []}} self.cc = code_completion.CodeCompletion() self.analyzer = analyzer.Analyzer() def tearDown(self): completion_daemon.shutdown_daemon() ############################################################################### # For Python Imports ###############################################################################
# along with NINJA-IDE; If not, see <http://www.gnu.org/licenses/>. from __future__ import absolute_import import _ast import time import unittest from ninja_ide.tools.completion import analyzer from ninja_ide.tools.completion import model from ninja_ide.tools.completion import code_completion from ninja_ide.tools.completion import completion_daemon from ninja_tests.tools.completion import (get_source_data, SOURCE_LATE_RESOLUTION, SOURCE_INHERITANCE) completion_daemon.shutdown_daemon() completion_daemon.WAITING_BEFORE_START = 0 class AnalyzerLateResolutionTestCase(unittest.TestCase): def setUp(self): code_completion.settings.SYNTAX = {'python': {'keywords': []}} self.cc = code_completion.CodeCompletion() self.analyzer = analyzer.Analyzer() def tearDown(self): completion_daemon.shutdown_daemon() ############################################################################### # For Python Imports