def __init__(self, locator, metadata=None): QObject.__init__(self) self.locator = locator if metadata is None: self.metadata = {} else: self.metadata = metadata klass = self.__class__ plugin_name = "%s.%s" % (klass.__module__, klass.__name__) self.logger = NinjaLogger('ninja_ide.plugins.%s' % plugin_name) # set the path! try: self_module = self.__module__ path = os.path.abspath(sys.modules[self_module].__file__) self._path = os.path.dirname(path) except BaseException: self._path = ''
# GNU General Public License for more details. # # 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 os from PyQt4.QtCore import QThread from pyinotify import ProcessEvent, IN_CREATE, IN_DELETE, IN_DELETE_SELF, \ IN_MODIFY, WatchManager, Notifier, ExcludeFilter from ninja_ide.tools.logger import NinjaLogger logger = NinjaLogger('ninja_ide.core.filesystem_notifications.linux') DEBUG = logger.debug from ninja_ide.core.filesystem_notifications import base_watcher ADDED = base_watcher.ADDED DELETED = base_watcher.DELETED REMOVE = base_watcher.REMOVE RENAME = base_watcher.RENAME MODIFIED = base_watcher.MODIFIED #FIXME: For some reaseon the code below raises an import error with name ADDED #from ninja_ide.core.filesystem_notifications.base_watcher import ADDED, \ # DELETED, REMOVE, RENAME, MODIFIED mask = IN_CREATE | IN_DELETE | IN_DELETE_SELF | IN_MODIFY
# 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 from PyQt4.QtCore import SIGNAL from threading import Thread import win32con import win32file import win32event import pywintypes import os from ninja_ide.core import file_manager from ninja_ide.tools.logger import NinjaLogger logger = NinjaLogger('ninja_ide.core.filesystem_notifications.windows') DEBUG = logger.debug from ninja_ide.core.filesystem_notifications import base_watcher ADDED = base_watcher.ADDED DELETED = base_watcher.DELETED REMOVE = base_watcher.REMOVE RENAME = base_watcher.RENAME MODIFIED = base_watcher.MODIFIED ACTIONS = {1: ADDED, 2: DELETED, 3: MODIFIED, 4: RENAME, 5: RENAME} # Thanks to Claudio Grondi for the correct set of numbers FILE_LIST_DIRECTORY = 0x0001 watchmask = win32con.FILE_NOTIFY_CHANGE_FILE_NAME | \
from ninja_ide.core import settings from ninja_ide.core.file_handling import file_manager from ninja_ide.tools.completion import completer_widget from ninja_ide.gui.ide import IDE from ninja_ide.gui.main_panel import itab_item from ninja_ide.gui.editor import highlighter from ninja_ide.gui.editor import syntax_highlighter from ninja_ide.gui.editor import helpers from ninja_ide.gui.editor import minimap from ninja_ide.gui.editor import sidebar_widget from ninja_ide.gui.editor import python_syntax from ninja_ide.tools.logger import NinjaLogger BRACE_DICT = {')': '(', ']': '[', '}': '{', '(': ')', '[': ']', '{': '}'} logger = NinjaLogger('ninja_ide.gui.editor.editor') if sys.version_info.major == 3: python3 = True else: python3 = False class Editor(QPlainTextEdit, itab_item.ITabItem): ############################################################################### # EDITOR SIGNALS ############################################################################### """ modificationChanged(bool) fileSaved(QPlainTextEdit)
# # You should have received a copy of the GNU General Public License # along with NINJA-IDE; If not, see <http://www.gnu.org/licenses/>. import os try: import json except ImportError: import simplejson as json from ninja_ide import resources from ninja_ide.core import settings from ninja_ide.tools.logger import NinjaLogger logger = NinjaLogger('ninja_ide.tools.json_manager') def parse(descriptor): try: return json.load(descriptor) except: logger.error("The file couldn't be parsed'") logger.error(descriptor) return {} def load_syntax(): files = os.listdir(resources.SYNTAX_FILES) for f in files: if f.endswith('.json'):
from PyQt4.QtGui import QStyle from PyQt4.QtGui import QIcon from PyQt4.QtGui import QShortcut from PyQt4.QtCore import SIGNAL from PyQt4.QtCore import Qt from ninja_ide import resources from ninja_ide.core import settings from ninja_ide.tools import locator from ninja_ide.tools import ui_tools from ninja_ide.gui import actions from ninja_ide.gui.ide import IDE from ninja_ide.gui.main_panel import main_container from ninja_ide.tools.logger import NinjaLogger logger = NinjaLogger('ninja_ide.gui.status_bar') DEBUG = logger.debug class _StatusBar(QStatusBar): def __init__(self): super(_StatusBar, self).__init__() self._widgetStatus = QWidget() vbox = QVBoxLayout(self._widgetStatus) vbox.setContentsMargins(0, 0, 0, 0) vbox.setSpacing(0) #Search Layout self._searchWidget = SearchWidget(self) vbox.addWidget(self._searchWidget) #Replace Layout
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with NINJA-IDE; If not, see <http://www.gnu.org/licenses/>. #Based in pycomplete emacs module. from __future__ import absolute_import import sys import types #import inspect import StringIO from ninja_ide.tools.logger import NinjaLogger logger = NinjaLogger('ninja_ide.tools.completion.completer') _HELPOUT = StringIO.StringIO _STDOUT = sys.stdout def get_completions_per_type(object_dir): '''Return info about function parameters''' if not object_dir: return {} result = {'attributes': [], 'modules': [], 'functions': [], 'classes': []} type_assign = { types.ClassType: 'classes', types.FunctionType: 'functions', types.MethodType: 'functions',
QBrush, QPixmap, QPixmapCache, QIcon, QPen, QColor, QImage, QKeySequence, qGray, qRgba, qAlpha) from PyQt5.QtPrintSupport import (QPrinter, QPrintPreviewDialog) from PyQt5.QtCore import (Qt, QSize, QDir, QUrl, QObject, QThread, pyqtSignal, QEvent, QTimeLine, QTimer, QRect, QPoint, QPropertyAnimation, QAbstractAnimation) from ninja_ide import resources from ninja_ide.core import settings from ninja_ide.core.file_handling import file_manager from ninja_ide.core.file_handling.file_manager import NinjaIOException from ninja_ide.tools import json_manager from ninja_ide.tools.logger import NinjaLogger logger = NinjaLogger('ninja_ide.tools.ui_tools') class NComboBox(QComboBox): def paintEvent(self, event): super().paintEvent(event) # painter = QStylePainter(self) # opt = QStyleOptionComboBox() # self.initStyleOption(opt) # arrow_rect = QRect((opt.rect.left() + opt.rect.right()) / 2 + 6, # opt.rect.center().y(), 7, 7) # arrow_rect.moveRight(opt.rect.width() - 10) # opt.rect = arrow_rect # opt.rect.translate(0, -6) # painter.drawPrimitive(QStyle.PE_IndicatorArrowUp, opt) # opt.rect.translate(0, 6)
from PyQt4.QtGui import QSystemTrayIcon from PyQt4.QtGui import QAction from PyQt4.QtGui import QMenu from PyQt4.QtGui import QIcon from PyQt4.QtGui import QMessageBox from PyQt4.QtCore import QThread from PyQt4.QtCore import SIGNAL import ninja_ide from ninja_ide import resources from ninja_ide.core import settings from ninja_ide.tools import json_manager from ninja_ide.tools.logger import NinjaLogger logger = NinjaLogger('ninja_ide.gui.updates') class TrayIconUpdates(QSystemTrayIcon): def __init__(self, parent): QSystemTrayIcon.__init__(self, parent) icon = QIcon(resources.IMAGES['iconUpdate']) self.setIcon(icon) self.setup_menu() self.ide_version = '0' self.download_link = '' if settings.NOTIFY_UPDATES: self.thread = ThreadUpdates()
from PyQt4.Qsci import (QsciLexerBash, QsciLexerBatch, QsciLexerCMake, QsciLexerCPP, QsciLexerCSS, QsciLexerCSharp, QsciLexerD, QsciLexerDiff, QsciLexerFortran, QsciLexerFortran77, QsciLexerHTML, QsciLexerIDL, QsciLexerJava, QsciLexerJavaScript, QsciLexerLua, QsciLexerMakefile, QsciLexerMatlab, QsciLexerOctave, QsciLexerPOV, QsciLexerPascal, QsciLexerPerl, QsciLexerPostScript, QsciLexerProperties, QsciLexerPython, QsciLexerRuby, QsciLexerSQL, QsciLexerSpice, QsciLexerTCL, QsciLexerTeX, QsciLexerVHDL, QsciLexerVerilog, QsciLexerXML, QsciLexerYAML) from ninja_ide.tools.logger import NinjaLogger logger = NinjaLogger('ninja_ide.gui.editor.extended_lexers.all_lexers') pattern = re.compile(r'^([A-Z]).+$') class BaseNinjaLexer(object): """WARNING: Only use this as the first part of a Lexer mixin""" def __init__(self, *args, **kwargs): self._settings_colored = None super(BaseNinjaLexer, self).__init__(*args, **kwargs) def initialize_color_scheme(self): self.scheme = {} self.background_color = QColor(resources.COLOR_SCHEME["EditorBackground"]) detected_values = []
# # You should have received a copy of the GNU General Public License # along with NINJA-IDE; If not, see <http://www.gnu.org/licenses/>. import _ast from PyQt5.QtCore import (QThread, pyqtSignal, QTimer) from ninja_ide.gui.editor.checkers import (register_checker, remove_checker) from ninja_ide import resources from ninja_ide import translations from ninja_ide.core import settings from ninja_ide.dependencies.pyflakes_mod import checker from ninja_ide.tools import ui_tools from ninja_ide.tools.logger import NinjaLogger from ninja_ide.core.file_handling import file_manager logger = NinjaLogger(__file__) class ErrorsChecker(QThread): checkerCompleted = pyqtSignal() def __init__(self, neditor): super().__init__() self._neditor = neditor self._path = '' self.checks = {} self.checker_icon = ui_tools.colored_icon( ":img/bicho", resources.get_color('ErrorUnderline'))
# the Free Software Foundation; either version 3 of the License, or # any later version. # # NINJA-IDE is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with NINJA-IDE; If not, see <http://www.gnu.org/licenses/>. # import os from PyQt4.QtCore import QObject from PyQt4.QtCore import SIGNAL, QThread from ninja_ide.tools.logger import NinjaLogger logger = NinjaLogger('ninja_ide.core.filesystem_notifications.Watcher') DEBUG = logger.debug ADDED = 1 MODIFIED = 2 DELETED = 3 RENAME = 4 REMOVE = 5 def do_stat(file_path): status = None try: status = os.stat(file_path) except OSError: pass
from PyQt4.QtGui import QListWidget from PyQt4.QtGui import QCompleter from PyQt4.QtGui import QDirModel from PyQt4.QtGui import QPixmap from PyQt4.QtCore import Qt from PyQt4.QtCore import SIGNAL from ninja_ide import resources from ninja_ide.core import settings from ninja_ide.core import plugin_interfaces from ninja_ide.core import file_manager from ninja_ide.tools import json_manager from ninja_ide.tools.logger import NinjaLogger logger = NinjaLogger('ninja_ide.gui.dialogs.wizard_new_project') logger.info("loaded") DEBUG = logger.debug ############################################################################### # Wizard handler and Python Project handler ############################################################################### class WizardNewProject(QWizard): """ Wizard to create a new project (of any kind), it implements the base behavior. Also, it set two special projects type handler (PythonProjectHandler, ImportFromSourcesProjectHandler) """ def __init__(self, parent):
# # You should have received a copy of the GNU General Public License # along with NINJA-IDE; If not, see <http://www.gnu.org/licenses/>. # DISCLAIMER ABOUT READING THIS CODE: # We are not responsible for any kind of mental or emotional # damage that may arise from reading this code. import re import ast import _ast from ninja_ide.tools.logger import NinjaLogger from ninja_ide.tools.completion import model logger = NinjaLogger('ninja_ide.tools.completion.analyzer') MAX_THRESHOLD = 3 def expand_attribute(attribute): parent_name = [] while attribute.__class__ is ast.Attribute: parent_name.append(attribute.attr) attribute = attribute.value name = '.'.join(reversed(parent_name)) attribute_id = '' if attribute.__class__ is ast.Name: attribute_id = attribute.id elif attribute.__class__ is ast.Call: if attribute.func.__class__ is ast.Attribute:
from ninja_ide.gui.explorer import tree_symbols_widget from ninja_ide.gui.explorer import errors_lists from ninja_ide.gui.explorer import migration_lists from ninja_ide.gui.main_panel import main_container from ninja_ide.gui.dialogs import wizard_new_project from ninja_ide.tools import json_manager from ninja_ide.tools import ui_tools try: from PyQt4.QtWebKit import QWebInspector except: settings.WEBINSPECTOR_SUPPORTED = False from ninja_ide.tools.logger import NinjaLogger logger = NinjaLogger('ninja_ide.gui.explorer.explorer_container') __explorerContainerInstance = None def ExplorerContainer(*args, **kw): global __explorerContainerInstance if __explorerContainerInstance is None: __explorerContainerInstance = __ExplorerContainer(*args, **kw) return __explorerContainerInstance class __ExplorerContainer(QTabWidget): ############################################################################### # ExplorerContainer SIGNALS
from ninja_ide.gui.ide import IDE from ninja_ide.gui.editor import syntax_highlighter from ninja_ide.gui.editor.syntaxes import python_syntax #from ninja_ide.tools.completion import completer #from ninja_ide.tools.completion import completer_widget from ninja_ide.tools.logger import NinjaLogger try: # For Python2 str = unicode # lint:ok except NameError: # We are in Python3 pass logger = NinjaLogger('ninja_ide.gui.misc.console_widget') BRACES = {"'": "'", '"': '"', '{': '}', '[': ']', '(': ')'} class ConsoleWidget(QPlainTextEdit): def __init__(self): super(ConsoleWidget, self).__init__('>>> ') self.setUndoRedoEnabled(False) self.apply_editor_style() self.setToolTip(self.tr("Show/Hide (F4)")) self.moveCursor(QTextCursor.EndOfLine) self._patIsWord = re.compile('\w+') self.prompt = '>>> ' self._console = console.Console()
from ninja_ide.gui.main_panel import start_page from ninja_ide.gui.main_panel import files_handler from ninja_ide.gui.main_panel import add_file_folder from ninja_ide.gui.main_panel import image_viewer from ninja_ide.gui.main_panel import combo_editor from ninja_ide.gui.main_panel.helpers import split_orientation # from ninja_ide.gui.dialogs import from_import_dialog from ninja_ide.tools.locator import ( # locator, locator_widget) # from ninja_ide.tools import runner from ninja_ide.tools import ui_tools from ninja_ide.tools.logger import NinjaLogger logger = NinjaLogger('ninja_ide.gui.main_panel.main_container') class _MainContainer(QWidget): ############################################################################### # MainContainer SIGNALS ############################################################################### """ newFileOpened(QString) allTabClosed() runFile(QString) addToProject(QString) showFileInExplorer(QString) recentTabsModified() currentEditorChanged(QString)
# GNU General Public License for more details. # # 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 from PyQt4.QtGui import QWidget from PyQt4.QtGui import QTabWidget from PyQt4.QtGui import QVBoxLayout from ninja_ide.core import plugin_manager from ninja_ide.tools.logger import NinjaLogger logger = NinjaLogger('ninja_ide.gui.misc.plugin_preferences') class PluginPreferences(QWidget): """ Plugins section widget in NINJA-IDE Preferences """ def __init__(self): QWidget.__init__(self) self.plugin_manager = plugin_manager.PluginManager() vbox = QVBoxLayout(self) self._tabs = QTabWidget() vbox.addWidget(self._tabs) # load widgets self._load_widgets()
# NINJA-IDE is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # 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 fsevents #from PyQt4.QtCore import SIGNAL from ninja_ide.tools.logger import NinjaLogger logger = NinjaLogger('ninja_ide.core.filesystem_notifications.darwin') DEBUG = logger.debug from ninja_ide.core.filesystem_notifications import base_watcher ADDED = base_watcher.ADDED DELETED = base_watcher.DELETED REMOVE = base_watcher.REMOVE RENAME = base_watcher.RENAME MODIFIED = base_watcher.MODIFIED class NinjaFileSystemWatcher(base_watcher.BaseWatcher): def __init__(self): super(NinjaFileSystemWatcher, self).__init__() #self.observer = fsevents.Observer()
from PyQt4.QtCore import QThread from PyQt4.QtCore import Qt from PyQt4.QtCore import QDir from PyQt4.QtCore import QFile from PyQt4.QtCore import QTextStream from PyQt4.QtCore import SIGNAL from ninja_ide import resources from ninja_ide import translations from ninja_ide.gui.ide import IDE from ninja_ide.core.file_handling import file_manager from ninja_ide.core import settings from ninja_ide.tools.logger import NinjaLogger logger = NinjaLogger('ninja_ide.tools.locator') mapping_locations = {} #@ FILES #< CLASSES #> FUNCTIONS #- MODULE ATTRIBUTES #! NO PYTHON FILES #. SYMBOLS IN THIS FILE #/ TABS OPENED #: LINE NUMBER FILTERS = { 'files': '@', 'classes': '<', 'functions': '>',
from PyQt4.QtGui import QMessageBox from PyQt4.QtGui import QIcon from PyQt4.QtGui import QCompleter from PyQt4.QtGui import QDirModel from PyQt4.QtCore import Qt from PyQt4.QtCore import SIGNAL from PyQt4.QtCore import QThread from PyQt4.QtCore import QDir from ninja_ide.core import plugin_manager from ninja_ide.core.file_handling import file_manager from ninja_ide.tools import ui_tools from ninja_ide import translations from ninja_ide.tools.logger import NinjaLogger logger = NinjaLogger('ninja_ide.gui.dialogs.plugin_manager') HTML_STYLE = """ <html> <body> <h2>{name}</h2> <p><i>Version: {version}</i></p> <h3>{description}</h3> <br><p><b>Author:</b> {author}</p> <p>More info about the Plugin: <a href='{link}'>Website</a></p> </body> </html> """ def _get_plugin(plugin_name, plugin_list):
# along with NINJA-IDE; If not, see <http://www.gnu.org/licenses/>. import os import shutil from PyQt5.QtCore import (QObject, QFile, QFileSystemWatcher, QIODevice, QTextStream, pyqtSignal) from ninja_ide import translations # FIXME: Obtain these form a getter from ninja_ide.core import settings from ninja_ide.tools.utils import SignalFlowControl from .file_manager import NinjaIOException, NinjaNoFileNameException, \ get_file_encoding, get_basename, get_file_extension from ninja_ide.tools.logger import NinjaLogger logger = NinjaLogger('ninja_ide.core.file_handling.nfile') DEBUG = logger.debug """ How to continue: We need to have a filesystem representation object, said object, registers himself into the IDE on its __init__.py, thus avoiding all kinds of circular imports, this way all objects should start registering themselves and fail individually if they cant. So, to this object, whoever creates new NFiles should ask for a it, this way it keeps record of the files and can do closing when receives terminate from the ide, and decides to call a changed callback from each file when the watched, that should deppend on it notifies a change. """ class NFile(QObject):
from ninja_ide import translations from ninja_ide.core import settings from ninja_ide.core.file_handling import file_manager from ninja_ide.tools import ui_tools from ninja_ide.tools import json_manager from ninja_ide.gui.ide import IDE # from ninja_ide.gui.dialogs import add_to_project from ninja_ide.gui.dialogs import project_properties_widget from ninja_ide.gui.dialogs import new_project_manager from ninja_ide.gui.explorer.explorer_container import ExplorerContainer from ninja_ide.gui.explorer import actions from ninja_ide.gui.explorer.nproject import NProject from ninja_ide.tools.logger import NinjaLogger logger = NinjaLogger('ninja_ide.gui.explorer.tree_projects_widget') DEBUG = logger.debug class ProjectTreeColumn(QDialog): # Signals dockWidget = pyqtSignal('PyQt_PyObject') undockWidget = pyqtSignal() changeTitle = pyqtSignal('PyQt_PyObject', 'QString') updateLocator = pyqtSignal() def __init__(self, parent=None): super(ProjectTreeColumn, self).__init__(parent) vbox = QVBoxLayout(self) # vbox.setSizeConstraint(QVBoxLayout.SetDefaultConstraint)
from PyQt4.QtGui import QIcon from PyQt4.QtGui import QFileDialog from PyQt4.QtGui import QMessageBox from PyQt4.QtGui import QSpinBox from PyQt4.QtGui import QCheckBox from PyQt4.QtCore import SIGNAL from PyQt4.QtCore import Qt from ninja_ide import resources from ninja_ide.core import file_manager from ninja_ide.core import settings from ninja_ide.tools import json_manager from ninja_ide.tools import ui_tools from ninja_ide.tools.logger import NinjaLogger logger = NinjaLogger('ninja_ide.gui.dialogs.project_properties_widget') DEBUG = logger.debug class ProjectProperties(QDialog): def __init__(self, item, parent=None): QDialog.__init__(self, parent, Qt.Dialog) self._item = item self.setWindowTitle(self.tr("Project Properties")) vbox = QVBoxLayout(self) self.tab_widget = QTabWidget() self.projectData = ProjectData(self) self.projectExecution = ProjectExecution(self) self.projectMetadata = ProjectMetadata(self) self.tab_widget.addTab(self.projectData, self.tr("Project Data")) self.tab_widget.addTab(self.projectExecution,
from ninja_ide.gui.main_panel import actions from ninja_ide.gui.main_panel import combo_editor from ninja_ide.gui.main_panel import add_file_folder from ninja_ide.gui.main_panel import start_page from ninja_ide.gui.dialogs import from_import_dialog from ninja_ide.gui.main_panel import image_viewer from ninja_ide.gui.main_panel import files_handler from ninja_ide.gui.main_panel.helpers import split_orientation from ninja_ide.gui import dynamic_splitter from ninja_ide import translations from ninja_ide.tools.logger import NinjaLogger from ninja_ide.gui.editor import editor from ninja_ide.core.file_handling import file_manager from ninja_ide.tools.locator import locator_widget logger = NinjaLogger('main_panel.main_container') class _MainContainer(QWidget): currentEditorChanged = pyqtSignal(str) fileOpened = pyqtSignal(str) beforeFileSaved = pyqtSignal(str) fileSaved = pyqtSignal(str) runFile = pyqtSignal(str) showFileInExplorer = pyqtSignal(str) addToProject = pyqtSignal(str) allFilesClosed = pyqtSignal() def __init__(self, parent=None): super().__init__(parent)
# # NINJA-IDE is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with NINJA-IDE; If not, see <http://www.gnu.org/licenses/>. import _ast import ast from ninja_ide.intellisensei.analyzer import model from ninja_ide.tools.logger import NinjaLogger logger_imports = NinjaLogger('ninja_ide.tools.introspection.obtaining_imports') logger_symbols = NinjaLogger('ninja_ide.tools.introspection.obtaining_symbols') _map_type = { _ast.Tuple: 'tuple', _ast.List: 'list', _ast.Str: 'str', _ast.Dict: 'dict', _ast.Num: 'int', _ast.Call: 'function()', } def _parse_assign(symbol): assigns = {} attributes = {}
#NINJA-IDE Menus from ninja_ide.gui.menus import menu_about from ninja_ide.gui.menus import menu_file from ninja_ide.gui.menus import menu_edit from ninja_ide.gui.menus import menu_view from ninja_ide.gui.menus import menu_plugins from ninja_ide.gui.menus import menu_project from ninja_ide.gui.menus import menu_source ############################################################################### # LOGGER INITIALIZE ############################################################################### from ninja_ide.tools.logger import NinjaLogger logger = NinjaLogger('ninja_ide.gui.ide') ############################################################################### # IDE: MAIN CONTAINER ############################################################################### __ideInstance = None #Save cursor flash time to restore it on close (necessary for Windows) cursor_flash_time = 0 def IDE(*args, **kw): global __ideInstance if __ideInstance is None: __ideInstance = __IDE(*args, **kw) return __ideInstance
from PyQt4.QtCore import Qt from PyQt4.QtCore import SIGNAL from PyQt4.QtCore import QDir from ninja_ide import resources from ninja_ide.core import settings from ninja_ide.core import file_manager from ninja_ide.core.filesystem_notifications.base_watcher import MODIFIED, \ DELETED from ninja_ide.core.filesystem_notifications import NinjaFileSystemWatcher from ninja_ide.gui.editor import editor from ninja_ide.gui.main_panel import browser_widget from ninja_ide.tools.logger import NinjaLogger logger = NinjaLogger('ninja_ide.gui.main_panel.tab_widget') DEBUG = logger.debug class TabWidget(QTabWidget): ############################################################################### # TabWidget SIGNALS ############################################################################### """ tabCloseRequested(int) dropTab(QTabWidget) saveActualEditor() allTabsClosed() changeActualTab(QTabWidget) splitTab(QTabWidget, int, bool)
import re import uuid from PyQt5.QtWidgets import ( QWidget, QVBoxLayout ) from PyQt5.QtCore import Qt, QTimer from PyQt5.QtQuickWidgets import QQuickWidget from ninja_ide import resources from ninja_ide.gui.ide import IDE from ninja_ide.tools import ui_tools from ninja_ide.tools.locator import locator from ninja_ide.tools.logger import NinjaLogger logger = NinjaLogger(__name__) class FilesHandler(QWidget): def __init__(self, parent=None): super(FilesHandler, self).__init__( None, Qt.FramelessWindowHint | Qt.Popup) self.setAttribute(Qt.WA_TranslucentBackground) self._main_container = parent # Create the QML user interface. self.setFixedHeight(300) self.setFixedWidth(400) self.view = QQuickWidget() self.view.rootContext().setContextProperty( "theme", resources.QML_COLORS)
import zipfile import traceback #lint:disable try: from urllib.request import urlopen from urllib.error import URLError except ImportError: from urllib2 import urlopen from urllib2 import URLError #lint:enable from ninja_ide import resources from ninja_ide.tools.logger import NinjaLogger from ninja_ide.tools import json_manager logger = NinjaLogger('ninja_ide.core.plugin_manager') REQUIREMENTS = 'requirements.txt' COMMAND_FOR_PIP_INSTALL = 'pip install -r %s' try: # For Python2 str = unicode # lint:ok except NameError: # We are in Python3 pass class ServiceLocator(object): ''' Hold the services and allows the interaction between NINJA-IDE and plugins ''' def __init__(self, services=None):