signature stringlengths 8 3.44k | body stringlengths 0 1.41M | docstring stringlengths 1 122k | id stringlengths 5 17 |
|---|---|---|---|
@location.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(AssertionError)<EOL>def location(self, value):<DEDENT> | if value is not None:<EOL><INDENT>assert type(value) is umbra.ui.common.Location,"<STR_LIT>".format("<STR_LIT:location>", value)<EOL><DEDENT>self.__location = value<EOL> | Setter for **self.__location** attribute.
:param value: Attribute value.
:type value: Location | f13122:c3:m8 |
@location.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def location(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT:location>"))<EOL> | Deleter for **self.__location** attribute. | f13122:c3:m9 |
@property<EOL><INDENT>def settings(self):<DEDENT> | return self.__settings<EOL> | Property for **self.__settings** attribute.
:return: self.__settings.
:rtype: Location | f13122:c3:m10 |
@settings.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(AssertionError)<EOL>def settings(self, value):<DEDENT> | if value is not None:<EOL><INDENT>assert type(value) is dict, "<STR_LIT>".format("<STR_LIT>", value)<EOL><DEDENT>self.__settings = foundations.data_structures.Structure(**{"<STR_LIT>": False,<EOL>"<STR_LIT>": False,<EOL>"<STR_LIT>": False})<EOL>self.__settings.update(value)<EOL> | Setter for **self.__settings** attribute.
:param value: Attribute value.
:type value: Location | f13122:c3:m11 |
@settings.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def settings(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__settings** attribute. | f13122:c3:m12 |
@property<EOL><INDENT>def search_results(self):<DEDENT> | return self.__search_results<EOL> | Property for **self.__search_results** attribute.
:return: self.__search_results.
:rtype: list | f13122:c3:m13 |
@search_results.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def search_results(self, value):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Setter for **self.__search_results** attribute.
:param value: Attribute value.
:type value: list | f13122:c3:m14 |
@search_results.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def search_results(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__search_results** attribute. | f13122:c3:m15 |
def run(self): | self.__search()<EOL> | Reimplements the :meth:`QThread.run` method. | f13122:c3:m16 |
def quit(self): | self.__interrupt = True<EOL>QThread.quit(self)<EOL> | Reimplements the :meth:`QThread.quit` method. | f13122:c3:m17 |
def __search(self): | self.__search_results = []<EOL>editorsFiles = self.__container.default_target in self.__location.targets and[editor.file for editor in self.__container.script_editor.list_editors()] or []<EOL>self.__search_editors_files(editorsFiles)<EOL>self.__search_files(self.__location.files)<EOL>for directory in self.__location.directories:<EOL><INDENT>if self.__interrupt:<EOL><INDENT>return<EOL><DEDENT>files_walker = foundations.walkers.files_walker(directory,<EOL>self.__location.filters_in,<EOL>list(itertools.chain(self.__location.filters_out,<EOL>self.__location.files,<EOL>editorsFiles)))<EOL>self.__search_files(files_walker)<EOL><DEDENT>not self.__interrupt and self.searchFinished.emit(self.__search_results)<EOL> | Performs the search. | f13122:c3:m18 |
def __search_editors_files(self, files): | for file in files:<EOL><INDENT>if self.__interrupt:<EOL><INDENT>return<EOL><DEDENT>if foundations.io.is_readable(file):<EOL><INDENT>if foundations.io.is_binary_file(file):<EOL><INDENT>continue<EOL><DEDENT><DEDENT>LOGGER.info("<STR_LIT>".format(self.__class__.__name__, file))<EOL>editor = self.__container.script_editor.get_editor(file)<EOL>if not editor:<EOL><INDENT>continue<EOL><DEDENT>self.__lock.lock()<EOL>occurrences = self.__search_document(editor.document(), self.__pattern, self.__settings)<EOL>self.__lock.unlock()<EOL>occurrences and self.__search_results.append(SearchResult(file=file,<EOL>pattern=self.__pattern,<EOL>settings=self.__settings,<EOL>occurrences=occurrences))<EOL><DEDENT> | Searches in :class:`umbra.components.factory.script_editor.script_editor.ScriptEditor` class editors files.
:param files: Editor files.
:type files: list | f13122:c3:m19 |
def __search_files(self, files): | for file in files:<EOL><INDENT>if self.__interrupt:<EOL><INDENT>return<EOL><DEDENT>if not foundations.common.path_exists(file):<EOL><INDENT>continue<EOL><DEDENT>if foundations.io.is_readable(file):<EOL><INDENT>if foundations.io.is_binary_file(file):<EOL><INDENT>continue<EOL><DEDENT><DEDENT>LOGGER.info("<STR_LIT>".format(self.__class__.__name__, file))<EOL>cache_data = self.__container.files_cache.get_content(file)<EOL>if not cache_data:<EOL><INDENT>reader = foundations.io.File(file)<EOL>content = reader.read()<EOL>if content is None:<EOL><INDENT>LOGGER.warning("<STR_LIT>".format(file))<EOL>continue<EOL><DEDENT>self.__container.files_cache.add_content(**{file: CacheData(content=content, document=None)})<EOL><DEDENT>else:<EOL><INDENT>content = cache_data.content<EOL><DEDENT>occurrences = self.__search_document(QTextDocument(QString(content)), self.__pattern, self.__settings)<EOL>occurrences and self.__search_results.append(SearchResult(file=file,<EOL>pattern=self.__pattern,<EOL>settings=self.__settings,<EOL>occurrences=occurrences))<EOL><DEDENT> | Searches in given files.
:param files: Files.
:type files: list | f13122:c3:m20 |
def __search_document(self, document, pattern, settings): | pattern = settings.regular_expressions and QRegExp(pattern) or pattern<EOL>flags = QTextDocument.FindFlags()<EOL>if settings.case_sensitive:<EOL><INDENT>flags = flags | QTextDocument.FindCaseSensitively<EOL><DEDENT>if settings.whole_word:<EOL><INDENT>flags = flags | QTextDocument.FindWholeWords<EOL><DEDENT>occurrences = []<EOL>block = document.findBlock(<NUM_LIT:0>)<EOL>cursor = document.find(pattern, block.position(), flags)<EOL>while block.isValid() and cursor.position() != -<NUM_LIT:1>:<EOL><INDENT>if self.__interrupt:<EOL><INDENT>return<EOL><DEDENT>block_cursor = QTextCursor(cursor)<EOL>block_cursor.movePosition(QTextCursor.StartOfLine, QTextCursor.MoveAnchor)<EOL>block_cursor.movePosition(QTextCursor.EndOfLine, QTextCursor.KeepAnchor)<EOL>length = cursor.selectionEnd() - cursor.selectionStart()<EOL>occurrences.append(Occurence(line=cursor.blockNumber(),<EOL>column=cursor.columnNumber() - length,<EOL>length=length,<EOL>position=cursor.position() - length,<EOL>text=block_cursor.selectedText()))<EOL>cursor = document.find(pattern, cursor.position(), flags)<EOL>block = block.next()<EOL><DEDENT>return occurrences<EOL> | Searches for given pattern occurrences in given document using given settings.
:param document: Document.
:type document: QTextDocument
:param pattern: Pattern.
:type pattern: unicode
:param settings: Search settings.
:type settings: Structure
:return: Matched occurrences.
:rtype: list | f13122:c3:m21 |
def __init__(self, parent, *args, **kwargs): | LOGGER.debug("<STR_LIT>".format(self.__class__.__name__))<EOL>super(EditorStatus, self).__init__(parent, *args, **kwargs)<EOL>self.__container = parent<EOL>self.__Lines_Columns_label_default_text = "<STR_LIT>"<EOL>EditorStatus.__initialize_ui(self)<EOL> | Initializes the class.
:param parent: Object parent.
:type parent: QObject
:param \*args: Arguments.
:type \*args: \*
:param \*\*kwargs: Keywords arguments.
:type \*\*kwargs: \*\* | f13123:c0:m0 |
@property<EOL><INDENT>def container(self):<DEDENT> | return self.__container<EOL> | Property for **self.__container** attribute.
:return: self.__container.
:rtype: QObject | f13123:c0:m1 |
@container.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def container(self, value):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Setter for **self.__container** attribute.
:param value: Attribute value.
:type value: QObject | f13123:c0:m2 |
@container.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def container(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__container** attribute. | f13123:c0:m3 |
@property<EOL><INDENT>def Lines_Columns_label_default_text(self):<DEDENT> | return self.__Lines_Columns_label_default_text<EOL> | Property for **self.__Lines_Columns_label_default_text** attribute.
:return: self.__Lines_Columns_label_default_text.
:rtype: unicode | f13123:c0:m4 |
@Lines_Columns_label_default_text.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def Lines_Columns_label_default_text(self, value):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Setter for **self.__Lines_Columns_label_default_text** attribute.
:param value: Attribute value.
:type value: unicode | f13123:c0:m5 |
@Lines_Columns_label_default_text.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def Lines_Columns_label_default_text(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__,<EOL>"<STR_LIT>"))<EOL> | Deleter for **self.__Lines_Columns_label_default_text** attribute. | f13123:c0:m6 |
def __initialize_ui(self): | self.Lines_Columns_label.setAlignment(Qt.AlignRight)<EOL>self.Lines_Columns_label.setText(self.__Lines_Columns_label_default_text.format(<NUM_LIT:1>, <NUM_LIT:1>))<EOL>self.Languages_comboBox.setModel(self.__container.languages_model)<EOL>self.Languages_comboBox.currentIndexChanged.connect(self.__Languages_comboBox__currentIndexChanged)<EOL> | Initializes the Widget ui. | f13123:c0:m7 |
def __Languages_comboBox_set_default_view_state(self): | if not self.__container.has_editor_tab():<EOL><INDENT>return<EOL><DEDENT>editor = self.__container.get_current_editor()<EOL>index = self.Languages_comboBox.findText(editor.language.name)<EOL>self.Languages_comboBox.setCurrentIndex(index)<EOL> | Sets the **Languages_comboBox** Widget default View state. | f13123:c0:m8 |
def __Languages_comboBox__currentIndexChanged(self, index): | if not self.__container.has_editor_tab():<EOL><INDENT>return<EOL><DEDENT>language = self.__container.languages_model.get_language(foundations.strings.to_string(<EOL>self.Languages_comboBox.currentText()))<EOL>if not language:<EOL><INDENT>return<EOL><DEDENT>editor = self.__container.get_current_editor()<EOL>if editor.language == language:<EOL><INDENT>return<EOL><DEDENT>editor.blockSignals(True)<EOL>self.__container.set_language(editor, language)<EOL>editor.blockSignals(False)<EOL> | Defines the slot triggered by the **Languages_comboBox** Widget when current index is changed.
:param index: ComboBox current item index.
:type index: int | f13123:c0:m9 |
def __editor__cursorPositionChanged(self): | if not self.__container.has_editor_tab():<EOL><INDENT>return<EOL><DEDENT>editor = self.__container.get_current_editor()<EOL>self.Lines_Columns_label.setText(self.__Lines_Columns_label_default_text.format(editor.get_cursor_line() + <NUM_LIT:1>,<EOL>editor.get_cursor_column() + <NUM_LIT:1>))<EOL> | Defines the slot triggered by :class:`umbra.components.factory.script_editor.script_editor.ScriptEditor`
Component Interface class editor when cursor position is changed. | f13123:c0:m10 |
def eventFilter(self, object, event): | if event.type() == QEvent.KeyPress:<EOL><INDENT>if event.key() in (Qt.Key_Enter, Qt.Key_Return):<EOL><INDENT>object.search()<EOL><DEDENT>elif event.key() in (Qt.Key_Escape,):<EOL><INDENT>object.close()<EOL><DEDENT>return True<EOL><DEDENT>else:<EOL><INDENT>return QObject.eventFilter(self, object, event)<EOL><DEDENT> | Reimplements the **QObject.eventFilter** method.
:param object: Object.
:type object: QObject
:param event: Event.
:type event: QEvent
:return: Event filtered.
:rtype: bool | f13124:c0:m0 |
def __init__(self, parent, *args, **kwargs): | LOGGER.debug("<STR_LIT>".format(self.__class__.__name__))<EOL>super(SearchAndReplace, self).__init__(parent, *args, **kwargs)<EOL>self.__container = parent<EOL>self.__search_patterns_model = None<EOL>self.__replace_with_patterns_model = None<EOL>self.__maximum_stored_patterns = <NUM_LIT:15><EOL>SearchAndReplace.__initialize_ui(self)<EOL> | Initializes the class.
:param parent: Object parent.
:type parent: QObject
:param \*args: Arguments.
:type \*args: \*
:param \*\*kwargs: Keywords arguments.
:type \*\*kwargs: \*\* | f13124:c1:m0 |
@property<EOL><INDENT>def container(self):<DEDENT> | return self.__container<EOL> | Property for **self.__container** attribute.
:return: self.__container.
:rtype: QObject | f13124:c1:m1 |
@container.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def container(self, value):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Setter for **self.__container** attribute.
:param value: Attribute value.
:type value: QObject | f13124:c1:m2 |
@container.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def container(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__container** attribute. | f13124:c1:m3 |
@property<EOL><INDENT>def search_patterns_model(self):<DEDENT> | return self.__search_patterns_model<EOL> | Property for **self.__search_patterns_model** attribute.
:return: self.__search_patterns_model.
:rtype: PatternsModel | f13124:c1:m4 |
@search_patterns_model.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def search_patterns_model(self, value):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Setter for **self.__search_patterns_model** attribute.
:param value: Attribute value.
:type value: PatternsModel | f13124:c1:m5 |
@search_patterns_model.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def search_patterns_model(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__search_patterns_model** attribute. | f13124:c1:m6 |
@property<EOL><INDENT>def replace_with_patterns_model(self):<DEDENT> | return self.__replace_with_patterns_model<EOL> | Property for **self.__replace_with_patterns_model** attribute.
:return: self.__replace_with_patterns_model.
:rtype: PatternsModel | f13124:c1:m7 |
@replace_with_patterns_model.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def replace_with_patterns_model(self, value):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Setter for **self.__replace_with_patterns_model** attribute.
:param value: Attribute value.
:type value: PatternsModel | f13124:c1:m8 |
@replace_with_patterns_model.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def replace_with_patterns_model(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__replace_with_patterns_model** attribute. | f13124:c1:m9 |
@property<EOL><INDENT>def maximum_stored_patterns(self):<DEDENT> | return self.__maximum_stored_patterns<EOL> | Property for **self.__maximum_stored_patterns** attribute.
:return: self.__maximum_stored_patterns.
:rtype: int | f13124:c1:m10 |
@maximum_stored_patterns.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def maximum_stored_patterns(self, value):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Setter for **self.__maximum_stored_patterns** attribute.
:param value: Attribute value.
:type value: int | f13124:c1:m11 |
@maximum_stored_patterns.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def maximum_stored_patterns(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__maximum_stored_patterns** attribute. | f13124:c1:m12 |
def show(self): | selected_text = self.__container.get_current_editor().get_selected_text()<EOL>selected_text and self.insert_pattern(selected_text, self.__search_patterns_model)<EOL>self.Search_comboBox.line_edit().selectAll()<EOL>self.Search_comboBox.setFocus()<EOL>super(SearchAndReplace, self).show()<EOL>self.raise_()<EOL> | Reimplements the :meth:`QWidget.show` method. | f13124:c1:m13 |
def __initialize_ui(self): | umbra.ui.common.set_window_default_icon(self)<EOL>for model, settings_key, combo_box in(("<STR_LIT>", "<STR_LIT>", self.Search_comboBox),<EOL>("<STR_LIT>", "<STR_LIT>",<EOL>self.Replace_With_comboBox)):<EOL><INDENT>self.__dict__[model] = PatternsModel()<EOL>patterns = foundations.common.ordered_uniqify([foundations.strings.to_string(pattern) for pattern in<EOL>self.__container.settings.get_key(<EOL>self.__container.settings_section,<EOL>settings_key).toStringList()])<EOL>[PatternNode(parent=self.__dict__[model].root_node, name=pattern)<EOL>for pattern in patterns[:self.__maximum_stored_patterns]]<EOL>combo_box.setInsertPolicy(QComboBox.InsertAtTop)<EOL>combo_box.setModel(self.__dict__[model])<EOL>combo_box.completer().setCaseSensitivity(Qt.CaseSensitive)<EOL>self.__dict__[model].pattern_inserted.connect(<EOL>functools.partial(self.__patterns_model__pattern_inserted, settings_key, combo_box))<EOL><DEDENT>self.Wrap_Around_checkBox.setChecked(True)<EOL>self.installEventFilter(ValidationFilter(self))<EOL>self.Search_pushButton.clicked.connect(self.__Search_pushButton__clicked)<EOL>self.Replace_pushButton.clicked.connect(self.__Replace_pushButton__clicked)<EOL>self.Replace_All_pushButton.clicked.connect(self.__Replace_All_pushButton__clicked)<EOL>self.Close_pushButton.clicked.connect(self.__Close_pushButton__clicked)<EOL> | Initializes the Widget ui. | f13124:c1:m14 |
def __patterns_model__pattern_inserted(self, settings_key, combo_box, index): | patterns_model = self.sender()<EOL>LOGGER.debug("<STR_LIT>".format(patterns_model, settings_key))<EOL>self.__container.settings.set_key(self.__container.settings_section,<EOL>settings_key,<EOL>[pattern_node.name for pattern_node in<EOL>patterns_model.root_node.children[:self.maximum_stored_patterns]])<EOL>combo_box.setCurrentIndex(index.row())<EOL> | Defines the slot triggered by a pattern when inserted into a patterns Model.
:param settings_key: Pattern Model settings key.
:type settings_key: unicode
:param combo_box: Pattern Model attached combo_box.
:type combo_box: QComboBox
:param index: Inserted pattern index.
:type index: QModelIndex | f13124:c1:m15 |
def __Search_pushButton__clicked(self, checked): | self.search()<EOL> | Defines the slot triggered by **Search_pushButton** Widget when clicked.
:param checked: Checked state.
:type checked: bool | f13124:c1:m16 |
def __Replace_pushButton__clicked(self, checked): | self.replace()<EOL> | Defines the slot triggered by **Replace_pushButton** Widget when clicked.
:param checked: Checked state.
:type checked: bool | f13124:c1:m17 |
def __Replace_All_pushButton__clicked(self, checked): | self.replace_all()<EOL> | Defines the slot triggered by **Replace_All_pushButton** Widget when clicked.
:param checked: Checked state.
:type checked: bool | f13124:c1:m18 |
def __Close_pushButton__clicked(self, checked): | self.close()<EOL> | Defines the slot triggered by **Close_pushButton** Widget when clicked.
:param checked: Checked state.
:type checked: bool | f13124:c1:m19 |
def __get_settings(self): | return {"<STR_LIT>": self.Case_Sensitive_checkBox.isChecked(),<EOL>"<STR_LIT>": self.Whole_Word_checkBox.isChecked(),<EOL>"<STR_LIT>": self.Regular_Expressions_checkBox.isChecked(),<EOL>"<STR_LIT>": self.Backward_Search_checkBox.isChecked(),<EOL>"<STR_LIT>": self.Wrap_Around_checkBox.isChecked()}<EOL> | Returns the current search and replace settings.
:return: Settings.
:rtype: dict | f13124:c1:m20 |
@staticmethod<EOL><INDENT>def insert_pattern(pattern, model, index=<NUM_LIT:0>):<DEDENT> | if not pattern:<EOL><INDENT>return False<EOL><DEDENT>pattern = pattern.replace(QChar(QChar.ParagraphSeparator), QString("<STR_LIT:\n>"))<EOL>pattern = foundations.common.get_first_item(foundations.strings.to_string(pattern).split("<STR_LIT:\n>"))<EOL>model.insert_pattern(foundations.strings.to_string(pattern), index)<EOL>return True<EOL> | Inserts given pattern into given Model.
:param pattern: Pattern.
:type pattern: unicode
:param model: Model.
:type model: PatternsModel
:param index: Insertion indes.
:type index: int
:return: Method success.
:rtype: bool | f13124:c1:m21 |
def search(self): | editor = self.__container.get_current_editor()<EOL>search_pattern = self.Search_comboBox.currentText()<EOL>replacement_pattern = self.Replace_With_comboBox.currentText()<EOL>if not editor or not search_pattern:<EOL><INDENT>return False<EOL><DEDENT>self.insert_pattern(search_pattern, self.__search_patterns_model)<EOL>self.insert_pattern(replacement_pattern, self.__replace_with_patterns_model)<EOL>settings = self.__get_settings()<EOL>LOGGER.debug("<STR_LIT>".format(search_pattern, settings))<EOL>return editor.search(search_pattern, **settings)<EOL> | Searchs current editor Widget for search pattern.
:return: Method success.
:rtype: bool | f13124:c1:m22 |
def replace(self): | editor = self.__container.get_current_editor()<EOL>search_pattern = self.Search_comboBox.currentText()<EOL>replacement_pattern = self.Replace_With_comboBox.currentText()<EOL>if not editor or not search_pattern:<EOL><INDENT>return False<EOL><DEDENT>self.insert_pattern(search_pattern, self.__search_patterns_model)<EOL>self.insert_pattern(replacement_pattern, self.__replace_with_patterns_model)<EOL>settings = self.__get_settings()<EOL>LOGGER.debug("<STR_LIT>".format(<EOL>search_pattern, replacement_pattern, settings))<EOL>return editor.replace(search_pattern, replacement_pattern, **settings)<EOL> | Replaces current editor Widget current search pattern occurence with replacement pattern.
:return: Method success.
:rtype: bool | f13124:c1:m23 |
def replace_all(self): | editor = self.__container.get_current_editor()<EOL>search_pattern = self.Search_comboBox.currentText()<EOL>replacement_pattern = self.Replace_With_comboBox.currentText()<EOL>if not editor or not search_pattern:<EOL><INDENT>return False<EOL><DEDENT>self.insert_pattern(search_pattern, self.__search_patterns_model)<EOL>self.insert_pattern(replacement_pattern, self.__replace_with_patterns_model)<EOL>settings = self.__get_settings()<EOL>settings.update({"<STR_LIT>": False,<EOL>"<STR_LIT>": False})<EOL>LOGGER.debug("<STR_LIT>".format(<EOL>search_pattern, replacement_pattern, settings))<EOL>return editor.replace_all(search_pattern, replacement_pattern, **settings)<EOL> | Replaces current editor Widget search pattern occurrences with replacement pattern.
:return: Method success.
:rtype: bool | f13124:c1:m24 |
def __init__(self, parent, model=None, read_only=False, message=None): | LOGGER.debug("<STR_LIT>".format(self.__class__.__name__))<EOL>umbra.ui.views.Abstract_QTreeView.__init__(self, parent, read_only, message)<EOL>self.setModel(model)<EOL>self.__tree_view_indentation = <NUM_LIT:15><EOL>SearchResults_QTreeView.__initialize_ui(self)<EOL> | Initializes the class.
:param parent: Object parent.
:type parent: QObject
:param read_only: View is read only.
:type read_only: bool
:param message: View default message when Model is empty.
:type message: unicode | f13125:c0:m0 |
@property<EOL><INDENT>def tree_view_indentation(self):<DEDENT> | return self.__tree_view_indentation<EOL> | Property for **self.__tree_view_indentation** attribute.
:return: self.__tree_view_indentation.
:rtype: int | f13125:c0:m1 |
@tree_view_indentation.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def tree_view_indentation(self, value):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Setter for **self.__tree_view_indentation** attribute.
:param value: Attribute value.
:type value: int | f13125:c0:m2 |
@tree_view_indentation.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def tree_view_indentation(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__tree_view_indentation** attribute. | f13125:c0:m3 |
def __initialize_ui(self): | self.setAutoScroll(True)<EOL>self.setSelectionMode(QAbstractItemView.ExtendedSelection)<EOL>self.setIndentation(self.__tree_view_indentation)<EOL>self.setDragDropMode(QAbstractItemView.DragOnly)<EOL>self.setHeaderHidden(True)<EOL>self.__set_default_ui_state()<EOL>self.model().modelReset.connect(self.__set_default_ui_state)<EOL> | Initializes the Widget ui. | f13125:c0:m4 |
def __set_default_ui_state(self, *args): | LOGGER.debug("<STR_LIT>")<EOL>if not self.model():<EOL><INDENT>return<EOL><DEDENT>self.expandAll()<EOL>for column in range(len(self.model().horizontal_headers)):<EOL><INDENT>self.resizeColumnToContents(column)<EOL><DEDENT> | Sets the Widget default ui state.
:param \*args: Arguments.
:type \*args: \* | f13125:c0:m5 |
def __init__(self, parent): | LOGGER.debug("<STR_LIT>".format(self.__class__.__name__))<EOL>QTabWidget.__init__(self, parent)<EOL>self.setAcceptDrops(True)<EOL>self.__container = parent<EOL> | Initializes the class.
:param parent: Parent object.
:type parent: QObject | f13125:c1:m0 |
@property<EOL><INDENT>def container(self):<DEDENT> | return self.__container<EOL> | Property for **self.__container** attribute.
:return: self.__container.
:rtype: QObject | f13125:c1:m1 |
@container.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def container(self, value):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Setter for **self.__container** attribute.
:param value: Attribute value.
:type value: QObject | f13125:c1:m2 |
@container.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def container(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__container** attribute. | f13125:c1:m3 |
def dragEnterEvent(self, event): | LOGGER.debug("<STR_LIT>".format(self.__class__.__name__))<EOL>event.accept()<EOL> | Reimplements the :meth:`QTabWidget.dragEnterEvent` method.
:param event: QEvent.
:type event: QEvent | f13125:c1:m4 |
def dragMoveEvent(self, event): | LOGGER.debug("<STR_LIT>".format(self.__class__.__name__))<EOL>event.accept()<EOL> | Reimplements the :meth:`QTabWidget.dragMoveEvent` method.
:param event: QEvent.
:type event: QEvent | f13125:c1:m5 |
def dropEvent(self, event): | LOGGER.debug("<STR_LIT>".format(self.__class__.__name__))<EOL>self.content_dropped.emit(event)<EOL> | Reimplements the :meth:`QTabWidget.dropEvent` method.
:param event: QEvent.
:type event: QEvent | f13125:c1:m6 |
def __init__(self, parent, *args, **kwargs): | LOGGER.debug("<STR_LIT>".format(self.__class__.__name__))<EOL>super(SearchInFiles, self).__init__(parent, *args, **kwargs)<EOL>self.__container = self.__script_editor = parent<EOL>self.__files_cache = foundations.cache.Cache()<EOL>self.__search_patterns_model = None<EOL>self.__replace_with_patterns_model = None<EOL>self.__model = None<EOL>self.__view = None<EOL>self.__delegate = None<EOL>self.__locations = OrderedDict([("<STR_LIT>", "<STR_LIT>"),<EOL>("<STR_LIT>", "<STR_LIT:file>"),<EOL>("<STR_LIT>", "<STR_LIT>"),<EOL>("<STR_LIT>", "<STR_LIT>"),<EOL>("<STR_LIT>", "<STR_LIT>")])<EOL>self.__locations_menu = None<EOL>self.__default_filter_in = "<STR_LIT>"<EOL>self.__filters_in_format = "<STR_LIT>"<EOL>self.__default_filter_out = "<STR_LIT>"<EOL>self.__filters_out_format = "<STR_LIT>"<EOL>self.__default_target = "<STR_LIT>"<EOL>self.__targets_format = "<STR_LIT>"<EOL>self.__default_line_number_width = <NUM_LIT:6><EOL>self.__default_line_color = QColor(<NUM_LIT>, <NUM_LIT>, <NUM_LIT>)<EOL>self.__ignore_hidden_files = True<EOL>self.__search_worker_thread = None<EOL>SearchInFiles.__initialize_ui(self)<EOL> | Initializes the class.
:param parent: Object parent.
:type parent: QObject
:param \*args: Arguments.
:type \*args: \*
:param \*\*kwargs: Keywords arguments.
:type \*\*kwargs: \*\* | f13126:c0:m0 |
@property<EOL><INDENT>def container(self):<DEDENT> | return self.__container<EOL> | Property for **self.__container** attribute.
:return: self.__container.
:rtype: QObject | f13126:c0:m1 |
@container.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def container(self, value):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Setter for **self.__container** attribute.
:param value: Attribute value.
:type value: QObject | f13126:c0:m2 |
@container.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def container(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__container** attribute. | f13126:c0:m3 |
@property<EOL><INDENT>def script_editor(self):<DEDENT> | return self.__script_editor<EOL> | Property for **self.__script_editor** attribute.
:return: self.__script_editor.
:rtype: QWidget | f13126:c0:m4 |
@script_editor.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def script_editor(self, value):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Setter for **self.__script_editor** attribute.
:param value: Attribute value.
:type value: QWidget | f13126:c0:m5 |
@script_editor.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def script_editor(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__script_editor** attribute. | f13126:c0:m6 |
@property<EOL><INDENT>def files_cache(self):<DEDENT> | return self.__files_cache<EOL> | Property for **self.__files_cache** attribute.
:return: self.__files_cache.
:rtype: Cache | f13126:c0:m7 |
@files_cache.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def files_cache(self, value):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Setter for **self.__files_cache** attribute.
:param value: Attribute value.
:type value: Cache | f13126:c0:m8 |
@files_cache.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def files_cache(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__files_cache** attribute. | f13126:c0:m9 |
@property<EOL><INDENT>def search_patterns_model(self):<DEDENT> | return self.__search_patterns_model<EOL> | Property for **self.__search_patterns_model** attribute.
:return: self.__search_patterns_model.
:rtype: PatternsModel | f13126:c0:m10 |
@search_patterns_model.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def search_patterns_model(self, value):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Setter for **self.__search_patterns_model** attribute.
:param value: Attribute value.
:type value: PatternsModel | f13126:c0:m11 |
@search_patterns_model.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def search_patterns_model(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__search_patterns_model** attribute. | f13126:c0:m12 |
@property<EOL><INDENT>def replace_with_patterns_model(self):<DEDENT> | return self.__replace_with_patterns_model<EOL> | Property for **self.__replace_with_patterns_model** attribute.
:return: self.__replace_with_patterns_model.
:rtype: PatternsModel | f13126:c0:m13 |
@replace_with_patterns_model.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def replace_with_patterns_model(self, value):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Setter for **self.__replace_with_patterns_model** attribute.
:param value: Attribute value.
:type value: PatternsModel | f13126:c0:m14 |
@replace_with_patterns_model.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def replace_with_patterns_model(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__replace_with_patterns_model** attribute. | f13126:c0:m15 |
@property<EOL><INDENT>def model(self):<DEDENT> | return self.__model<EOL> | Property for **self.__model** attribute.
:return: self.__model.
:rtype: SearchResultsModel | f13126:c0:m16 |
@model.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def model(self, value):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Setter for **self.__model** attribute.
:param value: Attribute value.
:type value: SearchResultsModel | f13126:c0:m17 |
@model.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def model(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__model** attribute. | f13126:c0:m18 |
@property<EOL><INDENT>def view(self):<DEDENT> | return self.__view<EOL> | Property for **self.__view** attribute.
:return: self.__view.
:rtype: QWidget | f13126:c0:m19 |
@view.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def view(self, value):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Setter for **self.__view** attribute.
:param value: Attribute value.
:type value: QWidget | f13126:c0:m20 |
@view.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def view(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__view** attribute. | f13126:c0:m21 |
@property<EOL><INDENT>def delegate(self):<DEDENT> | return self.__delegate<EOL> | Property for **self.__delegate** attribute.
:return: self.__delegate.
:rtype: QItemDelegate | f13126:c0:m22 |
@delegate.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def delegate(self, value):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Setter for **self.__delegate** attribute.
:param value: Attribute value.
:type value: QItemDelegate | f13126:c0:m23 |
@delegate.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def delegate(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__delegate** attribute. | f13126:c0:m24 |
@property<EOL><INDENT>def locations(self):<DEDENT> | return self.__locations<EOL> | Property for **self.__locations** attribute.
:return: self.__locations.
:rtype: OrderedDict | f13126:c0:m25 |
@locations.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def locations(self, value):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Setter for **self.__locations** attribute.
:param value: Attribute value.
:type value: OrderedDict | f13126:c0:m26 |
@locations.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def locations(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__locations** attribute. | f13126:c0:m27 |
@property<EOL><INDENT>def locations_menu(self):<DEDENT> | return self.__locations_menu<EOL> | Property for **self.__locations_menu** attribute.
:return: self.__locations_menu.
:rtype: QMenu | f13126:c0:m28 |
@locations_menu.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def locations_menu(self, value):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Setter for **self.__locations_menu** attribute.
:param value: Attribute value.
:type value: QMenu | f13126:c0:m29 |
@locations_menu.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def locations_menu(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__locations_menu** attribute. | f13126:c0:m30 |
@property<EOL><INDENT>def default_filter_in(self):<DEDENT> | return self.__default_filter_in<EOL> | Property for **self.__default_filter_in** attribute.
:return: self.__default_filter_in.
:rtype: unicode | f13126:c0:m31 |
@default_filter_in.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(AssertionError)<EOL>def default_filter_in(self, value):<DEDENT> | if value is not None:<EOL><INDENT>assert type(value) is unicode, "<STR_LIT>".format(<EOL>"<STR_LIT>", value)<EOL>assert os.path.exists(value), "<STR_LIT>".format(<EOL>"<STR_LIT>", value)<EOL><DEDENT>self.__default_filter_in = value<EOL> | Setter for **self.__default_filter_in** attribute.
:param value: Attribute value.
:type value: unicode | f13126:c0:m32 |
@default_filter_in.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def default_filter_in(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__default_filter_in** attribute. | f13126:c0:m33 |
@property<EOL><INDENT>def filters_in_format(self):<DEDENT> | return self.__filters_in_format<EOL> | Property for **self.__filters_in_format** attribute.
:return: self.__filters_in_format.
:rtype: unicode | f13126:c0:m34 |
@filters_in_format.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(AssertionError)<EOL>def filters_in_format(self, value):<DEDENT> | if value is not None:<EOL><INDENT>assert type(value) is unicode, "<STR_LIT>".format(<EOL>"<STR_LIT>", value)<EOL>assert os.path.exists(value), "<STR_LIT>".format(<EOL>"<STR_LIT>", value)<EOL><DEDENT>self.__filters_in_format = value<EOL> | Setter for **self.__filters_in_format** attribute.
:param value: Attribute value.
:type value: unicode | f13126:c0:m35 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.