def show_snake(self):
     from src.ui.widgets.pyborita import pyborita_widget
     w = pyborita_widget.PyboritaWidget(self)
     toolbar = Edis.get_component("toolbar")
     lateral = Edis.get_component("tab_container")
     status = Edis.get_component("status_bar")
     output = Edis.get_component("output")
     widgets = [toolbar, status, lateral, output]
     for widget in widgets:
         widget.hide()
     self.stack.insertWidget(0, w)
     self.stack.setCurrentIndex(0)
Exemple #2
0
    def _delete_file(self):
        """ Borra fisicamente el archivo y lo quita del árbol """

        DEBUG("Deleting file...")
        current_item = self.currentItem()
        # Flags
        yes = QMessageBox.Yes
        no = QMessageBox.No
        result = QMessageBox.warning(
            self,
            self.tr("Advertencia"),
            self.tr("Está seguro que quiere borrar " "el archivo?<br><br><b>{0}</b>").format(current_item.path),
            no | yes,
        )
        if result == no:
            return
        # Elimino el item de la lista de fuentes
        self._sources.remove(current_item.path)
        # Cierro el archivo del editor
        editor_container = Edis.get_component("principal")
        editor_container.close_file_from_project(current_item.path)
        # Elimino el item del árbol
        index = current_item.parent().indexOfChild(current_item)
        current_item.parent().takeChild(index)
        # Borro el archivo fisicamente
        os.remove(current_item.path)
    def _open_file(self, item):
        """ Cambia de archivo en el stacked """

        editor_container = Edis.get_component("principal")
        index = self.list_of_files.row(item)
        editor_container.editor_widget.change_item(index)
        self.close()
    def __init__(self, parent=None):
        super(EnvironmentConfiguration, self).__init__()
        self.general_section = GeneralSection()
        #self.shortcut_section = ShortcutSection()

        preferences = Edis.get_component("preferences")
        preferences.install_section(self)
Exemple #5
0
 def _change_dock_position(self):
     edis = Edis.get_component("edis")
     current_area = edis.dockWidgetArea(self)
     if current_area == Qt.LeftDockWidgetArea:
         edis.addDockWidget(Qt.RightDockWidgetArea, self)
     else:
         edis.addDockWidget(Qt.LeftDockWidgetArea, self)
Exemple #6
0
 def _change_scheme(self, theme):
     theme = theme.split()[0].lower()
     editor_container = Edis.get_component("principal")
     editor = editor_container.get_active_editor()
     if editor is not None:
         # Restyle
         pass
Exemple #7
0
 def _create_file(self):
     DEBUG("Creating a file...")
     dialog = NewFileDialog(self)
     data = dialog.data
     if data:
         current_item = self.currentItem()
         filename, ftype = data["filename"], data["type"]
         filename = os.path.join(current_item.path, filename)
         if os.path.exists(filename):
             # El archivo ya existe
             QMessageBox.information(
                 self, self.tr("Información"), self.tr("Ya existe un archivo con ese" " nombre"), QMessageBox.Ok
             )
             DEBUG("A file already exists...")
             return
         if ftype == 1:
             # Header file
             preprocessor = os.path.splitext(os.path.basename(filename))[0]
             content = "#ifndef %s_H_\n#define %s_H\n\n#endif" % (preprocessor.upper(), preprocessor.upper())
         else:
             content = ""
             # Agrego a la lista de archivos fuente
             self._sources.append(filename)
         # Creo el archivo
         file_manager.write_file(filename, content)
         if isinstance(current_item, EdisItem):
             parent = current_item.child(ftype)
         else:
             parent = current_item
         # Agrego el ítem al árbol
         new_item = TreeItem(parent, [data["filename"]])
         new_item.path = filename
         editor_container = Edis.get_component("principal")
         editor_container.open_file(filename)
Exemple #8
0
 def save(self):
     settings.set_setting('editor/wrap-mode',
         self.check_wrap.isChecked())
     settings.set_setting('editor/show-margin',
         self.check_margin.isChecked())
     settings.set_setting('editor/width-margin',
         self.slider_margin.value())
     settings.set_setting('editor/show-line-number',
         self.check_line_numbers.isChecked())
     settings.set_setting('editor/mark-change',
         self.check_mark_change.isChecked())
     settings.set_setting('editor/match-brace',
         self.check_match_brace.isChecked())
     settings.set_setting('editor/show-caret-line',
         self.check_current_line.isChecked())
     settings.set_setting('editor/show-tabs-spaces',
         self.check_whitespace.isChecked())
     settings.set_setting('editor/show-guides',
         self.check_guides.isChecked())
     settings.set_setting('editor/eof',
         self.check_eof.isChecked())
     editor_container = Edis.get_component("principal")
     editor = editor_container.get_active_editor()
     if editor is not None:
         editor.set_brace_matching()
         editor.show_line_numbers()
         editor.update_options()
         editor.update_margin()
Exemple #9
0
    def __init__(self, parent=None):
        super(EnvironmentConfiguration, self).__init__()
        self.general_section = GeneralSection()
        #self.shortcut_section = ShortcutSection()

        preferences = Edis.get_component("preferences")
        preferences.install_section(self)
    def create_editor(self, obj_file=None, filename=""):
        if obj_file is None:
            obj_file = object_file.EdisFile(filename)
        self.stack.addWidget(self.editor_widget)
        # Quito la página de inicio, si está
        _start_page = self.stack.widget(0)
        if isinstance(_start_page, start_page.StartPage):
            self.remove_widget(_start_page)
            # Detengo el tiimer
            _start_page.timer.stop()
        weditor = editor.Editor(obj_file)
        self.editor_widget.add_widget(weditor)
        self.editor_widget.add_item_combo(obj_file.filename)
        lateral = Edis.get_component("tab_container")
        if not lateral.isVisible():
            lateral.show()

        # Conexiones
        self.connect(obj_file, SIGNAL("fileChanged(PyQt_PyObject)"),
                     self._file_changed)
        self.connect(weditor, SIGNAL("cursorPositionChanged(int, int)"),
                     self.update_cursor)
        self.connect(weditor, SIGNAL("modificationChanged(bool)"),
                     self._file_modified)
        self.connect(weditor, SIGNAL("fileSaved(QString)"),
                     self._file_saved)
        self.connect(weditor, SIGNAL("linesChanged(int)"),
                     self.editor_widget.combo.move_to_symbol)
        self.connect(weditor, SIGNAL("dropEvent(PyQt_PyObject)"),
                     self._drop_editor)
        self.emit(SIGNAL("fileChanged(QString)"), obj_file.filename)

        weditor.setFocus()

        return weditor
Exemple #11
0
    def save(self):
        """ Guarda las configuraciones del Editor. """

        use_tabs = bool(self.combo_tabs.currentIndex())
        settings.set_setting('editor/usetabs', use_tabs)
        auto_indent = self.check_autoindent.isChecked()
        settings.set_setting('editor/indent', auto_indent)
        settings.set_setting('editor/minimap', self.check_minimap.isChecked())
        #settings.set_setting('editor/minimap-animation',
        #self.check_minimap_animation.isChecked())
        font = self.combo_font.currentFont().family()
        settings.set_setting('editor/font', font)
        font_size = self.spin_size_font.value()
        settings.set_setting('editor/size-font', font_size)
        scheme = self.combo_scheme.currentText().split()[0].lower()
        settings.set_setting('editor/scheme', scheme)
        settings.set_setting('editor/cursor', self.combo_caret.currentIndex())
        settings.set_setting('editor/caret-width',
                             self.spin_caret_width.value())
        settings.set_setting('editor/cursor-period',
                             self.slider_caret_period.value())
        editor_container = Edis.get_component("principal")
        editor = editor_container.get_active_editor()
        if editor is not None:
            editor.setIndentationsUseTabs(use_tabs)
            editor.load_font(font, font_size)
    def _load_menu_combo_file(self, point):
        """ Muestra el menú """

        menu = QMenu()
        editor_container = Edis.get_component("principal")
        save_as_action = menu.addAction(QIcon(":image/save-as"),
                                        self.tr("Guardar como..."))
        reload_action = menu.addAction(QIcon(":image/reload"),
                                       self.tr("Recargar"))
        menu.addSeparator()
        compile_action = menu.addAction(QIcon(":image/build"),
                                        self.tr("Compilar"))
        execute_action = menu.addAction(QIcon(":image/run"),
                                        self.tr("Ejecutar"))
        menu.addSeparator()
        close_action = menu.addAction(QIcon(":image/close"),
                                      self.tr("Cerrar archivo"))

        # Conexiones
        self.connect(save_as_action, SIGNAL("triggered()"),
                     editor_container.save_file_as)
        self.connect(reload_action, SIGNAL("triggered()"),
                     editor_container.reload_file)
        self.connect(compile_action, SIGNAL("triggered()"),
                     editor_container.build_source_code)
        self.connect(execute_action, SIGNAL("triggered()"),
                     editor_container.run_binary)
        self.connect(close_action, SIGNAL("triggered()"),
                     editor_container.close_file)

        menu.exec_(self.mapToGlobal(point))
Exemple #13
0
 def _change_scheme(self, theme):
     theme = theme.split()[0].lower()
     editor_container = Edis.get_component("principal")
     editor = editor_container.get_active_editor()
     if editor is not None:
         # Restyle
         pass
Exemple #14
0
 def save(self):
     settings.set_setting('editor/wrap-mode', self.check_wrap.isChecked())
     settings.set_setting('editor/show-margin',
                          self.check_margin.isChecked())
     settings.set_setting('editor/width-margin', self.slider_margin.value())
     settings.set_setting('editor/show-line-number',
                          self.check_line_numbers.isChecked())
     settings.set_setting('editor/mark-change',
                          self.check_mark_change.isChecked())
     settings.set_setting('editor/match-brace',
                          self.check_match_brace.isChecked())
     settings.set_setting('editor/show-caret-line',
                          self.check_current_line.isChecked())
     settings.set_setting('editor/show-tabs-spaces',
                          self.check_whitespace.isChecked())
     settings.set_setting('editor/show-guides',
                          self.check_guides.isChecked())
     settings.set_setting('editor/eof', self.check_eof.isChecked())
     editor_container = Edis.get_component("principal")
     editor = editor_container.get_active_editor()
     if editor is not None:
         editor.set_brace_matching()
         editor.show_line_numbers()
         editor.update_options()
         editor.update_margin()
 def _create_file(self):
     DEBUG("Creating a file...")
     dialog = NewFileDialog(self)
     data = dialog.data
     if data:
         current_item = self.currentItem()
         filename, ftype = data['filename'], data['type']
         filename = os.path.join(current_item.path, filename)
         if os.path.exists(filename):
             # El archivo ya existe
             QMessageBox.information(self, self.tr("Información"),
                                     self.tr("Ya existe un archivo con ese"
                                     " nombre"), QMessageBox.Ok)
             DEBUG("A file already exists...")
             return
         if ftype == 1:
             # Header file
             preprocessor = os.path.splitext(os.path.basename(filename))[0]
             content = "#ifndef %s_H_\n#define %s_H\n\n#endif" % \
                       (preprocessor.upper(), preprocessor.upper())
         else:
             content = ""
             # Agrego a la lista de archivos fuente
             self._sources.append(filename)
         # Creo el archivo
         file_manager.write_file(filename, content)
         if isinstance(current_item, EdisItem):
             parent = current_item.child(ftype)
         else:
             parent = current_item
         # Agrego el ítem al árbol
         new_item = TreeItem(parent, [data['filename']])
         new_item.path = filename
         editor_container = Edis.get_component("principal")
         editor_container.open_file(filename)
Exemple #16
0
 def _change_dock_position(self):
     edis = Edis.get_component("edis")
     current_area = edis.dockWidgetArea(self)
     if current_area == Qt.LeftDockWidgetArea:
         edis.addDockWidget(Qt.RightDockWidgetArea, self)
     else:
         edis.addDockWidget(Qt.LeftDockWidgetArea, self)
Exemple #17
0
    def save(self):
        """ Guarda las configuraciones del Editor. """

        use_tabs = bool(self.combo_tabs.currentIndex())
        settings.set_setting('editor/usetabs', use_tabs)
        auto_indent = self.check_autoindent.isChecked()
        settings.set_setting('editor/indent', auto_indent)
        settings.set_setting('editor/minimap', self.check_minimap.isChecked())
        #settings.set_setting('editor/minimap-animation',
                             #self.check_minimap_animation.isChecked())
        font = self.combo_font.currentFont().family()
        settings.set_setting('editor/font', font)
        font_size = self.spin_size_font.value()
        settings.set_setting('editor/size-font', font_size)
        scheme = self.combo_scheme.currentText().split()[0].lower()
        settings.set_setting('editor/scheme', scheme)
        settings.set_setting('editor/cursor',
                             self.combo_caret.currentIndex())
        settings.set_setting('editor/caret-width',
                             self.spin_caret_width.value())
        settings.set_setting('editor/cursor-period',
                             self.slider_caret_period.value())
        editor_container = Edis.get_component("principal")
        editor = editor_container.get_active_editor()
        if editor is not None:
            editor.setIndentationsUseTabs(use_tabs)
            editor.load_font(font, font_size)
Exemple #18
0
 def _replace_all(self):
     editor_container = Edis.get_component("principal")
     weditor = editor_container.get_active_editor()
     found = weditor.findFirst(self.word, False, False, False, False,
                               True, 0, 0, True)
     while found:
         weditor.replace(self.word_replace)
         found = weditor.findNext()
Exemple #19
0
    def __init__(self):
        super(EditorConfiguration, self).__init__()
        self.general = GeneralSection()
        self.display = DisplaySection()
        self.completion = CompletionSection()

        preferences = Edis.get_component("preferences")
        preferences.install_section(self)
Exemple #20
0
 def eventFilter(self, obj, event):
     if obj == self.label_logo and event.type() == QEvent.MouseButtonPress:
         self.clicks += 1
         if self.clicks == 6:
             self.close()
             editor_container = Edis.get_component("principal")
             editor_container.show_snake()
     return False
Exemple #21
0
 def _replace(self):
     if not self.word_replace:
         return
     editor_container = Edis.get_component("principal")
     weditor = editor_container.get_active_editor()
     if weditor.hasSelectedText():
         weditor.replace(self.word_replace)
         self._find_next()
Exemple #22
0
 def eventFilter(self, obj, event):
     if obj == self.label_logo and event.type() == QEvent.MouseButtonPress:
         self.clicks += 1
         if self.clicks == 6:
             self.close()
             editor_container = Edis.get_component("principal")
             editor_container.show_snake()
     return False
Exemple #23
0
    def __init__(self):
        super(EditorConfiguration, self).__init__()
        self.general = GeneralSection()
        self.display = DisplaySection()
        self.completion = CompletionSection()

        preferences = Edis.get_component("preferences")
        preferences.install_section(self)
Exemple #24
0
    def load_project_widget(self, widget):
        self._tree_project = Edis.get_lateral("tree_projects")
        self.tabs.addTab(self._tree_project, self.tr("Proyectos"))

        editor_container = Edis.get_component("principal")
        self.connect(editor_container, SIGNAL("projectOpened(PyQt_PyObject)"),
                     self._open_project)
        self.connect(editor_container, SIGNAL("folderOpened(PyQt_PyObject)"),
                     self._open_directory)
    def get_recents_files(self):
        """ Devuelve una lista con los archivos recientes en el menú """

        menu = Edis.get_component('menu_recent_file')
        actions = menu.actions()
        recents_files = []
        for filename in actions:
            recents_files.append(filename.text())
        return recents_files
    def update_recents_files(self, recents_files):
        """ Actualiza el submenú de archivos recientes """

        menu = Edis.get_component("menu_recent_file")
        self.connect(menu, SIGNAL("triggered(QAction*)"),
                     self._open_recent_file)
        menu.clear()
        for _file in recents_files:
            menu.addAction(_file)
Exemple #27
0
    def load_project_widget(self, widget):
        self._tree_project = Edis.get_lateral("tree_projects")
        self.tabs.addTab(self._tree_project, self.tr("Proyectos"))

        editor_container = Edis.get_component("principal")
        self.connect(editor_container, SIGNAL("projectOpened(PyQt_PyObject)"),
                     self._open_project)
        self.connect(editor_container, SIGNAL("folderOpened(PyQt_PyObject)"),
                     self._open_directory)
 def show_settings(self):
     preferences_widget = Edis.get_component("preferences")
     current_widget = self.stack.currentWidget()
     if isinstance(current_widget, preferences_widget.__class__):
         return
     self.connect(preferences_widget,
                  SIGNAL("configurationsClose(PyQt_PyObject)"),
                  lambda widget: self.remove_widget(widget))
     index = self.stack.addWidget(preferences_widget)
     self.stack.setCurrentIndex(index)
Exemple #29
0
 def _find(self):
     if not self.word:
         return
     editor_container = Edis.get_component("principal")
     weditor = editor_container.get_active_editor()
     found = weditor.findFirst(self.word, False, self._cs, False, False,
                               True, 0, 0, True)
     if self.word:
         self._line_search.update(found)
     weditor.hilo_ocurrencias.buscar(self.word, weditor.text())
 def build_source_code(self):
     output = Edis.get_component("output")
     project = Edis.get_lateral("tree_projects")
     weditor = self.get_active_editor()
     if weditor is not None:
         filename = self.save_file()
         if project.sources:
             output.build((filename, project.sources))
         else:
             if filename:
                 output.build((weditor.filename, []))
    def _load_files(self):
        """ Carga los archivos abiertos en la lista """

        editor_container = Edis.get_component("principal")
        opened_files = editor_container.opened_files_for_selector()
        for _file in opened_files:
            base_name = os.path.basename(_file)
            self._files[base_name] = _file
            self.list_of_files.addItem(base_name)
        index = editor_container.current_index()
        self.list_of_files.setCurrentRow(index)
        self._update_label()
 def _close_project(self):
     # Quito el ítem del árbol
     item = self.currentItem()
     index = self.indexOfTopLevelItem(item)
     self.takeTopLevelItem(index)
     # Quito el elemento de la lista
     self._projects.pop(index)
     # Elimino los archivos del editor
     editor_container = Edis.get_component("principal")
     for index in reversed(range(editor_container.editor_widget.count())):
         weditor = editor_container.editor_widget.widget(index)
         if not weditor.filename.split(item.path)[0]:
             # El archivo pertenece al proyecto
             editor_container.editor_widget.remove_widget(weditor, index)
Exemple #33
0
 def _close_project(self):
     # Quito el ítem del árbol
     item = self.currentItem()
     index = self.indexOfTopLevelItem(item)
     self.takeTopLevelItem(index)
     # Quito el elemento de la lista
     self._projects.pop(index)
     # Elimino los archivos del editor
     editor_container = Edis.get_component("principal")
     for index in reversed(range(editor_container.editor_widget.count())):
         weditor = editor_container.editor_widget.widget(index)
         if not weditor.filename.split(item.path)[0]:
             # El archivo pertenece al proyecto
             editor_container.editor_widget.remove_widget(weditor, index)
Exemple #34
0
    def load_symbols_widget(self, widget):
        if self._symbols_widget is None:
            self._symbols_widget = Edis.get_lateral("symbols")
            self.tabs.addTab(self._symbols_widget, self.tr("Símbolos"))

            # Conexiones
            editor_container = Edis.get_component("principal")
            self.connect(self._symbols_widget, SIGNAL("goToLine(int)"),
                         editor_container.go_to_line)
            self.connect(editor_container, SIGNAL("updateSymbols(QString)"),
                         self._update_symbols_widget)
                         #lambda filename: self.thread.parse(filename))
            self.connect(editor_container.editor_widget,
                         SIGNAL("allFilesClosed()"),
                         self._symbols_widget.clear)
Exemple #35
0
    def _restart_configurations(self):
        flags = QMessageBox.Cancel
        flags |= QMessageBox.Yes

        result = QMessageBox.question(
            self, self.tr("Advertencia!"),
            self.tr("Está seguro que quiere "
                    "reestablecer las "
                    "configuraciones?"), flags)
        if result == QMessageBox.Cancel:
            return
        elif result == QMessageBox.Yes:
            QSettings(paths.CONFIGURACION, QSettings.IniFormat).clear()
            dialog_preferences = Edis.get_component("preferences")
            dialog_preferences.close()
    def _restart_configurations(self):
        flags = QMessageBox.Cancel
        flags |= QMessageBox.Yes

        result = QMessageBox.question(self, self.tr("Advertencia!"),
                                      self.tr("Está seguro que quiere "
                                              "reestablecer las "
                                              "configuraciones?"),
                                      flags)
        if result == QMessageBox.Cancel:
            return
        elif result == QMessageBox.Yes:
            QSettings(paths.CONFIGURACION, QSettings.IniFormat).clear()
            dialog_preferences = Edis.get_component("preferences")
            dialog_preferences.close()
Exemple #37
0
    def load_symbols_widget(self, widget):
        if self._symbols_widget is None:
            self._symbols_widget = Edis.get_lateral("symbols")
            self.tabs.addTab(self._symbols_widget, self.tr("Símbolos"))

            # Conexiones
            editor_container = Edis.get_component("principal")
            self.connect(self._symbols_widget, SIGNAL("goToLine(int)"),
                         editor_container.go_to_line)
            self.connect(editor_container, SIGNAL("updateSymbols(QString)"),
                         self._update_symbols_widget)
            #lambda filename: self.thread.parse(filename))
            self.connect(editor_container.editor_widget,
                         SIGNAL("allFilesClosed()"),
                         self._symbols_widget.clear)
    def __init__(self, parent=None):
        super(ComboContainer, self).__init__()
        self._editor_widget = parent
        box = QHBoxLayout(self)
        box.setContentsMargins(0, 0, 0, 0)
        box.setSpacing(0)
        self._lines_symbols = []

        # Basado en la GUI de Qt Creator
        # Combo archivos
        self.combo_file = QComboBox()
        self.combo_file.setIconSize(QSize(14, 14))
        self.combo_file.setContextMenuPolicy(Qt.CustomContextMenu)
        box.addWidget(self.combo_file)
        # Botón cerrar
        btn_close_editor = QToolButton()
        btn_close_editor.setFixedSize(25, 22)
        btn_close_editor.setObjectName("combo-button")
        btn_close_editor.setToolTip(self.tr("Cerrar archivo"))
        btn_close_editor.setIcon(QIcon(":image/close"))
        btn_close_editor.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        box.addWidget(btn_close_editor)
        # Combo símbolos
        self.combo_symbols = QComboBox()
        self.combo_symbols.setIconSize(QSize(14, 14))
        box.addWidget(self.combo_symbols)
        # Label número de línea y columna
        self.label_line_row = QToolButton()
        self.label_line_row.mousePressEvent = self._show_dialog_go_to_line
        self.label_line_row.setObjectName("combo-lines-button")
        self.line_row = "Lin: %s, Col: %s - %s"
        self.label_line_row.setText(self.line_row % (0, 0, 0))
        self.label_line_row.setToolTip(
            self.tr("Click para ir a una línea y/o columna específica"))
        box.addWidget(self.label_line_row)

        output = Edis.get_component("output")

        # Conexiones
        self.connect(btn_close_editor, SIGNAL("clicked()"),
                     self._close_current_file)
        self.connect(output.salida_, SIGNAL("updateSyntaxCheck(bool)"),
                     self._show_icon_checker)
        self.connect(self.combo_symbols, SIGNAL("activated(int)"),
                     self._go_to_symbol)
        self.connect(self.combo_file,
                     SIGNAL("customContextMenuRequested(const QPoint)"),
                     self._load_menu_combo_file)
Exemple #39
0
    def done(self, result):
        if result == 0:
            super(NewProjectDialog, self).done(result)
            return
        name = self._intro.line_name.text()
        location = self._intro.line_location.text()
        template = self._finish.template
        full_path = os.path.join(location, name)

        self.data = {
            'name': name,
            'location': location,
            'template': template,
            'path': full_path
            }
        # Objeto EdisProject
        project = edis_project.EdisProject(self.data)
        project.name = name
        # Crea el directorio de proyectos si no existe
        if not os.path.isdir(paths.PROJECT_DIR):
            os.mkdir(paths.PROJECT_DIR)
        if os.path.exists(project.project_path):
            flags = QMessageBox.No | QMessageBox.Yes
            result = QMessageBox.information(self, self.tr("Advertencia!"),
                                             self.tr("Ya existe un proyecto "
                                             "con ese nombre. "
                                             "Quieres reemplazarlo?"), flags)
            if result == QMessageBox.No:
                return
            # Elimina los archivos del directorio
            for _file in os.listdir(project.project_path):
                os.remove(os.path.join(project.project_path, _file))
        else:
            os.mkdir(project.project_path)
        # Creo el archivo .epf
        json.dump(self.data, open(project.project_file, "w"))

        editor_container = Edis.get_component("principal")
        if project.template == 1:
            main_file = os.path.join(project.project_path, "main.c")
            with open(main_file, mode='w') as f:
                f.write(templates.MAIN_TEMPLATE)
            # Abro el archivo
            editor_container.open_file(main_file)
        # Cargo el projecto
        editor_container.open_project(project.project_file)
        super(NewProjectDialog, self).done(result)
Exemple #40
0
 def save(self):
     settings.set_setting('editor/complete-brace',
         self.check_key.isChecked())
     settings.set_setting('editor/complete-bracket',
         self.check_bracket.isChecked())
     if self.check_bracket.isChecked():
         settings.BRACES['['] = ']'
     elif ('[') in settings.BRACES:
         del settings.BRACES['[']
     settings.set_setting('editor/complete-paren',
         self.check_paren.isChecked())
     if self.check_paren.isChecked():
         settings.BRACES['('] = ')'
     elif ('(') in settings.BRACES:
         del settings.BRACES['(']
     settings.set_setting('editor/complete-double-quote',
         self.check_quote.isChecked())
     if self.check_quote.isChecked():
         settings.QUOTES.append('""')
     elif '""' in settings.QUOTES:
         settings.QUOTES.remove('""')
     settings.set_setting('editor/complete-single-quote',
         self.check_single_quote.isChecked())
     if self.check_single_quote.isChecked():
         settings.QUOTES.append('""')
     elif "''" in settings.QUOTES:
         settings.QUOTES.remove("''")
     code_completion = self.check_completion.isChecked()
     settings.set_setting('editor/completion',
         code_completion)
     settings.set_setting('editor/completion-threshold',
         self.spin_threshold.value())
     settings.set_setting('editor/completion-keywords',
         self.check_keywords.isChecked())
     settings.set_setting('editor/completion-document',
         self.check_document.isChecked())
     settings.set_setting('editor/completion-cs',
         self.check_cs.isChecked())
     settings.set_setting('editor/completion-replace-word',
         self.check_replace_word.isChecked())
     settings.set_setting('editor/completion-single',
         self.check_show_single.isChecked())
     editor_container = Edis.get_component("principal")
     editor = editor_container.get_active_editor()
     if editor is not None:
         editor.active_code_completion(code_completion)
Exemple #41
0
 def save(self):
     settings.set_setting('editor/complete-brace',
                          self.check_key.isChecked())
     settings.set_setting('editor/complete-bracket',
                          self.check_bracket.isChecked())
     if self.check_bracket.isChecked():
         settings.BRACES['['] = ']'
     elif ('[') in settings.BRACES:
         del settings.BRACES['[']
     settings.set_setting('editor/complete-paren',
                          self.check_paren.isChecked())
     if self.check_paren.isChecked():
         settings.BRACES['('] = ')'
     elif ('(') in settings.BRACES:
         del settings.BRACES['(']
     settings.set_setting('editor/complete-double-quote',
                          self.check_quote.isChecked())
     if self.check_quote.isChecked():
         settings.QUOTES.append('""')
     elif '""' in settings.QUOTES:
         settings.QUOTES.remove('""')
     settings.set_setting('editor/complete-single-quote',
                          self.check_single_quote.isChecked())
     if self.check_single_quote.isChecked():
         settings.QUOTES.append('""')
     elif "''" in settings.QUOTES:
         settings.QUOTES.remove("''")
     code_completion = self.check_completion.isChecked()
     settings.set_setting('editor/completion', code_completion)
     settings.set_setting('editor/completion-threshold',
                          self.spin_threshold.value())
     settings.set_setting('editor/completion-keywords',
                          self.check_keywords.isChecked())
     settings.set_setting('editor/completion-document',
                          self.check_document.isChecked())
     settings.set_setting('editor/completion-cs', self.check_cs.isChecked())
     settings.set_setting('editor/completion-replace-word',
                          self.check_replace_word.isChecked())
     settings.set_setting('editor/completion-single',
                          self.check_show_single.isChecked())
     editor_container = Edis.get_component("principal")
     editor = editor_container.get_active_editor()
     if editor is not None:
         editor.active_code_completion(code_completion)
Exemple #42
0
    def _create_main_file(self):
        """ Crea el archivo y la función main y lo agrega al árbol"""

        DEBUG("Creating main file...")
        current_item = self.currentItem()
        item_path = os.path.join(current_item.path, "main.c")
        if os.path.exists(item_path):
            # El archivo ya existe
            QMessageBox.information(
                self, self.tr("Información"), self.tr("El archivo <b>main.c</b> " "ya existe."), QMessageBox.Yes
            )
            DEBUG("File aready exists...")
            return
        # Creo el archivo
        file_manager.write_file(item_path, templates.MAIN_TEMPLATE)
        # Agrego el ítem, 0 = sources_item
        item = TreeItem(current_item.child(0), ["main.c"])
        item.path = item_path
        self._sources.append(item_path)
        # Abro el archivo
        editor_container = Edis.get_component("principal")
        editor_container.open_file(item_path)
    def _create_main_file(self):
        """ Crea el archivo y la función main y lo agrega al árbol"""

        DEBUG("Creating main file...")
        current_item = self.currentItem()
        item_path = os.path.join(current_item.path, 'main.c')
        if os.path.exists(item_path):
            # El archivo ya existe
            QMessageBox.information(self, self.tr("Información"),
                                    self.tr("El archivo <b>main.c</b> "
                                    "ya existe."), QMessageBox.Yes)
            DEBUG("File aready exists...")
            return
        # Creo el archivo
        file_manager.write_file(item_path, templates.MAIN_TEMPLATE)
        # Agrego el ítem, 0 = sources_item
        item = TreeItem(current_item.child(0), ['main.c'])
        item.path = item_path
        self._sources.append(item_path)
        # Abro el archivo
        editor_container = Edis.get_component("principal")
        editor_container.open_file(item_path)
    def _delete_file(self):
        """ Borra fisicamente el archivo y lo quita del árbol """

        DEBUG("Deleting file...")
        current_item = self.currentItem()
        # Flags
        yes = QMessageBox.Yes
        no = QMessageBox.No
        result = QMessageBox.warning(self, self.tr("Advertencia"),
                                     self.tr("Está seguro que quiere borrar "
                                     "el archivo?<br><br><b>{0}</b>").format(
                                      current_item.path), no | yes)
        if result == no:
            return
        # Elimino el item de la lista de fuentes
        self._sources.remove(current_item.path)
        # Cierro el archivo del editor
        editor_container = Edis.get_component("principal")
        editor_container.close_file_from_project(current_item.path)
        # Elimino el item del árbol
        index = current_item.parent().indexOfChild(current_item)
        current_item.parent().takeChild(index)
        # Borro el archivo fisicamente
        os.remove(current_item.path)
Exemple #45
0
 def _go_to_line(self, item):
     if item.clickeable:
         editor_container = Edis.get_component("principal")
         line = self._parse_line(item)
         editor_container.go_to_line(line)
 def __init__(self):
     super(CompilerConfiguration, self).__init__()
     self.flags = FlagsSection()
     preferences = Edis.get_component("preferences")
     preferences.install_section(self)
 def _go_to_symbol(self, index):
     editor_container = Edis.get_component("principal")
     line = self._lines_symbols[index]
     editor_container.go_to_line(line)
Exemple #48
0
 def _update_symbols_widget(self, filename):
     symbols, symbols_combo = ctags.get_symbols(filename)
     editor_container = Edis.get_component("principal")
     symbols_combo = sorted(symbols_combo.items())
     editor_container.add_symbols_combo(symbols_combo)
     self._symbols_widget.update_symbols(symbols)