signature stringlengths 8 3.44k | body stringlengths 0 1.41M | docstring stringlengths 1 122k | id stringlengths 5 17 |
|---|---|---|---|
def __insert_completion(self, completion): | LOGGER.debug("<STR_LIT>".format(completion))<EOL>text_cursor = self.textCursor()<EOL>extra = (completion.length() - self.__completer.completion_prefix().length())<EOL>text_cursor.insertText(completion.right(extra))<EOL>self.setTextCursor(text_cursor)<EOL> | Inserts the completion text in the current document.
:param completion: Completion text.
:type completion: QString | f13151:c1:m35 |
def __set_language_description(self): | LOGGER.debug("<STR_LIT>")<EOL>if not self.__language:<EOL><INDENT>return<EOL><DEDENT>if self.__language.highlighter:<EOL><INDENT>self.set_highlighter(self.__language.highlighter(self.document(),<EOL>self.__language.rules,<EOL>self.__language.theme))<EOL>self.highlighter.rehighlight()<EOL><DEDENT>else:<EOL><INDENT>self.... | Sets the language accelerators. | f13151:c1:m36 |
def set_language(self, language): | LOGGER.debug("<STR_LIT>".format(language.name))<EOL>self.__language = language or umbra.ui.languages.PYTHON_LANGUAGE<EOL>self.__set_language_description()<EOL>self.language_changed.emit()<EOL>return True<EOL> | Sets the language.
:param language: Language to set.
:type language: Language
:return: Method success.
:rtype: bool | f13151:c1:m37 |
@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL><INDENT>def set_highlighter(self, highlighter):<DEDENT> | if not issubclass(highlighter.__class__, QSyntaxHighlighter):<EOL><INDENT>raise foundations.exceptions.ProgrammingError("<STR_LIT>".format(<EOL>self.__class__.__name__, highlighter))<EOL><DEDENT>if self.__highlighter:<EOL><INDENT>self.remove_highlighter()<EOL><DEDENT>LOGGER.debug("<STR_LIT>".format(highlighter))<EOL>se... | Sets given highlighter as the current document highlighter.
:param highlighter: Highlighter.
:type highlighter: QSyntaxHighlighter
:return: Method success.
:rtype: bool | f13151:c1:m38 |
def remove_highlighter(self): | if self.__highlighter:<EOL><INDENT>LOGGER.debug("<STR_LIT>".format(self.__highlighter))<EOL>self.__highlighter.deleteLater()<EOL>self.__highlighter = None<EOL><DEDENT>return True<EOL> | Removes current highlighter.
:return: Method success.
:rtype: bool | f13151:c1:m39 |
@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL><INDENT>def set_completer(self, completer):<DEDENT> | if not issubclass(completer.__class__, QCompleter):<EOL><INDENT>raise foundations.exceptions.ProgrammingError("<STR_LIT>".format(<EOL>self.__class__.__name__, completer))<EOL><DEDENT>if self.__completer:<EOL><INDENT>self.remove_completer()<EOL><DEDENT>LOGGER.debug("<STR_LIT>".format(completer))<EOL>self.__completer = c... | Sets given completer as the current completer.
:param completer: Completer.
:type completer: QCompleter
:return: Method success.
:rtype: bool | f13151:c1:m40 |
def remove_completer(self): | if self.__completer:<EOL><INDENT>LOGGER.debug("<STR_LIT>".format(self.__completer))<EOL>self.__completer.activated.disconnect(self.__insert_completion)<EOL>self.__completer.deleteLater()<EOL>self.__completer = None<EOL><DEDENT>return True<EOL> | Removes current completer.
:return: Method success.
:rtype: bool | f13151:c1:m41 |
def get_matching_symbols_pairs(self, cursor, opening_symbol, closing_symbol, backward=False): | if cursor.hasSelection():<EOL><INDENT>start_position = cursor.selectionEnd() if backward else cursor.selectionStart()<EOL><DEDENT>else:<EOL><INDENT>start_position = cursor.position()<EOL><DEDENT>flags = QTextDocument.FindFlags()<EOL>if backward:<EOL><INDENT>flags = flags | QTextDocument.FindBackward<EOL><DEDENT>start_c... | Returns the cursor for matching given symbols pairs.
:param cursor: Cursor to match from.
:type cursor: QTextCursor
:param opening_symbol: Opening symbol.
:type opening_symbol: unicode
:param closing_symbol: Closing symbol to match.
:type closing_symbol: unicode
:return: Matching cursor.
:rtype: QTextCursor | f13151:c1:m42 |
@edit_block<EOL><INDENT>def indent(self):<DEDENT> | cursor = self.textCursor()<EOL>if not cursor.hasSelection():<EOL><INDENT>cursor.insertText(self.__indent_marker)<EOL><DEDENT>else:<EOL><INDENT>block = self.document().findBlock(cursor.selectionStart())<EOL>while True:<EOL><INDENT>block_cursor = self.textCursor()<EOL>block_cursor.setPosition(block.position())<EOL>block_... | Indents the document text under cursor.
:return: Method success.
:rtype: bool | f13151:c1:m43 |
@edit_block<EOL><INDENT>def unindent(self):<DEDENT> | cursor = self.textCursor()<EOL>if not cursor.hasSelection():<EOL><INDENT>cursor.movePosition(QTextCursor.StartOfBlock)<EOL>line = foundations.strings.to_string(self.document().findBlockByNumber(cursor.blockNumber()).text())<EOL>indent_marker = re.match(r"<STR_LIT>".format(self.__indent_marker), line)<EOL>if indent_mark... | Unindents the document text under cursor.
:return: Method success.
:rtype: bool | f13151:c1:m44 |
@edit_block<EOL><INDENT>def toggle_comments(self):<DEDENT> | if not self.__comment_marker:<EOL><INDENT>return True<EOL><DEDENT>cursor = self.textCursor()<EOL>if not cursor.hasSelection():<EOL><INDENT>cursor.movePosition(QTextCursor.StartOfBlock)<EOL>line = foundations.strings.to_string(self.document().findBlockByNumber(cursor.blockNumber()).text())<EOL>if line.startswith(self.__... | Toggles comments on the document selected lines.
:return: Method success.
:rtype: bool | f13151:c1:m45 |
@anchor_text_cursor<EOL><INDENT>@edit_block<EOL>def remove_trailing_white_spaces(self):<DEDENT> | cursor = self.textCursor()<EOL>block = self.document().findBlockByLineNumber(<NUM_LIT:0>)<EOL>while block.isValid():<EOL><INDENT>cursor.setPosition(block.position())<EOL>if re.search(r"<STR_LIT>", block.text()):<EOL><INDENT>cursor.movePosition(QTextCursor.EndOfBlock)<EOL>cursor.movePosition(QTextCursor.StartOfBlock, QT... | Removes document trailing white spaces.
:return: Method success.
:rtype: bool | f13151:c1:m46 |
@anchor_text_cursor<EOL><INDENT>@edit_block<EOL>def convert_indentation_to_tabs(self):<DEDENT> | cursor = self.textCursor()<EOL>block = self.document().findBlockByLineNumber(<NUM_LIT:0>)<EOL>while block.isValid():<EOL><INDENT>cursor.setPosition(block.position())<EOL>search = re.match(r"<STR_LIT>", block.text())<EOL>if search:<EOL><INDENT>cursor.movePosition(QTextCursor.StartOfBlock, QTextCursor.MoveAnchor)<EOL>sea... | Converts document indentation to tabs.
:return: Method success.
:rtype: bool | f13151:c1:m47 |
@anchor_text_cursor<EOL><INDENT>@edit_block<EOL>def convert_indentation_to_spaces(self):<DEDENT> | cursor = self.textCursor()<EOL>block = self.document().findBlockByLineNumber(<NUM_LIT:0>)<EOL>while block.isValid():<EOL><INDENT>cursor.setPosition(block.position())<EOL>search = re.match(r"<STR_LIT>", block.text())<EOL>if search:<EOL><INDENT>cursor.movePosition(QTextCursor.StartOfBlock, QTextCursor.MoveAnchor)<EOL>sea... | Converts document indentation to spaces.
:return: Method success.
:rtype: bool | f13151:c1:m48 |
def __init__(self,<EOL>parent=None,<EOL>color=None,<EOL>background_color=None,<EOL>border_color=None,<EOL>anchor=None,<EOL>horizontal_padding=None,<EOL>vertical_padding=None,<EOL>horizontal_offset=None,<EOL>vertical_offset=None,<EOL>fade_speed=None,<EOL>target_opacity=None,<EOL>duration=None): | LOGGER.debug("<STR_LIT>".format(self.__class__.__name__))<EOL>QLabel.__init__(self, parent)<EOL>self.__opacity = <NUM_LIT:0><EOL>self.__style = """<STR_LIT>"""<EOL>self.__color = QColor(<NUM_LIT>, <NUM_LIT>, <NUM_LIT>)<EOL>self.__background_color = QColor(<NUM_LIT:32>, <NUM_LIT:32>, <NUM_LIT:32>)<EOL>self.__border_colo... | Initializes the class.
:param parent: Widget parent.
:type parent: QObject
:param color: Widget text color.
:type color: QColor
:param background_color: Widget background color.
:type background_color: QColor
:param border_color: Widget border color.
:type border_color: QColor
:param anchor: Widget anchoring area ( Fr... | f13152:c0:m0 |
@property<EOL><INDENT>def color(self):<DEDENT> | return self.__color<EOL> | Property for **self.__color** attribute.
:return: self.__color.
:rtype: QColor | f13152:c0:m1 |
@color.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(AssertionError)<EOL>def color(self, value):<DEDENT> | if value is not None:<EOL><INDENT>assert type(value) is QColor, "<STR_LIT>".format("<STR_LIT>", value)<EOL><DEDENT>self.__color = value<EOL>self.__set_style_sheet()<EOL> | Setter for **self.__color** attribute.
:param value: Attribute value.
:type value: QColor | f13152:c0:m2 |
@color.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def color(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__color** attribute. | f13152:c0:m3 |
@property<EOL><INDENT>def background_color(self):<DEDENT> | return self.__background_color<EOL> | Property for **self.__background_color** attribute.
:return: self.__background_color.
:rtype: QColor | f13152:c0:m4 |
@background_color.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(AssertionError)<EOL>def background_color(self, value):<DEDENT> | if value is not None:<EOL><INDENT>assert type(value) is QColor, "<STR_LIT>".format(<EOL>"<STR_LIT>", value)<EOL><DEDENT>self.__background_color = value<EOL>self.__set_style_sheet()<EOL> | Setter for **self.__background_color** attribute.
:param value: Attribute value.
:type value: QColor | f13152:c0:m5 |
@background_color.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def background_color(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__background_color** attribute. | f13152:c0:m6 |
@property<EOL><INDENT>def border_color(self):<DEDENT> | return self.__border_color<EOL> | Property for **self.__border_color** attribute.
:return: self.__border_color.
:rtype: QColor | f13152:c0:m7 |
@border_color.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(AssertionError)<EOL>def border_color(self, value):<DEDENT> | if value is not None:<EOL><INDENT>assert type(value) is QColor, "<STR_LIT>".format("<STR_LIT>", value)<EOL><DEDENT>self.__border_color = value<EOL>self.__set_style_sheet()<EOL> | Setter for **self.__border_color** attribute.
:param value: Attribute value.
:type value: QColor | f13152:c0:m8 |
@border_color.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def border_color(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__border_color** attribute. | f13152:c0:m9 |
@property<EOL><INDENT>def anchor(self):<DEDENT> | return self.__anchor<EOL> | Property for **self.__anchor** attribute.
:return: self.__anchor.
:rtype: int | f13152:c0:m10 |
@anchor.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(AssertionError)<EOL>def anchor(self, value):<DEDENT> | if value is not None:<EOL><INDENT>assert type(value) is int, "<STR_LIT>".format("<STR_LIT>", value)<EOL>assert value in range(<EOL><NUM_LIT:0>, <NUM_LIT:9>), "<STR_LIT>".format("<STR_LIT>", value)<EOL><DEDENT>self.__anchor = value<EOL> | Setter for **self.__anchor** attribute.
:param value: Attribute value.
:type value: int | f13152:c0:m11 |
@anchor.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def anchor(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__anchor** attribute. | f13152:c0:m12 |
@property<EOL><INDENT>def horizontal_padding(self):<DEDENT> | return self.__horizontal_padding<EOL> | Property for **self.__horizontal_padding** attribute.
:return: self.__horizontal_padding.
:rtype: int | f13152:c0:m13 |
@horizontal_padding.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(AssertionError)<EOL>def horizontal_padding(self, value):<DEDENT> | if value is not None:<EOL><INDENT>assert type(value) is int, "<STR_LIT>".format("<STR_LIT>", value)<EOL>assert value >= <NUM_LIT:0>, "<STR_LIT>".format("<STR_LIT>", value)<EOL><DEDENT>self.__horizontal_padding = value<EOL> | Setter for **self.__horizontal_padding** attribute.
:param value: Attribute value.
:type value: int | f13152:c0:m14 |
@horizontal_padding.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def horizontal_padding(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__horizontal_padding** attribute. | f13152:c0:m15 |
@property<EOL><INDENT>def vertical_padding(self):<DEDENT> | return self.__vertical_padding<EOL> | Property for **self.__vertical_padding** attribute.
:return: self.__vertical_padding.
:rtype: int | f13152:c0:m16 |
@vertical_padding.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(AssertionError)<EOL>def vertical_padding(self, value):<DEDENT> | if value is not None:<EOL><INDENT>assert type(value) is int, "<STR_LIT>".format("<STR_LIT>", value)<EOL>assert value > <NUM_LIT:0>, "<STR_LIT>".format("<STR_LIT>", value)<EOL><DEDENT>self.__vertical_padding = value<EOL> | Setter for **self.__vertical_padding** attribute.
:param value: Attribute value.
:type value: int | f13152:c0:m17 |
@vertical_padding.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def vertical_padding(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__vertical_padding** attribute. | f13152:c0:m18 |
@property<EOL><INDENT>def horizontal_offset(self):<DEDENT> | return self.__horizontal_offset<EOL> | Property for **self.__horizontal_offset** attribute.
:return: self.__horizontal_offset.
:rtype: int | f13152:c0:m19 |
@horizontal_offset.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(AssertionError)<EOL>def horizontal_offset(self, value):<DEDENT> | if value is not None:<EOL><INDENT>assert type(value) is int, "<STR_LIT>".format("<STR_LIT>", value)<EOL><DEDENT>self.__horizontal_offset = value<EOL> | Setter for **self.__horizontal_offset** attribute.
:param value: Attribute value.
:type value: int | f13152:c0:m20 |
@horizontal_offset.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def horizontal_offset(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__horizontal_offset** attribute. | f13152:c0:m21 |
@property<EOL><INDENT>def vertical_offset(self):<DEDENT> | return self.__vertical_offset<EOL> | Property for **self.__vertical_offset** attribute.
:return: self.__vertical_offset.
:rtype: int | f13152:c0:m22 |
@vertical_offset.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(AssertionError)<EOL>def vertical_offset(self, value):<DEDENT> | if value is not None:<EOL><INDENT>assert type(value) is int, "<STR_LIT>".format("<STR_LIT>", value)<EOL><DEDENT>self.__vertical_offset = value<EOL> | Setter for **self.__vertical_offset** attribute.
:param value: Attribute value.
:type value: int | f13152:c0:m23 |
@vertical_offset.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def vertical_offset(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__vertical_offset** attribute. | f13152:c0:m24 |
@property<EOL><INDENT>def fade_speed(self):<DEDENT> | return self.__fade_speed<EOL> | Property for **self.__fade_speed** attribute.
:return: self.__fade_speed.
:rtype: float | f13152:c0:m25 |
@fade_speed.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(AssertionError)<EOL>def fade_speed(self, value):<DEDENT> | if value is not None:<EOL><INDENT>assert type(value) is float, "<STR_LIT>".format("<STR_LIT>", value)<EOL>assert value >= <NUM_LIT:0>, "<STR_LIT>".format("<STR_LIT>", value)<EOL><DEDENT>self.__fade_speed = value<EOL> | Setter for **self.__fade_speed** attribute.
:param value: Attribute value.
:type value: float | f13152:c0:m26 |
@fade_speed.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def fade_speed(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__fade_speed** attribute. | f13152:c0:m27 |
@property<EOL><INDENT>def target_opacity(self):<DEDENT> | return self.__target_opacity<EOL> | Property for **self.__target_opacity** attribute.
:return: self.__target_opacity.
:rtype: float | f13152:c0:m28 |
@target_opacity.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(AssertionError)<EOL>def target_opacity(self, value):<DEDENT> | if value is not None:<EOL><INDENT>assert type(value) is float, "<STR_LIT>".format("<STR_LIT>", value)<EOL>assert value >= <NUM_LIT:0>, "<STR_LIT>".format("<STR_LIT>", value)<EOL>assert value <= <NUM_LIT:1>, "<STR_LIT>".format(<EOL>"<STR_LIT>", value)<EOL><DEDENT>self.__target_opacity = value<EOL> | Setter for **self.__target_opacity** attribute.
:param value: Attribute value.
:type value: float | f13152:c0:m29 |
@target_opacity.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def target_opacity(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__target_opacity** attribute. | f13152:c0:m30 |
@property<EOL><INDENT>def duration(self):<DEDENT> | return self.__duration<EOL> | Property for **self.__duration** attribute.
:return: self.__duration.
:rtype: int | f13152:c0:m31 |
@duration.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(AssertionError)<EOL>def duration(self, value):<DEDENT> | if value is not None:<EOL><INDENT>assert type(value) is int, "<STR_LIT>".format("<STR_LIT>", value)<EOL>assert value >= <NUM_LIT:0>, "<STR_LIT>".format("<STR_LIT>", value)<EOL><DEDENT>self.__duration = value<EOL> | Setter for **self.__duration** attribute.
:param value: Attribute value.
:type value: int | f13152:c0:m32 |
@duration.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def duration(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__duration** attribute. | f13152:c0:m33 |
@property<EOL><INDENT>def opacity(self):<DEDENT> | return self.__opacity<EOL> | Property for **self.__opacity** attribute.
:return: self.__opacity.
:rtype: float | f13152:c0:m34 |
@opacity.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(AssertionError)<EOL>def opacity(self, value):<DEDENT> | if value is not None:<EOL><INDENT>assert type(value) in (int, float), "<STR_LIT>".format("<STR_LIT>",<EOL>value)<EOL><DEDENT>if value > <NUM_LIT:1>:<EOL><INDENT>value = <NUM_LIT:1><EOL><DEDENT>elif value < <NUM_LIT:0>:<EOL><INDENT>value = <NUM_LIT:0><EOL><DEDENT>self.__opacity = float(value)<EOL>self.__set_style_sheet(... | Setter for **self.__opacity** attribute.
:param value: Attribute value.
:type value: float | f13152:c0:m35 |
@opacity.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def opacity(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__opacity** attribute. | f13152:c0:m36 |
@property<EOL><INDENT>def style(self):<DEDENT> | return self.__style<EOL> | Property for **self.__style** attribute.
:return: self.__style.
:rtype: unicode | f13152:c0:m37 |
@style.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def style(self, value):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Setter for **self.__style** attribute.
:param value: Attribute value.
:type value: unicode | f13152:c0:m38 |
@style.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def style(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__style** attribute. | f13152:c0:m39 |
def setParent(self, parent): | QLabel.setParent(self, parent)<EOL>self.__set_position()<EOL> | Reimplements the :meth:`QLabel.setParent` method.
:param parent: Parent.
:type parent: QObject | f13152:c0:m40 |
def resizeEvent(self, event): | QLabel.resizeEvent(self, event)<EOL>self.__set_position()<EOL> | Reimplements the :meth:`QLabel.resizeEvent` method.
:param event: QEvent.
:type event: QEvent | f13152:c0:m41 |
def mousePressEvent(self, event): | self.notification_clicked.emit(self.text())<EOL> | Reimplements the :meth:`QLabel.mousePressEvent` method.
:param event: QEvent.
:type event: QEvent | f13152:c0:m42 |
def showEvent(self, event): | QLabel.showEvent(self, event)<EOL>self.__set_position()<EOL> | Reimplements the :meth:`QLabel.showEvent` method.
:param event: QEvent.
:type event: QEvent | f13152:c0:m43 |
def __raise(self, *args): | children = self.parent().children().remove(self)<EOL>if children:<EOL><INDENT>self.stackUnder(children[-<NUM_LIT:1>])<EOL><DEDENT>else:<EOL><INDENT>self.lower()<EOL><DEDENT>self.raise_()<EOL> | Ensures that the Widget stays on top of the parent stack forcing the redraw.
:param \*args: Arguments.
:type \*args: \* | f13152:c0:m44 |
def __set_position(self): | rectangle = hasattr(self.parent(), "<STR_LIT>") and self.parent().viewport().rect() or self.parent().rect()<EOL>if not rectangle:<EOL><INDENT>return<EOL><DEDENT>self.adjustSize()<EOL>if self.__anchor == <NUM_LIT:0>:<EOL><INDENT>point_x = rectangle.width() / <NUM_LIT:2> - self.width() / <NUM_LIT:2><EOL>point_y = self.__... | Sets the Widget position relatively to its parent. | f13152:c0:m45 |
def __fade_in(self): | self.__timer.stop()<EOL>self.__vector = self.__fade_speed<EOL>self.__timer.start()<EOL> | Starts the Widget fade in. | f13152:c0:m46 |
def __fade_out(self): | self.__timer.stop()<EOL>self.__vector = -self.__fade_speed<EOL>self.__timer.start()<EOL> | Starts the Widget fade out. | f13152:c0:m47 |
def __set_opacity(self): | if self.__vector > <NUM_LIT:0>:<EOL><INDENT>if self.isHidden():<EOL><INDENT>self.show()<EOL><DEDENT>if self.opacity <= self.__target_opacity:<EOL><INDENT>self.opacity += self.__vector<EOL><DEDENT>else:<EOL><INDENT>self.__timer.stop()<EOL>self.faded_in.emit()<EOL>self.__duration and QTimer.singleShot(self.__duration, se... | Sets the Widget opacity. | f13152:c0:m48 |
def __set_style_sheet(self): | colors = map(<EOL>lambda x: "<STR_LIT>".format(x.red(), x.green(), x.blue(), int(self.__opacity * <NUM_LIT:255>)),<EOL>(self.__color, self.__background_color, self.__border_color))<EOL>self.setStyleSheet(self.__style.format(*colors))<EOL> | Sets the Widget stylesheet. | f13152:c0:m49 |
def show_message(self, message, duration=<NUM_LIT>): | self.setText(message)<EOL>self.__duration = duration<EOL>self.__set_position()<EOL>if message:<EOL><INDENT>self.__fade_in()<EOL><DEDENT>else:<EOL><INDENT>self.__fade_out()<EOL><DEDENT>return True<EOL> | Shows given message.
:param message: Message.
:type message: unicode
:param duration: Notification duration in milliseconds.
:type duration: int
:return: Method success.
:rtype: bool | f13152:c0:m50 |
def hide_message(self): | self.__fade_out()<EOL>return True<EOL> | Hides the current message.
:return: Method success.
:rtype: bool | f13152:c0:m51 |
def refresh_position(self): | self.__set_position()<EOL>return True<EOL> | Refreshes the Widget position.
:return: Method success.
:rtype: bool | f13152:c0:m52 |
def __init__(self,<EOL>parent=None,<EOL>ui_search_image=None,<EOL>ui_search_clicked_image=None,<EOL>ui_clear_image=None,<EOL>ui_clear_clicked_image=None): | LOGGER.debug("<STR_LIT>".format(self.__class__.__name__))<EOL>QLineEdit.__init__(self, parent)<EOL>self.__ui_search_image = None<EOL>self.ui_search_image = ui_search_image or umbra.ui.common.get_resource_path("<STR_LIT>")<EOL>self.__ui_search_clicked_image = None<EOL>self.ui_search_clicked_image = ui_search_clicked_ima... | Initializes the class.
:param parent: Widget parent.
:type parent: QObject
:param ui_search_image: Search button image path.
:type ui_search_image: unicode
:param ui_search_clicked_image: Search button clicked image path.
:type ui_search_clicked_image: unicode
:param ui_clear_image: Clear button image path.
:type ui_c... | f13153:c0:m0 |
@property<EOL><INDENT>def ui_search_image(self):<DEDENT> | return self.__ui_search_image<EOL> | Property for **self.__ui_search_image** attribute.
:return: self.__ui_search_image.
:rtype: unicode | f13153:c0:m1 |
@ui_search_image.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(AssertionError)<EOL>def ui_search_image(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.__ui_search_image = value<EOL> | Setter for **self.__ui_search_image** attribute.
:param value: Attribute value.
:type value: unicode | f13153:c0:m2 |
@ui_search_image.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def ui_search_image(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__ui_search_image** attribute. | f13153:c0:m3 |
@property<EOL><INDENT>def ui_search_clicked_image(self):<DEDENT> | return self.__ui_search_clicked_image<EOL> | Property for **self.__ui_search_clicked_image** attribute.
:return: self.__ui_search_clicked_image.
:rtype: unicode | f13153:c0:m4 |
@ui_search_clicked_image.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(AssertionError)<EOL>def ui_search_clicked_image(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.__ui_search_clicked_image = value<EOL> | Setter for **self.__ui_search_clicked_image** attribute.
:param value: Attribute value.
:type value: unicode | f13153:c0:m5 |
@ui_search_clicked_image.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def ui_search_clicked_image(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__ui_search_clicked_image** attribute. | f13153:c0:m6 |
@property<EOL><INDENT>def ui_clear_image(self):<DEDENT> | return self.__ui_clear_image<EOL> | Property for **self.__ui_clear_image** attribute.
:return: self.__ui_clear_image.
:rtype: unicode | f13153:c0:m7 |
@ui_clear_image.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(AssertionError)<EOL>def ui_clear_image(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.__ui_clear_image = value<EOL> | Setter for **self.__ui_clear_image** attribute.
:param value: Attribute value.
:type value: unicode | f13153:c0:m8 |
@ui_clear_image.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def ui_clear_image(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__ui_clear_image** attribute. | f13153:c0:m9 |
@property<EOL><INDENT>def ui_clear_clicked_image(self):<DEDENT> | return self.__ui_clear_clicked_image<EOL> | Property for **self.__ui_clear_clicked_image** attribute.
:return: self.__ui_clear_clicked_image.
:rtype: unicode | f13153:c0:m10 |
@ui_clear_clicked_image.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(AssertionError)<EOL>def ui_clear_clicked_image(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.__ui_clear_clicked_image = value<EOL> | Setter for **self.__ui_clear_clicked_image** attribute.
:param value: Attribute value.
:type value: unicode | f13153:c0:m11 |
@ui_clear_clicked_image.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def ui_clear_clicked_image(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__ui_clear_clicked_image** attribute. | f13153:c0:m12 |
@property<EOL><INDENT>def search_active_label(self):<DEDENT> | return self.__search_active_label<EOL> | Property for **self.__search_active_label** attribute.
:return: self.__search_active_label.
:rtype: QPushButton | f13153:c0:m13 |
@search_active_label.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def search_active_label(self, value):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Setter for **self.__search_active_label** attribute.
:param value: Attribute value.
:type value: QPushButton | f13153:c0:m14 |
@search_active_label.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def search_active_label(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__search_active_label** attribute. | f13153:c0:m15 |
@property<EOL><INDENT>def clear_button(self):<DEDENT> | return self.__clear_button<EOL> | Property for **self.__clear_button** attribute.
:return: self.__clear_button.
:rtype: QPushButton | f13153:c0:m16 |
@clear_button.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def clear_button(self, value):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Setter for **self.__clear_button** attribute.
:param value: Attribute value.
:type value: QPushButton | f13153:c0:m17 |
@clear_button.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def clear_button(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__clear_button** attribute. | f13153:c0:m18 |
@property<EOL><INDENT>def completer(self):<DEDENT> | return self.__completer<EOL> | Property for **self.__completer** attribute.
:return: self.__completer.
:rtype: QCompleter | f13153:c0:m19 |
@completer.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def completer(self, value):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Setter for **self.__completer** attribute.
:param value: Attribute value.
:type value: QCompleter | f13153:c0:m20 |
@completer.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def completer(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__completer** attribute. | f13153:c0:m21 |
@property<EOL><INDENT>def completer_visible_items_count(self):<DEDENT> | return self.__completer_visible_items_count<EOL> | Property for **self.__completer_visible_items_count** attribute.
:return: self.__completer_visible_items_count.
:rtype: int | f13153:c0:m22 |
@completer_visible_items_count.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def completer_visible_items_count(self, value):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Setter for **self.__completer_visible_items_count** attribute.
:param value: Attribute value.
:type value: int | f13153:c0:m23 |
@completer_visible_items_count.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def completer_visible_items_count(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__completer_visible_items_count** attribute. | f13153:c0:m24 |
def resizeEvent(self, event): | frame_width = self.style().pixelMetric(QStyle.PM_DefaultFrameWidth)<EOL>search_active_labelSize = self.__search_active_label.sizeHint()<EOL>self.__search_active_label.move(self.rect().left() + frame_width,<EOL>(self.rect().bottom() - search_active_labelSize.height()) / <NUM_LIT:2> + frame_width / <NUM_LIT:2>)<EOL>clear... | Reimplements the :meth:`QLineEdit.QResizeEvent` method.
:param event: Resize event.
:type event: QResizeEvent | f13153:c0:m25 |
def __initialize_ui(self): | self.__clear_button.setCursor(Qt.ArrowCursor)<EOL>if self.__ui_clear_image and self.__ui_clear_clicked_image:<EOL><INDENT>pixmap = QPixmap(self.__ui_clear_image)<EOL>clicked_pixmap = QPixmap(self.__ui_clear_clicked_image)<EOL>self.__clear_button.setIcon(QIcon(pixmap))<EOL>self.__clear_button.setMaximumSize(pixmap.size(... | Initializes the Widget ui. | f13153:c0:m26 |
def __set_style_sheet(self): | frame_width = self.style().pixelMetric(QStyle.PM_DefaultFrameWidth)<EOL>self.setStyleSheet(QString("<STR_LIT>".format(<EOL>self.__search_active_label.sizeHint().width(<EOL>) if self.__search_active_label.isVisible() else <NUM_LIT:0> + frame_width,<EOL>self.__clear_button.sizeHint().width() + frame_width)))<EOL> | Sets the Widget stylesheet. | f13153:c0:m27 |
def __set_clear_button_visibility(self, text): | if text:<EOL><INDENT>self.__clear_button.show()<EOL><DEDENT>else:<EOL><INDENT>self.__clear_button.hide()<EOL><DEDENT> | Sets the clear button visibility.
:param text: Current field text.
:type text: QString | f13153:c0:m28 |
def get_application_instance(): | instance = QApplication.instance()<EOL>if not instance:<EOL><INDENT>instance = QApplication(sys.argv)<EOL><DEDENT>return instance<EOL> | Returns the current `QApplication <http://doc.qt.nokia.com/qapplication.html>`_ instance or
create one if it doesn't exists.
:return: Application instance.
:rtype: QApplication | f13154:m0 |
def parse_location(data): | tokens = data.split("<STR_LIT:U+002C>")<EOL>location = Location(directories=[], files=[], filters_in=[], filters_out=[], targets=[])<EOL>if not tokens:<EOL><INDENT>return location<EOL><DEDENT>for token in tokens:<EOL><INDENT>token = token.strip()<EOL>if not token:<EOL><INDENT>continue<EOL><DEDENT>if foundations.common.... | Parses given location data.
:param data: Exception.
:type data: Exception
:return: Location object.
:rtype: Location | f13154:m1 |
@foundations.exceptions.handle_exceptions(umbra.exceptions.ResourceExistsError)<EOL>def get_resource_path(name, raise_exception=False): | if not RuntimeGlobals.resources_directories:<EOL><INDENT>RuntimeGlobals.resources_directories.append(<EOL>os.path.normpath(os.path.join(umbra.__path__[<NUM_LIT:0>], Constants.resources_directory)))<EOL><DEDENT>for path in RuntimeGlobals.resources_directories:<EOL><INDENT>path = os.path.join(path, name)<EOL>if foundatio... | Returns the resource file path matching the given name.
:param name: Resource name.
:type name: unicode
:param raise_exception: Raise the exception.
:type raise_exception: bool
:return: Resource path.
:rtype: unicode | f13154:m2 |
def set_window_default_icon(window): | window.setWindowIcon(QIcon(get_resource_path(UiConstants.application_windows_icon)))<EOL>return True<EOL> | Sets the default Application icon to the given window.
:param window: Window.
:type window: QWidget
:return: Definition success.
:rtype: bool | f13154:m3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.