signature
stringlengths
8
3.44k
body
stringlengths
0
1.41M
docstring
stringlengths
1
122k
id
stringlengths
5
17
@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
f13135:c0:m13
@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
f13135:c0:m14
@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.
f13135:c0:m15
@property<EOL><INDENT>def address(self):<DEDENT>
return self.__address<EOL>
Property for **self.__address** attribute. :return: self.__address. :rtype: unicode
f13135:c0:m16
@address.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def address(self, value):<DEDENT>
if value is not None:<EOL><INDENT>assert type(value) is unicode, "<STR_LIT>".format(<EOL>"<STR_LIT:address>", value)<EOL>self.Address_lineEdit.setText(value)<EOL><DEDENT>self.__address = value<EOL>
Setter for **self.__address** attribute. :param value: Attribute value. :type value: unicode
f13135:c0:m17
@address.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def address(self):<DEDENT>
raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT:address>"))<EOL>
Deleter for **self.__address** attribute.
f13135:c0:m18
@property<EOL><INDENT>def port(self):<DEDENT>
return self.__port<EOL>
Property for **self.__port** attribute. :return: self.__port. :rtype: int
f13135:c0:m19
@port.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def port(self, value):<DEDENT>
if value is not None:<EOL><INDENT>assert type(value) is int, "<STR_LIT>".format(<EOL>"<STR_LIT:port>", value)<EOL>assert type(value) >= <NUM_LIT:0> and type(value) >= <NUM_LIT>,"<STR_LIT>".format("<STR_LIT:port>", value)<EOL>self.Port_spinBox.setValue(value)<EOL><DEDENT>self.__port = value<EOL>
Setter for **self.__port** attribute. :param value: Attribute value. :type value: int
f13135:c0:m20
@port.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def port(self):<DEDENT>
raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT:port>"))<EOL>
Deleter for **self.__port** attribute.
f13135:c0:m21
@property<EOL><INDENT>def file_command(self):<DEDENT>
return self.__file_command<EOL>
Property for **self.__file_command** attribute. :return: self.__file_command. :rtype: unicode
f13135:c0:m22
@file_command.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def file_command(self, value):<DEDENT>
if value is not None:<EOL><INDENT>assert type(value) is unicode, "<STR_LIT>".format(<EOL>"<STR_LIT>", value)<EOL><DEDENT>self.__file_command = value<EOL>
Setter for **self.__file_command** attribute. :param value: Attribute value. :type value: unicode
f13135:c0:m23
@file_command.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def file_command(self):<DEDENT>
raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL>
Deleter for **self.__file_command** attribute.
f13135:c0:m24
@property<EOL><INDENT>def connection_end(self):<DEDENT>
return self.__connection_end<EOL>
Property for **self.__connection_end** attribute. :return: self.__connection_end. :rtype: unicode
f13135:c0:m25
@connection_end.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def connection_end(self, value):<DEDENT>
if value is not None:<EOL><INDENT>assert type(value) is unicode, "<STR_LIT>".format(<EOL>"<STR_LIT>", value)<EOL><DEDENT>self.__connection_end = value<EOL>
Setter for **self.__connection_end** attribute. :param value: Attribute value. :type value: unicode
f13135:c0:m26
@connection_end.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def connection_end(self):<DEDENT>
raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL>
Deleter for **self.__connection_end** attribute.
f13135:c0:m27
def activate(self, engine):
LOGGER.debug("<STR_LIT>".format(self.__class__.__name__))<EOL>self.__engine = engine<EOL>self.__settings = self.__engine.settings<EOL>self.__settings_section = self.name<EOL>self.__preferences_manager = self.__engine.components_manager["<STR_LIT>"]<EOL>self.__script_editor = self.__engine.components_manager["<STR_LIT>"]<EOL>self.activated = True<EOL>return True<EOL>
Activates the Component. :param engine: Engine to attach the Component to. :type engine: QObject :return: Method success. :rtype: bool
f13135:c0:m28
def deactivate(self):
LOGGER.debug("<STR_LIT>".format(self.__class__.__name__))<EOL>self.__engine = None<EOL>self.__settings = None<EOL>self.__settings_section = None<EOL>self.__preferences_manager = None<EOL>self.activated = False<EOL>return True<EOL>
Deactivates the Component. :return: Method success. :rtype: bool
f13135:c0:m29
def initialize_ui(self):
LOGGER.debug("<STR_LIT>".format(self.__class__.__name__))<EOL>self.__Port_spinBox_set_ui()<EOL>self.__Address_lineEdit_set_ui()<EOL>self.__File_Command_lineEdit_set_ui()<EOL>self.__Connection_End_lineEdit_set_ui()<EOL>self.__add_actions()<EOL>self.Port_spinBox.valueChanged.connect(self.__Port_spinBox__valueChanged)<EOL>self.Address_lineEdit.editingFinished.connect(self.__Address_lineEdit__editFinished)<EOL>self.File_Command_lineEdit.editingFinished.connect(self.__File_Command_lineEdit__editFinished)<EOL>self.Connection_End_lineEdit.editingFinished.connect(self.__Connection_End_lineEdit__editFinished)<EOL>self.initialized_ui = True<EOL>return True<EOL>
Initializes the Component ui. :return: Method success. :rtype: bool
f13135:c0:m30
def uninitialize_ui(self):
LOGGER.debug("<STR_LIT>".format(self.__class__.__name__))<EOL>self.__remove_actions()<EOL>self.Port_spinBox.valueChanged.disconnect(self.__Port_spinBox__valueChanged)<EOL>self.Address_lineEdit.editingFinished.disconnect(self.__Address_lineEdit__editFinished)<EOL>self.File_Command_lineEdit.editingFinished.disconnect(self.__File_Command_lineEdit__editFinished)<EOL>self.Connection_End_lineEdit.editingFinished.disconnect(self.__Connection_End_lineEdit__editFinished)<EOL>self.initialized_ui = False<EOL>return True<EOL>
Uninitializes the Component ui. :return: Method success. :rtype: bool
f13135:c0:m31
def add_widget(self):
LOGGER.debug("<STR_LIT>".format(self.__class__.__name__))<EOL>self.__preferences_manager.Others_Preferences_gridLayout.addWidget(self.TCP_Client_Ui_groupBox)<EOL>return True<EOL>
Adds the Component Widget to the engine. :return: Method success. :rtype: bool
f13135:c0:m32
def remove_widget(self):
LOGGER.debug("<STR_LIT>".format(self.__class__.__name__))<EOL>self.__preferences_manager.findChild(QGridLayout, "<STR_LIT>").removeWidget(self)<EOL>self.TCP_Client_Ui_groupBox.setParent(None)<EOL>return True<EOL>
Removes the Component Widget from the engine. :return: Method success. :rtype: bool
f13135:c0:m33
def __add_actions(self):
LOGGER.debug("<STR_LIT>".format(self.__class__.__name__))<EOL>self.__script_editor.command_menu.addSeparator()<EOL>self.__script_editor.command_menu.addAction(self.__engine.actions_manager.register_action(<EOL>"<STR_LIT>",<EOL>shortcut=Qt.ControlModifier + Qt.AltModifier + Qt.Key_Return,<EOL>slot=self.__send_selection_to_server_action__triggered))<EOL>self.__script_editor.command_menu.addAction(self.__engine.actions_manager.register_action(<EOL>"<STR_LIT>",<EOL>shortcut=Qt.SHIFT + Qt.AltModifier + Qt.CTRL + Qt.Key_Return,<EOL>slot=self.__send_file_to_server_action__triggered))<EOL>
Sets Component actions.
f13135:c0:m34
def __remove_actions(self):
LOGGER.debug("<STR_LIT>".format(self.__class__.__name__))<EOL>send_selection_to_server_action = "<STR_LIT>"<EOL>send_file_to_server_action = "<STR_LIT>"<EOL>for action in (send_selection_to_server_action, send_file_to_server_action):<EOL><INDENT>self.__script_editor.command_menu.removeAction(self.__engine.actions_manager.get_action(action))<EOL>self.__engine.actions_manager.unregister_action(action)<EOL><DEDENT>
Removes actions.
f13135:c0:m35
def __Address_lineEdit_set_ui(self):
<EOL>self.__settings.get_key(self.__settings_section, "<STR_LIT:address>").isNull() andself.__settings.set_key(self.__settings_section, "<STR_LIT:address>", self.__address)<EOL>address = self.__settings.get_key(self.__settings_section, "<STR_LIT:address>").toString()<EOL>LOGGER.debug("<STR_LIT>".format("<STR_LIT>",<EOL>address))<EOL>self.__address = address<EOL>self.Address_lineEdit.setText(address)<EOL>
Fills **Address_lineEdit** Widget.
f13135:c0:m36
def __Address_lineEdit__editFinished(self):
address = self.Address_lineEdit.text()<EOL>self.__settings.set_key(self.__settings_section, "<STR_LIT:address>", address)<EOL>self.__address = address<EOL>
Defines the slot triggered by **Address_lineEdit** Widget when edited.
f13135:c0:m37
def __Port_spinBox_set_ui(self):
<EOL>self.__settings.get_key(self.__settings_section, "<STR_LIT:port>").isNull() andself.__settings.set_key(self.__settings_section, "<STR_LIT:port>", self.__port)<EOL>port = foundations.common.get_first_item(self.__settings.get_key(self.__settings_section, "<STR_LIT:port>").toInt())<EOL>LOGGER.debug("<STR_LIT>".format("<STR_LIT>",<EOL>port))<EOL>self.__port = port<EOL>self.Port_spinBox.setValue(port)<EOL>
Sets the **Port_spinBox** Widget.
f13135:c0:m38
def __Port_spinBox__valueChanged(self, value):
LOGGER.debug("<STR_LIT>".format(value))<EOL>self.__port = int(value)<EOL>self.__settings.set_key(self.__settings_section, "<STR_LIT:port>", value)<EOL>
Defines the slot triggered by the **Port_spinBox** Widget when value changed. :param value: Port value. :type value: int
f13135:c0:m39
def __File_Command_lineEdit_set_ui(self):
<EOL>self.__settings.get_key(self.__settings_section, "<STR_LIT>").isNull() andself.__settings.set_key(self.__settings_section, "<STR_LIT>", self.__file_command)<EOL>file_command = self.__settings.get_key(self.__settings_section, "<STR_LIT>").toString()<EOL>LOGGER.debug("<STR_LIT>".format("<STR_LIT>",<EOL>file_command))<EOL>self.__file_command = file_command<EOL>self.File_Command_lineEdit.setText(file_command)<EOL>
Fills **File_Command_lineEdit** Widget.
f13135:c0:m40
def __File_Command_lineEdit__editFinished(self):
file_command = self.File_Command_lineEdit.text()<EOL>self.__settings.set_key(self.__settings_section, "<STR_LIT>", file_command)<EOL>self.__file_command = file_command<EOL>
Defines the slot triggered by **File_Command_lineEdit** Widget when edited.
f13135:c0:m41
def __Connection_End_lineEdit_set_ui(self):
<EOL>self.__settings.get_key(self.__settings_section, "<STR_LIT>").isNull() andself.__settings.set_key(self.__settings_section, "<STR_LIT>", self.__connection_end)<EOL>connection_end = self.__settings.get_key(self.__settings_section, "<STR_LIT>").toString()<EOL>LOGGER.debug("<STR_LIT>".format("<STR_LIT>",<EOL>connection_end))<EOL>self.__connection_end = connection_end<EOL>self.Connection_End_lineEdit.setText(connection_end)<EOL>
Fills **Connection_End_lineEdit** Widget.
f13135:c0:m42
def __Connection_End_lineEdit__editFinished(self):
connection_end = self.Connection_End_lineEdit.text()<EOL>self.__settings.set_key(self.__settings_section, "<STR_LIT>", connection_end)<EOL>self.__connection_end = connection_end<EOL>
Defines the slot triggered by **Connection_End_lineEdit** Widget when edited.
f13135:c0:m43
def __send_selection_to_server_action__triggered(self, checked):
editor = self.__script_editor.get_current_editor()<EOL>if not editor:<EOL><INDENT>return False<EOL><DEDENT>selected_text = foundations.strings.to_string(<EOL>editor.get_selected_text().replace(QChar(QChar.ParagraphSeparator),<EOL>QString("<STR_LIT:\n>")))<EOL>if not selected_text:<EOL><INDENT>return False<EOL><DEDENT>return self.send_data_to_server(selected_text)<EOL>
Defines the slot triggered by **'Actions|Umbra|Components|addons.tcp_serverUi|&Command|Send Selection To Server'** action. :param checked: Checked state. :type checked: bool :return: Method success. :rtype: bool
f13135:c0:m44
def __send_file_to_server_action__triggered(self, checked):
editor = self.__script_editor.get_current_editor()<EOL>if not editor:<EOL><INDENT>return False<EOL><DEDENT>if self.__script_editor.save_file():<EOL><INDENT>return self.send_data_to_server(foundations.strings.to_string(self.__file_command).format(editor.file))<EOL><DEDENT>
Defines the slot triggered by **'Actions|Umbra|Components|addons.tcp_serverUi|&Command|&Send Current File To Server'** action. :param checked: Checked state. :type checked: bool :return: Method success. :rtype: bool
f13135:c0:m45
def send_data_to_server(self, data, time_out=<NUM_LIT:5>):
if not data.endswith(self.__connection_end):<EOL><INDENT>data = "<STR_LIT>".format(data, foundations.strings.to_string(self.__connection_end).decode("<STR_LIT>"))<EOL><DEDENT>connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM)<EOL>connection.settimeout(time_out)<EOL>connection.connect((foundations.strings.to_string(self.__address), int(self.__port)))<EOL>connection.send(data)<EOL>self.__engine.notifications_manager.notify(<EOL>"<STR_LIT>".format(self.__class__.__name__))<EOL>connection.close()<EOL>return True<EOL>
Sends given data to the Server. :param data: Data to send. :type data: unicode :param time_out: Connection timeout in seconds. :type time_out: float :return: Method success. :rtype: bool
f13135:c0:m46
def __init__(self, parent=None, name=None, *args, **kwargs):
LOGGER.debug("<STR_LIT>".format(self.__class__.__name__))<EOL>super(ProjectsExplorer, self).__init__(parent, name, *args, **kwargs)<EOL>self.deactivatable = True<EOL>self.__dock_area = <NUM_LIT:1><EOL>self.__engine = None<EOL>self.__settings = None<EOL>self.__settings_section = None<EOL>self.__script_editor = None<EOL>self.__model = None<EOL>self.__view = None<EOL>self.__delegate = None<EOL>self.__style = Style(default="""<STR_LIT>""",<EOL>hover="""<STR_LIT>""",<EOL>highlight="""<STR_LIT>""")<EOL>
Initializes the class. :param parent: Object parent. :type parent: QObject :param name: Component name. :type name: unicode :param \*args: Arguments. :type \*args: \* :param \*\*kwargs: Keywords arguments. :type \*\*kwargs: \*\*
f13136:c0:m0
@property<EOL><INDENT>def dock_area(self):<DEDENT>
return self.__dock_area<EOL>
Property for **self.__dock_area** attribute. :return: self.__dock_area. :rtype: int
f13136:c0:m1
@dock_area.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def dock_area(self, value):<DEDENT>
raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL>
Setter for **self.__dock_area** attribute. :param value: Attribute value. :type value: int
f13136:c0:m2
@dock_area.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def dock_area(self):<DEDENT>
raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL>
Deleter for **self.__dock_area** attribute.
f13136:c0:m3
@property<EOL><INDENT>def engine(self):<DEDENT>
return self.__engine<EOL>
Property for **self.__engine** attribute. :return: self.__engine. :rtype: QObject
f13136:c0:m4
@engine.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def engine(self, value):<DEDENT>
raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL>
Setter for **self.__engine** attribute. :param value: Attribute value. :type value: QObject
f13136:c0:m5
@engine.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def engine(self):<DEDENT>
raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL>
Deleter for **self.__engine** attribute.
f13136:c0:m6
@property<EOL><INDENT>def settings(self):<DEDENT>
return self.__settings<EOL>
Property for **self.__settings** attribute. :return: self.__settings. :rtype: QSettings
f13136:c0:m7
@settings.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def settings(self, value):<DEDENT>
raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL>
Setter for **self.__settings** attribute. :param value: Attribute value. :type value: QSettings
f13136:c0:m8
@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.
f13136:c0:m9
@property<EOL><INDENT>def settings_section(self):<DEDENT>
return self.__settings_section<EOL>
Property for **self.__settings_section** attribute. :return: self.__settings_section. :rtype: unicode
f13136:c0:m10
@settings_section.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def settings_section(self, value):<DEDENT>
raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL>
Setter for **self.__settings_section** attribute. :param value: Attribute value. :type value: unicode
f13136:c0:m11
@settings_section.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def settings_section(self):<DEDENT>
raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL>
Deleter for **self.__settings_section** attribute.
f13136:c0:m12
@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
f13136:c0:m13
@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
f13136:c0:m14
@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.
f13136:c0:m15
@property<EOL><INDENT>def model(self):<DEDENT>
return self.__model<EOL>
Property for **self.__model** attribute. :return: self.__model. :rtype: ProjectsProxyModel
f13136: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: ProjectsProxyModel
f13136: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.
f13136:c0:m18
@property<EOL><INDENT>def view(self):<DEDENT>
return self.__view<EOL>
Property for **self.__view** attribute. :return: self.__view. :rtype: QWidget
f13136: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
f13136: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.
f13136:c0:m21
@property<EOL><INDENT>def delegate(self):<DEDENT>
return self.__delegate<EOL>
Property for **self.__delegate** attribute. :return: self.__delegate. :rtype: QItemDelegate
f13136: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
f13136: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.
f13136:c0:m24
@property<EOL><INDENT>def style(self):<DEDENT>
return self.__style<EOL>
Property for **self.__style** attribute. :return: self.__style. :rtype: Style
f13136:c0:m25
@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: Style
f13136:c0:m26
@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.
f13136:c0:m27
def activate(self, engine):
LOGGER.debug("<STR_LIT>".format(self.__class__.__name__))<EOL>self.__engine = engine<EOL>self.__settings = self.__engine.settings<EOL>self.__settings_section = self.name<EOL>self.__script_editor = self.__engine.components_manager["<STR_LIT>"]<EOL>self.activated = True<EOL>return True<EOL>
Activates the Component. :param engine: Engine to attach the Component to. :type engine: QObject :return: Method success. :rtype: bool
f13136:c0:m28
def deactivate(self):
LOGGER.debug("<STR_LIT>".format(self.__class__.__name__))<EOL>self.__engine = None<EOL>self.__settings = None<EOL>self.__settings_section = None<EOL>self.__script_editor = None<EOL>self.activated = False<EOL>return True<EOL>
Deactivates the Component. :return: Method success. :rtype: bool
f13136:c0:m29
def initialize_ui(self):
LOGGER.debug("<STR_LIT>".format(self.__class__.__name__))<EOL>self.__model = ProjectsProxyModel(self)<EOL>self.__model.setSourceModel(self.__script_editor.model)<EOL>self.__delegate = RichText_QStyledItemDelegate(self, self.__style)<EOL>self.Projects_Explorer_treeView.setParent(None)<EOL>self.Projects_Explorer_treeView = Projects_QTreeView(self, self.__model)<EOL>self.Projects_Explorer_treeView.setItemDelegate(self.__delegate)<EOL>self.Projects_Explorer_treeView.setObjectName("<STR_LIT>")<EOL>self.Projects_Explorer_treeView.setContextMenuPolicy(Qt.ActionsContextMenu)<EOL>self.Projects_Explorer_dockWidgetContents_gridLayout.addWidget(self.Projects_Explorer_treeView, <NUM_LIT:0>, <NUM_LIT:0>)<EOL>self.__view = self.Projects_Explorer_treeView<EOL>self.__view_add_actions()<EOL>self.__add_actions()<EOL>self.__view.expanded.connect(self.__view__expanded)<EOL>self.__view.doubleClicked.connect(self.__view__doubleClicked)<EOL>self.__view.selectionModel().selectionChanged.connect(self.__view_selectionModel__selectionChanged)<EOL>self.__script_editor.Script_Editor_tabWidget.currentChanged.connect(<EOL>self.__script_editor_Script_Editor_tabWidget__currentChanged)<EOL>self.__script_editor.model.project_registered.connect(self.__script_editor_model__project_registered)<EOL>self.initialized_ui = True<EOL>return True<EOL>
Initializes the Component ui. :return: Method success. :rtype: bool
f13136:c0:m30
def uninitialize_ui(self):
LOGGER.debug("<STR_LIT>".format(self.__class__.__name__))<EOL>self.__remove_actions()<EOL>self.__view.expanded.disconnect(self.__view__expanded)<EOL>self.__view.doubleClicked.disconnect(self.__view__doubleClicked)<EOL>self.__view.selectionModel().selectionChanged.disconnect(self.__view_selectionModel__selectionChanged)<EOL>self.__script_editor.Script_Editor_tabWidget.currentChanged.disconnect(<EOL>self.__script_editor_Script_Editor_tabWidget__currentChanged)<EOL>self.__script_editor.model.project_registered.disconnect(self.__script_editor_model__project_registered)<EOL>self.__view_remove_actions()<EOL>self.__model = None<EOL>self.__delegate = None<EOL>self.__view = None<EOL>self.initialized_ui = False<EOL>return True<EOL>
Uninitializes the Component ui. :return: Method success. :rtype: bool
f13136:c0:m31
def add_widget(self):
LOGGER.debug("<STR_LIT>".format(self.__class__.__name__))<EOL>self.__engine.addDockWidget(Qt.DockWidgetArea(self.__dock_area), self)<EOL>return True<EOL>
Adds the Component Widget to the engine. :return: Method success. :rtype: bool
f13136:c0:m32
def remove_widget(self):
LOGGER.debug("<STR_LIT>".format(self.__class__.__name__))<EOL>self.__engine.removeDockWidget(self)<EOL>self.setParent(None)<EOL>return True<EOL>
Removes the Component Widget from the engine. :return: Method success. :rtype: bool
f13136:c0:m33
def __add_actions(self):
LOGGER.debug("<STR_LIT>".format(self.__class__.__name__))<EOL>add_project_action = self.__engine.actions_manager.get_action(<EOL>"<STR_LIT>")<EOL>remove_project_action = self.__engine.actions_manager.register_action(<EOL>"<STR_LIT>",<EOL>slot=self.__view_remove_project_action__triggered)<EOL>self.__script_editor.file_menu.insertAction(add_project_action, remove_project_action)<EOL>self.__script_editor.file_menu.removeAction(add_project_action)<EOL>self.__script_editor.file_menu.insertAction(remove_project_action, add_project_action)<EOL>
Sets Component actions.
f13136:c0:m34
def __remove_actions(self):
LOGGER.debug("<STR_LIT>".format(self.__class__.__name__))<EOL>remove_project_action = "<STR_LIT>"<EOL>self.__script_editor.command_menu.removeAction(self.__engine.actions_manager.get_action(remove_project_action))<EOL>self.__engine.actions_manager.unregister_action(remove_project_action)<EOL>
Removes actions.
f13136:c0:m35
def __view_add_actions(self):
self.__view.addAction(self.__engine.actions_manager.register_action(<EOL>"<STR_LIT>",<EOL>slot=self.__view_add_project_action__triggered))<EOL>self.__view.addAction(self.__engine.actions_manager.register_action(<EOL>"<STR_LIT>",<EOL>slot=self.__view_remove_project_action__triggered))<EOL>separator_action = QAction(self.__view)<EOL>separator_action.setSeparator(True)<EOL>self.__view.addAction(separator_action)<EOL>self.__view.addAction(self.__engine.actions_manager.register_action(<EOL>"<STR_LIT>",<EOL>slot=self.__view_add_new_file_action__triggered))<EOL>self.__view.addAction(self.__engine.actions_manager.register_action(<EOL>"<STR_LIT>",<EOL>slot=self.__view_add_new_directory_action__triggered))<EOL>separator_action = QAction(self.__view)<EOL>separator_action.setSeparator(True)<EOL>self.__view.addAction(separator_action)<EOL>self.__view.addAction(self.__engine.actions_manager.register_action(<EOL>"<STR_LIT>",<EOL>slot=self.__view_rename_action__triggered))<EOL>separator_action = QAction(self.__view)<EOL>separator_action.setSeparator(True)<EOL>self.__view.addAction(separator_action)<EOL>self.__view.addAction(self.__engine.actions_manager.register_action(<EOL>"<STR_LIT>",<EOL>slot=self.__view_delete_action__triggered))<EOL>separator_action = QAction(self.__view)<EOL>separator_action.setSeparator(True)<EOL>self.__view.addAction(separator_action)<EOL>self.__view.addAction(self.__engine.actions_manager.register_action(<EOL>"<STR_LIT>",<EOL>slot=self.__view_find_in_files_action__triggered))<EOL>separator_action = QAction(self.__view)<EOL>separator_action.setSeparator(True)<EOL>self.__view.addAction(separator_action)<EOL>self.__view.addAction(self.__engine.actions_manager.register_action(<EOL>"<STR_LIT>",<EOL>slot=self.__view_output_selected_path_action__triggered))<EOL>
Sets the View actions.
f13136:c0:m36
def __view_remove_actions(self):
add_project_action = "<STR_LIT>"<EOL>remove_project_action = "<STR_LIT>"<EOL>add_new_file_action = "<STR_LIT>"<EOL>add_new_directory_action = "<STR_LIT>"<EOL>rename_action = "<STR_LIT>"<EOL>delete_action = "<STR_LIT>"<EOL>find_in_files_action = "<STR_LIT>"<EOL>output_selected_path_action = "<STR_LIT>"<EOL>for action in (add_project_action,<EOL>remove_project_action,<EOL>add_new_file_action,<EOL>add_new_directory_action,<EOL>rename_action,<EOL>delete_action,<EOL>output_selected_path_action):<EOL><INDENT>self.__view.removeAction(self.__engine.actions_manager.get_action(action))<EOL>self.__engine.actions_manager.unregister_action(action)<EOL><DEDENT>
Removes the View actions.
f13136:c0:m37
def __view__expanded(self, index):
node = self.__model.get_node(index)<EOL>if node.family != "<STR_LIT>":<EOL><INDENT>return<EOL><DEDENT>self.__script_editor.model.set_project_nodes(node)<EOL>
Defines the slot triggered by a View when an item is expanded. :param index: Expdanded item. :type index: QModelIndex
f13136:c0:m38
def __view__doubleClicked(self, index):
node = self.__model.get_node(index)<EOL>if not node.family == "<STR_LIT>":<EOL><INDENT>return<EOL><DEDENT>foundations.common.path_exists(node.path) and self.__script_editor.load_file(node.path)<EOL>
Defines the slot triggered by a View when double clicked. :param index: Clicked item index. :type index: QModelIndex
f13136:c0:m39
def __view_selectionModel__selectionChanged(self, selected_items, deselected_items):
for node in self.__view.get_selected_nodes():<EOL><INDENT>if node.family == "<STR_LIT>":<EOL><INDENT>self.__script_editor.set_current_editor(node.path)<EOL><DEDENT><DEDENT>
Defines the slot triggered by the View **selectionModel** when selection changed. :param selected_items: Selected items. :type selected_items: QItemSelection :param deselected_items: Deselected items. :type deselected_items: QItemSelection
f13136:c0:m40
def __script_editor_Script_Editor_tabWidget__currentChanged(self, index):
editor = self.__script_editor.get_current_editor()<EOL>if not editor:<EOL><INDENT>return<EOL><DEDENT>editor_node = foundations.common.get_first_item(self.__script_editor.model.get_editor_nodes(editor))<EOL>if not editor_node:<EOL><INDENT>return<EOL><DEDENT>indexes = [self.__model.mapFromSource(self.__model.sourceModel().get_node_index(editor_node.parent))]<EOL>self.__view.clearSelection()<EOL>self.__view.select_indexes(indexes)<EOL>
Defines the slot triggered by :class:`umbra.components.factory.script_editor.script_editor.ScriptEditor` Component Interface class when the current tab is changed. :param index: Tab index. :type index: int
f13136:c0:m41
def __script_editor_model__project_registered(self, project_node):
index = self.__model.mapFromSource(self.__script_editor.model.get_node_index(project_node))<EOL>self.__view.setExpanded(index, True)<EOL>
Defines the slot triggered by :class:`umbra.components.factory.script_editor.script_editor` class Model when a project is registered. :param project_node: Registered project ProjectNode. :type project_node: ProjectNode
f13136:c0:m42
def __view_add_project_action__triggered(self, checked):
return self.__script_editor.add_project_ui()<EOL>
Defines the slot triggered by **'Actions|Umbra|Components|addons.projects_explorer|Add Project ...'** action. :param checked: Checked state. :type checked: bool :return: Method success. :rtype: bool
f13136:c0:m43
def __view_remove_project_action__triggered(self, checked):
node = foundations.common.get_first_item(self.get_selected_nodes())<EOL>if not node:<EOL><INDENT>return False<EOL><DEDENT>return self.remove_project(node)<EOL>
Defines the slot triggered by **'Actions|Umbra|Components|addons.projects_explorer|Remove Project'** action. :param checked: Checked state. :type checked: bool :return: Method success. :rtype: bool
f13136:c0:m44
def __view_add_new_file_action__triggered(self, checked):
node = foundations.common.get_first_item(self.get_selected_nodes())<EOL>if not node:<EOL><INDENT>return False<EOL><DEDENT>return self.add_new_file(node)<EOL>
Defines the slot triggered by **'"Actions|Umbra|Components|addons.projects_explorer|Add New File ..."'** action. :param checked: Checked state. :type checked: bool :return: Method success. :rtype: bool
f13136:c0:m45
def __view_add_new_directory_action__triggered(self, checked):
node = foundations.common.get_first_item(self.get_selected_nodes())<EOL>if not node:<EOL><INDENT>return False<EOL><DEDENT>return self.add_new_directory(node)<EOL>
Defines the slot triggered by **'"Actions|Umbra|Components|addons.projects_explorer|Add New Directory ..."'** action. :param checked: Checked state. :type checked: bool :return: Method success. :rtype: bool
f13136:c0:m46
def __view_rename_action__triggered(self, checked):
node = foundations.common.get_first_item(self.get_selected_nodes())<EOL>if not node:<EOL><INDENT>return False<EOL><DEDENT>return self.rename(node)<EOL>
Defines the slot triggered by **'"Actions|Umbra|Components|addons.projects_explorer|Rename ..."'** action. :param checked: Checked state. :type checked: bool :return: Method success. :rtype: bool
f13136:c0:m47
def __view_delete_action__triggered(self, checked):
node = foundations.common.get_first_item(self.get_selected_nodes())<EOL>if not node:<EOL><INDENT>return False<EOL><DEDENT>return self.delete(node)<EOL>
Defines the slot triggered by **'"Actions|Umbra|Components|addons.projects_explorer|Delete ..."'** action. :param checked: Checked state. :type checked: bool :return: Method success. :rtype: bool
f13136:c0:m48
def __view_find_in_files_action__triggered(self, checked):
node = foundations.common.get_first_item(self.__view.get_selected_nodes().iterkeys())<EOL>if not node:<EOL><INDENT>return False<EOL><DEDENT>self.__script_editor.search_in_files.Where_lineEdit.setText(node.path)<EOL>self.__script_editor.search_in_files.show()<EOL>return True<EOL>
Defines the slot triggered by **'Actions|Umbra|Components|addons.projects_explorer|Find In Files ...'** action. :param checked: Checked state. :type checked: bool :return: Method success. :rtype: bool
f13136:c0:m49
def __view_output_selected_path_action__triggered(self, checked):
node = foundations.common.get_first_item(self.__view.get_selected_nodes().iterkeys())<EOL>if not node:<EOL><INDENT>return False<EOL><DEDENT>LOGGER.info("<STR_LIT>".format(self.__class__.__name__, node.path))<EOL>return True<EOL>
Defines the slot triggered by **'Actions|Umbra|Components|addons.projects_explorer|Output Selected Path'** action. :param checked: Checked state. :type checked: bool :return: Method success. :rtype: bool
f13136:c0:m50
@foundations.exceptions.handle_exceptions(umbra.exceptions.notify_exception_handler,<EOL>foundations.exceptions.FileExistsError,<EOL>foundations.exceptions.DirectoryExistsError,<EOL>Exception)<EOL><INDENT>def __raise_file_system_exception(self, item, directory):<DEDENT>
path = os.path.join(directory, item)<EOL>if os.path.isfile(path):<EOL><INDENT>raise foundations.exceptions.FileExistsError(<EOL>"<STR_LIT>".format(self.__class__.__name__,<EOL>item,<EOL>directory))<EOL><DEDENT>else:<EOL><INDENT>raise foundations.exceptions.DirectoryExistsError(<EOL>"<STR_LIT>".format(self.__class__.__name__,<EOL>item,<EOL>directory))<EOL><DEDENT>
Raises a common fileSystem exception. :param item: Name of the item generating the exception. :type item: unicode :param directory: Name of the target directory. :type directory: unicode
f13136:c0:m51
def __set_authoring_nodes(self, source, target):
editor = self.__script_editor.get_editor(source)<EOL>editor.set_file(target)<EOL>self.__script_editor.model.update_authoring_nodes(editor)<EOL>
Sets given editor authoring nodes. :param source: Source file. :type source: unicode :param target: Target file. :type target: unicode
f13136:c0:m52
def __rename_path(self, source, target):
if not foundations.common.path_exists(source):<EOL><INDENT>return<EOL><DEDENT>parent_directory = os.path.dirname(source)<EOL>is_path_registered = self.__engine.file_system_events_manager.is_path_registered(parent_directory)<EOL>is_path_registered and self.__engine.file_system_events_manager.unregister_path(parent_directory)<EOL>os.rename(source, target)<EOL>is_path_registered and self.__engine.file_system_events_manager.register_path(parent_directory)<EOL>
Renames given source with given target name. :param source: Source file. :type source: unicode :param target: Target file. :type target: unicode
f13136:c0:m53
def __delete_path(self, path):
if not foundations.common.path_exists(path):<EOL><INDENT>return<EOL><DEDENT>parent_directory = os.path.dirname(path)<EOL>is_path_registered = self.__engine.file_system_events_manager.is_path_registered(parent_directory)<EOL>is_path_registered and self.__engine.file_system_events_manager.unregister_path(parent_directory)<EOL>foundations.io.remove(path)<EOL>is_path_registered and self.__engine.file_system_events_manager.register_path(parent_directory)<EOL>
Deletes given path. :param path: Path to delete. :type path: unicode
f13136:c0:m54
def __rename_file(self, source, target):
for file_node in self.__script_editor.model.get_file_nodes(source, self.__script_editor.model.root_node):<EOL><INDENT>self.__script_editor.unregister_node_path(file_node)<EOL>self.__rename_path(source, target)<EOL>self.__script_editor.register_node_path(file_node)<EOL>if self.__script_editor.model.is_authoring_node(file_node):<EOL><INDENT>self.__set_authoring_nodes(source, target)<EOL><DEDENT>else:<EOL><INDENT>self.__script_editor.model.update_project_nodes(file_node.parent)<EOL><DEDENT><DEDENT>
Renames a file using given source and target names. :param source: Source file. :type source: unicode :param target: Target file. :type target: unicode
f13136:c0:m55
def __rename_directory(self, source, target):
for node in itertools.chain(self.__script_editor.model.get_project_nodes(source),<EOL>self.__script_editor.model.get_directory_nodes(source)):<EOL><INDENT>self.__script_editor.model.unregister_project_nodes(node)<EOL>self.__script_editor.unregister_node_path(node)<EOL>self.__rename_path(source, target)<EOL>node.name = os.path.basename(target)<EOL>node.path = target<EOL>self.__script_editor.model.node_changed(node)<EOL>self.__script_editor.register_node_path(node)<EOL>self.__script_editor.model.set_project_nodes(node)<EOL><DEDENT>
Renames a directory using given source and target names. :param source: Source file. :type source: unicode :param target: Target file. :type target: unicode
f13136:c0:m56
def __rename_project(self, source, target):
self.__rename_directory(source, target)<EOL>
Renames a project using given source and target names. :param source: Source project. :type source: unicode :param target: Target project. :type target: unicode
f13136:c0:m57
def __delete_file(self, file):
for file_node in self.__script_editor.model.get_file_nodes(file, self.__script_editor.model.root_node):<EOL><INDENT>self.__script_editor.unregister_node_path(file_node)<EOL>self.__delete_path(file)<EOL>if self.__script_editor.model.is_authoring_node(file_node):<EOL><INDENT>self.__script_editor.get_editor(file).set_modified(True)<EOL><DEDENT>else:<EOL><INDENT>self.__script_editor.model.unregister_file(file_node)<EOL><DEDENT><DEDENT>
Deletes given file. :param file: File to delete. :type file: unicode
f13136:c0:m58
def __delete_directory(self, directory):
for node in itertools.chain(self.__script_editor.model.get_project_nodes(directory),<EOL>self.__script_editor.model.get_directory_nodes(directory)):<EOL><INDENT>self.__script_editor.model.unregister_project_nodes(node)<EOL>if node.family == "<STR_LIT>":<EOL><INDENT>self.__script_editor.model.unregister_project_nodes(node)<EOL>self.__script_editor.model.unregister_directory(node)<EOL><DEDENT>elif node.family == "<STR_LIT>":<EOL><INDENT>self.__script_editor.remove_project(directory)<EOL><DEDENT>self.__delete_path(directory)<EOL><DEDENT>
Deletes given directory. :param directory: Directory to delete. :type directory: unicode
f13136:c0:m59
def get_selected_nodes(self):
return self.__view.get_selected_nodes()<EOL>
Returns the View selected nodes. :return: View selected nodes. :rtype: dict
f13136:c0:m60
def remove_project(self, node):
if node.family == "<STR_LIT>":<EOL><INDENT>self.__script_editor.remove_project(node.path)<EOL>return True<EOL><DEDENT>for node in foundations.walkers.nodes_walker(node, ascendants=True):<EOL><INDENT>if node.family == "<STR_LIT>" and not node is self.__script_editor.model.default_project_node:<EOL><INDENT>self.__script_editor.remove_project(node.path)<EOL>return True<EOL><DEDENT><DEDENT>
Removes the project associated with given node. :param node: Node. :type node: ProjectNode or DirectoryNode or FileNode :return: Method success. :rtype: bool
f13136:c0:m61
def add_new_file(self, node):
if self.__script_editor.model.is_authoring_node(node):<EOL><INDENT>return self.__script_editor.new_file()<EOL><DEDENT>file, state = QInputDialog.getText(self, "<STR_LIT>", "<STR_LIT>")<EOL>if not state:<EOL><INDENT>return False<EOL><DEDENT>if node.family in ("<STR_LIT>", "<STR_LIT>"):<EOL><INDENT>directory = node.path<EOL><DEDENT>elif node.family == "<STR_LIT>":<EOL><INDENT>directory = os.path.dirname(node.path)<EOL><DEDENT>if not file in os.listdir(directory):<EOL><INDENT>file = os.path.join(directory, file)<EOL>LOGGER.info("<STR_LIT>".format(self.__class__.__name__, file))<EOL>open(file, "<STR_LIT:w>").close()<EOL><DEDENT>else:<EOL><INDENT>self.__raise_file_system_exception(file, directory)<EOL><DEDENT>return True<EOL>
Adds a new file next to given Node associated path. :param node: Node. :type node: ProjectNode or DirectoryNode or FileNode :return: Method success. :rtype: bool
f13136:c0:m62
def add_new_directory(self, node):
if self.__script_editor.model.is_authoring_node(node):<EOL><INDENT>return False<EOL><DEDENT>directory, state = QInputDialog.getText(self, "<STR_LIT>", "<STR_LIT>")<EOL>if not state:<EOL><INDENT>return False<EOL><DEDENT>if node.family in ("<STR_LIT>", "<STR_LIT>"):<EOL><INDENT>parent_directory = node.path<EOL><DEDENT>elif node.family == "<STR_LIT>":<EOL><INDENT>parent_directory = os.path.dirname(node.path)<EOL><DEDENT>directory = foundations.strings.to_string(directory)<EOL>if not directory in os.listdir(parent_directory):<EOL><INDENT>directory = os.path.join(parent_directory, directory)<EOL>LOGGER.info("<STR_LIT>".format(self.__class__.__name__, directory))<EOL>os.makedirs(directory)<EOL><DEDENT>else:<EOL><INDENT>self.__raise_file_system_exception(file, parent_directory)<EOL><DEDENT>return True<EOL>
Adds a new directory next to given Node associated path. :param node: Node. :type node: ProjectNode or DirectoryNode or FileNode :return: Method success. :rtype: bool
f13136:c0:m63
def rename(self, node):
source = node.path<EOL>base_name, state = QInputDialog.getText(self, "<STR_LIT>", "<STR_LIT>", text=os.path.basename(source))<EOL>if not state:<EOL><INDENT>return False<EOL><DEDENT>base_name = foundations.strings.to_string(base_name)<EOL>if base_name == os.path.basename(source):<EOL><INDENT>return False<EOL><DEDENT>parent_directory = os.path.dirname(source)<EOL>target = os.path.join(parent_directory, base_name)<EOL>if self.__script_editor.model.is_authoring_node(node):<EOL><INDENT>if not foundations.common.path_exists(source):<EOL><INDENT>LOGGER.info("<STR_LIT>".format(<EOL>self.__class__.__name__, source, target))<EOL>self.__set_authoring_nodes(source, target)<EOL>return True<EOL><DEDENT><DEDENT>if not base_name in os.listdir(parent_directory):<EOL><INDENT>if node.family == "<STR_LIT>":<EOL><INDENT>LOGGER.info("<STR_LIT>".format(self.__class__.__name__, source, target))<EOL>self.__rename_file(source, target)<EOL><DEDENT>elif node.family == "<STR_LIT>":<EOL><INDENT>LOGGER.info("<STR_LIT>".format(self.__class__.__name__, source, target))<EOL>self.__rename_directory(source, target)<EOL><DEDENT>elif node.family == "<STR_LIT>":<EOL><INDENT>LOGGER.info("<STR_LIT>".format(self.__class__.__name__, source, target))<EOL>self.__rename_project(source, target)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>self.__raise_file_system_exception(base_name, parent_directory)<EOL><DEDENT>return True<EOL>
Renames given Node associated path. :param node: Node. :type node: ProjectNode or DirectoryNode or FileNode :return: Method success. :rtype: bool
f13136:c0:m64
def delete(self, node):
path = node.path<EOL>if self.__script_editor.model.is_authoring_node(node):<EOL><INDENT>if not foundations.common.path_exists(path):<EOL><INDENT>return False<EOL><DEDENT><DEDENT>if message_box.message_box("<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>".format(<EOL>path, "<STR_LIT:file>" if os.path.isfile(path) else "<STR_LIT>"),<EOL>buttons=QMessageBox.Yes | QMessageBox.No) == QMessageBox.Yes:<EOL><INDENT>if os.path.isfile(path):<EOL><INDENT>LOGGER.info("<STR_LIT>".format(self.__class__.__name__, path))<EOL>self.__delete_file(path)<EOL><DEDENT>else:<EOL><INDENT>LOGGER.info("<STR_LIT>".format(self.__class__.__name__, path))<EOL>self.__delete_directory(path)<EOL><DEDENT><DEDENT>return True<EOL>
Deletes given Node associated path. :param node: Node. :type node: ProjectNode or DirectoryNode or FileNode :return: Method success. :rtype: bool
f13136:c0:m65