signature
stringlengths
8
3.44k
body
stringlengths
0
1.41M
docstring
stringlengths
1
122k
id
stringlengths
5
17
@property<EOL><INDENT>def hover_pixmap(self):<DEDENT>
return self.__hover_pixmap<EOL>
Property for **self.__hover_pixmap** attribute. :return: self.__hover_pixmap. :rtype: QPixmap
f13144:c0:m4
@hover_pixmap.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(AssertionError)<EOL>def hover_pixmap(self, value):<DEDENT>
if value is not None:<EOL><INDENT>assert type(value) is QPixmap, "<STR_LIT>".format(<EOL>"<STR_LIT>", value)<EOL><DEDENT>self.__hover_pixmap = value<EOL>
Setter for **self.__hover_pixmap** attribute. :param value: Attribute value. :type value: QPixmap
f13144:c0:m5
@hover_pixmap.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def hover_pixmap(self):<DEDENT>
raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL>
Deleter for **self.__hover_pixmap** attribute.
f13144:c0:m6
@property<EOL><INDENT>def active_pixmap(self):<DEDENT>
return self.__active_pixmap<EOL>
Property for **self.__active_pixmap** attribute. :return: self.__active_pixmap. :rtype: QPixmap
f13144:c0:m7
@active_pixmap.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(AssertionError)<EOL>def active_pixmap(self, value):<DEDENT>
if value is not None:<EOL><INDENT>assert type(value) is QPixmap, "<STR_LIT>".format(<EOL>"<STR_LIT>", value)<EOL><DEDENT>self.__active_pixmap = value<EOL>
Setter for **self.__active_pixmap** attribute. :param value: Attribute value. :type value: QPixmap
f13144:c0:m8
@active_pixmap.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def active_pixmap(self):<DEDENT>
raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL>
Deleter for **self.__active_pixmap** attribute.
f13144:c0:m9
@property<EOL><INDENT>def checkable(self):<DEDENT>
return self.__checkable<EOL>
Property for **self.__checkable** attribute. :return: self.__checkable. :rtype: bool
f13144:c0:m10
@checkable.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(AssertionError)<EOL>def checkable(self, value):<DEDENT>
if value is not None:<EOL><INDENT>assert type(value) is bool, "<STR_LIT>".format("<STR_LIT>", value)<EOL><DEDENT>self.__checkable = value<EOL>
Setter for **self.__checkable** attribute. :param value: Attribute value. :type value: bool
f13144:c0:m11
@checkable.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def checkable(self):<DEDENT>
raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL>
Deleter for **self.__checkable** attribute.
f13144:c0:m12
@property<EOL><INDENT>def checked(self):<DEDENT>
return self.__checked<EOL>
Property for **self.__checked** attribute. :return: self.__checked. :rtype: bool
f13144:c0:m13
@checked.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(AssertionError)<EOL>def checked(self, value):<DEDENT>
if value is not None:<EOL><INDENT>assert type(value) is bool, "<STR_LIT>".format("<STR_LIT>", value)<EOL><DEDENT>self.set_checked(value)<EOL>
Setter for **self.__checked** attribute. :param value: Attribute value. :type value: bool
f13144:c0:m14
@checked.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def checked(self):<DEDENT>
raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL>
Deleter for **self.__checked** attribute.
f13144:c0:m15
@property<EOL><INDENT>def menu(self):<DEDENT>
return self.__menu<EOL>
Property for **self.__menu** attribute. :return: self.__menu. :rtype: QMenu
f13144:c0:m16
@menu.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def menu(self, value):<DEDENT>
raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL>
Setter for **self.__menu** attribute. :param value: Attribute value. :type value: QMenu
f13144:c0:m17
@menu.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def menu(self):<DEDENT>
raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL>
Deleter for **self.__menu** attribute.
f13144:c0:m18
def enterEvent(self, event):
if self.__checkable:<EOL><INDENT>not self.__checked and self.setPixmap(self.__hover_pixmap)<EOL><DEDENT>else:<EOL><INDENT>self.setPixmap(self.__hover_pixmap)<EOL><DEDENT>
Reimplements the :meth:`QLabel.enterEvent` method. :param event: QEvent. :type event: QEvent
f13144:c0:m19
def leaveEvent(self, event):
if self.__checkable:<EOL><INDENT>not self.__checked and self.setPixmap(self.__default_pixmap)<EOL><DEDENT>else:<EOL><INDENT>self.setPixmap(self.__default_pixmap)<EOL><DEDENT>
Reimplements the :meth:`QLabel.leaveEvent` method. :param event: QEvent. :type event: QEvent
f13144:c0:m20
def mousePressEvent(self, event):
self.setPixmap(self.__active_pixmap)<EOL>self.__menu and self.__menu.exec_(QCursor.pos())<EOL>self.pressed.emit()<EOL>
Reimplements the :meth:`QLabel.mousePressEvent` method. :param event: QEvent. :type event: QEvent
f13144:c0:m21
def mouseReleaseEvent(self, event):
if self.underMouse():<EOL><INDENT>if self.__checkable:<EOL><INDENT>self.set_checked(not self.__checked)<EOL><DEDENT>else:<EOL><INDENT>self.setPixmap(self.__active_pixmap)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>self.setPixmap(self.__default_pixmap)<EOL><DEDENT>self.released.emit()<EOL>self.clicked.emit()<EOL>
Reimplements the :meth:`QLabel.mouseReleaseEvent` method. :param event: QEvent. :type event: QEvent
f13144:c0:m22
def set_checked(self, state):
if not self.__checkable:<EOL><INDENT>return False<EOL><DEDENT>if state:<EOL><INDENT>self.__checked = True<EOL>self.setPixmap(self.__active_pixmap)<EOL><DEDENT>else:<EOL><INDENT>self.__checked = False<EOL>self.setPixmap(self.__default_pixmap)<EOL><DEDENT>self.toggled.emit(state)<EOL>return True<EOL>
Sets the Widget checked state. :param state: New check state. :type state: bool :return: Method success. :rtype: bool
f13144:c0:m23
def set_menu(self, menu):
self.__menu = menu<EOL>if not self.parent():<EOL><INDENT>return False<EOL><DEDENT>parent = [parent for parent in umbra.ui.common.parents_walker(self)].pop()<EOL>for action in self.__menu.actions():<EOL><INDENT>not action.shortcut().isEmpty() and parent.addAction(action)<EOL><DEDENT>return True<EOL>
Sets the Widget menu. :param menu: Menu. :type menu: QMenu :return: Method success. :rtype: bool
f13144:c0:m24
def __init__(self, parent=None):
LOGGER.debug("<STR_LIT>".format(self.__class__.__name__))<EOL>QObject.__init__(self, parent)<EOL>self.__container = parent<EOL>self.__active_labels = []<EOL>
Initializes the class. :param parent: Widget parent. :type parent: QObject
f13145:c0:m0
@property<EOL><INDENT>def container(self):<DEDENT>
return self.__container<EOL>
Property for **self.__container** attribute. :return: self.__container. :rtype: QObject
f13145: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
f13145: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.
f13145:c0:m3
@property<EOL><INDENT>def active_labels(self):<DEDENT>
return self.__active_labels<EOL>
Property for **self.__active_labels** attribute. :return: self.__active_labels. :rtype: list
f13145:c0:m4
@active_labels.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def active_labels(self, value):<DEDENT>
raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL>
Setter for **self.__active_labels** attribute. :param value: Attribute value. :type value: list
f13145:c0:m5
@active_labels.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def active_labels(self):<DEDENT>
raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL>
Deleter for **self.__active_labels** attribute.
f13145:c0:m6
def __active_label__toggled(self, active_label, state):
LOGGER.debug("<STR_LIT>".format(active_label))<EOL>self.__update_siblings_active_labels_states(active_label)<EOL>
Defines the slot triggered by an **Active_QLabel** Widget when toggled. :param active_label: Active label. :type active_label: Active_QLabel :param state: Active label checked state. :type state: bool
f13145:c0:m7
def __update_siblings_active_labels_states(self, active_label):
LOGGER.debug("<STR_LIT>".format(active_label))<EOL>for item in self.__active_labels:<EOL><INDENT>if item is active_label:<EOL><INDENT>continue<EOL><DEDENT>umbra.ui.common.signals_blocker(item, item.set_checked, False)<EOL><DEDENT>
Updates given **Active_QLabel** Widget siblings states. :param active_label: Active label. :type active_label: Active_QLabel
f13145:c0:m8
@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL><INDENT>def add_active_label(self, active_label):<DEDENT>
if not issubclass(active_label.__class__, Active_QLabel):<EOL><INDENT>raise foundations.exceptions.ProgrammingError("<STR_LIT>".format(<EOL>self.__class__.__name__, active_label, Active_QLabel.__name__))<EOL><DEDENT>if active_label in self.__active_labels:<EOL><INDENT>raise foundations.exceptions.ProgrammingError("<STR_LIT>".format(<EOL>self.__class__.__name__, active_label))<EOL><DEDENT>active_label.checkable = True<EOL>not self.__active_labels and active_label.set_checked(True) or active_label.set_checked(False)<EOL>self.__active_labels.append(active_label)<EOL>active_label.toggled.connect(functools.partial(self.__active_label__toggled, active_label))<EOL>active_label.clicked.connect(functools.partial(self.active_label_clicked.emit, active_label))<EOL>active_label.pressed.connect(functools.partial(self.active_label_pressed.emit, active_label))<EOL>active_label.released.connect(functools.partial(self.active_label_released.emit, active_label))<EOL>active_label.toggled.connect(functools.partial(self.active_label_toggled.emit, active_label))<EOL>return True<EOL>
Adds given **Active_QLabel** Widget. :param active_label: Active label to add. :type active_label: Active_QLabel :return: Method success. :rtype: bool
f13145:c0:m9
def remove_active_label(self, active_label):
if not active_label in self.__active_labels:<EOL><INDENT>raise foundations.exceptions.ProgrammingError("<STR_LIT>".format(<EOL>self.__class__.__name__, active_label))<EOL><DEDENT>self.__active_labels.remove(active_label)<EOL>return True<EOL>
Removes given **Active_QLabel** Widget. :param active_label: Active label to remove. :type active_label: Active_QLabel :return: Method success. :rtype: bool
f13145:c0:m10
def get_toggled_active_label(self):
for active_label in self.__active_labels:<EOL><INDENT>if active_label.checked:<EOL><INDENT>return active_label<EOL><DEDENT><DEDENT>
Returns the toggled **Active_QLabel** Widget. :return: Checked active label. :rtype: bool
f13145:c0:m11
def get_active_label_index(self, active_label):
return self.__active_labels.index(active_label)<EOL>
Returns given **Active_QLabel** Widget index. :param active_label: Active label to retrieve index. :type active_label: Active_QLabel :return: Active label index. :rtype: int
f13145:c0:m12
def get_active_label_from_index(self, index):
return self.__active_labels[index]<EOL>
Returns the **Active_QLabel** Widget from given index. :param index: Index. :type index: int :return: Active label. :rtype: Active_QLabel
f13145:c0:m13
def message_box(type, title, message, icon=None, buttons=QMessageBox.Ok, custom_buttons=None):
LOGGER.debug("<STR_LIT>")<EOL>LOGGER.debug("<STR_LIT>".format(type))<EOL>LOGGER.debug("<STR_LIT>".format(title))<EOL>LOGGER.debug("<STR_LIT>".format(message))<EOL>message_box = QMessageBox()<EOL>message_box.setWindowTitle("<STR_LIT>".format(Constants.application_name, title))<EOL>message_box.setText(message)<EOL>for button, role in custom_buttons or ():<EOL><INDENT>message_box.addButton(button, role)<EOL><DEDENT>umbra.ui.common.set_children_padding(message_box, (QPushButton,), width=<NUM_LIT:12>)<EOL>message = message.split("<STR_LIT:\n>")<EOL>if type == "<STR_LIT>":<EOL><INDENT>if icon:<EOL><INDENT>message_box.setIcon(icon)<EOL><DEDENT>else:<EOL><INDENT>message_box.setIcon(QMessageBox.Critical)<EOL><DEDENT>for line in message:<EOL><INDENT>LOGGER.critical("<STR_LIT>".format(line))<EOL><DEDENT><DEDENT>elif type == "<STR_LIT>":<EOL><INDENT>if icon:<EOL><INDENT>message_box.setIcon(icon)<EOL><DEDENT>else:<EOL><INDENT>message_box.setIcon(QMessageBox.Critical)<EOL><DEDENT>for line in message:<EOL><INDENT>LOGGER.error("<STR_LIT>".format(line))<EOL><DEDENT><DEDENT>elif type == "<STR_LIT>":<EOL><INDENT>if icon:<EOL><INDENT>message_box.setIcon(icon)<EOL><DEDENT>else:<EOL><INDENT>message_box.setIcon(QMessageBox.Critical)<EOL><DEDENT>RuntimeGlobals.logging_session_handler_stream andmessage_box.setDetailedText("<STR_LIT>".join(RuntimeGlobals.logging_session_handler_stream.stream))<EOL>text_edit = message_box.findChild(QTextEdit)<EOL>if text_edit:<EOL><INDENT>text_edit.setCurrentFont(QFont("<STR_LIT>"))<EOL>text_edit.setLineWrapMode(QTextEdit.NoWrap)<EOL>text_edit.moveCursor(QTextCursor.End)<EOL>text_edit.ensureCursorVisible()<EOL><DEDENT>for line in message:<EOL><INDENT>LOGGER.error("<STR_LIT>".format(line))<EOL><DEDENT><DEDENT>elif type == "<STR_LIT>":<EOL><INDENT>if icon:<EOL><INDENT>message_box.setIcon(icon)<EOL><DEDENT>else:<EOL><INDENT>message_box.setIcon(QMessageBox.Warning)<EOL><DEDENT>for line in message:<EOL><INDENT>LOGGER.warning("<STR_LIT>".format(line))<EOL><DEDENT><DEDENT>elif type == "<STR_LIT>":<EOL><INDENT>if icon:<EOL><INDENT>message_box.setIcon(icon)<EOL><DEDENT>else:<EOL><INDENT>message_box.setIcon(QMessageBox.Information)<EOL><DEDENT>for line in message:<EOL><INDENT>LOGGER.info("<STR_LIT>".format(line))<EOL><DEDENT><DEDENT>elif type == "<STR_LIT>":<EOL><INDENT>if icon:<EOL><INDENT>message_box.setIcon(icon)<EOL><DEDENT>else:<EOL><INDENT>message_box.setIcon(QMessageBox.Question)<EOL><DEDENT>for line in message:<EOL><INDENT>LOGGER.info("<STR_LIT>".format(line))<EOL><DEDENT><DEDENT>message_box.setStandardButtons(buttons)<EOL>message_box.setWindowFlags(Qt.WindowStaysOnTopHint)<EOL>message_box.show()<EOL>foundations.ui.common.center_widget_on_screen(message_box)<EOL>return message_box.exec_()<EOL>
Provides a fast GUI message box. :param title: Current message title. :type title: unicode :param message: Message. :type message: unicode :param icon: Custom icon. :type icon: QConstant :param buttons: Standard buttons. :type buttons: QConstant :param custom_buttons: Custom buttons. :type custom_buttons: tuple or list :return: User choice. :rtype: int
f13146:m0
def edit_block(object):
@functools.wraps(object)<EOL>def edit_block_wrapper(*args, **kwargs):<EOL><INDENT>"""<STR_LIT>"""<EOL>if args:<EOL><INDENT>cursor = foundations.common.get_first_item(args).textCursor()<EOL>cursor.beginEditBlock()<EOL><DEDENT>value = None<EOL>try:<EOL><INDENT>value = object(*args, **kwargs)<EOL><DEDENT>finally:<EOL><INDENT>if args:<EOL><INDENT>cursor.endEditBlock()<EOL><DEDENT>return value<EOL><DEDENT><DEDENT>return edit_block_wrapper<EOL>
Handles edit blocks undo states. :param object: Object to decorate. :type object: object :return: Object. :rtype: object
f13147:m0
def anchor_text_cursor(object):
@functools.wraps(object)<EOL>def anchor_text_cursorWrapper(*args, **kwargs):<EOL><INDENT>"""<STR_LIT>"""<EOL>if args:<EOL><INDENT>if hasattr(foundations.common.get_first_item(args), "<STR_LIT>"):<EOL><INDENT>foundations.common.get_first_item(args).store_text_cursor_anchor()<EOL><DEDENT><DEDENT>value = object(*args, **kwargs)<EOL>if args:<EOL><INDENT>if hasattr(foundations.common.get_first_item(args), "<STR_LIT>"):<EOL><INDENT>foundations.common.get_first_item(args).store_text_cursor_anchor()<EOL><DEDENT><DEDENT>return value<EOL><DEDENT>return anchor_text_cursorWrapper<EOL>
Anchors the text cursor position. :param object: Object to decorate. :type object: object :return: Object. :rtype: object
f13147:m1
def center_text_cursor(object):
@functools.wraps(object)<EOL>def center_text_cursor_wrapper(*args, **kwargs):<EOL><INDENT>"""<STR_LIT>"""<EOL>if args:<EOL><INDENT>if hasattr(foundations.common.get_first_item(args), "<STR_LIT>"):<EOL><INDENT>foundations.common.get_first_item(args).setCenterOnScroll(True)<EOL><DEDENT><DEDENT>value = object(*args, **kwargs)<EOL>if args:<EOL><INDENT>if hasattr(foundations.common.get_first_item(args), "<STR_LIT>"):<EOL><INDENT>foundations.common.get_first_item(args).setCenterOnScroll(False)<EOL><DEDENT><DEDENT>return value<EOL><DEDENT>return center_text_cursor_wrapper<EOL>
Centers the text cursor position. :param object: Object to decorate. :type object: object :return: Object. :rtype: object
f13147:m2
def __init__(self, parent=None, *args, **kwargs):
LOGGER.debug("<STR_LIT>".format(self.__class__.__name__))<EOL>QPlainTextEdit.__init__(self, parent, *args, **kwargs)<EOL>self.__search_pattern = None<EOL>self.__minimum_font_point_size = <NUM_LIT:6><EOL>self.__maximum_font_point_size = <NUM_LIT><EOL>self.__text_cursor_anchor = None<EOL>
Initializes the class. :param parent: Widget parent. :type parent: QObject :param \*args: Arguments. :type \*args: \* :param \*\*kwargs: Keywords arguments. :type \*\*kwargs: \*\*
f13147:c0:m0
@property<EOL><INDENT>def search_pattern(self):<DEDENT>
return self.__search_pattern<EOL>
Property for **self.__search_pattern** attribute. :return: self.__search_pattern. :rtype: unicode
f13147:c0:m1
@search_pattern.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(AssertionError)<EOL>def search_pattern(self, value):<DEDENT>
if value is not None:<EOL><INDENT>assert type(value) in (unicode, QString),"<STR_LIT>".format("<STR_LIT>", value)<EOL><DEDENT>self.__search_pattern = value<EOL>
Setter for **self.__search_pattern** attribute. :param value: Attribute value. :type value: unicode
f13147:c0:m2
@search_pattern.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def search_pattern(self):<DEDENT>
raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL>
Deleter for **self.__search_pattern** attribute.
f13147:c0:m3
@property<EOL><INDENT>def minimum_font_point_size(self):<DEDENT>
return self.__minimum_font_point_size<EOL>
Property for **self.__minimum_font_point_size** attribute. :return: self.__minimum_font_point_size. :rtype: int
f13147:c0:m4
@minimum_font_point_size.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(AssertionError)<EOL>def minimum_font_point_size(self, value):<DEDENT>
if value is not None:<EOL><INDENT>assert type(value) in (int, float), "<STR_LIT>".format(<EOL>"<STR_LIT>", value)<EOL>assert value > <NUM_LIT:0>, "<STR_LIT>".format(<EOL>"<STR_LIT>", value)<EOL><DEDENT>self.__minimum_font_point_size = value<EOL>
Setter for **self.__minimum_font_point_size** attribute. :param value: Attribute value. :type value: int
f13147:c0:m5
@minimum_font_point_size.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def minimum_font_point_size(self):<DEDENT>
raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL>
Deleter for **self.__minimum_font_point_size** attribute.
f13147:c0:m6
@property<EOL><INDENT>def maximum_font_point_size(self):<DEDENT>
return self.__maximum_font_point_size<EOL>
Property for **self.__maximum_font_point_size** attribute. :return: self.__maximum_font_point_size. :rtype: int
f13147:c0:m7
@maximum_font_point_size.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(AssertionError)<EOL>def maximum_font_point_size(self, value):<DEDENT>
if value is not None:<EOL><INDENT>assert type(value) in (int, float), "<STR_LIT>".format(<EOL>"<STR_LIT>", value)<EOL>assert value > self.__minimum_font_point_size,"<STR_LIT>".format(<EOL>"<STR_LIT>", value, self.__minimum_font_point_size)<EOL><DEDENT>self.__maximum_font_point_size = value<EOL>
Setter for **self.__maximum_font_point_size** attribute. :param value: Attribute value. :type value: int
f13147:c0:m8
@maximum_font_point_size.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def maximum_font_point_size(self):<DEDENT>
raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL>
Deleter for **self.__maximum_font_point_size** attribute.
f13147:c0:m9
@foundations.trace.untracable<EOL><INDENT>def wheelEvent(self, event):<DEDENT>
if event.modifiers() == Qt.ControlModifier:<EOL><INDENT>if event.delta() == <NUM_LIT>:<EOL><INDENT>self.zoom_in()<EOL><DEDENT>elif event.delta() == -<NUM_LIT>:<EOL><INDENT>self.zoom_out()<EOL><DEDENT>event.ignore()<EOL><DEDENT>else:<EOL><INDENT>QPlainTextEdit.wheelEvent(self, event)<EOL><DEDENT>
Reimplements the :meth:`QPlainTextEdit.wheelEvent` method. :param event: Event. :type event: QEvent
f13147:c0:m10
def __select_text_under_cursor_blocks(self, cursor):
start_block = self.document().findBlock(cursor.selectionStart()).firstLineNumber()<EOL>end_block = self.document().findBlock(cursor.selectionEnd()).firstLineNumber()<EOL>cursor.setPosition(self.document().findBlockByLineNumber(start_block).position())<EOL>cursor.movePosition(QTextCursor.StartOfLine, QTextCursor.MoveAnchor)<EOL>cursor.movePosition(QTextCursor.Down, QTextCursor.KeepAnchor, end_block - start_block)<EOL>cursor.movePosition(QTextCursor.EndOfLine, QTextCursor.KeepAnchor)<EOL>
Selects the document text under cursor blocks. :param cursor: Cursor. :type cursor: QTextCursor
f13147:c0:m11
def get_selected_text_metrics(self):
selected_text = self.get_selected_text()<EOL>if not selected_text:<EOL><INDENT>return tuple()<EOL><DEDENT>return (selected_text, self.get_cursor_line(), self.get_cursor_column() - len(selected_text))<EOL>
Returns current document selected text metrics. :return: Selected text metrics. :rtype: tuple
f13147:c0:m12
def get_default_text_option(self):
return self.document().defaultTextOption()<EOL>
Returns default text option. :return: Default text options. :rtype: QTextOption
f13147:c0:m13
def set_default_text_option(self, text_option):
self.document().setDefaultTextOption(text_option)<EOL>return True<EOL>
Sets default text option using given flag. :param text_option: Text option. :type text_option: QTextOption :return: Method success. :rtype: bool
f13147:c0:m14
def store_text_cursor_anchor(self):
self.__text_cursor_anchor = (self.textCursor(),<EOL>self.horizontalScrollBar().sliderPosition(),<EOL>self.verticalScrollBar().sliderPosition())<EOL>return True<EOL>
Stores the document cursor anchor. :return: Method success. :rtype: bool
f13147:c0:m15
def restore_text_cursor_anchor(self):
if not self.__text_cursor_anchor:<EOL><INDENT>return False<EOL><DEDENT>text_cursor, horizontal_scroll_bar_slider_position, vertical_scroll_bar_slider_position = self.__text_cursor_anchor<EOL>self.setTextCursor(text_cursor)<EOL>self.horizontalScrollBar().setSliderPosition(horizontal_scroll_bar_slider_position)<EOL>self.verticalScrollBar().setSliderPosition(vertical_scroll_bar_slider_position)<EOL>return True<EOL>
Restores the document cursor anchor. :return: Method success. :rtype: bool
f13147:c0:m16
def get_cursor_line(self):
return self.textCursor().blockNumber()<EOL>
Returns the document cursor line. :return: Cursor line. :rtype: int
f13147:c0:m17
def get_cursor_column(self):
return self.textCursor().columnNumber()<EOL>
Returns the document cursor column. :return: Cursor column. :rtype: int
f13147:c0:m18
def get_previous_character(self):
cursor = self.textCursor()<EOL>cursor.movePosition(QTextCursor.PreviousCharacter, QTextCursor.KeepAnchor)<EOL>return cursor.selectedText()<EOL>
Returns the character before the cursor. :return: Previous cursor character. :rtype: QString
f13147:c0:m19
def get_next_character(self):
cursor = self.textCursor()<EOL>cursor.movePosition(QTextCursor.NextCharacter, QTextCursor.KeepAnchor)<EOL>return cursor.selectedText()<EOL>
Returns the character after the cursor. :return: Next cursor character. :rtype: QString
f13147:c0:m20
def get_words(self):
words = []<EOL>block = self.document().findBlockByLineNumber(<NUM_LIT:0>)<EOL>while block.isValid():<EOL><INDENT>blockWords = foundations.strings.get_words(foundations.strings.to_string(block.text()))<EOL>if blockWords:<EOL><INDENT>words.extend(blockWords)<EOL><DEDENT>block = block.next()<EOL><DEDENT>return words<EOL>
Returns the document words. :return: Document words. :rtype: list
f13147:c0:m21
def get_selected_text(self):
return self.textCursor().selectedText()<EOL>
Returns the document text under cursor. :return: Text under cursor. :rtype: QString
f13147:c0:m22
def get_word_under_cursor_legacy(self):
cursor = self.textCursor()<EOL>cursor.select(QTextCursor.WordUnderCursor)<EOL>return cursor.selectedText()<EOL>
Returns the document word under cursor ( Using Qt legacy "QTextCursor.WordUnderCursor" ). :return: Word under cursor. :rtype: QString
f13147:c0:m23
def get_word_under_cursor(self):
if not re.match(r"<STR_LIT>", foundations.strings.to_string(self.get_previous_character())):<EOL><INDENT>return QString()<EOL><DEDENT>cursor = self.textCursor()<EOL>cursor.movePosition(QTextCursor.PreviousWord, QTextCursor.MoveAnchor)<EOL>cursor.movePosition(QTextCursor.EndOfWord, QTextCursor.KeepAnchor)<EOL>return cursor.selectedText()<EOL>
Returns the document word under cursor. :return: Word under cursor. :rtype: QString
f13147:c0:m24
def get_partial_word_under_cursor(self):
if not re.match(r"<STR_LIT>", foundations.strings.to_string(self.get_previous_character())):<EOL><INDENT>return QString()<EOL><DEDENT>cursor = self.textCursor()<EOL>position = cursor.position()<EOL>cursor.movePosition(QTextCursor.PreviousWord, QTextCursor.KeepAnchor)<EOL>return cursor.selectedText()<EOL>
Returns the document partial word under cursor ( From word start to cursor position ). :return: Partial word under cursor. :rtype: QString
f13147:c0:m25
def is_modified(self):
return self.document().isModified()<EOL>
Returns if the document is modified. :return: Document modified state. :rtype: bool
f13147:c0:m26
def set_modified(self, state):
self.document().setModified(state)<EOL>return True<EOL>
Sets the document modified state. :param state: Modified state. :type state: bool :return: Method success. :rtype: bool
f13147:c0:m27
def is_empty(self):
return self.document().isEmpty()<EOL>
Returns if the document is empty. :return: Document empty state. :rtype: bool
f13147:c0:m28
@edit_block<EOL><INDENT>def set_content(self, content):<DEDENT>
cursor = self.textCursor()<EOL>cursor.movePosition(QTextCursor.Start, QTextCursor.MoveAnchor)<EOL>cursor.movePosition(QTextCursor.End, QTextCursor.KeepAnchor)<EOL>cursor.removeSelectedText()<EOL>for line in content:<EOL><INDENT>self.moveCursor(QTextCursor.End)<EOL>self.insertPlainText(line)<EOL><DEDENT>return True<EOL>
Sets document with given content while providing undo capability. :param content: Content to set. :type content: list :return: Method success. :rtype: bool
f13147:c0:m29
def delete(self):
self.textCursor().removeSelectedText()<EOL>return True<EOL>
Deletes the document text under cursor. :return: Method success. :rtype: bool
f13147:c0:m30
@edit_block<EOL><INDENT>def delete_lines(self):<DEDENT>
cursor = self.textCursor()<EOL>self.__select_text_under_cursor_blocks(cursor)<EOL>cursor.removeSelectedText()<EOL>cursor.deleteChar()<EOL>return True<EOL>
Deletes the document lines under cursor. :return: Method success. :rtype: bool
f13147:c0:m31
@edit_block<EOL><INDENT>def duplicate_lines(self):<DEDENT>
cursor = self.textCursor()<EOL>self.__select_text_under_cursor_blocks(cursor)<EOL>text = cursor.selectedText()<EOL>cursor.setPosition(cursor.block().next().position())<EOL>cursor.position() == cursor.document().firstBlock().position() and cursor.setPosition(<EOL>cursor.document().lastBlock().position())<EOL>start_position = cursor.position()<EOL>cursor.insertText(text)<EOL>end_position = cursor.position()<EOL>cursor.insertText(QChar(QChar.ParagraphSeparator))<EOL>cursor.setPosition(start_position, QTextCursor.MoveAnchor)<EOL>cursor.setPosition(end_position, QTextCursor.KeepAnchor)<EOL>self.setTextCursor(cursor)<EOL>return True<EOL>
Duplicates the document lines under cursor. :return: Method success. :rtype: bool
f13147:c0:m32
@edit_block<EOL><INDENT>def move_lines(self, direction=QTextCursor.Up):<DEDENT>
cursor = self.textCursor()<EOL>if (direction == QTextCursor.Up and cursor.block() == cursor.document().firstBlock()) or(direction == QTextCursor.Down and cursor.block() == cursor.document().lastBlock()):<EOL><INDENT>return False<EOL><DEDENT>self.__select_text_under_cursor_blocks(cursor)<EOL>text = cursor.selectedText()<EOL>cursor.removeSelectedText()<EOL>cursor.deleteChar()<EOL>cursor.setPosition(cursor.block().next().position() if direction == QTextCursor.Down else<EOL>cursor.block().previous().position())<EOL>if cursor.position() == cursor.document().firstBlock().position() and direction == QTextCursor.Down:<EOL><INDENT>cursor.movePosition(QTextCursor.End)<EOL>cursor.insertText(QChar(QChar.ParagraphSeparator))<EOL><DEDENT>start_position = cursor.position()<EOL>cursor.insertText(text)<EOL>end_position = cursor.position()<EOL>not cursor.atEnd() and cursor.insertText(QChar(QChar.ParagraphSeparator))<EOL>cursor.setPosition(start_position, QTextCursor.MoveAnchor)<EOL>cursor.setPosition(end_position, QTextCursor.KeepAnchor)<EOL>self.setTextCursor(cursor)<EOL>return True<EOL>
Moves the document lines under cursor. :param direction: Move direction ( QTextCursor.Down / QTextCursor.Up ). ( QTextCursor.MoveOperation ) :return: Method success. :rtype: bool
f13147:c0:m33
def move_lines_up(self):
return self.move_lines(QTextCursor.Up)<EOL>
Moves up the document lines under cursor. :return: Method success. :rtype: bool
f13147:c0:m34
def move_lines_down(self):
return self.move_lines(QTextCursor.Down)<EOL>
Moves down the document lines under cursor. :return: Method success. :rtype: bool
f13147:c0:m35
@center_text_cursor<EOL><INDENT>def search(self, pattern, **kwargs):<DEDENT>
settings = foundations.data_structures.Structure(**{"<STR_LIT>": False,<EOL>"<STR_LIT>": False,<EOL>"<STR_LIT>": False,<EOL>"<STR_LIT>": False,<EOL>"<STR_LIT>": True})<EOL>settings.update(kwargs)<EOL>self.__search_pattern = pattern<EOL>if settings.regular_expressions:<EOL><INDENT>pattern = QRegExp(pattern)<EOL>pattern.setCaseSensitivity(Qt.CaseSensitive if settings.case_sensitive else Qt.CaseInsensitive)<EOL><DEDENT>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>if settings.backward_search:<EOL><INDENT>flags = flags | QTextDocument.FindBackward<EOL><DEDENT>cursor = self.document().find(pattern, self.textCursor(), flags)<EOL>if not cursor.isNull():<EOL><INDENT>self.setTextCursor(cursor)<EOL>return True<EOL><DEDENT>else:<EOL><INDENT>if settings.wrap_around:<EOL><INDENT>self.store_text_cursor_anchor()<EOL>cursor = self.textCursor()<EOL>if settings.backward_search:<EOL><INDENT>cursor.movePosition(QTextCursor.End, QTextCursor.MoveAnchor)<EOL><DEDENT>else:<EOL><INDENT>cursor.movePosition(QTextCursor.Start, QTextCursor.MoveAnchor)<EOL><DEDENT>self.setTextCursor(cursor)<EOL>settings.wrap_around = False<EOL>if self.search(pattern, **settings):<EOL><INDENT>return True<EOL><DEDENT>else:<EOL><INDENT>self.restore_text_cursor_anchor()<EOL><DEDENT><DEDENT><DEDENT>
Searchs given pattern text in the document. Usage:: >>> script_editor = Umbra.components_manager.get_interface("factory.script_editor") True >>> codeEditor = script_editor.get_current_editor() True >>> codeEditor.search(search_pattern, case_sensitive=True, whole_word=True, regular_expressions=True, \ backward_search=True, wrap_around=True) True :param pattern: Pattern to search for. :type pattern: unicode :param \*\*kwargs: Search settings. :type \*\*kwargs: dict :return: Method success. :rtype: bool
f13147:c0:m36
@center_text_cursor<EOL><INDENT>def search_next(self):<DEDENT>
pattern = self.get_selected_text() or self.__search_pattern<EOL>if not pattern:<EOL><INDENT>return False<EOL><DEDENT>return self.search(pattern, **{"<STR_LIT>": True,<EOL>"<STR_LIT>": False,<EOL>"<STR_LIT>": False,<EOL>"<STR_LIT>": False,<EOL>"<STR_LIT>": True})<EOL>
Searchs the next search pattern in the document. :return: Method success. :rtype: bool
f13147:c0:m37
@center_text_cursor<EOL><INDENT>def search_previous(self):<DEDENT>
pattern = self.get_selected_text() or self.__search_pattern<EOL>if not pattern:<EOL><INDENT>return False<EOL><DEDENT>return self.search(pattern, **{"<STR_LIT>": True,<EOL>"<STR_LIT>": False,<EOL>"<STR_LIT>": False,<EOL>"<STR_LIT>": True,<EOL>"<STR_LIT>": True})<EOL>
Searchs the previous search pattern in the document. :return: Method success. :rtype: bool
f13147:c0:m38
@center_text_cursor<EOL><INDENT>@edit_block<EOL>def replace(self, pattern, replacement_pattern, **kwargs):<DEDENT>
settings = foundations.data_structures.Structure(**{"<STR_LIT>": False,<EOL>"<STR_LIT>": False})<EOL>settings.update(kwargs)<EOL>selected_text = self.get_selected_text()<EOL>regex = "<STR_LIT>".format(<EOL>pattern if settings.regular_expressions else re.escape(foundations.strings.to_string(pattern)))<EOL>flags = int() if settings.case_sensitive else re.IGNORECASE<EOL>if not selected_text or not re.search(regex, selected_text, flags=flags):<EOL><INDENT>self.search(pattern, **kwargs)<EOL>return False<EOL><DEDENT>cursor = self.textCursor()<EOL>metrics = self.get_selected_text_metrics()<EOL>if cursor.isNull():<EOL><INDENT>return False<EOL><DEDENT>if not cursor.hasSelection():<EOL><INDENT>return False<EOL><DEDENT>cursor.insertText(replacement_pattern)<EOL>self.patterns_replaced.emit([metrics])<EOL>self.search(pattern, **kwargs)<EOL>return True<EOL>
Replaces current given pattern occurence in the document with the replacement pattern. Usage:: >>> script_editor = Umbra.components_manager.get_interface("factory.script_editor") True >>> codeEditor = script_editor.get_current_editor() True >>> codeEditor.replace(search_pattern, replacement_pattern, case_sensitive=True, whole_word=True, \ regular_expressions=True, backward_search=True, wrap_around=True) True :param pattern: Pattern to replace. :type pattern: unicode :param replacement_pattern: Replacement pattern. :type replacement_pattern: unicode :param \*\*kwargs: Format settings. :type \*\*kwargs: dict :return: Method success. :rtype: bool
f13147:c0:m39
@center_text_cursor<EOL><INDENT>@anchor_text_cursor<EOL>@edit_block<EOL>def replace_all(self, pattern, replacement_pattern, **kwargs):<DEDENT>
edit_cursor = self.textCursor()<EOL>edit_cursor.movePosition(QTextCursor.Start, QTextCursor.MoveAnchor)<EOL>self.setTextCursor(edit_cursor)<EOL>patterns_replaced = []<EOL>while True:<EOL><INDENT>if not self.search(pattern, **kwargs):<EOL><INDENT>break<EOL><DEDENT>cursor = self.textCursor()<EOL>metrics = self.get_selected_text_metrics()<EOL>if cursor.isNull():<EOL><INDENT>break<EOL><DEDENT>if not cursor.hasSelection():<EOL><INDENT>break<EOL><DEDENT>cursor.insertText(replacement_pattern)<EOL>patterns_replaced.append(metrics)<EOL><DEDENT>self.patterns_replaced.emit(patterns_replaced)<EOL>return True<EOL>
| Replaces every given pattern occurrences in the document with the replacement pattern. .. warning:: Initializing **wrap_around** keyword to **True** leads to infinite recursion loop if the search pattern and the replacement_pattern are the same. :param pattern: Pattern to replace. :type pattern: unicode :param replacement_pattern: Replacement pattern. :type replacement_pattern: unicode :param \*\*kwargs: Format settings. :type \*\*kwargs: dict :return: Method success. :rtype: bool
f13147:c0:m40
@center_text_cursor<EOL><INDENT>def go_to_line(self, line):<DEDENT>
cursor = self.textCursor()<EOL>cursor.setPosition(self.document().findBlockByNumber(line - <NUM_LIT:1>).position())<EOL>self.setTextCursor(cursor)<EOL>return True<EOL>
Moves the text cursor to given line. :param line: Line to go to. :type line: int :return: Method success. :rtype: bool
f13147:c0:m41
def go_to_column(self, column):
cursor = self.textCursor()<EOL>cursor.setPosition(cursor.block().position() + column)<EOL>self.setTextCursor(cursor)<EOL>return True<EOL>
Moves the text cursor to given column. :param column: Column to go to. :type column: int :return: Method success. :rtype: bool
f13147:c0:m42
def go_to_position(self, position):
cursor = self.textCursor()<EOL>cursor.setPosition(position)<EOL>self.setTextCursor(cursor)<EOL>return True<EOL>
Moves the text cursor to given position. :param position: Position to go to. :type position: int :return: Method success. :rtype: bool
f13147:c0:m43
def toggle_word_wrap(self):
self.setWordWrapMode(not self.wordWrapMode() and QTextOption.WordWrap or QTextOption.NoWrap)<EOL>return True<EOL>
Toggles document word wrap. :return: Method success. :rtype: bool
f13147:c0:m44
def toggle_white_spaces(self):
text_option = self.get_default_text_option()<EOL>if text_option.flags().__int__():<EOL><INDENT>text_option = QTextOption()<EOL>text_option.setTabStop(self.tabStopWidth())<EOL><DEDENT>else:<EOL><INDENT>text_option.setFlags(<EOL>text_option.flags() | QTextOption.ShowTabsAndSpaces | QTextOption.ShowLineAndParagraphSeparators)<EOL><DEDENT>self.set_default_text_option(text_option)<EOL>return True<EOL>
Toggles document white spaces display. :return: Method success. :rtype: bool
f13147:c0:m45
def set_font_increment(self, value):
font = self.font()<EOL>point_size = font.pointSize() + value<EOL>if point_size < self.__minimum_font_point_size or point_size > self.__maximum_font_point_size:<EOL><INDENT>return False<EOL><DEDENT>font.setPointSize(point_size)<EOL>self.setFont(font)<EOL>return True<EOL>
Increments the document font size. :param value: Font size increment. :type value: int :return: Method success. :rtype: bool
f13147:c0:m46
def zoom_in(self):
return self.set_font_increment(<NUM_LIT:1>)<EOL>
Increases the document font size. :return: Method success. :rtype: bool
f13147:c0:m47
def zoom_out(self):
return self.set_font_increment(-<NUM_LIT:1>)<EOL>
Increases the document font size. :return: Method success. :rtype: bool
f13147:c0:m48
def __init__(self, pixmap, wait_time=<NUM_LIT:0>, text_color=Qt.black, *args, **kwargs):
LOGGER.debug("<STR_LIT>".format(self.__class__.__name__))<EOL>QSplashScreen.__init__(self, pixmap, *args, **kwargs)<EOL>self.setWindowFlags(self.windowFlags() | Qt.WindowStaysOnTopHint)<EOL>self.__wait_time = None<EOL>self.wait_time = wait_time<EOL>self.__text_color = None<EOL>self.text_color = text_color<EOL>
Initializes the class. :param pixmap: Current pixmap path. :type pixmap: unicode :param wait_time: wait time. :type wait_time: int :param \*args: Arguments. :type \*args: \* :param \*\*kwargs: Keywords arguments. :type \*\*kwargs: \*\*
f13148:c0:m0
@property<EOL><INDENT>def wait_time(self):<DEDENT>
return self.__wait_time<EOL>
Property for **self.__wait_time** attribute. :return: self.__wait_time :rtype: int or float
f13148:c0:m1
@wait_time.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(AssertionError)<EOL>def wait_time(self, value):<DEDENT>
if value is not None:<EOL><INDENT>assert type(value) in (int, float), "<STR_LIT>".format(<EOL>"<STR_LIT>", value)<EOL>assert value >= <NUM_LIT:0>, "<STR_LIT>".format("<STR_LIT>", value)<EOL><DEDENT>self.__wait_time = value<EOL>
Setter for **self.__wait_time** attribute. :param value: Attribute value. :type value: int or float
f13148:c0:m2
@wait_time.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def wait_time(self):<DEDENT>
raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL>
Deleter for **self.__wait_time** attribute.
f13148:c0:m3
@property<EOL><INDENT>def text_color(self):<DEDENT>
return self.__text_color<EOL>
Property for **self.__text_color** attribute. :return: self.__text_color :rtype: int or QColor
f13148:c0:m4
@text_color.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(AssertionError)<EOL>def text_color(self, value):<DEDENT>
if value is not None:<EOL><INDENT>assert type(value) in (Qt.GlobalColor, QColor),"<STR_LIT>".format("<STR_LIT>", value)<EOL><DEDENT>self.__text_color = value<EOL>
Setter for **self.__text_color** attribute. :param value: Attribute value. :type value: int or QColor
f13148:c0:m5
@text_color.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def text_color(self):<DEDENT>
raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL>
Deleter for **self.__text_color** attribute.
f13148:c0:m6
def show_message(self, message, text_alignement=Qt.AlignLeft, text_color=None, wait_time=None):
QSplashScreen.showMessage(<EOL>self, message, text_alignement, self.__text_color if text_color is None else text_color)<EOL>QApplication.processEvents()<EOL>foundations.core.wait(self.__wait_time if wait_time is None else wait_time)<EOL>
Reimplements the :meth:`QSplashScreen.show_message` method. :param message: Message to display on the splashscreen. :type message: unicode :param text_alignement: Text message alignment. :type text_alignement: object :param text_color: Text message color. :type text_color: object :param wait_time: Wait time. :type wait_time: int
f13148:c0:m7
def __init__(self,<EOL>parent=None,<EOL>state=True,<EOL>colors=(QColor(<NUM_LIT>, <NUM_LIT>, <NUM_LIT>),<EOL>QColor(<NUM_LIT>, <NUM_LIT>, <NUM_LIT>)),<EOL>labels=("<STR_LIT>", "<STR_LIT>")):
LOGGER.debug("<STR_LIT>".format(self.__class__.__name__))<EOL>QPushButton.__init__(self, parent)<EOL>self.__state = None<EOL>self.state = state<EOL>self.__colors = None<EOL>self.colors = colors<EOL>self.__labels = None<EOL>self.labels = labels<EOL>self.setCheckable(True)<EOL>if self.__state:<EOL><INDENT>self.__set_true_state()<EOL><DEDENT>else:<EOL><INDENT>self.__set_false_state()<EOL><DEDENT>self.clicked.connect(self.__variable_QPushButton__clicked)<EOL>
Initializes the class. :param parent: Widget parent. :type parent: QObject :param state: Current button state. :type state: bool :param colors: Button colors. :type colors: tuple :param labels: Button texts. :type labels: tuple
f13149:c0:m0
@property<EOL><INDENT>def state(self):<DEDENT>
return self.__state<EOL>
Property for **self.__state** attribute. :return: self.__state. :rtype: bool
f13149:c0:m1
@state.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(AssertionError)<EOL>def state(self, value):<DEDENT>
if value is not None:<EOL><INDENT>assert type(value) is bool, "<STR_LIT>".format("<STR_LIT:state>", value)<EOL><DEDENT>self.__state = value<EOL>
Setter for **self.__state** attribute. :param value: Attribute value. :type value: bool
f13149:c0:m2
@state.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def state(self):<DEDENT>
raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT:state>"))<EOL>
Deleter for **self.__state** attribute.
f13149:c0:m3